[FFmpeg-devel] [PATCH] lavfi: add opencl tonemap filter.

2018-05-28 Thread Ruiling Song
This filter does HDR(HDR10/HLG) to SDR conversion with tone-mapping.

An example command to use this filter with vaapi codecs:
FFMPEG -init_hw_device vaapi=va:/dev/dri/renderD128 -init_hw_device \
opencl=ocl@va -hwaccel vaapi -hwaccel_device va -hwaccel_output_format \
vaapi -i INPUT -filter_hw_device ocl -filter_complex \
'[0:v]hwmap,tonemap_opencl=t=bt2020:tonemap=linear:format=p010[x1]; \
[x1]hwmap=derive_device=vaapi:reverse=1' -c:v hevc_vaapi -profile 2 OUTPUT

v2:
add peak detection.

Signed-off-by: Ruiling Song 
---
 configure  |   1 +
 libavfilter/Makefile   |   2 +
 libavfilter/allfilters.c   |   1 +
 libavfilter/colorspace_basic.c |  89 +
 libavfilter/colorspace_basic.h |  40 ++
 libavfilter/opencl/colorspace_basic.cl | 187 ++
 libavfilter/opencl/tonemap.cl  | 278 ++
 libavfilter/opencl_source.h|   2 +
 libavfilter/vf_tonemap_opencl.c| 655 +
 9 files changed, 1255 insertions(+)
 create mode 100644 libavfilter/colorspace_basic.c
 create mode 100644 libavfilter/colorspace_basic.h
 create mode 100644 libavfilter/opencl/colorspace_basic.cl
 create mode 100644 libavfilter/opencl/tonemap.cl
 create mode 100644 libavfilter/vf_tonemap_opencl.c

diff --git a/configure b/configure
index e52f8f8..ee3586b 100755
--- a/configure
+++ b/configure
@@ -3401,6 +3401,7 @@ tinterlace_filter_deps="gpl"
 tinterlace_merge_test_deps="tinterlace_filter"
 tinterlace_pad_test_deps="tinterlace_filter"
 tonemap_filter_deps="const_nan"
+tonemap_opencl_filter_deps="opencl"
 unsharp_opencl_filter_deps="opencl"
 uspp_filter_deps="gpl avcodec"
 vaguedenoiser_filter_deps="gpl"
diff --git a/libavfilter/Makefile b/libavfilter/Makefile
index c68ef05..0915656 100644
--- a/libavfilter/Makefile
+++ b/libavfilter/Makefile
@@ -352,6 +352,8 @@ OBJS-$(CONFIG_TINTERLACE_FILTER) += 
vf_tinterlace.o
 OBJS-$(CONFIG_TLUT2_FILTER)  += vf_lut2.o framesync.o
 OBJS-$(CONFIG_TMIX_FILTER)   += vf_mix.o framesync.o
 OBJS-$(CONFIG_TONEMAP_FILTER)+= vf_tonemap.o
+OBJS-$(CONFIG_TONEMAP_OPENCL_FILTER) += vf_tonemap_opencl.o 
colorspace_basic.o opencl.o \
+opencl/tonemap.o 
opencl/colorspace_basic.o
 OBJS-$(CONFIG_TRANSPOSE_FILTER)  += vf_transpose.o
 OBJS-$(CONFIG_TRIM_FILTER)   += trim.o
 OBJS-$(CONFIG_UNPREMULTIPLY_FILTER)  += vf_premultiply.o framesync.o
diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c
index b44093d..6873bab 100644
--- a/libavfilter/allfilters.c
+++ b/libavfilter/allfilters.c
@@ -343,6 +343,7 @@ extern AVFilter ff_vf_tinterlace;
 extern AVFilter ff_vf_tlut2;
 extern AVFilter ff_vf_tmix;
 extern AVFilter ff_vf_tonemap;
+extern AVFilter ff_vf_tonemap_opencl;
 extern AVFilter ff_vf_transpose;
 extern AVFilter ff_vf_trim;
 extern AVFilter ff_vf_unpremultiply;
diff --git a/libavfilter/colorspace_basic.c b/libavfilter/colorspace_basic.c
new file mode 100644
index 000..93f9f08
--- /dev/null
+++ b/libavfilter/colorspace_basic.c
@@ -0,0 +1,89 @@
+/*
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "colorspace_basic.h"
+
+
+void invert_matrix3x3(const double in[3][3], double out[3][3])
+{
+double m00 = in[0][0], m01 = in[0][1], m02 = in[0][2],
+   m10 = in[1][0], m11 = in[1][1], m12 = in[1][2],
+   m20 = in[2][0], m21 = in[2][1], m22 = in[2][2];
+int i, j;
+double det;
+
+out[0][0] =  (m11 * m22 - m21 * m12);
+out[0][1] = -(m01 * m22 - m21 * m02);
+out[0][2] =  (m01 * m12 - m11 * m02);
+out[1][0] = -(m10 * m22 - m20 * m12);
+out[1][1] =  (m00 * m22 - m20 * m02);
+out[1][2] = -(m00 * m12 - m10 * m02);
+out[2][0] =  (m10 * m21 - m20 * m11);
+out[2][1] = -(m00 * m21 - m20 * m01);
+out[2][2] =  (m00 * m11 - m10 * m01);
+
+det = m00 * out[0][0] + m10 * out[0][1] + m20 * out[0][2];
+det = 1.0 / det;
+
+for (i = 0; i < 3; i++) {
+for (j = 0; j < 3; j++)
+out[i][j] *= det;
+}
+}
+
+void mul3x3(double dst[3][3], const double src1[3][3], const double src2[3][3])
+{
+int m, n;
+
+for (m = 0; m < 3; m++)

Re: [FFmpeg-devel] [PATCH v2 2/3] avformat/movenc: creating producer reference time (PRFT) box

2018-05-28 Thread Jeyapal, Karthick
Pushed Patchset.

Regards,
Karthick

On 5/7/18 3:27 PM, vdi...@akamai.com wrote:
> From: Vishwanath Dixit 
>
> The producer reference time box supplies relative wall-clock times
> at which movie fragments, or files containing movie fragments
> (such as segments) were produced.
> The box is mainly useful in live streaming use cases. A media player
> can parse the box and utilize the time fields to measure and improve
> the latency during real time playout.
> ---
>  doc/muxers.texi  | 10 ++
>  libavformat/movenc.c | 50 ++
>  libavformat/movenc.h |  9 +
>  3 files changed, 69 insertions(+)
>
> diff --git a/doc/muxers.texi b/doc/muxers.texi
> index 6f03bba..db81901 100644
> --- a/doc/muxers.texi
> +++ b/doc/muxers.texi
> @@ -1329,6 +1329,16 @@ be negative. This enables the initial sample to have 
> DTS/CTS of zero, and
>  reduces the need for edit lists for some cases such as video tracks with
>  B-frames. Additionally, eases conformance with the DASH-IF interoperability
>  guidelines.
> +@item -write_prft
> +Write producer time reference box (PRFT) with a specified time source for the
> +NTP field in the PRFT box. Set value as @samp{wallclock} to specify 
> timesource
> +as wallclock time and @samp{pts} to specify timesource as input packets' PTS
> +values.
> +
> +Setting value to @samp{pts} is applicable only for a live encoding use case,
> +where PTS values are set as as wallclock time at the source. For example, an
> +encoding use case with decklink capture source where @option{video_pts} and
> +@option{audio_pts} are set to @samp{abs_wallclock}.
>  @end table
>  
>  @subsection Example
> diff --git a/libavformat/movenc.c b/libavformat/movenc.c
> index 0b44fd6..7e616e8 100644
> --- a/libavformat/movenc.c
> +++ b/libavformat/movenc.c
> @@ -98,6 +98,9 @@ static const AVOption options[] = {
>  { "encryption_kid", "The media encryption key identifier (hex)", 
> offsetof(MOVMuxContext, encryption_kid), AV_OPT_TYPE_BINARY, .flags = 
> AV_OPT_FLAG_ENCODING_PARAM },
>  { "use_stream_ids_as_track_ids", "use stream ids as track ids", 
> offsetof(MOVMuxContext, use_stream_ids_as_track_ids), AV_OPT_TYPE_BOOL, {.i64 
> = 0}, 0, 1, AV_OPT_FLAG_ENCODING_PARAM},
>  { "write_tmcd", "force or disable writing tmcd", offsetof(MOVMuxContext, 
> write_tmcd), AV_OPT_TYPE_BOOL, {.i64 = -1}, -1, 1, 
> AV_OPT_FLAG_ENCODING_PARAM},
> +{ "write_prft", "Write producer reference time box with specified time 
> source", offsetof(MOVMuxContext, write_prft), AV_OPT_TYPE_INT, {.i64 = 
> MOV_PRFT_NONE}, 0, MOV_PRFT_NB-1, AV_OPT_FLAG_ENCODING_PARAM, "prft"},
> +{ "wallclock", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = 
> MOV_PRFT_SRC_WALLCLOCK}, 0, 0, AV_OPT_FLAG_ENCODING_PARAM, "prft"},
> +{ "pts", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = MOV_PRFT_SRC_PTS}, 0, 0, 
> AV_OPT_FLAG_ENCODING_PARAM, "prft"},
>  { NULL },
>  };
>  
> @@ -4514,6 +4517,49 @@ static int mov_write_sidx_tags(AVIOContext *pb, 
> MOVMuxContext *mov,
>  return 0;
>  }
>  
> +static int mov_write_prft_tag(AVIOContext *pb, MOVMuxContext *mov, int 
> tracks)
> +{
> +int64_t pos = avio_tell(pb), pts_us, ntp_ts;
> +MOVTrack *first_track;
> +
> +/* PRFT should be associated with at most one track. So, choosing only 
> the
> + * first track. */
> +if (tracks > 0)
> +return 0;
> +first_track = &(mov->tracks[0]);
> +
> +if (!first_track->entry) {
> +av_log(mov->fc, AV_LOG_WARNING, "Unable to write PRFT, no entries in 
> the track\n");
> +return 0;
> +}
> +
> +if (first_track->cluster[0].pts == AV_NOPTS_VALUE) {
> +av_log(mov->fc, AV_LOG_WARNING, "Unable to write PRFT, first PTS is 
> invalid\n");
> +return 0;
> +}
> +
> +if (mov->write_prft == MOV_PRFT_SRC_WALLCLOCK) {
> +ntp_ts = ff_get_formatted_ntp_time(ff_ntp_time());
> +} else if (mov->write_prft == MOV_PRFT_SRC_PTS) {
> +pts_us = av_rescale_q(first_track->cluster[0].pts,
> +  first_track->st->time_base, AV_TIME_BASE_Q);
> +ntp_ts = ff_get_formatted_ntp_time(pts_us + NTP_OFFSET_US);
> +} else {
> +av_log(mov->fc, AV_LOG_WARNING, "Unsupported PRFT box configuration: 
> %d\n",
> +   mov->write_prft);
> +return 0;
> +}
> +
> +avio_wb32(pb, 0);   // Size place holder
> +ffio_wfourcc(pb, "prft");   // Type
> +avio_w8(pb, 1); // Version
> +avio_wb24(pb, 0);   // Flags
> +avio_wb32(pb, first_track->track_id);   // reference track ID
> +avio_wb64(pb, ntp_ts);  // NTP time stamp
> +avio_wb64(pb, first_track->cluster[0].pts); //media time
> +return update_size(pb, pos);
> +}
> +
>  static int mov_write_moof_tag(AVIOContext *pb, MOVMuxContext *mov, int 
> tracks,
>int64_t mdat_size)
>  {
> @@ -4528,6 

Re: [FFmpeg-devel] [RFC] libfdk_aac license

2018-05-28 Thread Gyan Doshi



On 29-05-2018 03:34 AM, Carl Eugen Hoyos wrote:


Just remove "and is not known...", please don't state that you guarantee
they are compatible.


If we are continuing to permit LGPL compilation, shouldn't it be

"The Fraunhofer AAC library is licensed under a license incompatible to
 the GPL. Therefore, for GPL builds, you have to pass
 @code{--enable-nonfree} to configure to use it. To the best of our
 knowledge, it is compatible with the LGPL" ?


Regards,
Gyan
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [GSOC] [PATCH] DNN module introduction and SRCNN filter update

2018-05-28 Thread Guo, Yejun
I have no more comment for this patch, thanks.

yejun

-Original Message-
From: ffmpeg-devel [mailto:ffmpeg-devel-boun...@ffmpeg.org] On Behalf Of Pedro 
Arthur
Sent: Tuesday, May 29, 2018 2:05 AM
To: FFmpeg development discussions and patches 
Subject: Re: [FFmpeg-devel] [GSOC] [PATCH] DNN module introduction and SRCNN 
filter update

2018-05-28 3:32 GMT-03:00 Guo, Yejun :
> looks that no tensorflow dependency is introduced, a new model format is 
> created together with some CPU implementation for inference.   With this 
> idea, Android Neural Network would be a very good reference, see 
> https://developer.android.google.cn/ndk/guides/neuralnetworks/. It defines 
> how the model is organized, and also provided a CPU optimized inference 
> implementation (within the NNAPI runtime, it is open source). It is still 
> under development but mature enough to run some popular dnn models with 
> proper performance. We can absorb some basic design. Anyway, just a reference 
> fyi.  (btw, I'm not sure about any IP issue)
>
> For this patch, I have two comments.
>
> 1. change from "DNNModel* (*load_default_model)(DNNDefaultModel model_type);" 
> to " DNNModel* (*load_builtin_model)(DNNBuiltinModel model_type);"
> The DNNModule can be invoked by many filters,  default model is a good name 
> at the filter level, while built-in model is better within the DNN scope.
I have no problem with either name, both seems reasonable.

>
> typedef struct DNNModule{
> // Loads model and parameters from given file. Returns NULL if it is not 
> possible.
> DNNModel* (*load_model)(const char* model_filename);
> // Loads one of the default models
> DNNModel* (*load_default_model)(DNNDefaultModel model_type);
> // Executes model with specified input and output. Returns DNN_ERROR 
> otherwise.
> DNNReturnType (*execute_model)(const DNNModel* model);
> // Frees memory allocated for model.
> void (*free_model)(DNNModel** model); } DNNModule;
>
>
> 2. add a new variable 'number' for DNNData/InputParams
> As a typical DNN concept, the data shape usually is:  channel> or , the last component denotes its 
> index changes the fastest in the memory. We can add this concept into the 
> API, and decide to support  or  or both.
You mean how often the layer filter data changes?
If yes, I don't see much use for it, atm we are performing only inference.


If there are no more concerns about the patch I may push it by tomorrow.

Thanks.

>
>
> Thanks
> Yejun (郭叶军)
>
> -Original Message-
> From: ffmpeg-devel [mailto:ffmpeg-devel-boun...@ffmpeg.org] On Behalf Of 
> Sergey Lavrushkin
> Sent: Saturday, May 26, 2018 2:02 AM
> To: FFmpeg development discussions and patches 
> Subject: Re: [FFmpeg-devel] [GSOC] [PATCH] DNN module introduction and SRCNN 
> filter update
>
>>
>> You should use the ff_ prefix for internal, non-static functions only.
>> You don't need to use any prefix for internal structs.
>> The AV* prefix is only for public structs, and the av_ prefix is for
>> public functions.
>>
>> >
>> >
>> > And you need to indent and prettify the tables a bit.
>> >
>> >
>> > Do you mean kernels and biases in dnn_srcnn.h?
>> > Their formatting represents their 4D structure a little bit and it
>> > is similar to one that I used for the first srcnn filter version
>> > that was successfully pushed before.
>>
>> Yes, and i suppose they were pushed like that without the reviewer
>> noticing they had no indentation or vertical alignment.
>>
>
> Here is the patch with DNN module moved to libavfilter and proper formatting 
> of tables in dnn_srcnn.h.
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH 3/3] lavf/riff: add avs2 fourcc

2018-05-28 Thread hwren
Signed-off-by: hwren 
---
 libavformat/riff.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libavformat/riff.c b/libavformat/riff.c
index 8911725..4153372 100644
--- a/libavformat/riff.c
+++ b/libavformat/riff.c
@@ -369,6 +369,7 @@ const AVCodecTag ff_codec_bmp_tags[] = {
 { AV_CODEC_ID_ZMBV, MKTAG('Z', 'M', 'B', 'V') },
 { AV_CODEC_ID_KMVC, MKTAG('K', 'M', 'V', 'C') },
 { AV_CODEC_ID_CAVS, MKTAG('C', 'A', 'V', 'S') },
+{ AV_CODEC_ID_AVS2, MKTAG('A', 'V', 'S', '2') },
 { AV_CODEC_ID_JPEG2000, MKTAG('m', 'j', 'p', '2') },
 { AV_CODEC_ID_JPEG2000, MKTAG('M', 'J', '2', 'C') },
 { AV_CODEC_ID_JPEG2000, MKTAG('L', 'J', '2', 'C') },
-- 
2.7.4

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH 2/3] lavc, doc, configure: add avs2 decoder via libdavs2

2018-05-28 Thread hwren
Signed-off-by: hwren 
---
 Changelog  |   1 +
 configure  |   4 +
 doc/general.texi   |   8 ++
 libavcodec/Makefile|   1 +
 libavcodec/allcodecs.c |   1 +
 libavcodec/libdavs2.c  | 207 +
 6 files changed, 222 insertions(+)
 create mode 100644 libavcodec/libdavs2.c

diff --git a/Changelog b/Changelog
index 3d25564..ce1f97c 100644
--- a/Changelog
+++ b/Changelog
@@ -9,6 +9,7 @@ version :
 - aderivative and aintegral audio filters
 - pal75bars and pal100bars video filter sources
 - support mbedTLS based TLS
+- AVS2 video decoder via libdavs2
 
 
 version 4.0:
diff --git a/configure b/configure
index 09ff0c5..e2ac9f6 100755
--- a/configure
+++ b/configure
@@ -226,6 +226,7 @@ External library support:
   --enable-libcelt enable CELT decoding via libcelt [no]
   --enable-libcdio enable audio CD grabbing with libcdio [no]
   --enable-libcodec2   enable codec2 en/decoding using libcodec2 [no]
+  --enable-libdavs2enable AVS2 decoding via libdavs2 [no]
   --enable-libdc1394   enable IIDC-1394 grabbing using libdc1394
and libraw1394 [no]
   --enable-libfdk-aac  enable AAC de/encoding via libfdk-aac [no]
@@ -1636,6 +1637,7 @@ EXTERNAL_LIBRARY_GPL_LIST="
 avisynth
 frei0r
 libcdio
+libdavs2
 librubberband
 libvidstab
 libx264
@@ -3042,6 +3044,7 @@ libaom_av1_encoder_deps="libaom"
 libcelt_decoder_deps="libcelt"
 libcodec2_decoder_deps="libcodec2"
 libcodec2_encoder_deps="libcodec2"
+libdavs2_decoder_deps="libdavs2 gpl"
 libfdk_aac_decoder_deps="libfdk_aac"
 libfdk_aac_encoder_deps="libfdk_aac"
 libfdk_aac_encoder_select="audio_frame_queue"
@@ -5992,6 +5995,7 @@ enabled libcelt   && require libcelt celt/celt.h 
celt_decode -lcelt0 &&
die "ERROR: libcelt must be installed and 
version must be >= 0.11.0."; }
 enabled libcaca   && require_pkg_config libcaca caca caca.h 
caca_create_canvas
 enabled libcodec2 && require libcodec2 codec2/codec2.h codec2_create 
-lcodec2
+enabled libdavs2  && require_pkg_config libdavs2 "davs2 >= 1.2.34" 
davs2.h davs2_decoder_decode
 enabled libdc1394 && require_pkg_config libdc1394 libdc1394-2 
dc1394/dc1394.h dc1394_new
 enabled libdrm&& require_pkg_config libdrm libdrm xf86drm.h 
drmGetVersion
 enabled libfdk_aac&& { check_pkg_config libfdk_aac fdk-aac 
"fdk-aac/aacenc_lib.h" aacEncOpen ||
diff --git a/doc/general.texi b/doc/general.texi
index 2583006..d3c1503 100644
--- a/doc/general.texi
+++ b/doc/general.texi
@@ -17,6 +17,14 @@ for more formats. None of them are used by default, their 
use has to be
 explicitly requested by passing the appropriate flags to
 @command{./configure}.
 
+@section libdavs2
+
+FFmpeg can make use of the libdavs2 library for AVS2 decoding.
+
+Go to @url{https://github.com/pkuvcl/davs2} and follow the instructions for
+installing the library. Then pass @code{--enable-libdavs2} to configure to
+enable it.
+
 @section Alliance for Open Media libaom
 
 FFmpeg can make use of the libaom library for AV1 decoding.
diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index 3ab071a..2a845f1 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -944,6 +944,7 @@ OBJS-$(CONFIG_LIBAOM_AV1_ENCODER) += libaomenc.o
 OBJS-$(CONFIG_LIBCELT_DECODER)+= libcelt_dec.o
 OBJS-$(CONFIG_LIBCODEC2_DECODER)  += libcodec2.o codec2utils.o
 OBJS-$(CONFIG_LIBCODEC2_ENCODER)  += libcodec2.o codec2utils.o
+OBJS-$(CONFIG_LIBDAVS2_DECODER)   += libdavs2.o
 OBJS-$(CONFIG_LIBFDK_AAC_DECODER) += libfdk-aacdec.o
 OBJS-$(CONFIG_LIBFDK_AAC_ENCODER) += libfdk-aacenc.o
 OBJS-$(CONFIG_LIBGSM_DECODER) += libgsmdec.o
diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
index 7b7a8c7..6103081 100644
--- a/libavcodec/allcodecs.c
+++ b/libavcodec/allcodecs.c
@@ -705,6 +705,7 @@ extern AVCodec ff_libx264_encoder;
 extern AVCodec ff_libx264rgb_encoder;
 extern AVCodec ff_libx265_encoder;
 extern AVCodec ff_libxavs_encoder;
+extern AVCodec ff_libdavs2_decoder;
 extern AVCodec ff_libxvid_encoder;
 extern AVCodec ff_libzvbi_teletext_decoder;
 
diff --git a/libavcodec/libdavs2.c b/libavcodec/libdavs2.c
new file mode 100644
index 000..ef222cf
--- /dev/null
+++ b/libavcodec/libdavs2.c
@@ -0,0 +1,207 @@
+/*
+ * AVS2 decoding using the davs2 library
+ *
+ * Copyright (C) 2018 Yiqun Xu, 
+ *Falei Luo, 
+ *Huiwen Ren, 
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the 

[FFmpeg-devel] [PATCH 1/3] lavc,doc: add avs2 codec

2018-05-28 Thread hwren
Signed-off-by: hwren 
---
 doc/APIchanges  | 3 +++
 libavcodec/avcodec.h| 1 +
 libavcodec/codec_desc.c | 7 +++
 libavcodec/version.h| 4 ++--
 4 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/doc/APIchanges b/doc/APIchanges
index efe15ba..3d08bb9 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -15,6 +15,9 @@ libavutil: 2017-10-21
 
 API changes, most recent first:
 
+2018-05-xx - xx - lavc 58.20.100 - avcodec.h
+  Add AV_CODEC_ID_AVS2.
+
 2018-05-xx - xx - lavf 58.15.100 - avformat.h
   Add pmt_version field to AVProgram
 
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index fb0c6fa..ce5f307 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -409,6 +409,7 @@ enum AVCodecID {
 AV_CODEC_ID_DXV,
 AV_CODEC_ID_SCREENPRESSO,
 AV_CODEC_ID_RSCC,
+AV_CODEC_ID_AVS2,
 
 AV_CODEC_ID_Y41P = 0x8000,
 AV_CODEC_ID_AVRP,
diff --git a/libavcodec/codec_desc.c b/libavcodec/codec_desc.c
index 79552a9..e85492e 100644
--- a/libavcodec/codec_desc.c
+++ b/libavcodec/codec_desc.c
@@ -1395,6 +1395,13 @@ static const AVCodecDescriptor codec_descriptors[] = {
 .props = AV_CODEC_PROP_LOSSLESS,
 },
 {
+.id= AV_CODEC_ID_AVS2,
+.type  = AVMEDIA_TYPE_VIDEO,
+.name  = "avs2",
+.long_name = NULL_IF_CONFIG_SMALL("AVS2/IEEE 1857.4"),
+.props = AV_CODEC_PROP_LOSSY,
+},
+{
 .id= AV_CODEC_ID_Y41P,
 .type  = AVMEDIA_TYPE_VIDEO,
 .name  = "y41p",
diff --git a/libavcodec/version.h b/libavcodec/version.h
index da893da..b9752ce 100644
--- a/libavcodec/version.h
+++ b/libavcodec/version.h
@@ -28,8 +28,8 @@
 #include "libavutil/version.h"
 
 #define LIBAVCODEC_VERSION_MAJOR  58
-#define LIBAVCODEC_VERSION_MINOR  19
-#define LIBAVCODEC_VERSION_MICRO 102
+#define LIBAVCODEC_VERSION_MINOR  20
+#define LIBAVCODEC_VERSION_MICRO 100
 
 #define LIBAVCODEC_VERSION_INT  AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
LIBAVCODEC_VERSION_MINOR, \
-- 
2.7.4

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [GSOC] [PATCH] DNN module introduction and SRCNN filter update

2018-05-28 Thread Pedro Arthur
2018-05-28 19:52 GMT-03:00 Sergey Lavrushkin :
> 2018-05-28 9:32 GMT+03:00 Guo, Yejun :
>
>> looks that no tensorflow dependency is introduced, a new model format is
>> created together with some CPU implementation for inference.   With this
>> idea, Android Neural Network would be a very good reference, see
>> https://developer.android.google.cn/ndk/guides/neuralnetworks/. It
>> defines how the model is organized, and also provided a CPU optimized
>> inference implementation (within the NNAPI runtime, it is open source). It
>> is still under development but mature enough to run some popular dnn models
>> with proper performance. We can absorb some basic design. Anyway, just a
>> reference fyi.  (btw, I'm not sure about any IP issue)
>>
>
> The idea was to first introduce something to use when tensorflow is not
> available. Here is another patch, that introduces tensorflow backend.
I think it would be better for reviewing if you send the second patch
in a new email.

>
>
>> For this patch, I have two comments.
>>
>> 1. change from "DNNModel* (*load_default_model)(DNNDefaultModel
>> model_type);" to " DNNModel* (*load_builtin_model)(DNNBuiltinModel
>> model_type);"
>> The DNNModule can be invoked by many filters,  default model is a good
>> name at the filter level, while built-in model is better within the DNN
>> scope.
>>
>> typedef struct DNNModule{
>> // Loads model and parameters from given file. Returns NULL if it is
>> not possible.
>> DNNModel* (*load_model)(const char* model_filename);
>> // Loads one of the default models
>> DNNModel* (*load_default_model)(DNNDefaultModel model_type);
>> // Executes model with specified input and output. Returns DNN_ERROR
>> otherwise.
>> DNNReturnType (*execute_model)(const DNNModel* model);
>> // Frees memory allocated for model.
>> void (*free_model)(DNNModel** model);
>> } DNNModule;
>>
>>
>> 2. add a new variable 'number' for DNNData/InputParams
>> As a typical DNN concept, the data shape usually is: > width, channel> or , the last component
>> denotes its index changes the fastest in the memory. We can add this
>> concept into the API, and decide to support  or  or both.
>
>
> I did not add number of elements in batch because I thought, that we would
> not feed more than one element at once to a network in a ffmpeg filter.
> But it can be easily added if necessary.
>
> So here is the patch that adds tensorflow backend with the previous patch.
> I forgot to change include guards from AVUTIL_* to AVFILTER_* in it.
You moved the files from libavutil to libavfilter while it was
proposed to move them to libavformat.

>
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] avcodec/vc1: fix out-of-bounds reference pixel replication

2018-05-28 Thread Michael Niedermayer
On Sun, May 27, 2018 at 10:27:39PM +0200, Jerome Borsboom wrote:
> Out-of-bounds reference pixel replication should take into account the frame
> coding mode of the reference frame(s), not the frame coding mode of the
> current frame.
> 
> Signed-off-by: Jerome Borsboom 
> ---
> This should fix the remaining issue with the SA10180.vc1 test file.
> 
>  libavcodec/vc1_mc.c | 659 
> ++--
>  1 file changed, 379 insertions(+), 280 deletions(-)

This causes segfaults

Program received signal SIGSEGV, Segmentation fault.
0x00c36920 in ff_emu_edge_vfix18_sse ()
(gdb) bt
Python Exception  No module named gdb.frames: 
#0  0x00c36920 in ff_emu_edge_vfix18_sse ()
#1  0x009e6426 in emulated_edge_mc (dst=, src=, dst_stride=, src_stride=, 
block_w=, block_h=, src_x=, 
src_y=, w=, h=, 
vfix_tbl=, 
v_extend_var=, hfix_tbl=, 
h_extend_var=) at libavcodec/x86/videodsp_init.c:195
#2  0x009e6289 in emulated_edge_mc_sse2 (buf=0x1db3541 "", src=0x300 
, buf_stride=140737352976960, 
src_stride=768, block_w=, block_h=, src_x=-1, 
src_y=-2, w=720, h=240) at libavcodec/x86/videodsp_init.c:256
#3  0x00913cee in ff_vc1_mc_1mv (v=0x1d01200, dir=) at 
libavcodec/vc1_mc.c:323
#4  0x009086d4 in vc1_decode_p_mb_intfi (v=) at 
libavcodec/vc1_block.c:1758
#5  0x00906516 in vc1_decode_p_blocks (v=) at 
libavcodec/vc1_block.c:2796
#6  0x0091b1c8 in vc1_decode_frame (avctx=0x1c46500, data=0x1c91ec0, 
got_frame=0x7fffd6c4, avpkt=) at libavcodec/vc1dec.c:1042
#7  0x006ec6fb in decode_simple_internal (avctx=0x1c46500, 
frame=0x1c91ec0) at libavcodec/decode.c:398
#8  0x006ec647 in decode_simple_receive_frame (avctx=0x1c46500, 
frame=0x1c91ec0) at libavcodec/decode.c:594
#9  0x006ea0b2 in decode_receive_frame_internal (avctx=, 
frame=) at libavcodec/decode.c:612
#10 0x006e9e7d in avcodec_send_packet (avctx=0x1c46500, 
avpkt=) at libavcodec/decode.c:674
#11 0x0042abda in decode (avctx=0x1c46500, frame=0x1c92600, 
got_frame=0x7fffd954, pkt=0x300) at fftools/ffmpeg.c:2234
#12 0x0042a0e1 in decode_video (ist=0x1c46c40, pkt=0x7fffd960, 
got_output=0x7fffd954, duration_pts=0x7fffd958, eof=0, 
decode_failed=0x7fffd950) at fftools/ffmpeg.c:2378
#13 0x004234bd in process_input_packet (ist=0x1c46c40, 
pkt=0x7fffdcc0, no_eof=0) at fftools/ffmpeg.c:2619
#14 0x00427574 in process_input (file_index=) at 
fftools/ffmpeg.c:4457
#15 0x0042263d in transcode_step () at fftools/ffmpeg.c:4577
#16 0x00421081 in transcode () at fftools/ffmpeg.c:4631
#17 0x004207b5 in main (argc=, argv=) at 
fftools/ffmpeg.c:4838

rax0x0  0
rbx0x1  1
rcx0x300768
rdx0x77ee4a40   140737352976960
rsi0x300768
rdi0x1db354131143233
rbp0x7fffd390   0x7fffd390
rsp0x7fffd338   0x7fffd338
r8 0x2  2
r9 0x23 35
r100x77ee4a40   140737352976960
r110x1db354031143232
r120x300768
r130x13 19
r140x25 37
r150x13 19
rip0xc36920 0xc36920 
eflags 0x10202  [ IF RF ]
cs 0x33 51
ss 0x2b 43
ds 0x0  0
es 0x0  0
fs 0x0  0
gs 0x0  0

   0x00c36900 :  (bad)  
   0x00c36901 :  movd   %mm0,0xd(%rdi)
   0x00c36905 :  add%rsi,%rdi
   0x00c36908 :  dec%rax
   0x00c3690b :  jne0xc368fe 

   0x00c3690d :  repz retq 
   0x00c3690f :  nop
   0x00c36910 :   mov0x8(%rsp),%rax
   0x00c36915 :   sub%r9,%rax
   0x00c36918 :   sub%r8,%r9
   0x00c3691b :  test   %r8,%r8
   0x00c3691e :  je 0xc36936 

=> 0x00c36920 :  movups (%rdx),%xmm0
   0x00c36923 :  movd   0xe(%rdx),%mm0
   0x00c36927 :  movups %xmm0,(%rdi)
   0x00c3692a :  movd   %mm0,0xe(%rdi)
   0x00c3692e :  add%rsi,%rdi
   0x00c36931 :  dec%r8
   0x00c36934 :  jne0xc36927 

   0x00c36936 :  movups (%rdx),%xmm0
   0x00c36939 :  movd   0xe(%rdx),%mm0
   0x00c3693d :  movups %xmm0,(%rdi)

[...]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

No human being will ever know the Truth, for even if they happen to say it
by chance, they would not even known they had done so. -- Xenophanes


signature.asc
Description: PGP signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 06/10] segment.c: Add allocation failure checks.

2018-05-28 Thread Stephan Holljes
On Mon, May 28, 2018 at 11:45 PM, Michael Niedermayer
 wrote:
> On Mon, May 28, 2018 at 08:27:07PM +0200, Stephan Holljes wrote:
>> Signed-off-by: Stephan Holljes 
>> ---
>>  segment.c | 26 ++
>>  1 file changed, 26 insertions(+)
>>
>> diff --git a/segment.c b/segment.c
>> index c40d1ad..986aeb5 100644
>> --- a/segment.c
>> +++ b/segment.c
>> @@ -82,6 +82,10 @@ int segment_write(void *opaque, unsigned char *buf, int 
>> buf_size)
>>  struct Segment *seg = (struct Segment*) opaque;
>>  seg->size += buf_size;
>>  seg->buf = (unsigned char*) av_realloc(seg->buf, seg->size);
>> +if (!seg->buf) {
>> +av_log(NULL, AV_LOG_ERROR, "Could not grow segment.\n");
>> +return AVERROR(ENOMEM);
>> +}
>>  memcpy(seg->buf + seg->size - buf_size, buf, buf_size);
>>  return buf_size;
>>  }
>> @@ -110,6 +114,10 @@ void segment_init(struct Segment **seg_p, 
>> AVFormatContext *fmt)
>>  int i;
>>  AVStream *in_stream, *out_stream;
>>  struct Segment *seg = (struct Segment*) av_malloc(sizeof(struct 
>> Segment));
>> +if (!seg) {
>> +av_log(fmt, AV_LOG_ERROR, "Could not allocate segment.\n");
>> +return;
>> +}
>
> i didnt look at the surrounding code but just from the patch
> segment_init fails and its void, not returning an error, that seems odd
> does this work ?

Indeed, this would break as soon as ffserver.c calls seg->id = id++;
I think not being able to allocate a segment is fatal enough to
gracefully shut down the server-thread that depends on it. Checking
the allocated segment against NULL should be sufficient (if *seg_p is
set to NULL in the if() checking if seg is NULL).

Thanks, I will read up more on setrlimit() and friends to try to test
for these allocation failures.

>
>
> [...]
> --
> Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
>
> No human being will ever know the Truth, for even if they happen to say it
> by chance, they would not even known they had done so. -- Xenophanes
>
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] avcodec/allcodecs: Provide empty codec_list in allcodecs when ossfuzz is used

2018-05-28 Thread Michael Niedermayer
On Mon, May 28, 2018 at 03:47:08AM +0200, Michael Niedermayer wrote:
> The last workaround is not sufficient to make oss fuzz work with the iterate 
> API
> as it did not provide a FFmpeg that external libs can be linked to.
> 
> This patch does not fully restore the pre iterate functionality. My attempts 
> to
> do this have so far failed.
> 
> The problem with this solution is that it renders the fuzzers virtual system
> ffmpeg (libs) non functional. Which differs from a real system compared to the
> virtual system tested by the fuzzer.
> It should theoretically not matter as the system ffmpeg wouldnt be used.
> But with more cases being fuzzed we likely will hit a case where a external
> lib is involved and it does matter ...
> 
> Working around this may be possible with weak symbols but so far my attempts
> failed
> 
> Alternatively multiple ffmpeg could be built, this becomes messy though
> quickly as they need to be all linked together. That is we need a FFmpeg
> that has the iterate API modified so it can work with the resources
> available to ossfuzz. And at the same time we need a ffmpeg that has
> its full functionality for any external libs which use ffmpeg and are
> used by ffmpeg.
> 
> Signed-off-by: Michael Niedermayer 
> ---
>  libavcodec/allcodecs.c| 5 -
>  tools/target_dec_fuzzer.c | 5 +
>  2 files changed, 5 insertions(+), 5 deletions(-)

will apply

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Democracy is the form of government in which you can choose your dictator


signature.asc
Description: PGP signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 4/8] httpd.h: Adapt structs to config file

2018-05-28 Thread Michael Niedermayer
On Mon, May 28, 2018 at 08:18:55PM +0200, Stephan Holljes wrote:
> Signed-off-by: Stephan Holljes 
> ---
>  httpd.h | 17 +
>  1 file changed, 17 insertions(+)
> 
> diff --git a/httpd.h b/httpd.h
> index 6fb91bd..25cbe11 100644
> --- a/httpd.h
> +++ b/httpd.h
> @@ -26,11 +26,28 @@
>  
>  #include "publisher.h"
>  
> +/* Supported stream formats, for now only matroska */

writing this as /** ...
should make it show up in doxygen docs

[...]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Those who are best at talking, realize last or never when they are wrong.


signature.asc
Description: PGP signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH]ffplay: Mention codec_name if decoder for codec_id could not be found.

2018-05-28 Thread Carl Eugen Hoyos
Hi!

Attached patch makes debugging a little easier imo.

Please comment, Carl Eugen
From 3fcc0904e3775ed2a7a797bce984f6c7393d5fd6 Mon Sep 17 00:00:00 2001
From: Carl Eugen Hoyos 
Date: Tue, 29 May 2018 00:26:17 +0200
Subject: [PATCH] ffplay: Mention codec_name if decoder for codec_id could not
 be found.

---
 fftools/ffplay.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fftools/ffplay.c b/fftools/ffplay.c
index dcca9c2..f9571d7 100644
--- a/fftools/ffplay.c
+++ b/fftools/ffplay.c
@@ -2578,7 +2578,7 @@ static int stream_component_open(VideoState *is, int stream_index)
 if (forced_codec_name) av_log(NULL, AV_LOG_WARNING,
   "No codec could be found with name '%s'\n", forced_codec_name);
 else   av_log(NULL, AV_LOG_WARNING,
-  "No codec could be found with id %d\n", avctx->codec_id);
+  "No codec could be found with id %d (%s)\n", avctx->codec_id, avcodec_get_name(avctx->codec_id));
 ret = AVERROR(EINVAL);
 goto fail;
 }
-- 
1.7.10.4

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 2/8] ffserver: Implement lua config file reader

2018-05-28 Thread Michael Niedermayer
On Mon, May 28, 2018 at 08:18:53PM +0200, Stephan Holljes wrote:
> Signed-off-by: Stephan Holljes 
> ---
>  configreader.c | 235 
> +
>  configreader.h |  47 
>  2 files changed, 282 insertions(+)
>  create mode 100644 configreader.c
>  create mode 100644 configreader.h
> 
> diff --git a/configreader.c b/configreader.c
> new file mode 100644
> index 000..3580fc5
> --- /dev/null
> +++ b/configreader.c
> @@ -0,0 +1,235 @@
> +/*
> + * This file is part of FFmpeg.
> + *
> + * FFmpeg is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU Lesser General Public
> + * License as published by the Free Software Foundation; either
> + * version 2.1 of the License, or (at your option) any later version.
> + *
> + * FFmpeg is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> + * Lesser General Public License for more details.
> + *
> + * You should have received a copy of the GNU Lesser General Public
> + * License along with FFmpeg; if not, write to the Free Software
> + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 
> USA
> + */
> +
> +#include "configreader.h"
> +#include "httpd.h"
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +
> +#include 
> +#include 
> +
> +const char *stream_format_names[] = { "mkv" };
> +
> +static struct HTTPDConfig *parsed_configs = NULL;
> +
> +void stream_free(struct StreamConfig *stream)
> +{
> +if (stream->stream_name)
> +av_free(stream->stream_name);
> +if (stream->input_uri)
> +av_free(stream->input_uri);
> +if (stream->formats)
> +av_free(stream->formats);

the null checks arent needed
also av_freep() may be better as it does not leave the freed pointer but
replaces with with NULL


[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

I do not agree with what you have to say, but I'll defend to the death your
right to say it. -- Voltaire


signature.asc
Description: PGP signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 1/3] lavf: add avs2 fourcc

2018-05-28 Thread Michael Niedermayer
On Sun, May 27, 2018 at 11:38:37PM +0800, hwren wrote:
> Signed-off-by: hwren 
> ---
>  libavformat/riff.c | 1 +
>  1 file changed, 1 insertion(+)

The order of the patches is wrong. This cannot be 1/3 as it depends on
the introduction of AV_CODEC_ID_AVS2

[...]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

"You are 36 times more likely to die in a bathtub than at the hands of a
terrorist. Also, you are 2.5 times more likely to become a president and
2 times more likely to become an astronaut, than to die in a terrorist
attack." -- Thoughty2



signature.asc
Description: PGP signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 06/10] segment.c: Add allocation failure checks.

2018-05-28 Thread Michael Niedermayer
On Mon, May 28, 2018 at 08:27:07PM +0200, Stephan Holljes wrote:
> Signed-off-by: Stephan Holljes 
> ---
>  segment.c | 26 ++
>  1 file changed, 26 insertions(+)
> 
> diff --git a/segment.c b/segment.c
> index c40d1ad..986aeb5 100644
> --- a/segment.c
> +++ b/segment.c
> @@ -82,6 +82,10 @@ int segment_write(void *opaque, unsigned char *buf, int 
> buf_size)
>  struct Segment *seg = (struct Segment*) opaque;
>  seg->size += buf_size;
>  seg->buf = (unsigned char*) av_realloc(seg->buf, seg->size);
> +if (!seg->buf) {
> +av_log(NULL, AV_LOG_ERROR, "Could not grow segment.\n");
> +return AVERROR(ENOMEM);
> +}
>  memcpy(seg->buf + seg->size - buf_size, buf, buf_size);
>  return buf_size;
>  }
> @@ -110,6 +114,10 @@ void segment_init(struct Segment **seg_p, 
> AVFormatContext *fmt)
>  int i;
>  AVStream *in_stream, *out_stream;
>  struct Segment *seg = (struct Segment*) av_malloc(sizeof(struct 
> Segment));
> +if (!seg) {
> +av_log(fmt, AV_LOG_ERROR, "Could not allocate segment.\n");
> +return;
> +}

i didnt look at the surrounding code but just from the patch 
segment_init fails and its void, not returning an error, that seems odd
does this work ?


[...]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

No human being will ever know the Truth, for even if they happen to say it
by chance, they would not even known they had done so. -- Xenophanes


signature.asc
Description: PGP signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 2/5] avcodec/vc1: fix mquant calculation for interlace field pictures

2018-05-28 Thread Carl Eugen Hoyos
2018-05-18 17:06 GMT+02:00, Jerome Borsboom :
> For interlace field pictures s->mb_height indicates the height of the full
> picture in MBs, i.e. the two fields combined. A single field is half this
> size. When calculating mquant for interlace field pictures, the bottom edge
> is the last MB row of the field.
>
> Signed-off-by: Jerome Borsboom 
> ---
>  libavcodec/vc1_block.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/libavcodec/vc1_block.c b/libavcodec/vc1_block.c
> index daf30fdbfe..aa2ea5024e 100644
> --- a/libavcodec/vc1_block.c
> +++ b/libavcodec/vc1_block.c
> @@ -181,7 +181,8 @@ static void vc1_put_signed_blocks_clamped(VC1Context *v)
>  mquant = -v->altpq;\
>  if ((edges&4) && s->mb_x == (s->mb_width - 1)) \
>  mquant = -v->altpq;\
> -if ((edges&8) && s->mb_y == (s->mb_height - 1))\
> +if ((edges&8) &&   \
> +s->mb_y == ((s->mb_height >> v->field_mode) - 1))  \
>  mquant = -v->altpq;\
>  if (!mquant || mquant > 31) {  \
>  av_log(v->s.avctx, AV_LOG_ERROR,   \

Patch applied.

Thank you, Carl Eugen
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [RFC] libfdk_aac license

2018-05-28 Thread Carl Eugen Hoyos
2018-05-28 12:53 GMT+02:00, Gyan Doshi :
>
>
> doc/general.texi says this for the FDK AAC library,
>
> "The Fraunhofer AAC library is licensed under a license incompatible to
> the GPL and is not known to be compatible to the LGPL. Therefore, you
> have to pass @code{--enable-nonfree} to configure to use it."
>
> (added 2013 in 6fe419bf73)
>
> LICENSE.md says,
>
> "The Fraunhofer FDK AAC and OpenSSL libraries are under licenses which
> are incompatible with the GPLv2 and v3. To the best of our knowledge,
> they are compatible with the LGPL."
>
> (added 2016 in bbf7500df99)
>
> Indeed, current master can be configured and built as LGPL with FDK AAC
> without passing --enable-nonfree even though the lib is in the nonfree
> list. configure only complains about nonfree if I set license as GPL.
>
> If this is how it should be, I'll update general.texi

Just remove "and is not known...", please don't state that you guarantee
they are compatible.

Thank you, Carl Eugen
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] ffserver.c: Add ability to stream audio-only files.

2018-05-28 Thread Michael Niedermayer
On Mon, May 28, 2018 at 08:28:36PM +0200, Stephan Holljes wrote:
> Signed-off-by: Stephan Holljes 
> ---
>  ffserver.c | 16 +---
>  1 file changed, 9 insertions(+), 7 deletions(-)
> 
> diff --git a/ffserver.c b/ffserver.c
> index cdcc064..b0db64b 100644
> --- a/ffserver.c
> +++ b/ffserver.c
> @@ -42,6 +42,7 @@
>  
>  #define BUFFER_SECS 30
>  #define LISTEN_TIMEOUT_MSEC 1000
> +#define AUDIO_ONLY_SEGMENT_SECONDS 2
>  
>  struct ReadInfo {
>  struct PublisherContext *pub;
> @@ -76,8 +77,9 @@ void *read_thread(void *arg)
>  AVFormatContext *ifmt_ctx = info->ifmt_ctx;
>  int ret, i;
>  int video_idx = -1;
> +int audio_only = 0;
>  int id = 0;
> -int64_t pts, now, start;
> +int64_t pts, now, start, last_cut = 0;
>  int64_t *ts;
>  struct Segment *seg = NULL;
>  AVPacket pkt;
> @@ -101,10 +103,8 @@ void *read_thread(void *arg)
>  break;
>  }
>  }
> -if (video_idx == -1) {
> -av_log(ifmt_ctx, AV_LOG_ERROR, "No video stream found.\n");
> -goto end;
> -}
> +if (video_idx == -1)
> +audio_only = 1;
>  
>  
>  // All information needed to start segmenting the file is gathered now.
> @@ -143,8 +143,9 @@ void *read_thread(void *arg)
>  now = av_gettime_relative() - start;
>  }
>  
> -// keyframe or first Segment
> -if ((pkt.flags & AV_PKT_FLAG_KEY && pkt.stream_index == video_idx) 
> || !seg) {
> +// keyframe or first Segment or audio_only and more than 
> AUDIO_ONLY_SEGMENT_SECONDS passed since last cut
> +if ((pkt.flags & AV_PKT_FLAG_KEY && pkt.stream_index == video_idx) 
> || !seg ||

> +(audio_only && ((pts - last_cut) / AV_TIME_BASE) >= 
> AUDIO_ONLY_SEGMENT_SECONDS)) {

It feels more natural to me to convert the constant instead of the non
constant.

pts - last_cut >= AUDIO_ONLY_SEGMENT_SECONDS * AV_TIME_BASE

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

If you fake or manipulate statistics in a paper in physics you will never
get a job again.
If you fake or manipulate statistics in a paper in medicin you will get
a job for life at the pharma industry.


signature.asc
Description: PGP signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 04/10] ffserver.c: Check allocations

2018-05-28 Thread Michael Niedermayer
On Mon, May 28, 2018 at 08:27:05PM +0200, Stephan Holljes wrote:
> Signed-off-by: Stephan Holljes 
> ---
>  ffserver.c | 87 
> +-
>  1 file changed, 81 insertions(+), 6 deletions(-)
> 
> diff --git a/ffserver.c b/ffserver.c
> index 66bf7ac..171da51 100644
> --- a/ffserver.c
> +++ b/ffserver.c
> @@ -227,12 +227,25 @@ void write_segment(struct Client *c)
>  }
>  

>  avio_buffer = (unsigned char*) av_malloc(AV_BUFSIZE);

unrelated but you dont need the cast


> +if (!avio_buffer) {
> +av_log(NULL, AV_LOG_ERROR, "Could not allocate avio_buffer\n");

some context instead of NULL would be nice so errors arent just all "global"




> +avformat_free_context(fmt_ctx);
> +client_disconnect(c, 0);
> +return;
> +}
>  avio_ctx = avio_alloc_context(avio_buffer, AV_BUFSIZE, 0, , 
> _read, NULL, NULL);
> -
> +if (!avio_ctx) {
> +av_log(NULL, AV_LOG_ERROR, "Could not allocate avio_ctx\n");
> +avformat_free_context(fmt_ctx);
> +av_free(avio_buffer);
> +client_disconnect(c, 0);
> +return;
> +}
>  fmt_ctx->pb = avio_ctx;
>  ret = avformat_open_input(_ctx, NULL, seg->ifmt, NULL);
>  if (ret < 0) {
>  av_log(avio_ctx, AV_LOG_ERROR, "Could not open input\n");
> +avformat_close_input(_ctx);
>  av_free(avio_ctx->buffer);
>  avio_context_free(_ctx);
>  client_disconnect(c, 0);
> @@ -242,6 +255,7 @@ void write_segment(struct Client *c)
>  ret = avformat_find_stream_info(fmt_ctx, NULL);
>  if (ret < 0) {
>  av_log(fmt_ctx, AV_LOG_ERROR, "Could not find stream 
> information\n");
> +avformat_close_input(_ctx);
>  av_free(avio_ctx->buffer);
>  avio_context_free(_ctx);
>  client_disconnect(c, 0);
> @@ -274,9 +288,8 @@ void write_segment(struct Client *c)
>  return;
>  }
>  }
> -avformat_close_input(_ctx);
>  av_free(avio_ctx->buffer);
> -avformat_free_context(fmt_ctx);
> +avformat_close_input(_ctx);
>  avio_context_free(_ctx);
>  pthread_mutex_lock(>buffer_lock);
>  av_fifo_drain(c->buffer, sizeof(struct Segment*));
> @@ -369,13 +382,25 @@ void *accept_thread(void *arg)
>  }
>  
>  avio_buffer = av_malloc(AV_BUFSIZE);
> +if (!avio_buffer) {
> +av_log(NULL, AV_LOG_ERROR, "Could not allocate output format 
> context.\n");
> +publisher_cancel_reserve(pub);
> +info->httpd->close(server, client);
> +continue;
> +}

>  ffinfo = av_malloc(sizeof(struct FFServerInfo));

not about this patch but existing code but
using a code like sizeof(*ffinfo) would avoid having to duplicate the type
in the source code (one less opertunity to make mistakes)

[...]

> @@ -521,9 +555,39 @@ void *run_server(void *arg) {
>  ainfo.config = config;
>  
>  rinfos = av_mallocz_array(config->nb_streams, sizeof(struct ReadInfo));
> +if (!rinfos) {
> +av_log(NULL, AV_LOG_ERROR, "Could not allocate read infos.\n");
> +av_free(pubs);
> +av_free(ifmt_ctxs);
> +return NULL;
> +}
>  winfos_p = av_mallocz_array(config->nb_streams, sizeof(struct 
> WriteInfo*));
> +if (!winfos_p) {
> +av_log(NULL, AV_LOG_ERROR, "Could not allocate write info 
> pointers.\n");
> +av_free(pubs);
> +av_free(ifmt_ctxs);
> +av_free(rinfos);
> +return NULL;
> +}
>  r_threads = av_mallocz_array(config->nb_streams, sizeof(pthread_t));
> +if (!r_threads) {
> +av_log(NULL, AV_LOG_ERROR, "Could not allocate read thread 
> handles.\n");
> +av_free(pubs);
> +av_free(ifmt_ctxs);
> +av_free(rinfos);
> +av_free(winfos_p);
> +return NULL;
> +}
>  w_threads_p = av_mallocz_array(config->nb_streams, sizeof(pthread_t*));
> +if (!w_threads_p) {
> +av_log(NULL, AV_LOG_ERROR, "Could not allocate write thread handle 
> pointers.\n");
> +av_free(pubs);
> +av_free(ifmt_ctxs);
> +av_free(rinfos);
> +av_free(winfos_p);
> +av_free(r_threads);
> +return NULL;
> +}

some goto cleanup_error
and a cleanup_error that deallocates and returns
would avoid having to duplicate the cleanup code


[...]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

What does censorship reveal? It reveals fear. -- Julian Assange


signature.asc
Description: PGP signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] avcodec/vc1: fix out-of-bounds reference pixel replication

2018-05-28 Thread Carl Eugen Hoyos
2018-05-28 10:26 GMT+02:00, Jerome Borsboom :
>>> Out-of-bounds reference pixel replication should take into account
>>> the frame coding mode of the reference frame(s), not the frame
>>> coding mode of the current frame.
>>>
>>> Signed-off-by: Jerome Borsboom 
>>> ---
>>> This should fix the remaining issue with the SA10180.vc1 test file.
>>
>> With this patch, the first 601 frames are decoded bit-exact, the
>> following frame is not decoded correctly.
>>
>> Carl Eugen
>
> Are you sure you have applied all five patches of my previous patch set?

No, sorry, I hadn't realized there were still patches missing, I pushed the
remaining patches of the last set.

I will push this one in a few days if nobody beats me or comments.

I still get incorrect frames for SA10100.vc1, ticket #7173.

Thank you Carl Eugen
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 1/8] ffserver.c: Fix timestamp handling, still creates new clusters for mp4 files, but result is playable

2018-05-28 Thread Michael Niedermayer
On Mon, May 28, 2018 at 08:18:52PM +0200, Stephan Holljes wrote:
> Signed-off-by: Stephan Holljes 
> ---
>  ffserver.c | 14 +++---
>  1 file changed, 11 insertions(+), 3 deletions(-)
> 
> diff --git a/ffserver.c b/ffserver.c
> index 39e1c32..fc2a1a4 100644
> --- a/ffserver.c
> +++ b/ffserver.c
> @@ -133,7 +133,7 @@ void *read_thread(void *arg)
>  pkt.pos = -1;
>  
>  // current pts
> -pts = pkt.pts; //av_rescale_q(pkt.pts, in_stream->time_base, tb);
> +pts = pkt.pts;
>  
>  // current stream "uptime"
>  now = av_gettime_relative() - start;
> @@ -200,6 +200,9 @@ void write_segment(struct Client *c)
>  struct Segment *seg;
>  int ret;
>  int pkt_count = 0;

> +AVRational tb;
> +tb.num = 1;
> +tb.den = AV_TIME_BASE;

AVRational tb = {1, AV_TIME_BASE}


[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

I know you won't believe me, but the highest form of Human Excellence is
to question oneself and others. -- Socrates


signature.asc
Description: PGP signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 1/3] doc,lavc,lavf: add avs2 codec

2018-05-28 Thread Michael Niedermayer
On Mon, May 28, 2018 at 06:14:55PM +0800, hwren wrote:
> Signed-off-by: hwren 
> ---
>  doc/APIchanges | 3 +++
>  libavcodec/allcodecs.c | 1 +
>  libavcodec/avcodec.h   | 2 ++
>  libavcodec/version.h   | 2 +-
>  libavformat/riff.c | 1 +

non cosmetic patches should generally not change more than one lib


[...]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Take away the freedom of one citizen and you will be jailed, take away
the freedom of all citizens and you will be congratulated by your peers
in Parliament.


signature.asc
Description: PGP signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 5/5] avcodec/vc1: store zero MVs for all blocks in a MB

2018-05-28 Thread Carl Eugen Hoyos
2018-05-20 11:05 GMT+02:00, Jerome Borsboom :
>>> Direct prediction for interlace frame B pictures references the mv in the
>>> second block in an MB in the backward reference frame for the twomv case.
>>> When the backward reference frame is an I frame, this value may be unset.
>>>
>>> Signed-off-by: Jerome Borsboom 
>>> ---
>>>  libavcodec/vc1_block.c | 6 --
>>>  1 file changed, 4 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/libavcodec/vc1_block.c b/libavcodec/vc1_block.c
>>> index 74935ec9e9..9c170a1e3c 100644
>>> --- a/libavcodec/vc1_block.c
>>> +++ b/libavcodec/vc1_block.c
>>> @@ -2678,8 +2678,10 @@ static void vc1_decode_i_blocks_adv(VC1Context *v)
>>>  s->bdsp.clear_blocks(block[0]);
>>>  mb_pos = s->mb_x + s->mb_y * s->mb_stride;
>>>  s->current_picture.mb_type[mb_pos + v->mb_off]
>>>   = MB_TYPE_INTRA;
>>> -s->current_picture.motion_val[1][s->block_index[0] +
>>> v->blocks_off][0] = 0;
>>> -s->current_picture.motion_val[1][s->block_index[0] +
>>> v->blocks_off][1] = 0;
>>> +for (int i = 0; i < 4; i++) {
>>> +s->current_picture.motion_val[1][s->block_index[i] +
>>> v->blocks_off][0] = 0;
>>> +s->current_picture.motion_val[1][s->block_index[i] +
>>> v->blocks_off][1] = 0;
>>> +}
>>
>> see AV_ZERO*
>
> This style of setting motion_val to zero is used all over the VC-1
> decoder. vc1_decode_p_mb_intfr uses the exact same code. Changing to
> AV_ZERO may certainly a good point for improvement, however, for the
> sake of consistency the proposed code might be preferable.

Patch applied.

Thank you, Carl Eugen
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH] libavfilter/boxblur_opencl filter.

2018-05-28 Thread Danil Iashchenko
Add opencl version of boxblur filter. 
Behaves like existing libavfilter/boxblur filter.

Resubmitting patch because I used unnecessary variable inside kernels. Now it's 
fixed.

---
 configure   |   1 +
 libavfilter/Makefile|   2 +
 libavfilter/allfilters.c|   1 +
 libavfilter/opencl/boxblur.cl   |  53 +
 libavfilter/opencl_source.h |   1 +
 libavfilter/vf_boxblur_opencl.c | 468 
 6 files changed, 526 insertions(+)
 create mode 100644 libavfilter/opencl/boxblur.cl
 create mode 100644 libavfilter/vf_boxblur_opencl.c

diff --git a/configure b/configure
index e52f8f8..f8a2487 100755
--- a/configure
+++ b/configure
@@ -3302,6 +3302,7 @@ avgblur_opencl_filter_deps="opencl"
 azmq_filter_deps="libzmq"
 blackframe_filter_deps="gpl"
 boxblur_filter_deps="gpl"
+boxblur_opencl_filter_deps="opencl"
 bs2b_filter_deps="libbs2b"
 colormatrix_filter_deps="gpl"
 convolution_opencl_filter_deps="opencl"
diff --git a/libavfilter/Makefile b/libavfilter/Makefile
index c68ef05..97afdef 100644
--- a/libavfilter/Makefile
+++ b/libavfilter/Makefile
@@ -153,6 +153,8 @@ OBJS-$(CONFIG_BLACKDETECT_FILTER)+= 
vf_blackdetect.o
 OBJS-$(CONFIG_BLACKFRAME_FILTER) += vf_blackframe.o
 OBJS-$(CONFIG_BLEND_FILTER)  += vf_blend.o framesync.o
 OBJS-$(CONFIG_BOXBLUR_FILTER)+= vf_boxblur.o
+OBJS-$(CONFIG_BOXBLUR_OPENCL_FILTER) += vf_boxblur_opencl.o opencl.o \
+   opencl/boxblur.o
 OBJS-$(CONFIG_BWDIF_FILTER)  += vf_bwdif.o
 OBJS-$(CONFIG_CHROMAKEY_FILTER)  += vf_chromakey.o
 OBJS-$(CONFIG_CIESCOPE_FILTER)   += vf_ciescope.o
diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c
index b44093d..97d92a0 100644
--- a/libavfilter/allfilters.c
+++ b/libavfilter/allfilters.c
@@ -146,6 +146,7 @@ extern AVFilter ff_vf_blackdetect;
 extern AVFilter ff_vf_blackframe;
 extern AVFilter ff_vf_blend;
 extern AVFilter ff_vf_boxblur;
+extern AVFilter ff_vf_boxblur_opencl;
 extern AVFilter ff_vf_bwdif;
 extern AVFilter ff_vf_chromakey;
 extern AVFilter ff_vf_ciescope;
diff --git a/libavfilter/opencl/boxblur.cl b/libavfilter/opencl/boxblur.cl
new file mode 100644
index 000..9ecb441
--- /dev/null
+++ b/libavfilter/opencl/boxblur.cl
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 2018 Danil Iashchenko
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+__kernel void boxblur_horiz(__write_only image2d_t dst,
+__read_only  image2d_t src,
+int rad)
+{
+const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
+   CLK_ADDRESS_CLAMP_TO_EDGE   |
+   CLK_FILTER_NEAREST);
+
+int2   loc = (int2)(get_global_id(0), get_global_id(1));
+float4 acc = (float4)(0,0,0,0);
+
+for (int w = loc.x - rad; w < loc.x + rad + 1; w++) {
+acc += read_imagef(src, sampler, (int2)(w, loc.y));
+}
+write_imagef(dst, loc, acc / (rad * 2 + 1));
+}
+
+__kernel void boxblur_vertic(__write_only image2d_t dst,
+ __read_only  image2d_t src,
+ int radv)
+{
+const sampler_t sampler = (CLK_NORMALIZED_COORDS_FALSE |
+   CLK_ADDRESS_CLAMP_TO_EDGE   |
+   CLK_FILTER_NEAREST);
+
+int2   loc = (int2)(get_global_id(0), get_global_id(1));
+float4 acc = (float4)(0,0,0,0);
+
+for (int h = loc.y - radv; h < loc.y + radv + 1; h++) {
+acc += read_imagef(src, sampler, (int2)(loc.x, h));
+}
+write_imagef(dst, loc, acc / (radv * 2 + 1));
+}
diff --git a/libavfilter/opencl_source.h b/libavfilter/opencl_source.h
index 4bb9969..2e09770 100644
--- a/libavfilter/opencl_source.h
+++ b/libavfilter/opencl_source.h
@@ -20,6 +20,7 @@
 #define AVFILTER_OPENCL_SOURCE_H
 
 extern const char *ff_opencl_source_avgblur;
+extern const char *ff_opencl_source_boxblur;
 extern const char *ff_opencl_source_convolution;
 extern const char *ff_opencl_source_overlay;
 extern const char *ff_opencl_source_unsharp;
diff --git a/libavfilter/vf_boxblur_opencl.c b/libavfilter/vf_boxblur_opencl.c
new file mode 100644

[FFmpeg-devel] [PATCH 3/3] avcodec/h263dec: Reinitialize idct context if it has not been setup for the active profile

2018-05-28 Thread Michael Niedermayer
The profile after reading headers can be different from when the context was 
initialized

Signed-off-by: Michael Niedermayer 
---
 libavcodec/h263dec.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libavcodec/h263dec.c b/libavcodec/h263dec.c
index c082af1c52..f8a38083f2 100644
--- a/libavcodec/h263dec.c
+++ b/libavcodec/h263dec.c
@@ -546,6 +546,8 @@ retry:
 if (CONFIG_MPEG4_DECODER && avctx->codec_id == AV_CODEC_ID_MPEG4) {
 if (ff_mpeg4_workaround_bugs(avctx) == 1)
 goto retry;
+if (s->studio_profile != (s->idsp.idct == NULL))
+ff_mpv_idct_init(s);
 }
 
 /* After H.263 & MPEG-4 header decode we have the height, width,
-- 
2.17.0

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH 2/3] avcodec/idctdsp: Clear idct/idct_add for studio profile

2018-05-28 Thread Michael Niedermayer
This does not leave them "as before" which may be a value from a previous 
profile

Signed-off-by: Michael Niedermayer 
---
 libavcodec/idctdsp.c | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/libavcodec/idctdsp.c b/libavcodec/idctdsp.c
index 954066a5e3..846ed0b0f8 100644
--- a/libavcodec/idctdsp.c
+++ b/libavcodec/idctdsp.c
@@ -258,9 +258,11 @@ av_cold void ff_idctdsp_init(IDCTDSPContext *c, 
AVCodecContext *avctx)
 if (avctx->bits_per_raw_sample == 10 || avctx->bits_per_raw_sample == 
9) {
 /* 10-bit MPEG-4 Simple Studio Profile requires a higher precision 
IDCT
However, it only uses idct_put */
-if (c->mpeg4_studio_profile)
+if (c->mpeg4_studio_profile) {
 c->idct_put  = ff_simple_idct_put_int32_10bit;
-else {
+c->idct_add  = NULL;
+c->idct  = NULL;
+} else {
 c->idct_put  = ff_simple_idct_put_int16_10bit;
 c->idct_add  = ff_simple_idct_add_int16_10bit;
 c->idct  = ff_simple_idct_int16_10bit;
-- 
2.17.0

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH 1/3] avcodec/idctdsp: Transmit studio_profile to init instead of using AVCodecContext profile

2018-05-28 Thread Michael Niedermayer
These 2 fields are not always the same, it is simpler to always use the same 
field
for detecting studio profile

Fixes: null pointer dereference
Fixes: ffmpeg_crash_3.avi

Found-by: Thuan Pham , Marcel Böhme, Andrew Santosa 
and Alexandru RazvanCaciulescu with AFLSmart
Signed-off-by: Michael Niedermayer 
---
 libavcodec/idctdsp.c   | 2 +-
 libavcodec/idctdsp.h   | 2 ++
 libavcodec/mpegvideo.c | 2 ++
 3 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/libavcodec/idctdsp.c b/libavcodec/idctdsp.c
index 662033bd78..954066a5e3 100644
--- a/libavcodec/idctdsp.c
+++ b/libavcodec/idctdsp.c
@@ -258,7 +258,7 @@ av_cold void ff_idctdsp_init(IDCTDSPContext *c, 
AVCodecContext *avctx)
 if (avctx->bits_per_raw_sample == 10 || avctx->bits_per_raw_sample == 
9) {
 /* 10-bit MPEG-4 Simple Studio Profile requires a higher precision 
IDCT
However, it only uses idct_put */
-if (avctx->codec_id == AV_CODEC_ID_MPEG4 && avctx->profile == 
FF_PROFILE_MPEG4_SIMPLE_STUDIO)
+if (c->mpeg4_studio_profile)
 c->idct_put  = ff_simple_idct_put_int32_10bit;
 else {
 c->idct_put  = ff_simple_idct_put_int16_10bit;
diff --git a/libavcodec/idctdsp.h b/libavcodec/idctdsp.h
index 26221f6a9d..ca21a31a02 100644
--- a/libavcodec/idctdsp.h
+++ b/libavcodec/idctdsp.h
@@ -95,6 +95,8 @@ typedef struct IDCTDSPContext {
  */
 uint8_t idct_permutation[64];
 enum idct_permutation_type perm_type;
+
+int mpeg4_studio_profile;
 } IDCTDSPContext;
 
 void ff_put_pixels_clamped_c(const int16_t *block, uint8_t *av_restrict pixels,
diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c
index 45ea0f09e9..f75c0fd9b3 100644
--- a/libavcodec/mpegvideo.c
+++ b/libavcodec/mpegvideo.c
@@ -329,6 +329,8 @@ static av_cold int dct_init(MpegEncContext *s)
 
 av_cold void ff_mpv_idct_init(MpegEncContext *s)
 {
+if (s->codec_id == AV_CODEC_ID_MPEG4)
+s->idsp.mpeg4_studio_profile = s->studio_profile;
 ff_idctdsp_init(>idsp, s->avctx);
 
 /* load & permutate scantables
-- 
2.17.0

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH 03/10] ffserver.c: Fix indentation (replace tabs by spaces)

2018-05-28 Thread Stephan Holljes
Signed-off-by: Stephan Holljes 
---
 ffserver.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ffserver.c b/ffserver.c
index 4bbf254..66bf7ac 100644
--- a/ffserver.c
+++ b/ffserver.c
@@ -154,7 +154,7 @@ void *read_thread(void *arg)
 publisher_push_segment(info->pub, seg);
 av_log(NULL, AV_LOG_DEBUG, "New segment pushed.\n");
 publish(info->pub);
-   av_log(NULL, AV_LOG_DEBUG, "Published new 
segment.\n");
+av_log(NULL, AV_LOG_DEBUG, "Published new segment.\n");
 }
 segment_init(, ifmt_ctx);
 seg->id = id++;
-- 
2.16.2

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH 4/8] httpd.h: Adapt structs to config file

2018-05-28 Thread Stephan Holljes
Signed-off-by: Stephan Holljes 
---
 httpd.h | 17 +
 1 file changed, 17 insertions(+)

diff --git a/httpd.h b/httpd.h
index 6fb91bd..25cbe11 100644
--- a/httpd.h
+++ b/httpd.h
@@ -26,11 +26,28 @@
 
 #include "publisher.h"
 
+/* Supported stream formats, for now only matroska */
+enum StreamFormat {
+FMT_MATROSKA = 0,
+FMT_NB,
+};
+
+/* Stream Config struct */
+struct StreamConfig {
+char *stream_name;
+char *input_uri;
+enum StreamFormat *formats;
+int nb_formats;
+};
+
 /* HTTPD Config struct */
 struct HTTPDConfig {
+char *server_name;
 char *bind_address;
 int port;
 int accept_timeout;
+struct StreamConfig *streams;
+int nb_streams;
 };
 
 /* HTTPClient struct, this information is shared between ffserver and the 
httpd implementation */
-- 
2.16.2

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [GSoC] FFserver config file support

2018-05-28 Thread Stephan Holljes
This is an updated version of the previous patchset.
The most notable changes are:
  - timestamp fix reworked to work with mp4
  - the lua file reader is much safer by using lua's protected
environment

While the matroska muxer still spams the output about creating new
clusters because of timestamps, a client player has no more incorrect
timestamps. This far I have only observed this with mp4 files.

A second patchset adding more failure checks and bugfixes will be coming
shortly.

A third patch adding audio-only support (the goal for the second week)
will also be coming shortly.

As always, comments welcome :)
Stephan
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH 7/8] Makefile: Update Makefile

2018-05-28 Thread Stephan Holljes
Signed-off-by: Stephan Holljes 
---
 Makefile | 7 +--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/Makefile b/Makefile
index fbecdeb..83bc4e0 100644
--- a/Makefile
+++ b/Makefile
@@ -1,10 +1,11 @@
 all: ffserver
 LAV_FLAGS = $(shell pkg-config --libs --cflags libavformat libavcodec 
libavutil)
+LUA_FLAGS = $(shell pkg-config --libs --cflags lua5.3)
 CFLAGS=-fsanitize=address -fsanitize=undefined
 # LAV_FLAGS = -L/usr/local/lib -lavcodec -lavformat -lavutil
 
-ffserver: segment.o publisher.o lavfhttpd.o ffserver.c
-   cc -g -Wall $(CFLAGS) $(LAV_FLAGS) -lpthread -o ffserver segment.o 
publisher.o lavfhttpd.o ffserver.c
+ffserver: segment.o publisher.o lavfhttpd.o configreader.o ffserver.c
+   cc -g -Wall $(CFLAGS) $(LAV_FLAGS) $(LUA_FLAGS) -lpthread -o ffserver 
segment.o publisher.o lavfhttpd.o configreader.o ffserver.c
 
 segment.o: segment.c segment.h
cc -g -Wall $(CFLAGS) $(LAV_FLAGS) -lpthread -c segment.c
@@ -15,5 +16,7 @@ publisher.o: publisher.c publisher.h
 lavfhttpd.o: lavfhttpd.c httpd.h
cc -g -Wall $(CFLAGS) $(LAV_FLAGS) -lpthread -c lavfhttpd.c
 
+configreader.o: configreader.c configreader.h httpd.h
+   cc -g -Wall $(CFLAGS) $(LAV_FLAGS) $(LUA_FLAGS) -c configreader.c
 clean:
rm -f *.o ffserver
-- 
2.16.2

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [GSOC] [PATCH] DNN module introduction and SRCNN filter update

2018-05-28 Thread Pedro Arthur
2018-05-28 3:32 GMT-03:00 Guo, Yejun :
> looks that no tensorflow dependency is introduced, a new model format is 
> created together with some CPU implementation for inference.   With this 
> idea, Android Neural Network would be a very good reference, see 
> https://developer.android.google.cn/ndk/guides/neuralnetworks/. It defines 
> how the model is organized, and also provided a CPU optimized inference 
> implementation (within the NNAPI runtime, it is open source). It is still 
> under development but mature enough to run some popular dnn models with 
> proper performance. We can absorb some basic design. Anyway, just a reference 
> fyi.  (btw, I'm not sure about any IP issue)
>
> For this patch, I have two comments.
>
> 1. change from "DNNModel* (*load_default_model)(DNNDefaultModel model_type);" 
> to " DNNModel* (*load_builtin_model)(DNNBuiltinModel model_type);"
> The DNNModule can be invoked by many filters,  default model is a good name 
> at the filter level, while built-in model is better within the DNN scope.
I have no problem with either name, both seems reasonable.

>
> typedef struct DNNModule{
> // Loads model and parameters from given file. Returns NULL if it is not 
> possible.
> DNNModel* (*load_model)(const char* model_filename);
> // Loads one of the default models
> DNNModel* (*load_default_model)(DNNDefaultModel model_type);
> // Executes model with specified input and output. Returns DNN_ERROR 
> otherwise.
> DNNReturnType (*execute_model)(const DNNModel* model);
> // Frees memory allocated for model.
> void (*free_model)(DNNModel** model);
> } DNNModule;
>
>
> 2. add a new variable 'number' for DNNData/InputParams
> As a typical DNN concept, the data shape usually is:  channel> or , the last component denotes its 
> index changes the fastest in the memory. We can add this concept into the 
> API, and decide to support  or  or both.
You mean how often the layer filter data changes?
If yes, I don't see much use for it, atm we are performing only inference.


If there are no more concerns about the patch I may push it by tomorrow.

Thanks.

>
>
> Thanks
> Yejun (郭叶军)
>
> -Original Message-
> From: ffmpeg-devel [mailto:ffmpeg-devel-boun...@ffmpeg.org] On Behalf Of 
> Sergey Lavrushkin
> Sent: Saturday, May 26, 2018 2:02 AM
> To: FFmpeg development discussions and patches 
> Subject: Re: [FFmpeg-devel] [GSOC] [PATCH] DNN module introduction and SRCNN 
> filter update
>
>>
>> You should use the ff_ prefix for internal, non-static functions only.
>> You don't need to use any prefix for internal structs.
>> The AV* prefix is only for public structs, and the av_ prefix is for
>> public functions.
>>
>> >
>> >
>> > And you need to indent and prettify the tables a bit.
>> >
>> >
>> > Do you mean kernels and biases in dnn_srcnn.h?
>> > Their formatting represents their 4D structure a little bit and it
>> > is similar to one that I used for the first srcnn filter version
>> > that was successfully pushed before.
>>
>> Yes, and i suppose they were pushed like that without the reviewer
>> noticing they had no indentation or vertical alignment.
>>
>
> Here is the patch with DNN module moved to libavfilter and proper formatting 
> of tables in dnn_srcnn.h.
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH 2/8] ffserver: Implement lua config file reader

2018-05-28 Thread Stephan Holljes
Signed-off-by: Stephan Holljes 
---
 configreader.c | 235 +
 configreader.h |  47 
 2 files changed, 282 insertions(+)
 create mode 100644 configreader.c
 create mode 100644 configreader.h

diff --git a/configreader.c b/configreader.c
new file mode 100644
index 000..3580fc5
--- /dev/null
+++ b/configreader.c
@@ -0,0 +1,235 @@
+/*
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "configreader.h"
+#include "httpd.h"
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+
+const char *stream_format_names[] = { "mkv" };
+
+static struct HTTPDConfig *parsed_configs = NULL;
+
+void stream_free(struct StreamConfig *stream)
+{
+if (stream->stream_name)
+av_free(stream->stream_name);
+if (stream->input_uri)
+av_free(stream->input_uri);
+if (stream->formats)
+av_free(stream->formats);
+}
+
+void config_free(struct HTTPDConfig *config)
+{
+int i;
+if (config->server_name)
+av_free(config->server_name);
+if (config->bind_address)
+av_free(config->bind_address);
+if (config->streams) {
+for (i = 0; i < config->nb_streams; i++)
+stream_free(>streams[i]);
+av_free(config->streams);
+}
+}
+
+void config_dump(struct HTTPDConfig *config, FILE *stream) {
+int i, j;
+fprintf(stream, "==\nserver name: %s\nbind_address: %s\nport: 
%d\nnb_streams: %d\n",
+config->server_name, config->bind_address, config->port, 
config->nb_streams);
+for (i = 0; i < config->nb_streams; i++) {
+fprintf(stream, "--\nstream_name: %s\ninput: %s\nformats: ",
+config->streams[i].stream_name, config->streams[i].input_uri);
+for (j = 0; j < config->streams[i].nb_formats; j++) {
+fprintf(stream, "%s ", 
stream_format_names[config->streams[i].formats[j]]);
+}
+fprintf(stream, "\n");
+}
+}
+
+int configs_parse(lua_State *L)
+{
+int nb_configs = 0;
+int nb_streams = 0;
+int nb_formats = 0;
+int index = 0;
+const char *key;
+struct HTTPDConfig *config;
+struct StreamConfig *stream;
+
+luaL_checktype(L, -1, LUA_TTABLE);
+lua_pushnil(L);
+
+// iterate servers
+while (lua_next(L, -2) != 0) {
+nb_configs++;
+parsed_configs = av_realloc(parsed_configs, nb_configs * sizeof(struct 
HTTPDConfig));
+if (!parsed_configs) {
+return luaL_error(L, "Error could not allocate memory for 
configs");
+}
+luaL_checktype(L, -2, LUA_TSTRING);
+luaL_checktype(L, -1, LUA_TTABLE);
+config = _configs[nb_configs - 1];
+config->server_name = NULL;
+config->bind_address = NULL;
+config->port = -1;
+config->accept_timeout = 1000;
+config->streams = NULL;
+config->nb_streams = 0;
+
+config->server_name = av_strdup(lua_tostring(L, -2));
+if (!config->server_name) {
+return luaL_error(L, "Error could not allocate server name 
string");
+}
+lua_pushnil(L);
+// iterate server properties
+nb_streams = 0;
+while(lua_next(L, -2) != 0) {
+luaL_checktype(L, -2, LUA_TSTRING);
+key = lua_tostring(L, -2);
+if (!strncmp("bind_address", key, 12)) {
+config->bind_address = av_strdup(lua_tostring(L, -1));
+if (!config->bind_address) {
+return luaL_error(L, "Error could not allocate bind 
address string");
+}
+} else if (!strncmp("port", key, 4)) {
+config->port = (int) lua_tonumber(L, -1);
+} else {
+// keys that are not "bind_address" or "port" are streams
+luaL_checktype(L, -1, LUA_TTABLE);
+
+nb_streams++;
+config->streams = av_realloc(config->streams, nb_streams * 
sizeof(struct StreamConfig));
+if (!config->streams) {
+return luaL_error(L, "Error could not allocate memory for 
streams");
+}
+stream = >streams[nb_streams - 1];
+stream->input_uri = NULL;
+

[FFmpeg-devel] [PATCH 02/10] ffserver.c: Check pthread_create for thread creation failure

2018-05-28 Thread Stephan Holljes
Signed-off-by: Stephan Holljes 
---
 ffserver.c | 34 ++
 1 file changed, 26 insertions(+), 8 deletions(-)

diff --git a/ffserver.c b/ffserver.c
index 5fc7c44..4bbf254 100644
--- a/ffserver.c
+++ b/ffserver.c
@@ -558,21 +558,35 @@ void *run_server(void *arg) {
 for (i = 0; i < pub->nb_threads; i++) {
 winfos[i].pub = pub;
 winfos[i].thread_id = i;
-pthread_create(_threads[i], NULL, write_thread, 
_p[stream_index][i]);
+ret = pthread_create(_threads[i], NULL, write_thread, 
_p[stream_index][i]);
+if (ret != 0) {
+pub->shutdown = 1;
+goto end;
+}
 }
 w_threads_p[stream_index] = w_threads;
-pthread_create(_thread, NULL, read_thread, [stream_index]);
+ret = pthread_create(_thread, NULL, read_thread, 
[stream_index]);
+if (ret != 0) {
+pub->shutdown = 1;
+goto end;
+}
 r_threads[stream_index] = r_thread;
 }
 
 
 //pthread_create(_thread, NULL, accept_thread, );
 accept_thread();
+
+end:
 for (stream_index = 0; stream_index < config->nb_streams; stream_index++) {
-pthread_join(r_threads[stream_index], NULL);
+// in case of thread creation failure this might NULL
+if (r_threads[stream_index])
+pthread_join(r_threads[stream_index], NULL);
 if (pubs[stream_index]) {
 for (i = 0; i < pubs[stream_index]->nb_threads; i++) {
-pthread_join(w_threads_p[stream_index][i], NULL);
+// might also be NULL because of thread creation failure
+if (w_threads_p[stream_index][i])
+pthread_join(w_threads_p[stream_index][i], NULL);
 }
 }
 av_free(winfos_p[stream_index]);
@@ -596,7 +610,7 @@ int main(int argc, char *argv[])
 struct HTTPDConfig *configs;
 int nb_configs;
 pthread_t *server_threads;
-int i;
+int i, ret;
 
 if (argc < 2) {
 printf("Usage: %s config.lua\n", argv[0]);
@@ -610,12 +624,16 @@ int main(int argc, char *argv[])
 }
 server_threads = av_mallocz_array(nb_configs, sizeof(pthread_t));
 for (i = 0; i < nb_configs; i++) {
-config_dump(configs + i);
-pthread_create(_threads[i], NULL, run_server, configs + i);
+config_dump(configs + i, stderr);
+ret = pthread_create(_threads[i], NULL, run_server, configs + 
i);
+if (ret != 0) {
+server_threads[i] = 0;
+}
 }
 
 for (i = 0; i < nb_configs; i++) {
-pthread_join(server_threads[i], NULL);
+if (server_threads[i])
+pthread_join(server_threads[i], NULL);
 config_free(configs + i);
 }
 av_free(configs);
-- 
2.16.2

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [GSoC] FFserver refactor and bugfixes

2018-05-28 Thread Stephan Holljes
This patchset refactors av_*alloc* with av_*alloc*_array where useful,
adds allocation checks to a lot of unchecked allocations,
pthread-creation checks and simplification and simple bugfixes.

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH 6/8] ffserver.c: Add config file reading

2018-05-28 Thread Stephan Holljes
Signed-off-by: Stephan Holljes 
---
 ffserver.c | 248 ++---
 1 file changed, 172 insertions(+), 76 deletions(-)

diff --git a/ffserver.c b/ffserver.c
index 402e710..12c257f 100644
--- a/ffserver.c
+++ b/ffserver.c
@@ -38,6 +38,7 @@
 #include "segment.h"
 #include "publisher.h"
 #include "httpd.h"
+#include "configreader.h"
 
 #define BUFFER_SECS 30
 #define LISTEN_TIMEOUT_MSEC 1000
@@ -54,9 +55,11 @@ struct WriteInfo {
 };
 
 struct AcceptInfo {
-struct PublisherContext *pub;
+struct PublisherContext **pubs;
 struct HTTPDInterface *httpd;
-AVFormatContext *ifmt_ctx;
+AVFormatContext **ifmt_ctxs;
+struct HTTPDConfig *config;
+int nb_pub; /* number of publishers (streams) equal to number of ifmt_ctx 
*/
 };
 
 
@@ -290,52 +293,77 @@ void *accept_thread(void *arg)
 {
 struct AcceptInfo *info = (struct AcceptInfo*) arg;
 struct FFServerInfo *ffinfo = NULL;
+struct PublisherContext *pub;
 char status[4096];
+char *stream_name;
 struct HTTPClient *client = NULL;
 void *server = NULL;
 AVIOContext *client_ctx = NULL;
 AVFormatContext *ofmt_ctx = NULL;
+AVFormatContext *ifmt_ctx;
 unsigned char *avio_buffer;
 AVOutputFormat *ofmt;
 AVDictionary *mkvopts = NULL;
 AVStream *in_stream, *out_stream;
 int ret, i, reply_code;
-struct HTTPDConfig config = {
-.bind_address = "0",
-.port = 8080,
-.accept_timeout = LISTEN_TIMEOUT_MSEC,
-};
-
-info->httpd->init(, config);
-
-
+int shutdown;
+struct HTTPDConfig *config = info->config;
+
+info->httpd->init(, *config);
+
 for (;;) {
-if (info->pub->shutdown)
+shutdown = 1;
+for (i = 0; i < config->nb_streams; i++) {
+if (info->pubs[i] && !info->pubs[i]->shutdown)
+shutdown = 0;
+}
+if (shutdown)
 break;
-publisher_gen_status_json(info->pub, status);
-av_log(server, AV_LOG_INFO, status);
+for (i = 0; i < config->nb_streams; i++) {
+publisher_gen_status_json(info->pubs[i], status);
+av_log(server, AV_LOG_INFO, status);
+}
 client = NULL;
 av_log(server, AV_LOG_DEBUG, "Accepting new clients.\n");
 reply_code = 200;
-if (publisher_reserve_client(info->pub)) {
-av_log(client, AV_LOG_WARNING, "No more client slots free, 
Returning 503.\n");
-reply_code = 503;
-}
-
+
 if ((ret = info->httpd->accept(server, , reply_code)) < 0) {
 if (ret == HTTPD_LISTEN_TIMEOUT) {
-publisher_cancel_reserve(info->pub);
 continue;
 } else if (ret == HTTPD_CLIENT_ERROR) {
 info->httpd->close(server, client);
 }
 av_log(server, AV_LOG_WARNING, "Error during accept, retrying.\n");
-publisher_cancel_reserve(info->pub);
 continue;
 }
-
+
+pub = NULL;
+ifmt_ctx = NULL;
+for (i = 0; i < config->nb_streams; i++) {
+stream_name = info->pubs[i]->stream_name;
+//   skip leading '/'  ---v
+if(!strncmp(client->resource + 1, stream_name, 
strlen(stream_name))) {
+pub = info->pubs[i];
+ifmt_ctx = info->ifmt_ctxs[i];
+break;
+}
+}
+
+if (!pub || !ifmt_ctx) {
+av_log(client_ctx, AV_LOG_WARNING, "No suitable publisher found 
for resource: %s.\n",
+client->resource ? 
client->resource : "(null)");
+reply_code = 404;
+}
+
+
+if (pub && ifmt_ctx && publisher_reserve_client(pub)) {
+av_log(client_ctx, AV_LOG_WARNING, "No more client slots free, 
Returning 503.\n");
+reply_code = 503;
+}
+
 if (reply_code != 200) {
-publisher_cancel_reserve(info->pub);
+if (pub && ifmt_ctx)
+publisher_cancel_reserve(pub);
 info->httpd->close(server, client);
 continue;
 }
@@ -348,7 +376,7 @@ void *accept_thread(void *arg)
 client_ctx = avio_alloc_context(avio_buffer, AV_BUFSIZE, 1, ffinfo, 
NULL, _write, NULL);
 if (!client_ctx) {
 av_log(client, AV_LOG_ERROR, "Could not allocate output format 
context.\n");
-publisher_cancel_reserve(info->pub);
+publisher_cancel_reserve(pub);
 info->httpd->close(server, client);
 av_free(client_ctx->buffer);
 avio_context_free(_ctx);
@@ -358,7 +386,7 @@ void *accept_thread(void *arg)
 avformat_alloc_output_context2(_ctx, NULL, "matroska", NULL);
 if (!ofmt_ctx) {
 av_log(client, AV_LOG_ERROR, "Could not allocate output format 
context.\n");
-publisher_cancel_reserve(info->pub);
+

[FFmpeg-devel] [PATCH 1/8] ffserver.c: Fix timestamp handling, still creates new clusters for mp4 files, but result is playable

2018-05-28 Thread Stephan Holljes
Signed-off-by: Stephan Holljes 
---
 ffserver.c | 14 +++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/ffserver.c b/ffserver.c
index 39e1c32..fc2a1a4 100644
--- a/ffserver.c
+++ b/ffserver.c
@@ -133,7 +133,7 @@ void *read_thread(void *arg)
 pkt.pos = -1;
 
 // current pts
-pts = pkt.pts; //av_rescale_q(pkt.pts, in_stream->time_base, tb);
+pts = pkt.pts;
 
 // current stream "uptime"
 now = av_gettime_relative() - start;
@@ -200,6 +200,9 @@ void write_segment(struct Client *c)
 struct Segment *seg;
 int ret;
 int pkt_count = 0;
+AVRational tb;
+tb.num = 1;
+tb.den = AV_TIME_BASE;
 pthread_mutex_lock(>buffer_lock);
 if (av_fifo_size(c->buffer) > 0) {
 AVFormatContext *fmt_ctx;
@@ -249,8 +252,13 @@ void write_segment(struct Client *c)
 if (ret < 0)
 break;
 
-pkt.dts = seg->ts[pkt_count];
-pkt.pts = seg->ts[pkt_count+1];
+pkt.dts = av_rescale_q_rnd(seg->ts[pkt_count], tb,
+
c->ofmt_ctx->streams[pkt.stream_index]->time_base,
+   
AV_ROUND_NEAR_INF|AV_ROUND_PASS_MINMAX);
+pkt.pts = av_rescale_q_rnd(seg->ts[pkt_count+1], tb,
+
c->ofmt_ctx->streams[pkt.stream_index]->time_base,
+   
AV_ROUND_NEAR_INF|AV_ROUND_PASS_MINMAX);
+pkt.pos = -1;
 pkt_count += 2;
 ret = av_write_frame(c->ofmt_ctx, );
 av_packet_unref();
-- 
2.16.2

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH 01/10] ffserver.c: Replace av_malloc with av_mallocz_array

2018-05-28 Thread Stephan Holljes
Signed-off-by: Stephan Holljes 
---
 ffserver.c | 18 +-
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/ffserver.c b/ffserver.c
index 12c257f..5fc7c44 100644
--- a/ffserver.c
+++ b/ffserver.c
@@ -509,8 +509,8 @@ void *run_server(void *arg) {
 pthread_t *r_threads;
 pthread_t **w_threads_p;
 
-pubs = av_mallocz(config->nb_streams * sizeof(struct PublisherContext*));
-ifmt_ctxs = av_mallocz(config->nb_streams * sizeof(AVFormatContext*));
+pubs = av_mallocz_array(config->nb_streams, sizeof(struct 
PublisherContext*));
+ifmt_ctxs = av_mallocz_array(config->nb_streams, sizeof(AVFormatContext*));
 
 av_log_set_level(AV_LOG_INFO);
 
@@ -520,10 +520,10 @@ void *run_server(void *arg) {
 ainfo.httpd = 
 ainfo.config = config;
 
-rinfos = av_mallocz(config->nb_streams * sizeof(struct ReadInfo));
-winfos_p = av_mallocz(config->nb_streams * sizeof(struct WriteInfo*));
-r_threads = av_mallocz(config->nb_streams * sizeof(pthread_t));
-w_threads_p = av_mallocz(config->nb_streams * sizeof(pthread_t*));
+rinfos = av_mallocz_array(config->nb_streams, sizeof(struct ReadInfo));
+winfos_p = av_mallocz_array(config->nb_streams, sizeof(struct WriteInfo*));
+r_threads = av_mallocz_array(config->nb_streams, sizeof(pthread_t));
+w_threads_p = av_mallocz_array(config->nb_streams, sizeof(pthread_t*));
 
 for (stream_index = 0; stream_index < config->nb_streams; stream_index++) {
 struct PublisherContext *pub = NULL;
@@ -549,8 +549,8 @@ void *run_server(void *arg) {
 
 rinfos[stream_index] = rinfo;
 
-w_threads = av_malloc(sizeof(pthread_t) * pub->nb_threads);
-winfos = av_malloc(sizeof(struct WriteInfo) * pub->nb_threads);
+w_threads = av_mallocz_array(pub->nb_threads, sizeof(pthread_t));
+winfos = av_mallocz_array(pub->nb_threads, sizeof(struct WriteInfo));
 
 w_threads_p[stream_index] = w_threads;
 winfos_p[stream_index] = winfos;
@@ -608,7 +608,7 @@ int main(int argc, char *argv[])
 printf("No valid configurations parsed.\n");
 return 1;
 }
-server_threads = av_malloc(nb_configs * sizeof(pthread_t));
+server_threads = av_mallocz_array(nb_configs, sizeof(pthread_t));
 for (i = 0; i < nb_configs; i++) {
 config_dump(configs + i);
 pthread_create(_threads[i], NULL, run_server, configs + i);
-- 
2.16.2

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH 04/10] ffserver.c: Check allocations

2018-05-28 Thread Stephan Holljes
Signed-off-by: Stephan Holljes 
---
 ffserver.c | 87 +-
 1 file changed, 81 insertions(+), 6 deletions(-)

diff --git a/ffserver.c b/ffserver.c
index 66bf7ac..171da51 100644
--- a/ffserver.c
+++ b/ffserver.c
@@ -227,12 +227,25 @@ void write_segment(struct Client *c)
 }
 
 avio_buffer = (unsigned char*) av_malloc(AV_BUFSIZE);
+if (!avio_buffer) {
+av_log(NULL, AV_LOG_ERROR, "Could not allocate avio_buffer\n");
+avformat_free_context(fmt_ctx);
+client_disconnect(c, 0);
+return;
+}
 avio_ctx = avio_alloc_context(avio_buffer, AV_BUFSIZE, 0, , 
_read, NULL, NULL);
-
+if (!avio_ctx) {
+av_log(NULL, AV_LOG_ERROR, "Could not allocate avio_ctx\n");
+avformat_free_context(fmt_ctx);
+av_free(avio_buffer);
+client_disconnect(c, 0);
+return;
+}
 fmt_ctx->pb = avio_ctx;
 ret = avformat_open_input(_ctx, NULL, seg->ifmt, NULL);
 if (ret < 0) {
 av_log(avio_ctx, AV_LOG_ERROR, "Could not open input\n");
+avformat_close_input(_ctx);
 av_free(avio_ctx->buffer);
 avio_context_free(_ctx);
 client_disconnect(c, 0);
@@ -242,6 +255,7 @@ void write_segment(struct Client *c)
 ret = avformat_find_stream_info(fmt_ctx, NULL);
 if (ret < 0) {
 av_log(fmt_ctx, AV_LOG_ERROR, "Could not find stream 
information\n");
+avformat_close_input(_ctx);
 av_free(avio_ctx->buffer);
 avio_context_free(_ctx);
 client_disconnect(c, 0);
@@ -274,9 +288,8 @@ void write_segment(struct Client *c)
 return;
 }
 }
-avformat_close_input(_ctx);
 av_free(avio_ctx->buffer);
-avformat_free_context(fmt_ctx);
+avformat_close_input(_ctx);
 avio_context_free(_ctx);
 pthread_mutex_lock(>buffer_lock);
 av_fifo_drain(c->buffer, sizeof(struct Segment*));
@@ -369,13 +382,25 @@ void *accept_thread(void *arg)
 }
 
 avio_buffer = av_malloc(AV_BUFSIZE);
+if (!avio_buffer) {
+av_log(NULL, AV_LOG_ERROR, "Could not allocate output format 
context.\n");
+publisher_cancel_reserve(pub);
+info->httpd->close(server, client);
+continue;
+}
 ffinfo = av_malloc(sizeof(struct FFServerInfo));
+if (!ffinfo) {
+av_log(NULL, AV_LOG_ERROR, "Could not allocate FFServerInfo 
struct.\n");
+publisher_cancel_reserve(pub);
+info->httpd->close(server, client);
+continue;
+}
 ffinfo->httpd = info->httpd;
 ffinfo->client = client;
 ffinfo->server = server;
 client_ctx = avio_alloc_context(avio_buffer, AV_BUFSIZE, 1, ffinfo, 
NULL, _write, NULL);
 if (!client_ctx) {
-av_log(client, AV_LOG_ERROR, "Could not allocate output format 
context.\n");
+av_log(NULL, AV_LOG_ERROR, "Could not allocate output format 
context.\n");
 publisher_cancel_reserve(pub);
 info->httpd->close(server, client);
 av_free(client_ctx->buffer);
@@ -385,7 +410,7 @@ void *accept_thread(void *arg)
 }
 avformat_alloc_output_context2(_ctx, NULL, "matroska", NULL);
 if (!ofmt_ctx) {
-av_log(client, AV_LOG_ERROR, "Could not allocate output format 
context.\n");
+av_log(client_ctx, AV_LOG_ERROR, "Could not allocate output format 
context.\n");
 publisher_cancel_reserve(pub);
 info->httpd->close(server, client);
 avformat_free_context(ofmt_ctx);
@@ -510,7 +535,16 @@ void *run_server(void *arg) {
 pthread_t **w_threads_p;
 
 pubs = av_mallocz_array(config->nb_streams, sizeof(struct 
PublisherContext*));
+if (!pubs) {
+av_log(NULL, AV_LOG_ERROR, "Could not allocate publishers\n");
+return NULL;
+}
 ifmt_ctxs = av_mallocz_array(config->nb_streams, sizeof(AVFormatContext*));
+if (!ifmt_ctxs) {
+av_log(NULL, AV_LOG_ERROR, "Could not allocate input format 
contexts.\n");
+av_free(pubs);
+return NULL;
+}
 
 av_log_set_level(AV_LOG_INFO);
 
@@ -521,9 +555,39 @@ void *run_server(void *arg) {
 ainfo.config = config;
 
 rinfos = av_mallocz_array(config->nb_streams, sizeof(struct ReadInfo));
+if (!rinfos) {
+av_log(NULL, AV_LOG_ERROR, "Could not allocate read infos.\n");
+av_free(pubs);
+av_free(ifmt_ctxs);
+return NULL;
+}
 winfos_p = av_mallocz_array(config->nb_streams, sizeof(struct WriteInfo*));
+if (!winfos_p) {
+av_log(NULL, AV_LOG_ERROR, "Could not allocate write info 
pointers.\n");
+av_free(pubs);
+av_free(ifmt_ctxs);
+av_free(rinfos);
+return 

[FFmpeg-devel] [PATCH 05/10] publisher.c: Add allocation failure checks.

2018-05-28 Thread Stephan Holljes
Signed-off-by: Stephan Holljes 
---
 publisher.c | 20 
 1 file changed, 20 insertions(+)

diff --git a/publisher.c b/publisher.c
index 2e96f2f..9374c41 100644
--- a/publisher.c
+++ b/publisher.c
@@ -97,17 +97,37 @@ void publisher_init(struct PublisherContext **pub, char 
*stream_name)
 {
 int i;
 struct PublisherContext *pc = (struct PublisherContext*) 
av_malloc(sizeof(struct PublisherContext));
+if (!pc) {
+av_log(NULL, AV_LOG_ERROR, "Could not allocate publisher context.\n");
+return;
+}
 pc->nb_threads = 8;
 pc->stream_name = stream_name;
 pc->current_segment_id = -1;
 pc->shutdown = 0;
 pc->buffer = av_fifo_alloc_array(sizeof(struct Segment), MAX_SEGMENTS);
+if (!pc->buffer) {
+av_log(NULL, AV_LOG_ERROR, "Could not allocate publisher buffer.\n");
+av_free(pc);
+return;
+}
 pc->fs_buffer = av_fifo_alloc_array(sizeof(struct Segment), MAX_SEGMENTS);
+if (!pc->fs_buffer) {
+av_log(NULL, AV_LOG_ERROR, "Could not allocate publisher fast-start 
buffer.\n");
+av_fifo_free(pc->buffer);
+av_free(pc);
+return;
+}
 pthread_mutex_init(>buffer_lock, NULL);
 pthread_mutex_init(>fs_buffer_lock, NULL);
 for (i = 0; i < MAX_CLIENTS; i++) {
 struct Client *c = >clients[i];
 c->buffer = av_fifo_alloc_array(sizeof(struct Segment), MAX_SEGMENTS);
+if (!c->buffer) {
+av_log(NULL, AV_LOG_ERROR, "Could not allocate client buffer.\n");
+publisher_free(pc);
+return;
+}
 c->ofmt_ctx = NULL;
 c->ffinfo = NULL;
 c->id = i;
-- 
2.16.2

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH 10/10] ffserver.c: Fix invalid read if resource is empty string

2018-05-28 Thread Stephan Holljes
Signed-off-by: Stephan Holljes 
---
 ffserver.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/ffserver.c b/ffserver.c
index 65b12da..cdcc064 100644
--- a/ffserver.c
+++ b/ffserver.c
@@ -350,8 +350,9 @@ void *accept_thread(void *arg)
 ifmt_ctx = NULL;
 for (i = 0; i < config->nb_streams; i++) {
 stream_name = info->pubs[i]->stream_name;
-//   skip leading '/'  ---v
-if(!strncmp(client->resource + 1, stream_name, 
strlen(stream_name))) {
+//   skip leading '/'  ---v
+if(client->resource && strlen(client->resource)
+&& !strncmp(client->resource + 1, stream_name, 
strlen(stream_name))) {
 pub = info->pubs[i];
 ifmt_ctx = info->ifmt_ctxs[i];
 break;
-- 
2.16.2

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH 06/10] segment.c: Add allocation failure checks.

2018-05-28 Thread Stephan Holljes
Signed-off-by: Stephan Holljes 
---
 segment.c | 26 ++
 1 file changed, 26 insertions(+)

diff --git a/segment.c b/segment.c
index c40d1ad..986aeb5 100644
--- a/segment.c
+++ b/segment.c
@@ -82,6 +82,10 @@ int segment_write(void *opaque, unsigned char *buf, int 
buf_size)
 struct Segment *seg = (struct Segment*) opaque;
 seg->size += buf_size;
 seg->buf = (unsigned char*) av_realloc(seg->buf, seg->size);
+if (!seg->buf) {
+av_log(NULL, AV_LOG_ERROR, "Could not grow segment.\n");
+return AVERROR(ENOMEM);
+}
 memcpy(seg->buf + seg->size - buf_size, buf, buf_size);
 return buf_size;
 }
@@ -110,6 +114,10 @@ void segment_init(struct Segment **seg_p, AVFormatContext 
*fmt)
 int i;
 AVStream *in_stream, *out_stream;
 struct Segment *seg = (struct Segment*) av_malloc(sizeof(struct Segment));
+if (!seg) {
+av_log(fmt, AV_LOG_ERROR, "Could not allocate segment.\n");
+return;
+}
 
 seg->ifmt = av_find_input_format("matroska");
 seg->fmt_ctx = NULL;
@@ -119,10 +127,28 @@ void segment_init(struct Segment **seg_p, AVFormatContext 
*fmt)
 seg->ts_len = 0;
 seg->buf = NULL;
 seg->avio_buffer = (unsigned char*) av_malloc(AV_BUFSIZE);
+if (!seg->avio_buffer) {
+av_log(NULL, AV_LOG_ERROR, "Could not allocate segment 
avio_buffer.\n");
+av_free(seg);
+return;
+}
 pthread_mutex_init(>nb_read_lock, NULL);
 seg->io_ctx = avio_alloc_context(seg->avio_buffer, AV_BUFSIZE, 1, seg, 
NULL, _write, NULL);
+if (!seg->io_ctx) {
+av_log(NULL, AV_LOG_ERROR, "Could not allocate segment io context.\n");
+av_free(seg->avio_buffer);
+av_free(seg);
+return;
+}
 seg->io_ctx->seekable = 0;
 avformat_alloc_output_context2(>fmt_ctx, NULL, "matroska", NULL);
+if (!seg->fmt_ctx) {
+av_log(seg->io_ctx, AV_LOG_ERROR, "Could not allocate segment output 
context.\n");
+av_free(seg->avio_buffer);
+av_free(seg->io_ctx);
+av_free(seg);
+return;
+}
 if ((ret = av_opt_set_int(seg->fmt_ctx, "flush_packets", 1, 
AV_OPT_SEARCH_CHILDREN)) < 0) {
 av_log(seg->fmt_ctx, AV_LOG_WARNING, "Could not set flush_packets!\n");
 }
-- 
2.16.2

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH 07/10] lavfhttpd.c: Add allocation failure check.

2018-05-28 Thread Stephan Holljes
Signed-off-by: Stephan Holljes 
---
 lavfhttpd.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/lavfhttpd.c b/lavfhttpd.c
index 3cf9958..5488e14 100644
--- a/lavfhttpd.c
+++ b/lavfhttpd.c
@@ -74,6 +74,10 @@ int lavfhttpd_accept(void *server, struct HTTPClient 
**client, int reply_code)
 client_ctx->seekable = 0;
 ret2 = HTTPD_OK;
 client_http = av_malloc(sizeof(struct HTTPClient));
+if (!client_http) {
+av_log(server, AV_LOG_ERROR, "Could not allocate http client.\n");
+return HTTPD_OTHER_ERROR;
+}
 client_http->method = NULL;
 client_http->resource = NULL;
 client_http->httpd_data = client_ctx;
-- 
2.16.2

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH 3/8] ffserver.c: rename ReadInfo.in_filename to ReadInfo.in_uri

2018-05-28 Thread Stephan Holljes
Signed-off-by: Stephan Holljes 
---
 ffserver.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ffserver.c b/ffserver.c
index fc2a1a4..402e710 100644
--- a/ffserver.c
+++ b/ffserver.c
@@ -45,7 +45,7 @@
 struct ReadInfo {
 struct PublisherContext *pub;
 AVFormatContext *ifmt_ctx;
-char *in_filename;
+char *input_uri;
 };
 
 struct WriteInfo {
-- 
2.16.2

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH 8/8] doc: Update Documentation.txt and add sample config as supplement

2018-05-28 Thread Stephan Holljes
Signed-off-by: Stephan Holljes 
---
 Documentation.txt | 17 -
 sample_config.lua | 28 
 2 files changed, 36 insertions(+), 9 deletions(-)
 create mode 100644 sample_config.lua

diff --git a/Documentation.txt b/Documentation.txt
index 9a7f0bf..c8fef11 100644
--- a/Documentation.txt
+++ b/Documentation.txt
@@ -67,16 +67,15 @@ struct HTTPDInterface {
 Usage
 -
 
-Currently streams can be supplied as a stream through stdin or any ffmpeg-
-compatible URI, e.g. files or network locations. Examples:
+To use ffserver, a config file has to be created that defines what streams to
+read and where to serve them. A sample config is supplied as sample_config.lua.
+This sample config defines two servers with a total of three streams. The first
+server serves two streams on all interfaces on port 8080, while the second
+server serves one stream on 127.0.0.1. The streams can be received by
+requesting the configured stream name as the GET parameter in the HTTP request.
+In the sample config, this would be 
"http://:8080/default_stream"
+for the first stream.
 
-cat somefile.mkv | ./ffserver
-
-./ffserver somefile.mkv
-
-./ffserver http://somehost/somefile.mkv
-
-This will start reading the file and open port 8080 for HTTP client 
connections.
 The stream is read in real time from whatever resource it is retrieved.
 Currently a maximum of 16 clients is implemented.
 
diff --git a/sample_config.lua b/sample_config.lua
new file mode 100644
index 000..a5e6192
--- /dev/null
+++ b/sample_config.lua
@@ -0,0 +1,28 @@
+-- Sample configuration file for ffserver
+-- Contains all settings
+settings = {
+-- A server instance
+default_server = {
+-- Server settings
+bind_address = "0.0.0.0",
+port = 8080,
+-- Stream settings
+default_stream = {
+input = "default.mkv",
+formats = { "mkv" }, -- later possible: { "mkv", "hls", "dash" }
+},
+other_stream = {
+input = "other_file.mkv",
+formats = { "mkv" }
+}
+},
+-- Another server instance
+other_server = {
+bind_address = "127.0.0.1",
+port = 8081,
+default_restream = {
+input = "yet_another_file.mkv",
+formats = { "mkv" }
+}
+}
+}
-- 
2.16.2

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH 09/10] lavfhttpd.c: Free client context if allocated but an error occured

2018-05-28 Thread Stephan Holljes
Signed-off-by: Stephan Holljes 
---
 lavfhttpd.c | 7 +--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/lavfhttpd.c b/lavfhttpd.c
index 5488e14..d094d65 100644
--- a/lavfhttpd.c
+++ b/lavfhttpd.c
@@ -66,10 +66,13 @@ int lavfhttpd_accept(void *server, struct HTTPClient 
**client, int reply_code)
 int reply_code2 = reply_code;
 char *method, *resource;
 if ((ret = avio_accept(server_ctx, _ctx)) < 0) {
-if (ret == AVERROR(ETIMEDOUT))
+if (ret == AVERROR(ETIMEDOUT)) {
 return HTTPD_LISTEN_TIMEOUT;
-else
+} else {
+if (client_ctx)
+avio_context_free(_ctx);
 return HTTPD_OTHER_ERROR;
+}
 }
 client_ctx->seekable = 0;
 ret2 = HTTPD_OK;
-- 
2.16.2

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH 5/8] publisher.h: Add stream_name to PublisherContext

2018-05-28 Thread Stephan Holljes
Signed-off-by: Stephan Holljes 
---
 publisher.c | 3 ++-
 publisher.h | 4 +++-
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/publisher.c b/publisher.c
index 1123056..2e96f2f 100644
--- a/publisher.c
+++ b/publisher.c
@@ -93,11 +93,12 @@ void client_push_segment(struct Client *c, struct Segment 
*seg)
 client_set_state(c, WRITABLE);
 }
 
-void publisher_init(struct PublisherContext **pub)
+void publisher_init(struct PublisherContext **pub, char *stream_name)
 {
 int i;
 struct PublisherContext *pc = (struct PublisherContext*) 
av_malloc(sizeof(struct PublisherContext));
 pc->nb_threads = 8;
+pc->stream_name = stream_name;
 pc->current_segment_id = -1;
 pc->shutdown = 0;
 pc->buffer = av_fifo_alloc_array(sizeof(struct Segment), MAX_SEGMENTS);
diff --git a/publisher.h b/publisher.h
index 97b745d..e25c33d 100644
--- a/publisher.h
+++ b/publisher.h
@@ -73,6 +73,7 @@ struct PublisherContext {
 int nb_threads;
 int current_segment_id;
 int shutdown; // indicate shutdown, gracefully close client connections 
and files and exit
+char *stream_name;
 };
 
 /**
@@ -101,8 +102,9 @@ void client_set_state(struct Client *c, enum State state);
  * Allocate and initialize a PublisherContext
  *
  * @param pub pointer to a pointer to a PublisherContext. It will be allocated 
and initialized.
+ * @param stream_name string containing the name of the stream.
  */
-void publisher_init(struct PublisherContext **pub);
+void publisher_init(struct PublisherContext **pub, char *stream_name);
 
 /**
  * Push a Segment to a PublisherContext.
-- 
2.16.2

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH] ffserver.c: Add ability to stream audio-only files.

2018-05-28 Thread Stephan Holljes
Signed-off-by: Stephan Holljes 
---
 ffserver.c | 16 +---
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/ffserver.c b/ffserver.c
index cdcc064..b0db64b 100644
--- a/ffserver.c
+++ b/ffserver.c
@@ -42,6 +42,7 @@
 
 #define BUFFER_SECS 30
 #define LISTEN_TIMEOUT_MSEC 1000
+#define AUDIO_ONLY_SEGMENT_SECONDS 2
 
 struct ReadInfo {
 struct PublisherContext *pub;
@@ -76,8 +77,9 @@ void *read_thread(void *arg)
 AVFormatContext *ifmt_ctx = info->ifmt_ctx;
 int ret, i;
 int video_idx = -1;
+int audio_only = 0;
 int id = 0;
-int64_t pts, now, start;
+int64_t pts, now, start, last_cut = 0;
 int64_t *ts;
 struct Segment *seg = NULL;
 AVPacket pkt;
@@ -101,10 +103,8 @@ void *read_thread(void *arg)
 break;
 }
 }
-if (video_idx == -1) {
-av_log(ifmt_ctx, AV_LOG_ERROR, "No video stream found.\n");
-goto end;
-}
+if (video_idx == -1)
+audio_only = 1;
 
 
 // All information needed to start segmenting the file is gathered now.
@@ -143,8 +143,9 @@ void *read_thread(void *arg)
 now = av_gettime_relative() - start;
 }
 
-// keyframe or first Segment
-if ((pkt.flags & AV_PKT_FLAG_KEY && pkt.stream_index == video_idx) || 
!seg) {
+// keyframe or first Segment or audio_only and more than 
AUDIO_ONLY_SEGMENT_SECONDS passed since last cut
+if ((pkt.flags & AV_PKT_FLAG_KEY && pkt.stream_index == video_idx) || 
!seg ||
+(audio_only && ((pts - last_cut) / AV_TIME_BASE) >= 
AUDIO_ONLY_SEGMENT_SECONDS)) {
 if (seg) {
 segment_close(seg);
 publisher_push_segment(info->pub, seg);
@@ -152,6 +153,7 @@ void *read_thread(void *arg)
 publish(info->pub);
 av_log(NULL, AV_LOG_DEBUG, "Published new segment.\n");
 }
+last_cut = pts;
 segment_init(, ifmt_ctx);
 seg->id = id++;
 av_log(NULL, AV_LOG_DEBUG, "Starting new segment, id: %d\n", 
seg->id);
-- 
2.16.2

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH 08/10] ffserver.c: Simplify codec_type access in read_thread

2018-05-28 Thread Stephan Holljes
Signed-off-by: Stephan Holljes 
---
 ffserver.c | 6 +-
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/ffserver.c b/ffserver.c
index 171da51..65b12da 100644
--- a/ffserver.c
+++ b/ffserver.c
@@ -86,8 +86,6 @@ void *read_thread(void *arg)
 tb.num = 1;
 tb.den = AV_TIME_BASE;
 AVStream *stream;
-AVCodecParameters *params;
-enum AVMediaType type;
 
 if ((ret = avformat_find_stream_info(ifmt_ctx, NULL)) < 0) {
 av_log(ifmt_ctx, AV_LOG_ERROR, "Could not get input stream info.\n");
@@ -98,9 +96,7 @@ void *read_thread(void *arg)
 for (i = 0; i < ifmt_ctx->nb_streams; i++) {
 av_log(ifmt_ctx, AV_LOG_DEBUG, "Checking stream %d\n", i);
 stream = ifmt_ctx->streams[i];
-params = stream->codecpar;
-type = params->codec_type;
-if (type == AVMEDIA_TYPE_VIDEO) {
+if (stream->codecpar->codec_type == AVMEDIA_TYPE_VIDEO) {
 video_idx = i;
 break;
 }
-- 
2.16.2

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] lavf/libssh: translate a read of 0 to EOF

2018-05-28 Thread Jan Ekström
On Mon, May 28, 2018 at 2:16 PM, Nicolas George  wrote:
> Jan Ekström (2018-05-28):
>> Yet another case of forgotten 0 =! EOF translation.
>>
>> While the documentation for this specific synchronous read
>> function does not mention it, the documentation for
>> `sftp_async_read` documents it, as well as looking at the
>> implementation of this function leads one to find
>> `if (handle->eof) { return 0; }`.
>>
>> Reported by stnutt on IRC.
>
> LGTM.
>
> --
>   Nicolas George

Cheers.

Pushed and back-ported to release/4.0.

Jan
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 3/3] Changelog, doc/general: add libdavs2 entry

2018-05-28 Thread Moritz Barsnick
On Mon, May 28, 2018 at 15:00:18 +0200, Moritz Barsnick wrote:
> And, as previously mentioned, listing and even describing the encoder's
> options is desired.

This is the decoder, and it has no options. Sorry for this remark of
mine, it does not fit at all here.

Moritz
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 3/3] Changelog, doc/general: add libdavs2 entry

2018-05-28 Thread Moritz Barsnick
On Mon, May 28, 2018 at 18:14:57 +0800, hwren wrote:
> Signed-off-by: hwren 
> ---
>  Changelog| 1 +
>  doc/general.texi | 8 
>  2 files changed, 9 insertions(+)

This should be in the same commit as patch 2, separation is not
desired.

And, as previously mentioned, listing and even describing the encoder's
options is desired.

Cheers,
Moritz
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 2/3] lavc, configure: add avs2 video decoder via libdavs2

2018-05-28 Thread Moritz Barsnick
On Mon, May 28, 2018 at 18:14:56 +0800, hwren wrote:
> +.name  = "avs2",
> +.long_name = NULL_IF_CONFIG_SMALL("Chinese AVS2 (Audio Video 
> Standar) (AVS2-P2, JiZhun profile)"),
> +.props = AV_CODEC_PROP_LOSSY,

So, does "Chinese" belong to the name or description of the codec, or
not?

Furthermore, "Audio Video Standar" is missing a "d" at the end.

> +if(*got_frame==1) {

Whitespace:if (*got_frame == 1) {
As far as I understand, you should also omit the curly brackets.

> +if (len < 0) {
> +av_log(NULL, AV_LOG_ERROR, "An decoder error counted\n");

"A decoder error occurred."

And why logging with context NULL? That should be avoided, you have
avctx available, right?

> +av_log(avctx, AV_LOG_VERBOSE, "[davs2] decoder 
> destroyed. 0x%p; frames %d\n", cad->decoder, cad->decoded_frames);
  ^^
^Here, on the other hand, the context will already report davs2, if I'm
not mistaken.

> +if(*got_frame==1) {
Whitespace and brackets, see above.

> +.long_name  = NULL_IF_CONFIG_SMALL("Decoder for Chinese AVS2"),

Chinese?

Moritz
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 1/3] doc,lavc,lavf: add avs2 codec

2018-05-28 Thread Moritz Barsnick
On Mon, May 28, 2018 at 18:14:55 +0800, hwren wrote:
> --- a/libavcodec/allcodecs.c
> +++ b/libavcodec/allcodecs.c
> @@ -705,6 +705,7 @@ extern AVCodec ff_libx264_encoder;
>  extern AVCodec ff_libx264rgb_encoder;
>  extern AVCodec ff_libx265_encoder;
>  extern AVCodec ff_libxavs_encoder;
> +extern AVCodec ff_libdavs2_decoder;
>  extern AVCodec ff_libxvid_encoder;

Does this work without patch 2? (I didn't test.)

> @@ -689,6 +690,7 @@ enum AVCodecID {
>  * stream (only used by libavformat) */
>  AV_CODEC_ID_FFMETADATA = 0x21000,   ///< Dummy codec for streams 
> containing only metadata information.
>  AV_CODEC_ID_WRAPPED_AVFRAME = 0x21001, ///< Passthrough codec, AVFrames 
> wrapped in AVPacket
> +
>  };

Why? Please omit this change.

>  #define LIBAVCODEC_VERSION_MAJOR  58
> -#define LIBAVCODEC_VERSION_MINOR  19
> +#define LIBAVCODEC_VERSION_MINOR  20
>  #define LIBAVCODEC_VERSION_MICRO 102

If you increase minor, you also need to reset micro to 100.

Moritz
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] lavc,lavf: add libxavs2 encoder

2018-05-28 Thread Moritz Barsnick
On Mon, May 28, 2018 at 19:16:49 +0800, hwren wrote:
> >Is that really the name of the codec? Otherwise, "Chinese" seems
> >awkward to me. (Same for the decoder.)
> 
> Changed.

I still see it in your newly pushlished patches.

> >Proper documentation of the encoder's options would be appreciated!
> 
> I'm sorry to say that xavs2 could only use '-h' to get some
> information about its options. We'll make a documentation soon.

I don't understand. You explicitly implemented these options:

+static const AVOption options[] = {
+   { "i_lcurow_threads",   "number of parallel threads for rows" , 
  OFFSET(i_lcurow_threads),  AV_OPT_TYPE_INT,{.i64 =  5 }, 1,   8,  VE 
},
+{ "i_frame_threads" ,   "number of parallel threads for frames"   
,   OFFSET(i_frame_threads) ,  AV_OPT_TYPE_INT,{.i64 =  1 }, 1,   4,  
VE },
+{ "i_initial_qp",   "Quantization parameter",   
OFFSET(i_initial_qp),  AV_OPT_TYPE_INT,{.i64 = 34 }, 1,  63,  VE },
+{ "preset_level",   "Speed level"   ,   
OFFSET(preset_level),  AV_OPT_TYPE_INT,{.i64 =  0 }, 0,   9,  VE },
+{ "intra_period",   "Intra period"  ,   
OFFSET(intra_period),  AV_OPT_TYPE_INT,{.i64 =  4 }, 3, 100,  VE },
+{ "hierarchical_ref",   "hierarchical reference",   
OFFSET(b_hierarchical_reference),  AV_OPT_TYPE_INT,{.i64 =  1 }, 0, 1,  
VE },
+{ "num_bframes" ,   "number of B frames",   
OFFSET(num_b_frames),  AV_OPT_TYPE_INT,{.i64 =  7 }, 0,  15,  VE },
+{ "xavs2-params","set the xavs2 configuration using a :-separated list 
of key=value parameters", OFFSET(xavs2_opts), AV_OPT_TYPE_STRING, { 0 }, 0, 0, 
VE },
+{ NULL },
+};

Their description (incl. ranges with explanations, if possible) should
also go into doc/*.texi. At least mention them there initially, if you
don't know what they actually do.

> Thanks for suggestions. We've put them into EXTERNAL_LIBRARY_GPL_LIST
> and added the gpl dependency. I'm not sure if I did right, new
> patches are submitted.

Let's see what the other say.

Cheers,
Moritz
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 4/5] avformat/mxfdec: fix data_essence_descriptor matching logic

2018-05-28 Thread Tomas Härdin
mån 2018-05-28 klockan 00:16 +0200 skrev Marton Balint:
> 
> On Sun, 27 May 2018, Tomas Härdin wrote:
> 
> > sön 2018-05-27 klockan 21:21 +0200 skrev Marton Balint:
> > > > Signed-off-by: Marton Balint 
> > > 
> > > ---
> > >  libavformat/mxfdec.c | 10 +-
> > >  1 file changed, 5 insertions(+), 5 deletions(-)
> > > 
> > > diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c
> > > index bd46572e48..a62021b0d7 100644
> > > --- a/libavformat/mxfdec.c
> > > +++ b/libavformat/mxfdec.c
> > > @@ -2354,12 +2354,12 @@ static int
> > > mxf_parse_structural_metadata(MXFContext *mxf)
> > >  st->need_parsing = AVSTREAM_PARSE_FULL;
> > >  }
> > >  } else if (st->codecpar->codec_type ==
> > > AVMEDIA_TYPE_DATA) {
> > > -int codec_id =
> > > mxf_get_codec_ul(mxf_data_essence_container_uls,
> > > -essence_container_ul
> > > )->id;
> > > -if (codec_id >= 0 &&
> > > -codec_id <
> > > FF_ARRAY_ELEMS(mxf_data_essence_descriptor)) {
> > > +int index;
> > > +container_ul =
> > > mxf_get_codec_ul(mxf_data_essence_container_uls,
> > > essence_container_ul);
> > > +index = container_ul -
> > > mxf_data_essence_container_uls;
> > 
> > Nice use of C peculiarities (:
> 
> The other way is to add a char* to the MXFCodecUL struct, but I
> thought 
> that would be overkill for such a tiny use case.
> 
> > 
> > > +if (index <
> > > FF_ARRAY_ELEMS(mxf_data_essence_descriptor)) {
> > 
> > index can never be <0? Say if container_ul == NULL...
> 
> No, because mxf_get_codec_ul never returns NULL.

Alright, looks OK then. Still irked by the lack of static analysis.
Maybe should give Frama-C a go in some module one day

/Tomas
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] lavc,lavf: add libxavs2 encoder

2018-05-28 Thread hwren









At 2018-05-27 02:20:22, "Moritz Barsnick"  wrote:
>On Sat, May 26, 2018 at 14:08:56 +0800, hwren wrote:
>> Add Chinese AVS2 video encoder, FFmpeg can make use of the libxavs2 library 
>> for AVS2 encoding.
>[...]
>> +.long_name = NULL_IF_CONFIG_SMALL("raw Chinese AVS2 (2nd Audio 
>> Video Standard)"),
>
>Is that really the name of the codec? Otherwise, "Chinese" seems
>awkward to me. (Same for the decoder.)

Changed.

>
>> +Go to @url{https://github.com/pkuvcl/xavs2} and follow the instructions for
>> +installing the library. Then pass @code{--enable-libxavs2} to configure to
>> +enable it.
>
>Proper documentation of the encoder's options would be appreciated!

I'm sorry to say that xavs2 could only use '-h' to get some information about 
its options. We'll make a documentation soon.

>
>One more important thing: libdavs2 and libxavs2 are licensed under
>GPL2, not LGPL. You therefore need a handful of extra boilerplate in
>configure (such as EXTERNAL_LIBRARY_GPL_LIST, and adding "gpl" as a
>dependency), as far as I understand.

Thanks for suggestions. We've put them into EXTERNAL_LIBRARY_GPL_LIST and added 
the gpl dependency. I'm not sure if  I did right, new patches are submitted.

>
>Cheers,
>Moritz
>___
>ffmpeg-devel mailing list
>ffmpeg-devel@ffmpeg.org
>http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] lavf/libssh: translate a read of 0 to EOF

2018-05-28 Thread Nicolas George
Jan Ekström (2018-05-28):
> Yet another case of forgotten 0 =! EOF translation.
> 
> While the documentation for this specific synchronous read
> function does not mention it, the documentation for
> `sftp_async_read` documents it, as well as looking at the
> implementation of this function leads one to find
> `if (handle->eof) { return 0; }`.
> 
> Reported by stnutt on IRC.

LGTM.

-- 
  Nicolas George
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] lavc,lavf: add libdavs2 decoder

2018-05-28 Thread hwren

Thanks for your patience, we've amended some of our patches add resent them.







At 2018-05-26 22:28:27, "Mark Thompson"  wrote:
>On 26/05/18 05:41, hwren wrote:
>> Add Chinese AVS2 video decoder, FFmpeg can make use of the libdavs2 library 
>> for AVS2 decoding.
>> 
>> Signed-off-by: hwren 
>> ---
>> [...] 
>> +static int DumpFrames(AVCodecContext *avctx, davs2_picture_t *pic, 
>> davs2_seq_info_t *headerset, AVFrame *frm) 
>> +{ 
>> + DAVS2Context *cad = avctx->priv_data; 
>> + avctx->flags |= AV_CODEC_FLAG_TRUNCATED; 
> 
>Why this line?

we won't send a complete frame to our decoder, so we need to chage the flag. if 
not, we may get error info.

> 
>> [...] 
>> + frm->data[i] = frm->buf[i]->data; 
>> + frm->linesize[i] = pic->width[i] * bytes_per_sample; 
>> + memcpy(frm->data[i], pic->planes[i], size_plane); 
> 
>This is the same format as libavcodec wants, so is there any way to keep a 
>reference to it so we can avoid this copy?  

We've tried to make it, while it did not work well. May avoid this copy in the 
future.

> 
>> [...] 
>> + buf_ptr += len; 
>> + buf_size -= len; 
> 
>Can you explain how the consuming partial packets works? It looks like if this 
>consumes part of a packet and they returns a frame, the rest of the packet 
>will be discarded (because the next call will be given a new packet).

Once we decode a frame, indeed, there are still some data left in the packet. 
so we just move the pointer and decode the next part (decode until our flag 
turns or out of buf_size range).

> 
>>[...]
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [RFC] libfdk_aac license

2018-05-28 Thread Gyan Doshi



doc/general.texi says this for the FDK AAC library,

"The Fraunhofer AAC library is licensed under a license incompatible to 
the GPL and is not known to be compatible to the LGPL. Therefore, you 
have to pass @code{--enable-nonfree} to configure to use it."


(added 2013 in 6fe419bf73)

LICENSE.md says,

"The Fraunhofer FDK AAC and OpenSSL libraries are under licenses which 
are incompatible with the GPLv2 and v3. To the best of our knowledge, 
they are compatible with the LGPL."


(added 2016 in bbf7500df99)

Indeed, current master can be configured and built as LGPL with FDK AAC 
without passing --enable-nonfree even though the lib is in the nonfree 
list. configure only complains about nonfree if I set license as GPL.


If this is how it should be, I'll update general.texi


Regards,
Gyan
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH 1/3] doc,lavc,lavf: add avs2 codec

2018-05-28 Thread hwren
Signed-off-by: hwren 
---
 doc/APIchanges | 3 +++
 libavcodec/allcodecs.c | 1 +
 libavcodec/avcodec.h   | 2 ++
 libavcodec/version.h   | 2 +-
 libavformat/riff.c | 1 +
 5 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/doc/APIchanges b/doc/APIchanges
index efe15ba..430a914 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -15,6 +15,9 @@ libavutil: 2017-10-21
 
 API changes, most recent first:
 
+2018-05-xx - xx - lavc 58.20.102 - avcodec.h
+  Add AV_CODEC_ID_AVS2.
+
 2018-05-xx - xx - lavf 58.15.100 - avformat.h
   Add pmt_version field to AVProgram
 
diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
index 7b7a8c7..6103081 100644
--- a/libavcodec/allcodecs.c
+++ b/libavcodec/allcodecs.c
@@ -705,6 +705,7 @@ extern AVCodec ff_libx264_encoder;
 extern AVCodec ff_libx264rgb_encoder;
 extern AVCodec ff_libx265_encoder;
 extern AVCodec ff_libxavs_encoder;
+extern AVCodec ff_libdavs2_decoder;
 extern AVCodec ff_libxvid_encoder;
 extern AVCodec ff_libzvbi_teletext_decoder;
 
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index fb0c6fa..a0dd2ce 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -409,6 +409,7 @@ enum AVCodecID {
 AV_CODEC_ID_DXV,
 AV_CODEC_ID_SCREENPRESSO,
 AV_CODEC_ID_RSCC,
+AV_CODEC_ID_AVS2,
 
 AV_CODEC_ID_Y41P = 0x8000,
 AV_CODEC_ID_AVRP,
@@ -689,6 +690,7 @@ enum AVCodecID {
 * stream (only used by libavformat) */
 AV_CODEC_ID_FFMETADATA = 0x21000,   ///< Dummy codec for streams 
containing only metadata information.
 AV_CODEC_ID_WRAPPED_AVFRAME = 0x21001, ///< Passthrough codec, AVFrames 
wrapped in AVPacket
+
 };
 
 /**
diff --git a/libavcodec/version.h b/libavcodec/version.h
index da893da..219f56c 100644
--- a/libavcodec/version.h
+++ b/libavcodec/version.h
@@ -28,7 +28,7 @@
 #include "libavutil/version.h"
 
 #define LIBAVCODEC_VERSION_MAJOR  58
-#define LIBAVCODEC_VERSION_MINOR  19
+#define LIBAVCODEC_VERSION_MINOR  20
 #define LIBAVCODEC_VERSION_MICRO 102
 
 #define LIBAVCODEC_VERSION_INT  AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
diff --git a/libavformat/riff.c b/libavformat/riff.c
index 8911725..4153372 100644
--- a/libavformat/riff.c
+++ b/libavformat/riff.c
@@ -369,6 +369,7 @@ const AVCodecTag ff_codec_bmp_tags[] = {
 { AV_CODEC_ID_ZMBV, MKTAG('Z', 'M', 'B', 'V') },
 { AV_CODEC_ID_KMVC, MKTAG('K', 'M', 'V', 'C') },
 { AV_CODEC_ID_CAVS, MKTAG('C', 'A', 'V', 'S') },
+{ AV_CODEC_ID_AVS2, MKTAG('A', 'V', 'S', '2') },
 { AV_CODEC_ID_JPEG2000, MKTAG('m', 'j', 'p', '2') },
 { AV_CODEC_ID_JPEG2000, MKTAG('M', 'J', '2', 'C') },
 { AV_CODEC_ID_JPEG2000, MKTAG('L', 'J', '2', 'C') },
-- 
2.7.4

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH 2/3] lavc, configure: add avs2 video decoder via libdavs2

2018-05-28 Thread hwren
Signed-off-by: hwren 
---
 configure   |   4 +
 libavcodec/Makefile |   1 +
 libavcodec/codec_desc.c |   7 ++
 libavcodec/libdavs2.c   | 212 
 4 files changed, 224 insertions(+)
 create mode 100644 libavcodec/libdavs2.c

diff --git a/configure b/configure
index 09ff0c5..e2ac9f6 100755
--- a/configure
+++ b/configure
@@ -226,6 +226,7 @@ External library support:
   --enable-libcelt enable CELT decoding via libcelt [no]
   --enable-libcdio enable audio CD grabbing with libcdio [no]
   --enable-libcodec2   enable codec2 en/decoding using libcodec2 [no]
+  --enable-libdavs2enable AVS2 decoding via libdavs2 [no]
   --enable-libdc1394   enable IIDC-1394 grabbing using libdc1394
and libraw1394 [no]
   --enable-libfdk-aac  enable AAC de/encoding via libfdk-aac [no]
@@ -1636,6 +1637,7 @@ EXTERNAL_LIBRARY_GPL_LIST="
 avisynth
 frei0r
 libcdio
+libdavs2
 librubberband
 libvidstab
 libx264
@@ -3042,6 +3044,7 @@ libaom_av1_encoder_deps="libaom"
 libcelt_decoder_deps="libcelt"
 libcodec2_decoder_deps="libcodec2"
 libcodec2_encoder_deps="libcodec2"
+libdavs2_decoder_deps="libdavs2 gpl"
 libfdk_aac_decoder_deps="libfdk_aac"
 libfdk_aac_encoder_deps="libfdk_aac"
 libfdk_aac_encoder_select="audio_frame_queue"
@@ -5992,6 +5995,7 @@ enabled libcelt   && require libcelt celt/celt.h 
celt_decode -lcelt0 &&
die "ERROR: libcelt must be installed and 
version must be >= 0.11.0."; }
 enabled libcaca   && require_pkg_config libcaca caca caca.h 
caca_create_canvas
 enabled libcodec2 && require libcodec2 codec2/codec2.h codec2_create 
-lcodec2
+enabled libdavs2  && require_pkg_config libdavs2 "davs2 >= 1.2.34" 
davs2.h davs2_decoder_decode
 enabled libdc1394 && require_pkg_config libdc1394 libdc1394-2 
dc1394/dc1394.h dc1394_new
 enabled libdrm&& require_pkg_config libdrm libdrm xf86drm.h 
drmGetVersion
 enabled libfdk_aac&& { check_pkg_config libfdk_aac fdk-aac 
"fdk-aac/aacenc_lib.h" aacEncOpen ||
diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index 3ab071a..2a845f1 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -944,6 +944,7 @@ OBJS-$(CONFIG_LIBAOM_AV1_ENCODER) += libaomenc.o
 OBJS-$(CONFIG_LIBCELT_DECODER)+= libcelt_dec.o
 OBJS-$(CONFIG_LIBCODEC2_DECODER)  += libcodec2.o codec2utils.o
 OBJS-$(CONFIG_LIBCODEC2_ENCODER)  += libcodec2.o codec2utils.o
+OBJS-$(CONFIG_LIBDAVS2_DECODER)   += libdavs2.o
 OBJS-$(CONFIG_LIBFDK_AAC_DECODER) += libfdk-aacdec.o
 OBJS-$(CONFIG_LIBFDK_AAC_ENCODER) += libfdk-aacenc.o
 OBJS-$(CONFIG_LIBGSM_DECODER) += libgsmdec.o
diff --git a/libavcodec/codec_desc.c b/libavcodec/codec_desc.c
index 79552a9..48cb413 100644
--- a/libavcodec/codec_desc.c
+++ b/libavcodec/codec_desc.c
@@ -1395,6 +1395,13 @@ static const AVCodecDescriptor codec_descriptors[] = {
 .props = AV_CODEC_PROP_LOSSLESS,
 },
 {
+.id= AV_CODEC_ID_AVS2,
+.type  = AVMEDIA_TYPE_VIDEO,
+.name  = "avs2",
+.long_name = NULL_IF_CONFIG_SMALL("Chinese AVS2 (Audio Video Standar) 
(AVS2-P2, JiZhun profile)"),
+.props = AV_CODEC_PROP_LOSSY,
+},
+{
 .id= AV_CODEC_ID_Y41P,
 .type  = AVMEDIA_TYPE_VIDEO,
 .name  = "y41p",
diff --git a/libavcodec/libdavs2.c b/libavcodec/libdavs2.c
new file mode 100644
index 000..4fa8790
--- /dev/null
+++ b/libavcodec/libdavs2.c
@@ -0,0 +1,212 @@
+/*
+ * AVS2 decoding using the davs2 library
+ *
+ * Copyright (C) 2018 Yiqun Xu, 
+ *Falei Luo, 
+ *Huiwen Ren, 
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "libavutil/avassert.h"
+#include "libavutil/common.h"
+#include "libavutil/avutil.h"
+#include "avcodec.h"
+#include "libavutil/imgutils.h"
+#include "internal.h"
+
+#include 
+
+typedef struct DAVS2Context {
+AVCodecContext *avctx;
+
+void *decoder;
+
+AVFrame *frame;
+davs2_param_tparam;  

[FFmpeg-devel] [PATCH 3/3] Changelog, doc/general: add libdavs2 entry

2018-05-28 Thread hwren
Signed-off-by: hwren 
---
 Changelog| 1 +
 doc/general.texi | 8 
 2 files changed, 9 insertions(+)

diff --git a/Changelog b/Changelog
index 3d25564..ce1f97c 100644
--- a/Changelog
+++ b/Changelog
@@ -9,6 +9,7 @@ version :
 - aderivative and aintegral audio filters
 - pal75bars and pal100bars video filter sources
 - support mbedTLS based TLS
+- AVS2 video decoder via libdavs2
 
 
 version 4.0:
diff --git a/doc/general.texi b/doc/general.texi
index 2583006..d3c1503 100644
--- a/doc/general.texi
+++ b/doc/general.texi
@@ -17,6 +17,14 @@ for more formats. None of them are used by default, their 
use has to be
 explicitly requested by passing the appropriate flags to
 @command{./configure}.
 
+@section libdavs2
+
+FFmpeg can make use of the libdavs2 library for AVS2 decoding.
+
+Go to @url{https://github.com/pkuvcl/davs2} and follow the instructions for
+installing the library. Then pass @code{--enable-libdavs2} to configure to
+enable it.
+
 @section Alliance for Open Media libaom
 
 FFmpeg can make use of the libaom library for AV1 decoding.
-- 
2.7.4

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] lavf/libssh: translate a read of 0 to EOF

2018-05-28 Thread Jan Ekström
On Mon, May 28, 2018, 03:21 Jan Ekström  wrote:

> Yet another case of forgotten 0 =! EOF translation.
>
> While the documentation for this specific synchronous read
> function does not mention it, the documentation for
> `sftp_async_read` documents it, as well as looking at the
> implementation of this function leads one to find
> `if (handle->eof) { return 0; }`.
>
> Reported by stnutt on IRC.
> ---
>  libavformat/libssh.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/libavformat/libssh.c b/libavformat/libssh.c
> index 9e3d4da45e..21474f0f0a 100644
> --- a/libavformat/libssh.c
> +++ b/libavformat/libssh.c
> @@ -295,7 +295,7 @@ static int libssh_read(URLContext *h, unsigned char
> *buf, int size)
>  av_log(libssh, AV_LOG_ERROR, "Read error.\n");
>  return AVERROR(EIO);
>  }
> -return bytes_read;
> +return bytes_read ? bytes_read : AVERROR_EOF;
>  }
>
>  static int libssh_write(URLContext *h, const unsigned char *buf, int size)
> --
> 2.17.0
>


During the time while I was sleeping I got a confirnation from the user
that this indeed fixes the issues with seeming freezing+constant cpu usage
with the sftp protocol.

In other words, if this looks OK to people, feel free to merge while I'm at
work and back-port to release/4.0


Jan

>
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH v2 0/2] dump more codec information

2018-05-28 Thread myp...@gmail.com
2018-05-27 21:04 GMT+08:00 Mark Thompson :
> On 27/05/18 02:38, Jun Zhao wrote:
>> V2: - fix the alignment as Reto Kromer's comment
>> - improve the characterization as Mark's comments
>>
>> Jun Zhao (2):
>>   cmdutils: print missing caps in print_codec().
>>   cmdutils: dump supported hardware devices in print_codec()
>>
>>  fftools/cmdutils.c | 21 +
>>  1 file changed, 21 insertions(+)
>>
>
> Set LGTM.
>
> Thanks,
>
> - Mark
will apply, thanks
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] avcodec/vc1: fix out-of-bounds reference pixel replication

2018-05-28 Thread Jerome Borsboom
>> Out-of-bounds reference pixel replication should take into account
>> the frame coding mode of the reference frame(s), not the frame
>> coding mode of the current frame.
>>
>> Signed-off-by: Jerome Borsboom 
>> ---
>> This should fix the remaining issue with the SA10180.vc1 test file.
> 
> With this patch, the first 601 frames are decoded bit-exact, the
> following frame is not decoded correctly.
> 
> Carl Eugen

Are you sure you have applied all five patches of my previous patch set?
The set has only been partially applied to the master branch. My output
is fully equal to the output of the reference decoder. You could also
specify -bitexact on the command line when decoding as I have previously
run into issues with non-bitexact decoding.


Regards,
Jerome
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 2/2] ffmpeg: Use the colour properties from the input stream when doing transcode

2018-05-28 Thread Xiang, Haihao
On Sat, 2018-05-26 at 17:29 +0100, Mark Thompson wrote:
> On 25/05/18 07:57, Tobias Rapp wrote:
> > On 25.05.2018 07:58, Xiang, Haihao wrote:
> > > On Thu, 2018-05-24 at 11:15 +0100, Mark Thompson wrote:
> > > > 
> > > > For example:
> > > > 
> > > > ffmpeg -i bt709_input.mkv -vf colorspace=bt2020 bt2020_output.mkv
> > > > 
> > > > will have the output file marked as BT.709 after this patch, where
> > > > previously
> > > > it was "unspecified".  (Explicitly setting -color_primaries/-color_trc/-
> > > > colorspace on the output works in both cases.)
> > > 
> > > I agree with you it's not worse than before as we don't get the expected
> > > result
> > > in both cases.
> > 
> > Not quite: When a file says "I don't know this property value" you have a
> > chance to lookup the value somewhere else or use a default. When it says "I
> > know the value" and gives a wrong value, you completely loose trust.
> 
> Right, that is a compelling argument.  I agree with you, so I definitely won't
> apply the patch in this form.
> 

According the comment in avcodec.h, the color properties in AVCodecContext
should be set by user for encoding. I think ffmpeg is the user in the case
below. Where are the color properties set if we don't set the default values in
init_output_stream_encode()?

ffmpeg -hwaccel vaapi -hwaccel_device /dev/dri/renderD128 -hwaccel_output_format
vaapi -i input-with-hdr.mkv -c:v hevc_vaapi -profile:v main10 output.h265


> > So in my opinion this patch should not be applied, as it possibly makes
> > ffmpeg generate files with wrong information where it just had no
> > information before. The correct approach would be to set the encoder
> > properties from output frame data and only write a header once the encoders
> > have been initialized completely.
> 
> Passing the information through libavfilter should be equivalent, but yeah.
> 

In hevc_vaapi encoder, the color properties in AVCodecContext are used to
initialize sequence parameters and extradata is written when AVCodec.init() is
called, where AVFrame is unavailable. 

Actually I have another patch to use the properties in AVFrame to update
sequence parameters however it will result in mismatch in sps because extradata
is written in the initialization path. 

Both AVCodecContext and AVFrame have color properties, which one should be used
for encoding?

BTW I debugged ffmpeg with args set to '-i bt709_input.mkv -vf colorspace=bt2020
bt2020_output.mkv' and found the color properties have been set correctly for
input and output AVFrames when create_filtergraph() is called w/wo this patch:

(gdb) p out->color_primaries
$16 = AVCOL_PRI_BT2020
(gdb) p in->color_primaries 
$17 = AVCOL_PRI_BT709

I guess color properties in AVCodecContext are used when writing .mkv, 

Thanks
Haihao
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] configure: fix libdavs2 description

2018-05-28 Thread Carl Eugen Hoyos
2018-05-28 8:51 GMT+02:00, hwren :
> Signed-off-by: hwren 
> ---
>  configure | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/configure b/configure
> index 811f57c..e2ac9f6 100755
> --- a/configure
> +++ b/configure
> @@ -226,7 +226,7 @@ External library support:
>--enable-libcelt enable CELT decoding via libcelt [no]
>--enable-libcdio enable audio CD grabbing with libcdio [no]
>--enable-libcodec2   enable codec2 en/decoding using libcodec2 [no]
> -  --enable-libdavs2enable AVS2 decoding via davs2 [no]
> +  --enable-libdavs2enable AVS2 decoding via libdavs2 [no]

Your last patch was not yet committed, so please provide patches
against current FFmpeg, not against your last changes.

Thank you, Carl Eugen
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH] configure: fix libdavs2 description

2018-05-28 Thread hwren
Signed-off-by: hwren 
---
 configure | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/configure b/configure
index 811f57c..e2ac9f6 100755
--- a/configure
+++ b/configure
@@ -226,7 +226,7 @@ External library support:
   --enable-libcelt enable CELT decoding via libcelt [no]
   --enable-libcdio enable audio CD grabbing with libcdio [no]
   --enable-libcodec2   enable codec2 en/decoding using libcodec2 [no]
-  --enable-libdavs2enable AVS2 decoding via davs2 [no]
+  --enable-libdavs2enable AVS2 decoding via libdavs2 [no]
   --enable-libdc1394   enable IIDC-1394 grabbing using libdc1394
and libraw1394 [no]
   --enable-libfdk-aac  enable AAC de/encoding via libfdk-aac [no]
-- 
2.7.4

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [GSOC] [PATCH] DNN module introduction and SRCNN filter update

2018-05-28 Thread Guo, Yejun
looks that no tensorflow dependency is introduced, a new model format is 
created together with some CPU implementation for inference.   With this idea, 
Android Neural Network would be a very good reference, see 
https://developer.android.google.cn/ndk/guides/neuralnetworks/. It defines how 
the model is organized, and also provided a CPU optimized inference 
implementation (within the NNAPI runtime, it is open source). It is still under 
development but mature enough to run some popular dnn models with proper 
performance. We can absorb some basic design. Anyway, just a reference fyi.  
(btw, I'm not sure about any IP issue)

For this patch, I have two comments.

1. change from "DNNModel* (*load_default_model)(DNNDefaultModel model_type);" 
to " DNNModel* (*load_builtin_model)(DNNBuiltinModel model_type);"
The DNNModule can be invoked by many filters,  default model is a good name at 
the filter level, while built-in model is better within the DNN scope.

typedef struct DNNModule{
// Loads model and parameters from given file. Returns NULL if it is not 
possible.
DNNModel* (*load_model)(const char* model_filename);
// Loads one of the default models
DNNModel* (*load_default_model)(DNNDefaultModel model_type);
// Executes model with specified input and output. Returns DNN_ERROR 
otherwise.
DNNReturnType (*execute_model)(const DNNModel* model);
// Frees memory allocated for model.
void (*free_model)(DNNModel** model);
} DNNModule;


2. add a new variable 'number' for DNNData/InputParams
As a typical DNN concept, the data shape usually is:  or , the last component denotes its 
index changes the fastest in the memory. We can add this concept into the API, 
and decide to support  or  or both.


Thanks
Yejun (郭叶军)

-Original Message-
From: ffmpeg-devel [mailto:ffmpeg-devel-boun...@ffmpeg.org] On Behalf Of Sergey 
Lavrushkin
Sent: Saturday, May 26, 2018 2:02 AM
To: FFmpeg development discussions and patches 
Subject: Re: [FFmpeg-devel] [GSOC] [PATCH] DNN module introduction and SRCNN 
filter update

>
> You should use the ff_ prefix for internal, non-static functions only.
> You don't need to use any prefix for internal structs.
> The AV* prefix is only for public structs, and the av_ prefix is for 
> public functions.
>
> >
> >
> > And you need to indent and prettify the tables a bit.
> >
> >
> > Do you mean kernels and biases in dnn_srcnn.h?
> > Their formatting represents their 4D structure a little bit and it 
> > is similar to one that I used for the first srcnn filter version 
> > that was successfully pushed before.
>
> Yes, and i suppose they were pushed like that without the reviewer 
> noticing they had no indentation or vertical alignment.
>

Here is the patch with DNN module moved to libavfilter and proper formatting of 
tables in dnn_srcnn.h.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH v2 2/2] avformat/dashenc: Added a warning for incorrect segment name extension

2018-05-28 Thread Jeyapal, Karthick
Pushed Patchset.

On 5/4/18 12:02 PM, Karthick J wrote:
> From: Karthick Jeyapal 
>
> Applicable only to webm output format.
> By default all the segment filenames end with .m4s extension.
> When someone chooses webm output format, we recommend they also override the 
> relevant segment name options to end with .webm extension. This patch will 
> issue a warning for he same.
> ---
>  libavformat/dashenc.c | 18 ++
>  1 file changed, 18 insertions(+)
>
> diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c
> index 412f074..bd374e2 100644
> --- a/libavformat/dashenc.c
> +++ b/libavformat/dashenc.c
> @@ -177,6 +177,16 @@ static void dashenc_io_close(AVFormatContext *s, 
> AVIOContext **pb, char *filenam
>  }
>  }
>  
> +static int check_file_extension(const char *filename, const char *extension) 
> {
> +char *dot;
> +if (!filename || !extension)
> +return -1;
> +dot = strrchr(filename, '.');
> +if (dot && !strcmp(dot + 1, extension))
> +return 0;
> +return -1;
> +}
> +
>  static void set_vp9_codec_str(AVFormatContext *s, AVCodecParameters *par,
>AVRational *frame_rate, char *str, int size) {
>  VPCC vpcc;
> @@ -967,6 +977,14 @@ static int dash_init(AVFormatContext *s)
>  
>  if (c->segment_type == SEGMENT_TYPE_WEBM) {
>  snprintf(c->format_name, sizeof(c->format_name), "webm");
> +if ((!c->single_file && check_file_extension(c->init_seg_name, 
> c->format_name) != 0) ||
> +(!c->single_file && check_file_extension(c->media_seg_name, 
> c->format_name) != 0) ||
> +(c->single_file && check_file_extension(c->single_file_name, 
> c->format_name) != 0)) {
> +av_log(s, AV_LOG_WARNING,
> +   "One or many segment file names doesn't end with 
> .webm. "
> +   "Override -init_seg_name and/or -media_seg_name 
> and/or "
> +   "-single_file_name to end with the extension 
> .webm\n");
> +}
>  } else if (c->segment_type == SEGMENT_TYPE_MP4) {
>  snprintf(c->format_name, sizeof(c->format_name), "mp4");
>  } else {


___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel