Re: [FFmpeg-devel] [PATCH 2/3] configure: Do not create/install versioned DLLs on OS/2.

2016-04-15 Thread KO Myung-Hun
Hi/2.

Dave Yeo wrote:
> On 04/14/16 07:29 PM, Dave Yeo wrote:
>>> From fbff28a583cc9fd7144dd4f9dc37b7b5f8aa Mon Sep 17 00:00:00 2001
>> From: Dmitriy Kuminov 
>> Date: Thu, 14 Apr 2016 01:45:01 +0400
>> Subject: [PATCH 2/3] configure: Do not create/install versioned DLLs on
>> OS/2.
> 
> Attached
> Dave> From fbff28a583cc9fd7144dd4f9dc37b7b5f8aa Mon Sep 17 00:00:00 2001
> From: Dmitriy Kuminov 
> Date: Thu, 14 Apr 2016 01:45:01 +0400
> Subject: [PATCH 2/3] configure: Do not create/install versioned DLLs on OS/2.
> 
> Only one DLL for each module must be present on OS/2: SLIBNAME_WITH_MAJOR
> (the same as on Windows). Creating other DLLs makes no sense as they can't
> be used.
> 
> Signed-off-by: Dave Yeo 
> ---
>  configure | 23 ---
>  1 file changed, 12 insertions(+), 11 deletions(-)
> 
> diff --git a/configure b/configure
> index ff80aee..36a23f4 100755
> --- a/configure
> +++ b/configure
> @@ -4716,7 +4716,6 @@ case $target_os in
>  ;;
>  os/2*)
>  strip="lxlite -CS"
> -ln_s="cp -f"

Please do not remove this. Copying is more compatible than a symbolic
link on OS/2.

>  objformat="aout"
>  add_cppflags -D_GNU_SOURCE
>  add_ldflags -Zomf -Zbin-files -Zargs-wild -Zmap
> @@ -4724,16 +4723,18 @@ case $target_os in
>  LIBSUF="_s.a"
>  SLIBPREF=""
>  SLIBSUF=".dll"
> -SLIBNAME_WITH_VERSION='$(SLIBPREF)$(NAME)-$(LIBVERSION)$(SLIBSUF)'
> -SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(shell echo $(NAME) | cut 
> -c1-6)$(LIBMAJOR)$(SLIBSUF)'
> -SLIB_CREATE_DEF_CMD='echo LIBRARY $(SLIBNAME_WITH_MAJOR) 
> INITINSTANCE TERMINSTANCE > $(SUBDIR)$(NAME).def; \
> -echo CODE PRELOAD MOVEABLE DISCARDABLE >> $(SUBDIR)$(NAME).def; \
> -echo DATA PRELOAD MOVEABLE MULTIPLE NONSHARED >> 
> $(SUBDIR)$(NAME).def; \
> -echo EXPORTS >> $(SUBDIR)$(NAME).def; \
> -emxexp $(OBJS) >> $(SUBDIR)$(NAME).def'
> -SLIB_EXTRA_CMD='emximp -o $(SUBDIR)$(LIBPREF)$(NAME)_dll.a 
> $(SUBDIR)$(NAME).def; \
> -emximp -o $(SUBDIR)$(LIBPREF)$(NAME)_dll.lib 
> $(SUBDIR)$(NAME).def;'
> -SLIB_INSTALL_EXTRA_LIB='$(LIBPREF)$(NAME)_dll.a 
> $(LIBPREF)$(NAME)_dll.lib'
> +
> SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBVERSION)$(SLIBSUF)'
> +SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(shell echo $(FULLNAME) | cut 
> -c1-6)$(LIBMAJOR)$(SLIBSUF)'
> +SLIB_CREATE_DEF_CMD='echo LIBRARY $(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=) 
> INITINSTANCE TERMINSTANCE > $(SUBDIR)$(FULLNAME).def; \
> +echo CODE PRELOAD MOVEABLE DISCARDABLE >> 
> $(SUBDIR)$(FULLNAME).def; \
> +echo DATA PRELOAD MOVEABLE MULTIPLE NONSHARED >> 
> $(SUBDIR)$(FULLNAME).def; \
> +echo EXPORTS >> $(SUBDIR)$(FULLNAME).def; \
> +emxexp $(OBJS) >> $(SUBDIR)$(FULLNAME).def'
> +SLIB_EXTRA_CMD='emximp -o $(SUBDIR)$(LIBPREF)$(FULLNAME)_dll.a 
> $(SUBDIR)$(FULLNAME).def; \
> +emximp -o $(SUBDIR)$(LIBPREF)$(FULLNAME)_dll.lib 
> $(SUBDIR)$(FULLNAME).def;'
> +SLIB_INSTALL_NAME='$(SLIBNAME_WITH_MAJOR)'
> +SLIB_INSTALL_LINKS=
> +SLIB_INSTALL_EXTRA_LIB='$(LIBPREF)$(FULLNAME)_dll.a 
> $(LIBPREF)$(FULLNAME)_dll.lib'
>  enable dos_paths
>  enable_weak os2threads
>  ;;
> -- 
> 2.0.0
> 

> 
> 



-- 
KO Myung-Hun

Using Mozilla SeaMonkey 2.7.2
Under OS/2 Warp 4 for Korean with FixPak #15
In VirtualBox v4.1.32 on Intel Core i7-3615QM 2.30GHz with 8GB RAM

Korean OS/2 User Community : http://www.ecomstation.co.kr

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


Re: [FFmpeg-devel] [PATCH 1/3] configure: Support backslashes in TMPDIR on OS/2.

2016-04-15 Thread KO Myung-Hun
Hi/2.

Dave Yeo wrote:
> From b322802ecc6d87fae3afb17fbca8217993d8d0c7 Mon Sep 17 00:00:00 2001
> From: Dmitriy Kuminov 
> Date: Thu, 14 Apr 2016 01:41:30 +0400
> Subject: [PATCH 1/3] configure: Support backslashes in TMPDIR on OS/2.
> 
> Signed-off-by: Dave Yeo 
> ---
>  configure | 13 +
>  1 file changed, 9 insertions(+), 4 deletions(-)
> 
> diff --git a/configure b/configure
> index 0ff1b9d..ff80aee 100755
> --- a/configure
> +++ b/configure
> @@ -734,7 +734,12 @@ check_deps(){
>  
>  print_config(){
>  pfx=$1
> -files=$2
> +if test "$host_os" = "os/2"; then
> +# awk treats \ as escape chars, convert them to / in paths
> +files=`echo "$2" | tr '\\\' /`

echoing back-slashes with echo is not portable. For example, on
ksh-compatible shells such as pdksh and mksh, back-slashes are escaped
by echo. Please use expr.

> +else
> +files=$2
> +fi
>  shift 2
>  map 'eval echo "$v \${$v:-no}"' "$@" |
>  awk "BEGIN { split(\"$files\", files) }
> @@ -3550,10 +3555,10 @@ fi
>  
>  tmpfile(){
>  tmp=$(mktemp -u "${TMPDIR}/ffconf.")$2 &&
> -(set -C; exec > $tmp) 2>/dev/null ||
> +(set -C; exec > "$tmp") 2>/dev/null ||
>  die "Unable to create temporary file in $TMPDIR."
> -append TMPFILES $tmp
> -eval $1=$tmp
> +append TMPFILES "$tmp"
> +eval $1=\"$tmp\"
>  }
>  
>  trap 'rm -f -- $TMPFILES' EXIT

-- 
KO Myung-Hun

Using Mozilla SeaMonkey 2.7.2
Under OS/2 Warp 4 for Korean with FixPak #15
In VirtualBox v4.1.32 on Intel Core i7-3615QM 2.30GHz with 8GB RAM

Korean OS/2 User Community : http://www.ecomstation.co.kr

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


Re: [FFmpeg-devel] [PATCHv2] add signature filter for MPEG7 video signature

2016-04-15 Thread Michael Niedermayer
On Sat, Apr 16, 2016 at 12:07:27AM +0200, Gerion Entrup wrote:
> On Donnerstag, 14. April 2016 19:52:46 CEST Michael Niedermayer wrote:
> > On Thu, Apr 14, 2016 at 07:06:29PM +0200, Gerion Entrup wrote:
> > > On Montag, 11. April 2016 14:54:57 CEST Michael Niedermayer wrote:
> > > > On Mon, Apr 11, 2016 at 02:30:37PM +0200, Gerion Entrup wrote:
> > > > > On Montag, 11. April 2016 12:57:17 CEST Michael Niedermayer wrote:
> > > > > > On Mon, Apr 11, 2016 at 04:25:28AM +0200, Gerion Entrup wrote:
> > > > > > > On Donnerstag, 7. April 2016 00:35:25 CEST Michael Niedermayer 
> > > > > > > wrote:
> > > > > > > > On Wed, Mar 30, 2016 at 11:02:36PM +0200, Gerion Entrup wrote:
> > > > > > > > > On Mittwoch, 30. März 2016 22:57:47 CEST Gerion Entrup wrote:
> > > > > > > > > > Add improved patch.
> > > > > > > > > 
> > > > > > > > > Rebased to master.
> > > > > > > > > 
> > > > > > > > >  Changelog  |1
> > > > > > > > >  configure  |1
> > > > > > > > >  doc/filters.texi   |   70 +++
> > > > > > > > >  libavfilter/Makefile   |1
> > > > > > > > >  libavfilter/allfilters.c   |1
> > > > > > > > >  libavfilter/signature.h|  554
> > > > > > > > >  ++
> > > > > > > > >  libavfilter/signature_lookup.c |  550
> > > > > > > > >  ++
> > > > > > > > >  libavfilter/version.h  |4
> > > > > > > > >  libavfilter/vf_signature.c |  741
> > > > > > > > >  + 9 files changed, 
> > > > > > > > > 1921
> > > > > > > > >  insertions(+), 2 deletions(-)
> > > > > > > > > 
> > > > > > > > > 9192f27ded45c607996b4e266b6746f807c9a7fd 
> > > > > > > > > 0001-add-signature-filter-for-MPEG7-video-signature.patch From
> > > > > > > > > 9646ed6f0cf78356cf2914a60705c98d8f21fe8a Mon Sep 17 00:00:00 
> > > > > > > > > 2001
> > > > > > > > > From: Gerion Entrup 
> > > > > > > > > Date: Sun, 20 Mar 2016 11:10:31 +0100
> > > > > > > > > Subject: [PATCH] add signature filter for MPEG7 video 
> > > > > > > > > signature
> > > > > > > > > 
> > > > > > > > > This filter does not implement all features of MPEG7. Missing
> > > > > > > > > features:
> > > > > > > > > - compression of signature files
> > > > > > > > > - work only on (cropped) parts of the video
> > > > > > > > > ---
> > > > > > > > > 
> > > > > > > > >  Changelog  |   1 +
> > > > > > > > >  configure  |   1 +
> > > > > > > > >  doc/filters.texi   |  70 
> > > > > > > > >  libavfilter/Makefile   |   1 +
> > > > > > > > >  libavfilter/allfilters.c   |   1 +
> > > > > > > > >  libavfilter/signature.h| 554
> > > > > > > > >  ++
> > > > > > > > >  libavfilter/signature_lookup.c | 550
> > > > > > > > >  ++
> > > > > > > > >  libavfilter/version.h  |   4 +-
> > > > > > > > >  libavfilter/vf_signature.c | 741
> > > > > > > > >  + 9 files changed, 
> > > > > > > > > 1921
> > > > > > > > >  insertions(+), 2 deletions(-)
> > > > > > > > >  create mode 100644 libavfilter/signature.h
> > > > > > > > >  create mode 100644 libavfilter/signature_lookup.c
> > > > > > > > >  create mode 100644 libavfilter/vf_signature.c
> > > > > > > > > 
> > > > > > > > > diff --git a/Changelog b/Changelog
> > > > > > > > > index 7b0187d..8a2b7fd 100644
> > > > > > > > > --- a/Changelog
> > > > > > > > > +++ b/Changelog
> > > > > > > > > 
> > > > > > > > > @@ -18,6 +18,7 @@ version :
> > > > > > > > >  - coreimage filter (GPU based image filtering on OSX)
> > > > > > > > >  - libdcadec removed
> > > > > > > > >  - bitstream filter for extracting DTS core
> > > > > > > > > 
> > > > > > > > > +- MPEG-7 Video Signature filter
> > > > > > > > > 
> > > > > > > > >  version 3.0:
> > > > > > > > >  - Common Encryption (CENC) MP4 encoding and decoding support
> > > > > > > > > 
> > > > > > > > > diff --git a/configure b/configure
> > > > > > > > > index e550547..fe29827 100755
> > > > > > > > > --- a/configure
> > > > > > > > > +++ b/configure
> > > > > > > > > @@ -2979,6 +2979,7 @@ showspectrum_filter_deps="avcodec"
> > > > > > > > > 
> > > > > > > > >  showspectrum_filter_select="fft"
> > > > > > > > >  showspectrumpic_filter_deps="avcodec"
> > > > > > > > >  showspectrumpic_filter_select="fft"
> > > > > > > > > 
> > > > > > > > > +signature_filter_deps="gpl avcodec avformat"
> > > > > > > > > 
> > > > > > > > >  smartblur_filter_deps="gpl swscale"
> > > > > > > > >  sofalizer_filter_deps="netcdf avcodec"
> > > > > > > > >  sofalizer_filter_select="fft"
> > > > > > > > > 
> > > > > > > > > diff --git a/doc/filters.texi b/doc/filters.texi
> > > > > > > > > index 5d6cf52..a95f5a7 100644
> > > > > > > > > --- a/doc/filters.texi
> > > > > > > > > +++ b/doc/filters.texi
> > > > > > > > > @@ -11559,6 +11559,76 @@ saturation maximum:
> > > > > 

Re: [FFmpeg-devel] [PATCH] vf_scale: support bt2020 in in/out_color_matrix properties.

2016-04-15 Thread Ronald S. Bultje
Hi,

On Fri, Apr 15, 2016 at 2:39 PM, wm4  wrote:

> On Fri, 15 Apr 2016 14:26:47 -0400
> "Ronald S. Bultje"  wrote:
>
> > ---
> >  libavfilter/vf_scale.c | 4 +++-
> >  1 file changed, 3 insertions(+), 1 deletion(-)
> >
> > diff --git a/libavfilter/vf_scale.c b/libavfilter/vf_scale.c
> > index ac9d4c3..22bee96 100644
> > --- a/libavfilter/vf_scale.c
> > +++ b/libavfilter/vf_scale.c
> > @@ -237,9 +237,11 @@ static const int *parse_yuv_type(const char *s,
> enum AVColorSpace colorspace)
> >  colorspace = AVCOL_SPC_SMPTE240M;
> >  } else if (s && (strstr(s, "bt601") || strstr(s, "bt470") ||
> strstr(s, "smpte170m"))) {
> >  colorspace = AVCOL_SPC_BT470BG;
> > +} else if (s && strstr(s, "bt2020")) {
> > +colorspace = AVCOL_SPC_BT2020_NCL;
> >  }
> >
> > -if (colorspace < 1 || colorspace > 7) {
> > +if (colorspace < 1 || colorspace > 10 || colorspace == 8) {
> >  colorspace = AVCOL_SPC_BT470BG;
> >  }
> >
>
> What's with those magic numbers? Why is it using strstr for string
> parsing?


Dunno, just following the style that existed. I'm assuming the string
parsing precedes AVOptions enums? I can port that too, sure.

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


Re: [FFmpeg-devel] [PATCH]lavc/webp: Warn if anim chunk is not read

2016-04-15 Thread Michael Niedermayer
On Tue, Apr 12, 2016 at 10:16:13PM +0200, Carl Eugen Hoyos wrote:
> Hi!
> 
> Afaict, FFmpeg is not very good at reading webp files.
> Attached patch makes it more obvious to the user why.
> 
> Please comment, Carl Eugen

>  webp.c |2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 6a8ad3a804cb624b509c6bff37b2dc1359dc43c7  patchwebpwarn.diff

probably ok

thx

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Dictatorship naturally arises out of democracy, and the most aggravated
form of tyranny and slavery out of the most extreme liberty. -- Plato


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


Re: [FFmpeg-devel] [PATCH] vf_scale: support bt2020 in in/out_color_matrix properties.

2016-04-15 Thread Michael Niedermayer
On Fri, Apr 15, 2016 at 02:26:47PM -0400, Ronald S. Bultje wrote:
> ---
>  libavfilter/vf_scale.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)

LGTM (if noone else objects)

thx

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

No great genius has ever existed without some touch of madness. -- Aristotle


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


[FFmpeg-devel] [PATCH 2/3 v2] doc/examples: Enchance argument parsing in fffuzz

2016-04-15 Thread Pawel Golinski
Now any combination of arguments is allowed.
---
 doc/examples/fffuzz.c | 64 ---
 1 file changed, 51 insertions(+), 13 deletions(-)

diff --git a/doc/examples/fffuzz.c b/doc/examples/fffuzz.c
index 6672f42..fdf97e7 100644
--- a/doc/examples/fffuzz.c
+++ b/doc/examples/fffuzz.c
@@ -29,6 +29,8 @@
  * @example ddcf.c
  */
 
+#include 
+
 #include 
 #include 
 #include 
@@ -207,27 +209,63 @@ static int open_codec_context(AVCodecContext **dec_ctx, 
AVFormatContext *fmt_ctx
 return ret;
 }
 
+static void exit_with_usage_msg(char* prog_name)
+{
+fprintf(stderr, "\n"
+"usage: %s [options] -i input_file -o output_file\n\n"
+"API example program to show how to read frames from an input 
file.\n"
+"This program reads frames from a file, decodes them, and 
writes decoded\n"
+"frames to a rawvideo/rawaudio file named output_file.\n"
+"Optionally format and codec can be specified.\n\n"
+"Options:\n"
+"-i input_file, -input input_file\n"
+"\tSets input_file as input\n"
+"-o output_file, -output output_file\n"
+"\tSets output_file as output\n"
+"-f format_name, -format format_name\n"
+"\tSets the decode format to format_name\n"
+"-c codec_name, -codec codec_name\n"
+"\tSets the decode codec to codec_name\n\n", prog_name);
+exit(1);
+}
+
 int main (int argc, char **argv)
 {
-int ret = 0;
+int ret = 0, opt;
 const char *src_filename = NULL;
 const char *dst_filename = NULL;
 char* format = NULL;
 char* codec  = NULL;
 
-if (argc != 5 && argc != 3) {
-fprintf(stderr, "usage: %s input_file output_file [format codec]\n"
-"API example program to show how to read frames from an input 
file.\n"
-"This program reads frames from a file, decodes them, and 
writes decoded\n"
-"frames to a rawvideo/rawaudio file named output_file.\n"
-"Optionally format and codec can be specified.\n\n", argv[0]);
-exit(1);
+static struct option long_options[] =
+{
+{"input",  required_argument, NULL, 'i'},
+{"output", required_argument, NULL, 'o'},
+{"format", required_argument, NULL, 'f'},
+{"codec",  required_argument, NULL, 'c'},
+{0, 0, 0, 0}
+};
+
+while ((opt = getopt_long_only(argc, argv, "", long_options, NULL)) != -1) 
{
+switch (opt) {
+case 'i':
+src_filename = optarg;
+break;
+case 'o':
+dst_filename = optarg;
+break;
+case 'f':
+format = optarg;
+break;
+case 'c':
+codec = optarg;
+break;
+}
 }
-src_filename = argv[1];
-dst_filename = argv[2];
-if (argc == 5) {
-format = argv[3];
-codec  = argv[4];
+
+if (src_filename == NULL || dst_filename == NULL) {
+fprintf(stderr, "%s: No input_file and/or output_file passed\n", 
argv[0]);
+exit_with_usage_msg(argv[0]);
 }
 
 /* log all debug messages */
-- 
2.6.4 (Apple Git-63)

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


[FFmpeg-devel] [PATCH 3/3 v2] doc/examples: Add "thread_type" and "threads" flags to fffuzz

2016-04-15 Thread Pawel Golinski
---
 doc/examples/fffuzz.c | 38 --
 1 file changed, 32 insertions(+), 6 deletions(-)

diff --git a/doc/examples/fffuzz.c b/doc/examples/fffuzz.c
index fdf97e7..50bccee 100644
--- a/doc/examples/fffuzz.c
+++ b/doc/examples/fffuzz.c
@@ -225,7 +225,11 @@ static void exit_with_usage_msg(char* prog_name)
 "-f format_name, -format format_name\n"
 "\tSets the decode format to format_name\n"
 "-c codec_name, -codec codec_name\n"
-"\tSets the decode codec to codec_name\n\n", prog_name);
+"\tSets the decode codec to codec_name\n"
+"-t slice|frame, -thread_type slice|frame\n"
+"\tSets threading mode (slice or frame threads)\n"
+"-n thread_num, -threads thread_num\n"
+"\tSets thread number to thread_num\n\n", prog_name);
 exit(1);
 }
 
@@ -236,17 +240,21 @@ int main (int argc, char **argv)
 const char *dst_filename = NULL;
 char* format = NULL;
 char* codec  = NULL;
+char* thread_type= NULL;
+char* threads= NULL;
 
 static struct option long_options[] =
 {
-{"input",  required_argument, NULL, 'i'},
-{"output", required_argument, NULL, 'o'},
-{"format", required_argument, NULL, 'f'},
-{"codec",  required_argument, NULL, 'c'},
+{"input",required_argument, NULL, 'i'},
+{"output",   required_argument, NULL, 'o'},
+{"format",   required_argument, NULL, 'f'},
+{"codec",required_argument, NULL, 'c'},
+{"thread_type",  required_argument, NULL, 't'},
+{"threads",  required_argument, NULL, 'n'},
 {0, 0, 0, 0}
 };
 
-while ((opt = getopt_long_only(argc, argv, "", long_options, NULL)) != -1) 
{
+while ((opt = getopt_long_only(argc, argv, "i:o:f:c:t:n:", long_options, 
NULL)) != -1) {
 switch (opt) {
 case 'i':
 src_filename = optarg;
@@ -260,6 +268,12 @@ int main (int argc, char **argv)
 case 'c':
 codec = optarg;
 break;
+case 't':
+thread_type = optarg;
+break;
+case 'n':
+threads = optarg;
+break;
 }
 }
 
@@ -306,6 +320,18 @@ int main (int argc, char **argv)
 ret = 1;
 goto end;
 }
+/* set threading mode */
+if (av_dict_set(, "thread_type", thread_type, 0) < 0) {
+fprintf(stderr, "Could not set thread_type.\n");
+ret = 1;
+goto end;
+}
+/* set number of threads */
+if (av_dict_set(, "threads", threads, 0) < 0) {
+fprintf(stderr, "Could not set threads.\n");
+ret = 1;
+goto end;
+}
 
 if (format) {
 fmt = av_find_input_format(format);
-- 
2.6.4 (Apple Git-63)

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


[FFmpeg-devel] [PATCH 1/3 v2] doc/examples: Add fffuzz example

2016-04-15 Thread Pawel Golinski
There are some afl specific macros inside,
to make the example usable with afl fuzzer.
---
 doc/examples/fffuzz.c | 370 ++
 1 file changed, 370 insertions(+)
 create mode 100644 doc/examples/fffuzz.c

diff --git a/doc/examples/fffuzz.c b/doc/examples/fffuzz.c
new file mode 100644
index 000..6672f42
--- /dev/null
+++ b/doc/examples/fffuzz.c
@@ -0,0 +1,370 @@
+/*
+ * Copyright (c) 2012 Stefano Sabatini
+ * Copyright (c) 2015 Andreas Cadhalpun
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to 
deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 
FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+
+/**
+ * @file
+ * Demuxing and decoding (a codec/format combination) example.
+ *
+ * This can be useful for fuzz testing.
+ * @example ddcf.c
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+/* needed for decoding video */
+static int width, height;
+static enum AVPixelFormat pix_fmt;
+static uint8_t *video_dst_data[4] = {NULL};
+static int  video_dst_linesize[4];
+static int video_dst_bufsize;
+
+static int decode_packet(AVCodecContext *dec_ctx, FILE *dst_file, AVFrame 
*frame, int *got_frame, int *frame_count, AVPacket *pkt)
+{
+int ret = -1;
+*got_frame = 0;
+AVSubtitle sub;
+unsigned i, j, k, l;
+
+if (dec_ctx->codec_type == AVMEDIA_TYPE_VIDEO) {
+/* decode video frame */
+ret = avcodec_decode_video2(dec_ctx, frame, got_frame, pkt);
+if (ret < 0) {
+fprintf(stderr, "Error decoding video frame (%s)\n", 
av_err2str(ret));
+return ret;
+}
+
+if (*got_frame) {
+
+if (frame->width != width || frame->height != height ||
+frame->format != pix_fmt) {
+fprintf(stderr, "Error: input video width/height/format 
changed:\n"
+"old: width = %d, height = %d, format = %s\n"
+"new: width = %d, height = %d, format = %s\n",
+width, height, av_get_pix_fmt_name(pix_fmt),
+dec_ctx->width, dec_ctx->height,
+av_get_pix_fmt_name(dec_ctx->pix_fmt));
+return -1;
+}
+
+printf("video_frame n:%d coded_n:%d pts:%s\n",
+   *frame_count, frame->coded_picture_number,
+   av_ts2timestr(frame->pts, _ctx->time_base));
+
+/* copy decoded frame to destination buffer:
+ * this is required since rawvideo expects non aligned data */
+av_image_copy(video_dst_data, video_dst_linesize,
+  (const uint8_t **)(frame->data), frame->linesize,
+  pix_fmt, width, height);
+*frame_count += 1;
+
+/* write to rawvideo file */
+fwrite(video_dst_data[0], 1, video_dst_bufsize, dst_file);
+}
+} else if (dec_ctx->codec_type == AVMEDIA_TYPE_AUDIO) {
+/* decode audio frame */
+ret = avcodec_decode_audio4(dec_ctx, frame, got_frame, pkt);
+if (ret < 0) {
+fprintf(stderr, "Error decoding audio frame (%s)\n", 
av_err2str(ret));
+return ret;
+}
+/* Some audio decoders decode only part of the packet, and have to be
+ * called again with the remainder of the packet data.
+ * Sample: fate-suite/lossless-audio/luckynight-partial.shn
+ * Also, some decoders might over-read the packet. */
+ret = FFMIN(ret, pkt->size);
+
+if (*got_frame) {
+size_t unpadded_linesize = frame->nb_samples * 
av_get_bytes_per_sample(frame->format);
+printf("audio_frame n:%d nb_samples:%d pts:%s\n",
+   *frame_count, frame->nb_samples,
+   av_ts2timestr(frame->pts, _ctx->time_base));
+*frame_count += 1;
+
+/* Write the raw audio data samples of the first plane. This works
+ * fine for packed formats (e.g. AV_SAMPLE_FMT_S16). However,
+ * most audio decoders 

Re: [FFmpeg-devel] [PATCHv2] add signature filter for MPEG7 video signature

2016-04-15 Thread Gerion Entrup
On Donnerstag, 14. April 2016 19:52:46 CEST Michael Niedermayer wrote:
> On Thu, Apr 14, 2016 at 07:06:29PM +0200, Gerion Entrup wrote:
> > On Montag, 11. April 2016 14:54:57 CEST Michael Niedermayer wrote:
> > > On Mon, Apr 11, 2016 at 02:30:37PM +0200, Gerion Entrup wrote:
> > > > On Montag, 11. April 2016 12:57:17 CEST Michael Niedermayer wrote:
> > > > > On Mon, Apr 11, 2016 at 04:25:28AM +0200, Gerion Entrup wrote:
> > > > > > On Donnerstag, 7. April 2016 00:35:25 CEST Michael Niedermayer 
> > > > > > wrote:
> > > > > > > On Wed, Mar 30, 2016 at 11:02:36PM +0200, Gerion Entrup wrote:
> > > > > > > > On Mittwoch, 30. März 2016 22:57:47 CEST Gerion Entrup wrote:
> > > > > > > > > Add improved patch.
> > > > > > > > 
> > > > > > > > Rebased to master.
> > > > > > > > 
> > > > > > > >  Changelog  |1
> > > > > > > >  configure  |1
> > > > > > > >  doc/filters.texi   |   70 +++
> > > > > > > >  libavfilter/Makefile   |1
> > > > > > > >  libavfilter/allfilters.c   |1
> > > > > > > >  libavfilter/signature.h|  554
> > > > > > > >  ++
> > > > > > > >  libavfilter/signature_lookup.c |  550
> > > > > > > >  ++
> > > > > > > >  libavfilter/version.h  |4
> > > > > > > >  libavfilter/vf_signature.c |  741
> > > > > > > >  + 9 files changed, 1921
> > > > > > > >  insertions(+), 2 deletions(-)
> > > > > > > > 
> > > > > > > > 9192f27ded45c607996b4e266b6746f807c9a7fd 
> > > > > > > > 0001-add-signature-filter-for-MPEG7-video-signature.patch From
> > > > > > > > 9646ed6f0cf78356cf2914a60705c98d8f21fe8a Mon Sep 17 00:00:00 
> > > > > > > > 2001
> > > > > > > > From: Gerion Entrup 
> > > > > > > > Date: Sun, 20 Mar 2016 11:10:31 +0100
> > > > > > > > Subject: [PATCH] add signature filter for MPEG7 video signature
> > > > > > > > 
> > > > > > > > This filter does not implement all features of MPEG7. Missing
> > > > > > > > features:
> > > > > > > > - compression of signature files
> > > > > > > > - work only on (cropped) parts of the video
> > > > > > > > ---
> > > > > > > > 
> > > > > > > >  Changelog  |   1 +
> > > > > > > >  configure  |   1 +
> > > > > > > >  doc/filters.texi   |  70 
> > > > > > > >  libavfilter/Makefile   |   1 +
> > > > > > > >  libavfilter/allfilters.c   |   1 +
> > > > > > > >  libavfilter/signature.h| 554
> > > > > > > >  ++
> > > > > > > >  libavfilter/signature_lookup.c | 550
> > > > > > > >  ++
> > > > > > > >  libavfilter/version.h  |   4 +-
> > > > > > > >  libavfilter/vf_signature.c | 741
> > > > > > > >  + 9 files changed, 1921
> > > > > > > >  insertions(+), 2 deletions(-)
> > > > > > > >  create mode 100644 libavfilter/signature.h
> > > > > > > >  create mode 100644 libavfilter/signature_lookup.c
> > > > > > > >  create mode 100644 libavfilter/vf_signature.c
> > > > > > > > 
> > > > > > > > diff --git a/Changelog b/Changelog
> > > > > > > > index 7b0187d..8a2b7fd 100644
> > > > > > > > --- a/Changelog
> > > > > > > > +++ b/Changelog
> > > > > > > > 
> > > > > > > > @@ -18,6 +18,7 @@ version :
> > > > > > > >  - coreimage filter (GPU based image filtering on OSX)
> > > > > > > >  - libdcadec removed
> > > > > > > >  - bitstream filter for extracting DTS core
> > > > > > > > 
> > > > > > > > +- MPEG-7 Video Signature filter
> > > > > > > > 
> > > > > > > >  version 3.0:
> > > > > > > >  - Common Encryption (CENC) MP4 encoding and decoding support
> > > > > > > > 
> > > > > > > > diff --git a/configure b/configure
> > > > > > > > index e550547..fe29827 100755
> > > > > > > > --- a/configure
> > > > > > > > +++ b/configure
> > > > > > > > @@ -2979,6 +2979,7 @@ showspectrum_filter_deps="avcodec"
> > > > > > > > 
> > > > > > > >  showspectrum_filter_select="fft"
> > > > > > > >  showspectrumpic_filter_deps="avcodec"
> > > > > > > >  showspectrumpic_filter_select="fft"
> > > > > > > > 
> > > > > > > > +signature_filter_deps="gpl avcodec avformat"
> > > > > > > > 
> > > > > > > >  smartblur_filter_deps="gpl swscale"
> > > > > > > >  sofalizer_filter_deps="netcdf avcodec"
> > > > > > > >  sofalizer_filter_select="fft"
> > > > > > > > 
> > > > > > > > diff --git a/doc/filters.texi b/doc/filters.texi
> > > > > > > > index 5d6cf52..a95f5a7 100644
> > > > > > > > --- a/doc/filters.texi
> > > > > > > > +++ b/doc/filters.texi
> > > > > > > > @@ -11559,6 +11559,76 @@ saturation maximum:
> > > > > > > > %@{metadata:lavfi.signalstats.SATMAX@}> > > > > 
> > > > > > > >  @end example
> > > > > > > >  @end itemize
> > > > > > > > 
> > > > > > > > +@anchor{signature}
> > > > > > > > +@section signature
> > > > > > > > +
> > > > > > > > +Calculates the MPEG-7 Video Signature. The filter could handle
> > > > 

Re: [FFmpeg-devel] [PATCH]lavc/dds: Fix GRAY8A decoding

2016-04-15 Thread Carl Eugen Hoyos
Paul B Mahol  gmail.com> writes:

> >> do you have explanation why it should change?
> >
> > Because I believe it is wrong.

> Should be ok, but keep postproc step for case when 
> y and a are swapped.

Done and pushed, thanks for spotting this.

Thank you, Carl Eugen

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


Re: [FFmpeg-devel] [PATCH]lavf/bink: Support SMUSH files

2016-04-15 Thread Carl Eugen Hoyos
Carl Eugen Hoyos  ag.or.at> writes:

> > > Attached patch fixes ticket #5410 for me.
> >
> > New patch for Monkey Island 4 files attached.
> 
> Improved patch with less overhead attached.

Oked by Paul on irc and pushed.

Thank you, Carl Eugen

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


Re: [FFmpeg-devel] [PATCH] vf_scale: support bt2020 in in/out_color_matrix properties.

2016-04-15 Thread wm4
On Fri, 15 Apr 2016 14:26:47 -0400
"Ronald S. Bultje"  wrote:

> ---
>  libavfilter/vf_scale.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/libavfilter/vf_scale.c b/libavfilter/vf_scale.c
> index ac9d4c3..22bee96 100644
> --- a/libavfilter/vf_scale.c
> +++ b/libavfilter/vf_scale.c
> @@ -237,9 +237,11 @@ static const int *parse_yuv_type(const char *s, enum 
> AVColorSpace colorspace)
>  colorspace = AVCOL_SPC_SMPTE240M;
>  } else if (s && (strstr(s, "bt601") || strstr(s, "bt470") || strstr(s, 
> "smpte170m"))) {
>  colorspace = AVCOL_SPC_BT470BG;
> +} else if (s && strstr(s, "bt2020")) {
> +colorspace = AVCOL_SPC_BT2020_NCL;
>  }
>  
> -if (colorspace < 1 || colorspace > 7) {
> +if (colorspace < 1 || colorspace > 10 || colorspace == 8) {
>  colorspace = AVCOL_SPC_BT470BG;
>  }
>  

What's with those magic numbers? Why is it using strstr for string
parsing?
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH] vf_scale: support bt2020 in in/out_color_matrix properties.

2016-04-15 Thread Ronald S. Bultje
---
 libavfilter/vf_scale.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/libavfilter/vf_scale.c b/libavfilter/vf_scale.c
index ac9d4c3..22bee96 100644
--- a/libavfilter/vf_scale.c
+++ b/libavfilter/vf_scale.c
@@ -237,9 +237,11 @@ static const int *parse_yuv_type(const char *s, enum 
AVColorSpace colorspace)
 colorspace = AVCOL_SPC_SMPTE240M;
 } else if (s && (strstr(s, "bt601") || strstr(s, "bt470") || strstr(s, 
"smpte170m"))) {
 colorspace = AVCOL_SPC_BT470BG;
+} else if (s && strstr(s, "bt2020")) {
+colorspace = AVCOL_SPC_BT2020_NCL;
 }
 
-if (colorspace < 1 || colorspace > 7) {
+if (colorspace < 1 || colorspace > 10 || colorspace == 8) {
 colorspace = AVCOL_SPC_BT470BG;
 }
 
-- 
2.1.2

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


Re: [FFmpeg-devel] [PATCH] avcodec: Add bits_per_raw_sample to AVCodecParameters

2016-04-15 Thread Michael Niedermayer
On Fri, Apr 15, 2016 at 12:38:23PM +0200, wm4 wrote:
> On Fri, 15 Apr 2016 00:06:27 -0300
> James Almer  wrote:
> 
> > On 4/14/2016 7:30 PM, Michael Niedermayer wrote:
> > > On Tue, Apr 12, 2016 at 01:25:43PM +0200, wm4 wrote:  
> > >> On Tue, 12 Apr 2016 13:10:09 +0200
> > >> Michael Niedermayer  wrote:
> > >>  
> > >>> On Mon, Apr 11, 2016 at 01:32:07AM +0200, Michael Niedermayer wrote:  
> >  The bits_per_raw_sample represents the number of bits of precission 
> >  per sample.
> > 
> >  The field is added at the logical place, not at the end as the code 
> >  was just
> >  recently added
> > 
> >  This fixes the regression about loosing the audio sample precission 
> >  information
> > 
> >  The change in the fate test checksum un-does the change from the merge
> > 
> >  Signed-off-by: Michael Niedermayer 
> >  ---
> >   libavcodec/avcodec.h |   17 +
> >   libavcodec/utils.c   |2 ++
> >   tests/ref/lavf/ffm   |2 +-
> >   3 files changed, 20 insertions(+), 1 deletion(-)
> > >>>
> > >>> new version of this with improved documentation
> > >>> I intend to apply this soon if noone is against
> > >>>
> > >>>
> > >>> From e500dd31368b760144b1e2b5b094f73b571b Mon Sep 17 00:00:00 2001
> > >>> From: Michael Niedermayer 
> > >>> Date: Mon, 11 Apr 2016 00:52:21 +0200
> > >>> Subject: [PATCH] avcodec: Add bits_per_raw_sample to AVCodecParameters
> > >>>
> > >>> The bits_per_raw_sample represents the number of bits of precission per 
> > >>> sample.
> > >>>
> > >>> The field is added at the logical place, not at the end as the code was 
> > >>> just
> > >>> recently added
> > >>>
> > >>> This fixes the regression about loosing the audio sample precission 
> > >>> information
> > >>>
> > >>> The change in the fate test checksum un-does the change from the merge
> > >>>
> > >>> Signed-off-by: Michael Niedermayer 
> > >>> ---
> > >>>  libavcodec/avcodec.h |   21 +
> > >>>  libavcodec/utils.c   |2 ++
> > >>>  tests/ref/lavf/ffm   |2 +-
> > >>>  3 files changed, 24 insertions(+), 1 deletion(-)
> > >>>
> > >>> diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
> > >>> index b3655c5..99cbf88 100644
> > >>> --- a/libavcodec/avcodec.h
> > >>> +++ b/libavcodec/avcodec.h
> > >>> @@ -3832,9 +3832,30 @@ typedef struct AVCodecParameters {
> > >>>   */
> > >>>  int64_t bit_rate;
> > >>>
> > >>> +/**
> > >>> + * The number of bits per sample in the codedwords.
> > >>> + *
> > >>> + * This is basically the bitrate per sample, it is mandatory for a 
> > >>> bunch of
> > >>> + * formats to actually decode them, its the number of bits for one 
> > >>> sample in  
> > >>
> > >> "It's". Also, add more full stops instead of creating long sentences.
> > >>  
> > >>> + * the actual coded bitstream.
> > >>> + *
> > >>> + * This could be for example 4 for ADPCM
> > >>> + * For PCM formats this matches bits_per_raw_sample
> > >>> + * Can be 0
> > >>> + */
> > >>>  int bits_per_coded_sample;
> > >>>
> > >>>  /**
> > >>> + * The number of bits of precission in the samples.  
> > >>
> > >> Precision. Just get a spellchecker.
> > >>  
> > >>> + *
> > >>> + * These are the bits in a decoded (raw) sample.  
> > >>
> > >> Maybe: "This is the number of valid bits in each output sample. If the
> > >> sample format has more bits, the least significant bits are additional
> > >> padding bits, which are always 0. Use right shifts to reduce the sample
> > >> to its actual size. For example, audio formats with 24 bit samples will
> > >> have bits_per_raw_sample set to 24, and format set to AV_SAMPLEFMT_S32.
> > >> To get the original sample use "(uint32_t)sample >> 8"."
> > >>
> > >> Don't know if this is good. (Also is it even correct? I forgot whether
> > >> audio sample data uses negative values too.) Maybe this should be added
> > >> to AVCodecContext too. It's a common point of confusion.  
> > > 
> > > suggested changed made ad applied  
> > 
> > Should the change made to matroskaenc be reverted then? It was changed from
> > using bits_per_raw_sample to bits_per_coded_sample in the codecpar commit
> > because the former wasn't available back then.
> > 
> 
> Yep.

change made

i forgot about it totally

thx


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

Dictatorship: All citizens are under surveillance, all their steps and
actions recorded, for the politicians to enforce control.
Democracy: All politicians are under surveillance, all their steps and
actions recorded, for the citizens to enforce control.


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


Re: [FFmpeg-devel] [PATCH] fix avcodec_find_best_pix_fmt_of_list

2016-04-15 Thread Michael Niedermayer
On Fri, Apr 15, 2016 at 06:49:07PM +0200, Frédéric Devernay wrote:
>  (best format was wrong  and depended on list order, see 
> https://trac.ffmpeg.org/ticket/5223 )

no patch is attched to this mail if you intended to attach one

[...]
-- 
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: Digital signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH] fix avcodec_find_best_pix_fmt_of_list

2016-04-15 Thread Frédéric Devernay
 (best format was wrong  and depended on list order, see 
https://trac.ffmpeg.org/ticket/5223 )

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


Re: [FFmpeg-devel] [PATCH]lavc/webp: Warn if anim chunk is not read

2016-04-15 Thread Carl Eugen Hoyos
Carl Eugen Hoyos  ag.or.at> writes:

> Afaict, FFmpeg is not very good at reading webp files.
> Attached patch makes it more obvious to the user why.

Ping, any objections?

Carl Eugen

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


Re: [FFmpeg-devel] [PATCH v5 2/3] avformat/tee: Fix leaks in tee muxer when open_slave fails

2016-04-15 Thread Jan Sebechlebsky


On 04/15/2016 02:28 AM, Marton Balint wrote:


On Thu, 14 Apr 2016, Marton Balint wrote:



On Tue, 12 Apr 2016, sebechlebsky...@gmail.com wrote:


From: Jan Sebechlebsky 

Calling close_slave in case error is to be returned from open_slave
will free allocated resources.

Since failure can happen before bsfs array is initialized,
close_slave must check that bsfs is not NULL before accessing
tee_slave->bsfs[i] element.

Slave muxer expects write_trailer to be called if it's
write_header suceeded (so resources allocated in write_header
are freed). Therefore if failure happens after successfull
write_header call, we must ensure that write_trailer of
that particular slave is called.


Hmm, I guess you are right, I see no other way freeing resources 
allocated in write_header then calling write_trailer. It does make 
the code a bit more complex, but I don't really see a way to make it 
more simple.


So this looks good to me. Nicolas, any ideas improving this?



Actually I have given this some additional thought, and by using a new 
per-slave variable to keep the information if the header was written 
or not, I think your patch can be simplifed, also close_slave can be 
changed so it will write the trailer if necessary, in fact, the 
write_trailer function can use it as well.


I have modified your patch (see attached), could you please 
test/review it and check if I missed anything? I hope you don't mind, 
this kind of collaborative work is not that common in ffmpeg, but in 
this case it seemed easier moving those few lines around than 
describing what I wanted.


Thanks,
Marton


Hello Marton,
I'm ok with it, you're right it is more elegant this way. I've tested it 
and it seems allright. I've recreated the last patch on top of these 
changes and I'm sending it in attachment (and I am also cc-ing this mail 
to Nicolas, so he can review the patches).


Have a nice day!

Jan

>From 81901087b1cda032fc9688f436974578359bfb36 Mon Sep 17 00:00:00 2001
From: Jan Sebechlebsky 
Date: Fri, 15 Apr 2016 17:33:59 +0300
Subject: [PATCH v7 3/3] avformat/tee: Handling slave failure in tee muxer

Adds per slave option 'onfail' to the tee muxer allowing an output to
fail,so other slave outputs can continue.

Signed-off-by: Jan Sebechlebsky 
---
 doc/muxers.texi   | 14 
 libavformat/tee.c | 98 ---
 2 files changed, 100 insertions(+), 12 deletions(-)

diff --git a/doc/muxers.texi b/doc/muxers.texi
index 042efce..c62d4b5 100644
--- a/doc/muxers.texi
+++ b/doc/muxers.texi
@@ -1453,6 +1453,12 @@ Select the streams that should be mapped to the slave output,
 specified by a stream specifier. If not specified, this defaults to
 all the input streams. You may use multiple stream specifiers
 separated by commas (@code{,}) e.g.: @code{a:0,v}
+
+@item onfail
+Specify behaviour on output failure. This can be set to either @code{abort} (which is
+default) or @code{ignore}. @code{abort} will cause whole process to fail in case of failure
+on this slave output. @code{ignore} will ignore failure on this output, so other outputs
+will continue without being affected.
 @end table
 
 @subsection Examples
@@ -1467,6 +1473,14 @@ ffmpeg -i ... -c:v libx264 -c:a mp2 -f tee -map 0:v -map 0:a
 @end example
 
 @item
+As above, but continue streaming even if output to local file fails
+(for example local drive fills up):
+@example
+ffmpeg -i ... -c:v libx264 -c:a mp2 -f tee -map 0:v -map 0:a
+  "[onfail=ignore]archive-20121107.mkv|[f=mpegts]udp://10.0.1.255:1234/"
+@end example
+
+@item
 Use @command{ffmpeg} to encode the input, and send the output
 to three different destinations. The @code{dump_extra} bitstream
 filter is used to add extradata information to all the output video
diff --git a/libavformat/tee.c b/libavformat/tee.c
index 753f7ea..2aa3071 100644
--- a/libavformat/tee.c
+++ b/libavformat/tee.c
@@ -29,10 +29,19 @@
 
 #define MAX_SLAVES 16
 
+typedef enum {
+ON_SLAVE_FAILURE_ABORT  = 1,
+ON_SLAVE_FAILURE_IGNORE = 2
+} SlaveFailurePolicy;
+
+#define DEFAULT_SLAVE_FAILURE_POLICY ON_SLAVE_FAILURE_ABORT
+
 typedef struct {
 AVFormatContext *avf;
 AVBitStreamFilterContext **bsfs; ///< bitstream filters per stream
 
+SlaveFailurePolicy on_fail;
+
 /** map from input to output streams indexes,
  * disabled output streams are set to -1 */
 int *stream_map;
@@ -42,6 +51,7 @@ typedef struct {
 typedef struct TeeContext {
 const AVClass *class;
 unsigned nb_slaves;
+unsigned nb_alive;
 TeeSlave slaves[MAX_SLAVES];
 } TeeContext;
 
@@ -136,6 +146,23 @@ end:
 return ret;
 }
 
+static inline int parse_slave_failure_policy_option(const char *opt, TeeSlave *tee_slave)
+{
+if (!opt) {
+tee_slave->on_fail = DEFAULT_SLAVE_FAILURE_POLICY;
+return 0;
+} else if (!av_strcasecmp("abort", opt)) {
+tee_slave->on_fail = ON_SLAVE_FAILURE_ABORT;

Re: [FFmpeg-devel] [PATCH] avcodec/avcodec: Document signed/unsignedness of sample formats in relation to bits_per_raw_sample

2016-04-15 Thread Michael Niedermayer
On Fri, Apr 15, 2016 at 12:44:15PM +0200, wm4 wrote:
> On Fri, 15 Apr 2016 00:42:22 +0200
> Michael Niedermayer  wrote:
> 
> > Signed-off-by: Michael Niedermayer 
> > ---
> >  libavcodec/avcodec.h |8 ++--
> >  1 file changed, 6 insertions(+), 2 deletions(-)
> > 
> > diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
> > index 9e6169f..e5ba9aa 100644
> > --- a/libavcodec/avcodec.h
> > +++ b/libavcodec/avcodec.h
> > @@ -3850,8 +3850,12 @@ typedef struct AVCodecParameters {
> >   * sample format has more bits, the least significant bits are 
> > additional
> >   * padding bits, which are always 0. Use right shifts to reduce the 
> > sample
> >   * to its actual size. For example, audio formats with 24 bit samples 
> > will
> > - * have bits_per_raw_sample set to 24, and format set to 
> > AV_SAMPLEFMT_S32.
> > - * To get the original sample use "(uint32_t)sample >> 8"."
> > + * have bits_per_raw_sample set to 24, and format set to 
> > AV_SAMPLE_FMT_S32.
> > + * To get the original sample use "(int32_t)sample >> 8"."
> 
> OK. AFAIK this isn't UB, but implementation defined. But probably fine.

applied


> 
> > + *
> > + * Sample formats that contain a S(num) like AV_SAMPLE_FMT_S32 use 
> > signed
> > + * integers, formats that contain a U(num) like AV_SAMPLE_FMT_U8 use 
> > unsigned
> > + * integers.
> 
> Hm, I don't think that needs to be mentioned here. U8 is the only
> unsigned format too. And the doxygen for AVSampleFormat is quite clear.

removed

thx

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

Into a blind darkness they enter who follow after the Ignorance,
they as if into a greater darkness enter who devote themselves
to the Knowledge alone. -- Isha Upanishad


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


Re: [FFmpeg-devel] [PATCH 2/3] configure: Do not create/install versioned DLLs on OS/2.

2016-04-15 Thread Dave Yeo

On 04/14/16 07:29 PM, Dave Yeo wrote:

From fbff28a583cc9fd7144dd4f9dc37b7b5f8aa Mon Sep 17 00:00:00 2001

From: Dmitriy Kuminov 
Date: Thu, 14 Apr 2016 01:45:01 +0400
Subject: [PATCH 2/3] configure: Do not create/install versioned DLLs on
OS/2.


Attached
Dave
From fbff28a583cc9fd7144dd4f9dc37b7b5f8aa Mon Sep 17 00:00:00 2001
From: Dmitriy Kuminov 
Date: Thu, 14 Apr 2016 01:45:01 +0400
Subject: [PATCH 2/3] configure: Do not create/install versioned DLLs on OS/2.

Only one DLL for each module must be present on OS/2: SLIBNAME_WITH_MAJOR
(the same as on Windows). Creating other DLLs makes no sense as they can't
be used.

Signed-off-by: Dave Yeo 
---
 configure | 23 ---
 1 file changed, 12 insertions(+), 11 deletions(-)

diff --git a/configure b/configure
index ff80aee..36a23f4 100755
--- a/configure
+++ b/configure
@@ -4716,7 +4716,6 @@ case $target_os in
 ;;
 os/2*)
 strip="lxlite -CS"
-ln_s="cp -f"
 objformat="aout"
 add_cppflags -D_GNU_SOURCE
 add_ldflags -Zomf -Zbin-files -Zargs-wild -Zmap
@@ -4724,16 +4723,18 @@ case $target_os in
 LIBSUF="_s.a"
 SLIBPREF=""
 SLIBSUF=".dll"
-SLIBNAME_WITH_VERSION='$(SLIBPREF)$(NAME)-$(LIBVERSION)$(SLIBSUF)'
-SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(shell echo $(NAME) | cut -c1-6)$(LIBMAJOR)$(SLIBSUF)'
-SLIB_CREATE_DEF_CMD='echo LIBRARY $(SLIBNAME_WITH_MAJOR) INITINSTANCE TERMINSTANCE > $(SUBDIR)$(NAME).def; \
-echo CODE PRELOAD MOVEABLE DISCARDABLE >> $(SUBDIR)$(NAME).def; \
-echo DATA PRELOAD MOVEABLE MULTIPLE NONSHARED >> $(SUBDIR)$(NAME).def; \
-echo EXPORTS >> $(SUBDIR)$(NAME).def; \
-emxexp $(OBJS) >> $(SUBDIR)$(NAME).def'
-SLIB_EXTRA_CMD='emximp -o $(SUBDIR)$(LIBPREF)$(NAME)_dll.a $(SUBDIR)$(NAME).def; \
-emximp -o $(SUBDIR)$(LIBPREF)$(NAME)_dll.lib $(SUBDIR)$(NAME).def;'
-SLIB_INSTALL_EXTRA_LIB='$(LIBPREF)$(NAME)_dll.a $(LIBPREF)$(NAME)_dll.lib'
+SLIBNAME_WITH_VERSION='$(SLIBPREF)$(FULLNAME)-$(LIBVERSION)$(SLIBSUF)'
+SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(shell echo $(FULLNAME) | cut -c1-6)$(LIBMAJOR)$(SLIBSUF)'
+SLIB_CREATE_DEF_CMD='echo LIBRARY $(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=) INITINSTANCE TERMINSTANCE > $(SUBDIR)$(FULLNAME).def; \
+echo CODE PRELOAD MOVEABLE DISCARDABLE >> $(SUBDIR)$(FULLNAME).def; \
+echo DATA PRELOAD MOVEABLE MULTIPLE NONSHARED >> $(SUBDIR)$(FULLNAME).def; \
+echo EXPORTS >> $(SUBDIR)$(FULLNAME).def; \
+emxexp $(OBJS) >> $(SUBDIR)$(FULLNAME).def'
+SLIB_EXTRA_CMD='emximp -o $(SUBDIR)$(LIBPREF)$(FULLNAME)_dll.a $(SUBDIR)$(FULLNAME).def; \
+emximp -o $(SUBDIR)$(LIBPREF)$(FULLNAME)_dll.lib $(SUBDIR)$(FULLNAME).def;'
+SLIB_INSTALL_NAME='$(SLIBNAME_WITH_MAJOR)'
+SLIB_INSTALL_LINKS=
+SLIB_INSTALL_EXTRA_LIB='$(LIBPREF)$(FULLNAME)_dll.a $(LIBPREF)$(FULLNAME)_dll.lib'
 enable dos_paths
 enable_weak os2threads
 ;;
-- 
2.0.0

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


Re: [FFmpeg-devel] [PATCH] lavf/mpl2dec: skip BOM

2016-04-15 Thread wm4
On Fri, 15 Apr 2016 15:01:23 +0200
Clément Bœsch  wrote:

> On Fri, Apr 15, 2016 at 02:58:00PM +0200, wm4 wrote:
> > Stolen from microdvddec.c.
> > 
> > Fixes ticket #5442.
> > ---
> >  libavformat/mpl2dec.c | 4 
> >  1 file changed, 4 insertions(+)
> > 
> > diff --git a/libavformat/mpl2dec.c b/libavformat/mpl2dec.c
> > index 59589d5..2a0cb28 100644
> > --- a/libavformat/mpl2dec.c
> > +++ b/libavformat/mpl2dec.c
> > @@ -26,6 +26,7 @@
> >  #include "avformat.h"
> >  #include "internal.h"
> >  #include "subtitles.h"
> > +#include "libavutil/intreadwrite.h"
> >  
> >  typedef struct {
> >  FFDemuxSubtitlesQueue q;
> > @@ -39,6 +40,9 @@ static int mpl2_probe(AVProbeData *p)
> >  const unsigned char *ptr = p->buf;
> >  const unsigned char *ptr_end = ptr + p->buf_size;
> >  
> > +if (AV_RB24(ptr) == 0xEFBBBF)
> > +ptr += 3;  /* skip UTF-8 BOM */
> > +
> >  for (i = 0; i < 2; i++) {
> >  if (sscanf(ptr, "[%"SCNd64"][%"SCNd64"]%c", , , ) != 3 
> > &&
> >  sscanf(ptr, "[%"SCNd64"][]%c",  ,   ) != 
> > 2)  
> 
> make sure you don't need it in the read_header() callback too.
> 
> BTW, as a side note, it will be appropriate to s/if/while/, I have a few
> samples with more than one bom... IIRC only in ASS files but we probably
> to have it uniformly across sub text decoder. It's fine to keep it
> consistent with a single if for now.
> 
> thanks
> 

Indeed the BOM causes dropping the first subtitle event in
read_header().
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] Implement hdcd filtering

2016-04-15 Thread Carl Eugen Hoyos
Derek Buitenhuis  gmail.com> writes:

> Why is this in libavfilter and not libavcodec, when it is 
> described as a decoder?

Please fix the documentation, neither the author nor myself 
are native speakers.

Carl Eugen

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


Re: [FFmpeg-devel] [PATCH 3/3] doc/examples: Add thread_type flag to fffuzz

2016-04-15 Thread Kieran Kunhya
On Mon, 11 Apr 2016 at 22:37 Pawel Golinski  wrote:

> ---
>  doc/examples/fffuzz.c | 26 +-
>  1 file changed, 25 insertions(+), 1 deletion(-)
>
>
>
For simplicity can you make this match the ffmpeg.c command line.
so -thread_type slice and -threads 4 or whatever.

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


Re: [FFmpeg-devel] [PATCH 2/3] configure: Do not create/install versioned DLLs on OS/2.

2016-04-15 Thread Michael Niedermayer
On Thu, Apr 14, 2016 at 07:29:26PM -0700, Dave Yeo wrote:
> >From fbff28a583cc9fd7144dd4f9dc37b7b5f8aa Mon Sep 17 00:00:00 2001
> From: Dmitriy Kuminov 
> Date: Thu, 14 Apr 2016 01:45:01 +0400
> Subject: [PATCH 2/3] configure: Do not create/install versioned DLLs
> on OS/2.
> 
> Only one DLL for each module must be present on OS/2: SLIBNAME_WITH_MAJOR
> (the same as on Windows). Creating other DLLs makes no sense as they can't
> be used.
> 
> Signed-off-by: Dave Yeo 
> ---
>  configure | 23 ---
>  1 file changed, 12 insertions(+), 11 deletions(-)
> 
> diff --git a/configure b/configure
> index ff80aee..36a23f4 100755
> --- a/configure
> +++ b/configure
> @@ -4716,7 +4716,6 @@ case $target_os in
>  ;;
>  os/2*)
>  strip="lxlite -CS"
> -ln_s="cp -f"
>  objformat="aout"
>  add_cppflags -D_GNU_SOURCE
>  add_ldflags -Zomf -Zbin-files -Zargs-wild -Zmap
> @@ -4724,16 +4723,18 @@ case $target_os in
>  LIBSUF="_s.a"
>  SLIBPREF=""
>  SLIBSUF=".dll"
> -SLIBNAME_WITH_VERSION='$(SLIBPREF)$(NAME)-$(LIBVERSION)$(SLIBSUF)'
> -SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(shell echo $(NAME) | cut
> -c1-6)$(LIBMAJOR)$(SLIBSUF)'
> -SLIB_CREATE_DEF_CMD='echo LIBRARY $(SLIBNAME_WITH_MAJOR)
> INITINSTANCE TERMINSTANCE > $(SUBDIR)$(NAME).def; \
> -echo CODE PRELOAD MOVEABLE DISCARDABLE >>
> $(SUBDIR)$(NAME).def; \
> -echo DATA PRELOAD MOVEABLE MULTIPLE NONSHARED >>
> $(SUBDIR)$(NAME).def; \
> -echo EXPORTS >> $(SUBDIR)$(NAME).def; \

this patch has been corrupted with linebreaks

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

The misfortune of the wise is better than the prosperity of the fool.
-- Epicurus


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


Re: [FFmpeg-devel] [PATCH] lavf/mpl2dec: skip BOM

2016-04-15 Thread Clément Bœsch
On Fri, Apr 15, 2016 at 02:58:00PM +0200, wm4 wrote:
> Stolen from microdvddec.c.
> 
> Fixes ticket #5442.
> ---
>  libavformat/mpl2dec.c | 4 
>  1 file changed, 4 insertions(+)
> 
> diff --git a/libavformat/mpl2dec.c b/libavformat/mpl2dec.c
> index 59589d5..2a0cb28 100644
> --- a/libavformat/mpl2dec.c
> +++ b/libavformat/mpl2dec.c
> @@ -26,6 +26,7 @@
>  #include "avformat.h"
>  #include "internal.h"
>  #include "subtitles.h"
> +#include "libavutil/intreadwrite.h"
>  
>  typedef struct {
>  FFDemuxSubtitlesQueue q;
> @@ -39,6 +40,9 @@ static int mpl2_probe(AVProbeData *p)
>  const unsigned char *ptr = p->buf;
>  const unsigned char *ptr_end = ptr + p->buf_size;
>  
> +if (AV_RB24(ptr) == 0xEFBBBF)
> +ptr += 3;  /* skip UTF-8 BOM */
> +
>  for (i = 0; i < 2; i++) {
>  if (sscanf(ptr, "[%"SCNd64"][%"SCNd64"]%c", , , ) != 3 &&
>  sscanf(ptr, "[%"SCNd64"][]%c",  ,   ) != 2)

make sure you don't need it in the read_header() callback too.

BTW, as a side note, it will be appropriate to s/if/while/, I have a few
samples with more than one bom... IIRC only in ASS files but we probably
to have it uniformly across sub text decoder. It's fine to keep it
consistent with a single if for now.

thanks

-- 
Clément B.


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


[FFmpeg-devel] [PATCH] lavf/mpl2dec: skip BOM

2016-04-15 Thread wm4
Stolen from microdvddec.c.

Fixes ticket #5442.
---
 libavformat/mpl2dec.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/libavformat/mpl2dec.c b/libavformat/mpl2dec.c
index 59589d5..2a0cb28 100644
--- a/libavformat/mpl2dec.c
+++ b/libavformat/mpl2dec.c
@@ -26,6 +26,7 @@
 #include "avformat.h"
 #include "internal.h"
 #include "subtitles.h"
+#include "libavutil/intreadwrite.h"
 
 typedef struct {
 FFDemuxSubtitlesQueue q;
@@ -39,6 +40,9 @@ static int mpl2_probe(AVProbeData *p)
 const unsigned char *ptr = p->buf;
 const unsigned char *ptr_end = ptr + p->buf_size;
 
+if (AV_RB24(ptr) == 0xEFBBBF)
+ptr += 3;  /* skip UTF-8 BOM */
+
 for (i = 0; i < 2; i++) {
 if (sscanf(ptr, "[%"SCNd64"][%"SCNd64"]%c", , , ) != 3 &&
 sscanf(ptr, "[%"SCNd64"][]%c",  ,   ) != 2)
-- 
2.8.0.rc3

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


Re: [FFmpeg-devel] [PATCH] Implement hdcd filtering

2016-04-15 Thread Derek Buitenhuis
On 3/22/2016 11:22 AM, Benjamin St wrote:
> This patch applies filtering/decoding for hdcds(see ticket #4441) . The
> filter is heavily based on
> https://github.com/kode54/foo_hdcd/. (Is this ok? Copyright?)
> 
> Discuss, Review

Hi,

Sorry to be late to the party (I just saw this pushed.)

Why is this in libavfilter and not libavcodec, when it is described
as a decoder?

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


Re: [FFmpeg-devel] [PATCH] lavf/matroskadec: Demux the PixelCrop* values

2016-04-15 Thread wm4
On Wed, 6 Apr 2016 17:09:21 -0600
Nic Wolfe  wrote:

> Thanks for elaborating wm4. Out of curiosity when you say "generic"
> and "normal" metadata what do you mean? Are you talking about using
> generic key names or is there another way to store metadata?
> 
> I have attached a patch which adds a new AVPacketSideDataType and uses
> that type to store crop values in the AVStream's side data if they're
> found during Matroska demuxing. I have included a comment in avcodec.h
> with some of the info Dave shared above but I'm not sure if that is
> sufficient to call this "well defined".
> 
> I'm aware that this is a complex topic and this patch is certainly not
> comprehensive but hopefully it is a step in the right direction.

I think this is much better. The problem are still the semantics. I
tried to discuss it in Libav, but nothing conclusive has emerged.

Maybe you could send this patch to libav-devel for discussion? (I feel
a bit sorry for playing this ping pong with a first time contributor.
If anyone has a better idea how to continue this, please make a
suggestion.)

By the way, it's not a good idea to send base64 encoded patches. I
don't think most mail clients can expand them automatically. It
makes review harder. Just attach them normally. Also, try to avoid
top-posting.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] lavc/mediacodec: add hwaccel support

2016-04-15 Thread wm4
On Thu, 14 Apr 2016 14:19:42 +0200
Matthieu Bouron  wrote:

> On Thu, Apr 7, 2016 at 4:18 PM, wm4  wrote:
> 
> > On Fri, 18 Mar 2016 17:50:39 +0100
> > Matthieu Bouron  wrote:
> >  
> > > From: Matthieu Bouron 
> > >
> > > ---
> > >
> > > Hello,  
> >
> > Can't say much about this, so just some minor confused comments.
> >  
> 
> Thanks for your comments and sorry for the late reply.

Well, I've also taken some time to send that review...

> 
> >  
> > >
> > > The following patch add hwaccel support to the mediacodec (h264) decoder  
> > by allowing  
> > > the user to render the output frames directly on a surface.
> > >
> > > In order to do so the user needs to initialize the hwaccel through the  
> > use of  
> > > av_mediacodec_alloc_context and av_mediacodec_default_init functions.  
> > The later  
> > > takes a reference to an android/view/Surface as parameter.
> > >
> > > If the hwaccel successfully initialize, the decoder output frames pix  
> > fmt will be  
> > > AV_PIX_FMT_MEDIACODEC. The following snippet of code demonstrate how to  
> > render  
> > > the frames on the surface:
> > >
> > > AVMediaCodecBuffer *buffer = (AVMediaCodecBuffer *)frame->data[3];
> > > av_mediacodec_release_buffer(buffer, 1);
> > >
> > > The last argument of av_mediacodec_release_buffer enable rendering of the
> > > buffer on the surface (or not if set to 0).
> > >  
> >
> > I don't understand this (at all), but unreferencing the AVFrame should
> > unref the underlying surface.
> >  
> 
> In this case, the underlying surface will remain (it is owned by the codec
> itself) but the output buffer (that should be renderered to the surface)
> will be discarded.
> 

So: the AVFrame (and AVMediaCodecBuffer) really reference two buffers,
the codec and output buffer? And this API call releases the codec
buffer? Why can't it be released immediately?

> >  
> > > Regarding the internal changes in the mediacodec decoder:
> > >
> > > MediaCodec.flush() discards both input and output buffers meaning that if
> > > MediaCodec.flush() is called all output buffers the user has a reference  
> > on are  
> > > now invalid (and cannot be used).
> > > This behaviour does not fit well in the avcodec API.
> > >
> > > When the decoder is configured to output software buffers, there is no  
> > issue as  
> > > the buffers are copied.
> > >
> > > Now when the decoder is configured to output to a surface, the user  
> > might not  
> > > want to render all the frames as fast as the decoder can go and might  
> > want to  
> > > control *when* the frame are rendered, so we need to make sure that the
> > > MediaCodec.flush() call is delayed until all the frames the user retains  
> > has  
> > > been released or rendered.
> > >
> > > Delaying the call to MediaCodec.flush() means buffering any inputs that  
> > come  
> > > the decoder until the user has released/renderer the frame he retains.
> > >
> > > This is a limitation of this hwaccel implementation, if the user retains  
> > a  
> > > frame (a), then issue a flush command to the decoder, the packets he  
> > feeds to  
> > > the decoder at that point will be queued in the internal decoder packet  
> > queue  
> > > (until he releases the frame (a)). This scenario leads to a memory usage
> > > increase to say the least.
> > >
> > > Currently there is no limitation on the size of the internal decoder  
> > packet  
> > > queue but this is something that can be added easily. Then, if the queue  
> > is  
> > > full, what would be the behaviour of the decoder ? Can it block ? Or  
> > should it  
> > > returns something like AVERROR(EAGAIN) ?  
> >
> > The current API can't do anything like this. It has to output 0 or 1
> > frame per input packet. (If it outputs nothing, the frame is either
> > discarded or queued internally. The queue can be emptied only when
> > draining the decoder at the end of the stream.)
> >
> > So it looks like all you can do is blocking. (Which could lead to a
> > deadlock in the API user, depending of how the user's code works?)
> >  
> 
> Yes if I block at some point, it can lead to a deadlock if the user never
> releases all the frames. I'm considering buffering a few input packets
> before blocking.

OK, I guess this can't be avoided. Maybe the user should get the
possibility to control how many surfaces are buffered at most (before a
deadlock happens).

> 
> >  
> > >
> > > About the other internal decoder changes I introduced:
> > >
> > > The MediaCodecDecContext is now refcounted (using the lavu/atomic api)  
> > since  
> > > the (hwaccel) frames can be retained by the user, we need to delay the
> > > destruction of the codec until the user has released all the frames he  
> > has a  
> > > reference on.
> > > The reference counter of the MediaCodecDecContext is incremented each  
> > time an  
> > > (hwaccel) frame is outputted by the decoder 

Re: [FFmpeg-devel] [PATCH] avcodec: Add bits_per_raw_sample to AVCodecParameters

2016-04-15 Thread wm4
On Fri, 15 Apr 2016 00:06:27 -0300
James Almer  wrote:

> On 4/14/2016 7:30 PM, Michael Niedermayer wrote:
> > On Tue, Apr 12, 2016 at 01:25:43PM +0200, wm4 wrote:  
> >> On Tue, 12 Apr 2016 13:10:09 +0200
> >> Michael Niedermayer  wrote:
> >>  
> >>> On Mon, Apr 11, 2016 at 01:32:07AM +0200, Michael Niedermayer wrote:  
>  The bits_per_raw_sample represents the number of bits of precission per 
>  sample.
> 
>  The field is added at the logical place, not at the end as the code was 
>  just
>  recently added
> 
>  This fixes the regression about loosing the audio sample precission 
>  information
> 
>  The change in the fate test checksum un-does the change from the merge
> 
>  Signed-off-by: Michael Niedermayer 
>  ---
>   libavcodec/avcodec.h |   17 +
>   libavcodec/utils.c   |2 ++
>   tests/ref/lavf/ffm   |2 +-
>   3 files changed, 20 insertions(+), 1 deletion(-)
> >>>
> >>> new version of this with improved documentation
> >>> I intend to apply this soon if noone is against
> >>>
> >>>
> >>> From e500dd31368b760144b1e2b5b094f73b571b Mon Sep 17 00:00:00 2001
> >>> From: Michael Niedermayer 
> >>> Date: Mon, 11 Apr 2016 00:52:21 +0200
> >>> Subject: [PATCH] avcodec: Add bits_per_raw_sample to AVCodecParameters
> >>>
> >>> The bits_per_raw_sample represents the number of bits of precission per 
> >>> sample.
> >>>
> >>> The field is added at the logical place, not at the end as the code was 
> >>> just
> >>> recently added
> >>>
> >>> This fixes the regression about loosing the audio sample precission 
> >>> information
> >>>
> >>> The change in the fate test checksum un-does the change from the merge
> >>>
> >>> Signed-off-by: Michael Niedermayer 
> >>> ---
> >>>  libavcodec/avcodec.h |   21 +
> >>>  libavcodec/utils.c   |2 ++
> >>>  tests/ref/lavf/ffm   |2 +-
> >>>  3 files changed, 24 insertions(+), 1 deletion(-)
> >>>
> >>> diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
> >>> index b3655c5..99cbf88 100644
> >>> --- a/libavcodec/avcodec.h
> >>> +++ b/libavcodec/avcodec.h
> >>> @@ -3832,9 +3832,30 @@ typedef struct AVCodecParameters {
> >>>   */
> >>>  int64_t bit_rate;
> >>>
> >>> +/**
> >>> + * The number of bits per sample in the codedwords.
> >>> + *
> >>> + * This is basically the bitrate per sample, it is mandatory for a 
> >>> bunch of
> >>> + * formats to actually decode them, its the number of bits for one 
> >>> sample in  
> >>
> >> "It's". Also, add more full stops instead of creating long sentences.
> >>  
> >>> + * the actual coded bitstream.
> >>> + *
> >>> + * This could be for example 4 for ADPCM
> >>> + * For PCM formats this matches bits_per_raw_sample
> >>> + * Can be 0
> >>> + */
> >>>  int bits_per_coded_sample;
> >>>
> >>>  /**
> >>> + * The number of bits of precission in the samples.  
> >>
> >> Precision. Just get a spellchecker.
> >>  
> >>> + *
> >>> + * These are the bits in a decoded (raw) sample.  
> >>
> >> Maybe: "This is the number of valid bits in each output sample. If the
> >> sample format has more bits, the least significant bits are additional
> >> padding bits, which are always 0. Use right shifts to reduce the sample
> >> to its actual size. For example, audio formats with 24 bit samples will
> >> have bits_per_raw_sample set to 24, and format set to AV_SAMPLEFMT_S32.
> >> To get the original sample use "(uint32_t)sample >> 8"."
> >>
> >> Don't know if this is good. (Also is it even correct? I forgot whether
> >> audio sample data uses negative values too.) Maybe this should be added
> >> to AVCodecContext too. It's a common point of confusion.  
> > 
> > suggested changed made ad applied  
> 
> Should the change made to matroskaenc be reverted then? It was changed from
> using bits_per_raw_sample to bits_per_coded_sample in the codecpar commit
> because the former wasn't available back then.
> 

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


Re: [FFmpeg-devel] [PATCH] avcodec/avcodec: Document signed/unsignedness of sample formats in relation to bits_per_raw_sample

2016-04-15 Thread wm4
On Fri, 15 Apr 2016 00:42:22 +0200
Michael Niedermayer  wrote:

> Signed-off-by: Michael Niedermayer 
> ---
>  libavcodec/avcodec.h |8 ++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
> index 9e6169f..e5ba9aa 100644
> --- a/libavcodec/avcodec.h
> +++ b/libavcodec/avcodec.h
> @@ -3850,8 +3850,12 @@ typedef struct AVCodecParameters {
>   * sample format has more bits, the least significant bits are additional
>   * padding bits, which are always 0. Use right shifts to reduce the 
> sample
>   * to its actual size. For example, audio formats with 24 bit samples 
> will
> - * have bits_per_raw_sample set to 24, and format set to 
> AV_SAMPLEFMT_S32.
> - * To get the original sample use "(uint32_t)sample >> 8"."
> + * have bits_per_raw_sample set to 24, and format set to 
> AV_SAMPLE_FMT_S32.
> + * To get the original sample use "(int32_t)sample >> 8"."

OK. AFAIK this isn't UB, but implementation defined. But probably fine.

> + *
> + * Sample formats that contain a S(num) like AV_SAMPLE_FMT_S32 use signed
> + * integers, formats that contain a U(num) like AV_SAMPLE_FMT_U8 use 
> unsigned
> + * integers.

Hm, I don't think that needs to be mentioned here. U8 is the only
unsigned format too. And the doxygen for AVSampleFormat is quite clear.

>   *
>   * For ADPCM this might be 12 or 16 or similar
>   * Can be 0

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


Re: [FFmpeg-devel] [PATCH] Implement hdcd filtering

2016-04-15 Thread Carl Eugen Hoyos
Benjamin St  gmail.com> writes:

> OK, added av_assert0() checks.

Tested again and applied.

Thank you, Carl Eugen

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


Re: [FFmpeg-devel] [PATCH 01/11] lavf/mux: fix auto-inserted bsfs that read extradata

2016-04-15 Thread Hendrik Leppkes
On Fri, Apr 15, 2016 at 10:37 AM, Rodger Combs  wrote:
> ---
>  libavformat/mux.c | 10 ++
>  1 file changed, 10 insertions(+)
>
> diff --git a/libavformat/mux.c b/libavformat/mux.c
> index 33301f1..0ed0c3d 100644
> --- a/libavformat/mux.c
> +++ b/libavformat/mux.c
> @@ -1054,6 +1054,16 @@ int av_interleaved_write_frame(AVFormatContext *s, 
> AVPacket *pkt)
>  }
>  }
>
> +if (!st->internal->avctx->extradata && st->codecpar->extradata) {
> +int size = st->codecpar->extradata_size;
> +if (size < 0 || size >= INT32_MAX - AV_INPUT_BUFFER_PADDING_SIZE)
> +return AVERROR(EINVAL);
> +st->internal->avctx->extradata = av_mallocz(size + 
> AV_INPUT_BUFFER_PADDING_SIZE);
> +if (!st->internal->avctx->extradata)
> +return AVERROR(ENOMEM);
> +st->internal->avctx->extradata_size = size;
> +memcpy(st->internal->avctx->extradata, st->codecpar->extradata, 
> size);
> +}
>  av_apply_bitstream_filters(st->internal->avctx, pkt, 
> st->internal->bsfc);
>  if (pkt->size == 0 && pkt->side_data_elems == 0)
>  return 0;
> --
> 2.7.3

Derek is actively working on merging the new BSF API right now, it
might be better to just update this to the new API instead of wasting
some time on the old one.
It solves a bunch of these problems by accepting codecpar directly.

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


Re: [FFmpeg-devel] [PATCH 11/11] fate/aac: add automatic bsf test

2016-04-15 Thread Hendrik Leppkes
On Fri, Apr 15, 2016 at 10:37 AM, Rodger Combs  wrote:
> ---
>  tests/fate/aac.mak   | 3 +++
>  tests/ref/fate/aac-autobsf-adtstoasc | 1 +
>  2 files changed, 4 insertions(+)
>  create mode 100644 tests/ref/fate/aac-autobsf-adtstoasc
>
> diff --git a/tests/fate/aac.mak b/tests/fate/aac.mak
> index 3d64031..c71f990 100644
> --- a/tests/fate/aac.mak
> +++ b/tests/fate/aac.mak
> @@ -241,10 +241,13 @@ FATE_AAC_LATM += fate-aac-latm_stereo_to_51
>  fate-aac-latm_stereo_to_51: CMD = pcm -i 
> $(TARGET_SAMPLES)/aac/latm_stereo_to_51.ts -channel_layout 5.1
>  fate-aac-latm_stereo_to_51: REF = $(SAMPLES)/aac/latm_stereo_to_51_ref.s16
>
> +fate-aac-autobsf-adtstoasc: CMD = md5 -i 
> $(TARGET_SAMPLES)/audiomatch/tones_afconvert_16000_mono_aac_lc.adts -acodec 
> copy -fflags +bitexact -f matroska
> +
>  FATE_AAC-$(call  DEMDEC, AAC,AAC)  += $(FATE_AAC_CT_RAW)
>  FATE_AAC-$(call  DEMDEC, MOV,AAC)  += $(FATE_AAC)
>  FATE_AAC_LATM-$(call DEMDEC, MPEGTS, AAC_LATM) += $(FATE_AAC_LATM)
>  FATE_AAC-$(call  DEMDEC, AAC,AAC_FIXED)+= $(FATE_AAC_FIXED)
> +FATE_AAC-$(call  DEMMUX, AAC,MATROSKA) += fate-aac-autobsf-adtstoasc
>

This would also need a dependency on the BSF itself being enabled.

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


[FFmpeg-devel] [PATCH 06/11] lavf/segment: fix writing separate header with auto BSF

2016-04-15 Thread Rodger Combs
---
 libavformat/segment.c | 46 +++---
 1 file changed, 39 insertions(+), 7 deletions(-)

diff --git a/libavformat/segment.c b/libavformat/segment.c
index 41d8e53..6368f9b 100644
--- a/libavformat/segment.c
+++ b/libavformat/segment.c
@@ -260,6 +260,7 @@ static int segment_start(AVFormatContext *s, int 
write_header)
 if (write_header) {
 AVDictionary *options = NULL;
 av_dict_copy(, seg->format_options, 0);
+av_dict_set(, "fflags", "-autobsf", 0);
 err = avformat_write_header(oc, );
 av_dict_free();
 if (err < 0)
@@ -751,7 +752,8 @@ static int seg_init(AVFormatContext *s)
 }
 
 av_dict_copy(, seg->format_options, 0);
-ret = avformat_write_header(oc, );
+av_dict_set(, "fflags", "-autobsf", 0);
+ret = avformat_init_output(oc, );
 if (av_dict_count(options)) {
 av_log(s, AV_LOG_ERROR,
"Some of the provided format options in '%s' are not 
recognized\n", seg->format_options_str);
@@ -767,14 +769,42 @@ static int seg_init(AVFormatContext *s)
 seg->segment_frame_count = 0;
 
 av_assert0(s->nb_streams == oc->nb_streams);
-for (i = 0; i < s->nb_streams; i++) {
-AVStream *inner_st  = oc->streams[i];
-AVStream *outer_st = s->streams[i];
-avpriv_set_pts_info(outer_st, inner_st->pts_wrap_bits, 
inner_st->time_base.num, inner_st->time_base.den);
+if (ret == AVSTREAM_INIT_IN_INIT_OUTPUT) {
+for (i = 0; i < s->nb_streams; i++) {
+AVStream *inner_st  = oc->streams[i];
+AVStream *outer_st = s->streams[i];
+avpriv_set_pts_info(outer_st, inner_st->pts_wrap_bits, 
inner_st->time_base.num, inner_st->time_base.den);
+}
+
+if (oc->avoid_negative_ts > 0 && s->avoid_negative_ts < 0)
+s->avoid_negative_ts = 1;
 }
 
-if (oc->avoid_negative_ts > 0 && s->avoid_negative_ts < 0)
-s->avoid_negative_ts = 1;
+fail:
+av_dict_free();
+return ret;
+}
+
+static int seg_write_header(AVFormatContext *s)
+{
+SegmentContext *seg = s->priv_data;
+AVFormatContext *oc = seg->avf;
+int i;
+
+int ret = avformat_write_header(oc, NULL);
+if (ret < 0)
+return ret;
+
+if (ret == AVSTREAM_INIT_IN_WRITE_HEADER) {
+for (i = 0; i < s->nb_streams; i++) {
+AVStream *inner_st  = oc->streams[i];
+AVStream *outer_st = s->streams[i];
+avpriv_set_pts_info(outer_st, inner_st->pts_wrap_bits, 
inner_st->time_base.num, inner_st->time_base.den);
+}
+
+if (oc->avoid_negative_ts > 0 && s->avoid_negative_ts < 0)
+s->avoid_negative_ts = 1;
+}
 
 if (!seg->write_header_trailer || seg->header_filename) {
 if (seg->header_filename) {
@@ -1024,6 +1054,7 @@ AVOutputFormat ff_segment_muxer = {
 .priv_data_size = sizeof(SegmentContext),
 .flags  = AVFMT_NOFILE|AVFMT_GLOBALHEADER,
 .init   = seg_init,
+.write_header   = seg_write_header,
 .write_packet   = seg_write_packet,
 .write_trailer  = seg_write_trailer,
 .deinit = seg_free,
@@ -1044,6 +1075,7 @@ AVOutputFormat ff_stream_segment_muxer = {
 .priv_data_size = sizeof(SegmentContext),
 .flags  = AVFMT_NOFILE,
 .init   = seg_init,
+.write_header   = seg_write_header,
 .write_packet   = seg_write_packet,
 .write_trailer  = seg_write_trailer,
 .deinit = seg_free,
-- 
2.7.3

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


[FFmpeg-devel] [PATCH 07/11] lavf/movenc: add deinit function

2016-04-15 Thread Rodger Combs
---
 libavformat/movenc.c | 63 ++--
 1 file changed, 27 insertions(+), 36 deletions(-)

diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index 5acb9af..1e1dc84 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -5263,21 +5263,18 @@ static int mov_write_header(AVFormatContext *s)
 if (mov->encryption_key_len != AES_CTR_KEY_SIZE) {
 av_log(s, AV_LOG_ERROR, "Invalid encryption key len %d 
expected %d\n",
 mov->encryption_key_len, AES_CTR_KEY_SIZE);
-ret = AVERROR(EINVAL);
-goto error;
+return AVERROR(EINVAL);
 }
 
 if (mov->encryption_kid_len != CENC_KID_SIZE) {
 av_log(s, AV_LOG_ERROR, "Invalid encryption kid len %d 
expected %d\n",
 mov->encryption_kid_len, CENC_KID_SIZE);
-ret = AVERROR(EINVAL);
-goto error;
+return AVERROR(EINVAL);
 }
 } else {
 av_log(s, AV_LOG_ERROR, "unsupported encryption scheme %s\n",
 mov->encryption_scheme_str);
-ret = AVERROR(EINVAL);
-goto error;
+return AVERROR(EINVAL);
 }
 }
 
@@ -5297,8 +5294,7 @@ static int mov_write_header(AVFormatContext *s)
 av_log(s, AV_LOG_ERROR, "Could not find tag for codec %s in stream 
#%d, "
"codec not currently supported in container\n",
avcodec_get_name(st->codecpar->codec_id), i);
-ret = AVERROR(EINVAL);
-goto error;
+return AVERROR(EINVAL);
 }
 /* If hinting of this track is enabled by a later hint track,
  * this is updated. */
@@ -5312,8 +5308,7 @@ static int mov_write_header(AVFormatContext *s)
 track->tag == MKTAG('m','x','5','p') || track->tag == 
MKTAG('m','x','5','n')) {
 if (st->codecpar->width != 720 || (st->codecpar->height != 608 
&& st->codecpar->height != 512)) {
 av_log(s, AV_LOG_ERROR, "D-10/IMX must use 720x608 or 
720x512 video resolution\n");
-ret = AVERROR(EINVAL);
-goto error;
+return AVERROR(EINVAL);
 }
 track->height = track->tag >> 24 == 'n' ? 486 : 576;
 }
@@ -5326,8 +5321,7 @@ static int mov_write_header(AVFormatContext *s)
 }
 if (st->codecpar->width > 65535 || st->codecpar->height > 65535) {
 av_log(s, AV_LOG_ERROR, "Resolution %dx%d too large for 
mov/mp4\n", st->codecpar->width, st->codecpar->height);
-ret = AVERROR(EINVAL);
-goto error;
+return AVERROR(EINVAL);
 }
 if (track->mode == MODE_MOV && track->timescale > 10)
 av_log(s, AV_LOG_WARNING,
@@ -5358,8 +5352,7 @@ static int mov_write_header(AVFormatContext *s)
  st->codecpar->codec_id == AV_CODEC_ID_ILBC){
 if (!st->codecpar->block_align) {
 av_log(s, AV_LOG_ERROR, "track %d: codec block align is 
not set for adpcm\n", i);
-ret = AVERROR(EINVAL);
-goto error;
+return AVERROR(EINVAL);
 }
 track->sample_size = st->codecpar->block_align;
 }else if (st->codecpar->frame_size > 1){ /* assume compressed 
audio */
@@ -5376,8 +5369,7 @@ static int mov_write_header(AVFormatContext *s)
 if (s->strict_std_compliance >= FF_COMPLIANCE_NORMAL) {
 av_log(s, AV_LOG_ERROR, "track %d: muxing mp3 at %dhz is 
not standard, to mux anyway set strict to -1\n",
 i, track->par->sample_rate);
-ret = AVERROR(EINVAL);
-goto error;
+return AVERROR(EINVAL);
 } else {
 av_log(s, AV_LOG_WARNING, "track %d: muxing mp3 at %dhz is 
not standard in MP4\n",
i, track->par->sample_rate);
@@ -5407,8 +5399,7 @@ static int mov_write_header(AVFormatContext *s)
 track->vos_len  = st->codecpar->extradata_size;
 track->vos_data = av_malloc(track->vos_len);
 if (!track->vos_data) {
-ret = AVERROR(ENOMEM);
-goto error;
+return AVERROR(ENOMEM);
 }
 memcpy(track->vos_data, st->codecpar->extradata, 
track->vos_len);
 }
@@ -5417,9 +5408,8 @@ static int mov_write_header(AVFormatContext *s)
 if (mov->encryption_scheme == MOV_ENC_CENC_AES_CTR) {
 ret = ff_mov_cenc_init(>cenc, mov->encryption_key,
 track->par->codec_id == AV_CODEC_ID_H264, s->flags & 
AVFMT_FLAG_BITEXACT);
-if (ret) {
-goto error;
-}
+  

[FFmpeg-devel] [PATCH 08/11] lavf/dashenc: add deinit function

2016-04-15 Thread Rodger Combs
---
 libavformat/dashenc.c | 51 +--
 1 file changed, 17 insertions(+), 34 deletions(-)

diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c
index 519f9c4..0848052 100644
--- a/libavformat/dashenc.c
+++ b/libavformat/dashenc.c
@@ -580,16 +580,12 @@ static int dash_write_header(AVFormatContext *s)
 *ptr = '\0';
 
 oformat = av_guess_format("mp4", NULL, NULL);
-if (!oformat) {
-ret = AVERROR_MUXER_NOT_FOUND;
-goto fail;
-}
+if (!oformat)
+return AVERROR_MUXER_NOT_FOUND;
 
 c->streams = av_mallocz(sizeof(*c->streams) * s->nb_streams);
-if (!c->streams) {
-ret = AVERROR(ENOMEM);
-goto fail;
-}
+if (!c->streams)
+return AVERROR(ENOMEM);
 
 for (i = 0; i < s->nb_streams; i++) {
 OutputStream *os = >streams[i];
@@ -606,17 +602,13 @@ static int dash_write_header(AVFormatContext *s)
 int level = s->strict_std_compliance >= FF_COMPLIANCE_STRICT ?
 AV_LOG_ERROR : AV_LOG_WARNING;
 av_log(s, level, "No bit rate set for stream %d\n", i);
-if (s->strict_std_compliance >= FF_COMPLIANCE_STRICT) {
-ret = AVERROR(EINVAL);
-goto fail;
-}
+if (s->strict_std_compliance >= FF_COMPLIANCE_STRICT)
+return AVERROR(EINVAL);
 }
 
 ctx = avformat_alloc_context();
-if (!ctx) {
-ret = AVERROR(ENOMEM);
-goto fail;
-}
+if (!ctx)
+return AVERROR(ENOMEM);
 os->ctx = ctx;
 ctx->oformat = oformat;
 ctx->interrupt_callback = s->interrupt_callback;
@@ -624,10 +616,8 @@ static int dash_write_header(AVFormatContext *s)
 ctx->io_close   = s->io_close;
 ctx->io_open= s->io_open;
 
-if (!(st = avformat_new_stream(ctx, NULL))) {
-ret = AVERROR(ENOMEM);
-goto fail;
-}
+if (!(st = avformat_new_stream(ctx, NULL)))
+return AVERROR(ENOMEM);
 avcodec_parameters_copy(st->codecpar, s->streams[i]->codecpar);
 st->sample_aspect_ratio = s->streams[i]->sample_aspect_ratio;
 st->time_base = s->streams[i]->time_base;
@@ -635,10 +625,8 @@ static int dash_write_header(AVFormatContext *s)
 ctx->flags = s->flags;
 
 ctx->pb = avio_alloc_context(os->iobuf, sizeof(os->iobuf), 
AVIO_FLAG_WRITE, os, NULL, dash_write, NULL);
-if (!ctx->pb) {
-ret = AVERROR(ENOMEM);
-goto fail;
-}
+if (!ctx->pb)
+return AVERROR(ENOMEM);
 
 if (c->single_file) {
 if (c->single_file_name)
@@ -651,13 +639,12 @@ static int dash_write_header(AVFormatContext *s)
 snprintf(filename, sizeof(filename), "%s%s", c->dirname, os->initfile);
 ret = s->io_open(s, >out, filename, AVIO_FLAG_WRITE, NULL);
 if (ret < 0)
-goto fail;
+return ret;
 os->init_start_pos = 0;
 
 av_dict_set(, "movflags", "frag_custom+dash+delay_moov", 0);
-if ((ret = avformat_write_header(ctx, )) < 0) {
- goto fail;
-}
+if ((ret = avformat_write_header(ctx, )) < 0)
+return ret;
 os->ctx_inited = 1;
 avio_flush(ctx->pb);
 av_dict_free();
@@ -693,15 +680,11 @@ static int dash_write_header(AVFormatContext *s)
 
 if (!c->has_video && c->min_seg_duration <= 0) {
 av_log(s, AV_LOG_WARNING, "no video stream and no min seg duration 
set\n");
-ret = AVERROR(EINVAL);
+return AVERROR(EINVAL);
 }
 ret = write_manifest(s, 0);
 if (!ret)
 av_log(s, AV_LOG_VERBOSE, "Manifest written to: %s\n", s->filename);
-
-fail:
-if (ret)
-dash_free(s);
 return ret;
 }
 
@@ -992,7 +975,6 @@ static int dash_write_trailer(AVFormatContext *s)
 unlink(s->filename);
 }
 
-dash_free(s);
 return 0;
 }
 
@@ -1029,6 +1011,7 @@ AVOutputFormat ff_dash_muxer = {
 .write_header   = dash_write_header,
 .write_packet   = dash_write_packet,
 .write_trailer  = dash_write_trailer,
+.deinit = dash_free,
 .codec_tag  = (const AVCodecTag* const []){ ff_mp4_obj_type, 0 },
 .priv_class = _class,
 };
-- 
2.7.3

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


[FFmpeg-devel] [PATCH 09/11] lavf/movenc+dashenc: add automatic bitstream filtering

2016-04-15 Thread Rodger Combs
This is disabled by default when the empty_moov flag is enabled
---
 libavformat/dashenc.c |  41 +++-
 libavformat/movenc.c  | 105 +++---
 2 files changed, 121 insertions(+), 25 deletions(-)

diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c
index 0848052..42dd604 100644
--- a/libavformat/dashenc.c
+++ b/libavformat/dashenc.c
@@ -551,7 +551,7 @@ static int write_manifest(AVFormatContext *s, int final)
 return avpriv_io_move(temp_filename, s->filename);
 }
 
-static int dash_write_header(AVFormatContext *s)
+static int dash_init(AVFormatContext *s)
 {
 DASHContext *c = s->priv_data;
 int ret = 0, i;
@@ -643,7 +643,7 @@ static int dash_write_header(AVFormatContext *s)
 os->init_start_pos = 0;
 
 av_dict_set(, "movflags", "frag_custom+dash+delay_moov", 0);
-if ((ret = avformat_write_header(ctx, )) < 0)
+if ((ret = avformat_init_output(ctx, )) < 0)
 return ret;
 os->ctx_inited = 1;
 avio_flush(ctx->pb);
@@ -682,6 +682,20 @@ static int dash_write_header(AVFormatContext *s)
 av_log(s, AV_LOG_WARNING, "no video stream and no min seg duration 
set\n");
 return AVERROR(EINVAL);
 }
+return 0;
+}
+
+static int dash_write_header(AVFormatContext *s)
+{
+DASHContext *c = s->priv_data;
+int i, ret;
+for (i = 0; i < s->nb_streams; i++) {
+OutputStream *os = >streams[i];
+if ((ret = avformat_write_header(os->ctx, NULL)) < 0) {
+dash_free(s);
+return ret;
+}
+}
 ret = write_manifest(s, 0);
 if (!ret)
 av_log(s, AV_LOG_VERBOSE, "Manifest written to: %s\n", s->filename);
@@ -978,6 +992,27 @@ static int dash_write_trailer(AVFormatContext *s)
 return 0;
 }
 
+static int dash_check_bitstream(struct AVFormatContext *s, const AVPacket 
*avpkt)
+{
+DASHContext *c = s->priv_data;
+OutputStream *os = >streams[avpkt->stream_index];
+AVFormatContext *oc = os->ctx;
+if (oc->oformat->check_bitstream) {
+int ret;
+AVPacket pkt = *avpkt;
+pkt.stream_index = 0;
+ret = oc->oformat->check_bitstream(oc, );
+if (ret == 1) {
+AVStream *st = s->streams[avpkt->stream_index];
+AVStream *ost = oc->streams[0];
+st->internal->bsfc = ost->internal->bsfc;
+ost->internal->bsfc = NULL;
+}
+return ret;
+}
+return 1;
+}
+
 #define OFFSET(x) offsetof(DASHContext, x)
 #define E AV_OPT_FLAG_ENCODING_PARAM
 static const AVOption options[] = {
@@ -1008,10 +1043,12 @@ AVOutputFormat ff_dash_muxer = {
 .audio_codec= AV_CODEC_ID_AAC,
 .video_codec= AV_CODEC_ID_H264,
 .flags  = AVFMT_GLOBALHEADER | AVFMT_NOFILE | AVFMT_TS_NEGATIVE,
+.init   = dash_init,
 .write_header   = dash_write_header,
 .write_packet   = dash_write_packet,
 .write_trailer  = dash_write_trailer,
 .deinit = dash_free,
 .codec_tag  = (const AVCodecTag* const []){ ff_mp4_obj_type, 0 },
+.check_bitstream = dash_check_bitstream,
 .priv_class = _class,
 };
diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index 1e1dc84..14d5c81 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -5116,11 +5116,10 @@ static int 
mov_create_dvd_sub_decoder_specific_info(MOVTrack *track,
 return 0;
 }
 
-static int mov_write_header(AVFormatContext *s)
+static int mov_init(AVFormatContext *s)
 {
-AVIOContext *pb = s->pb;
 MOVMuxContext *mov = s->priv_data;
-AVDictionaryEntry *t, *global_tcr = av_dict_get(s->metadata, "timecode", 
NULL, 0);
+AVDictionaryEntry *global_tcr = av_dict_get(s->metadata, "timecode", NULL, 
0);
 int i, ret, hint_track = 0, tmcd_track = 0;
 
 mov->fc = s;
@@ -5157,6 +5156,11 @@ static int mov_write_header(AVFormatContext *s)
 mov->flags |= FF_MOV_FLAG_FRAGMENT | FF_MOV_FLAG_EMPTY_MOOV |
   FF_MOV_FLAG_DEFAULT_BASE_MOOF;
 
+if (mov->flags & FF_MOV_FLAG_EMPTY_MOOV && s->flags & AVFMT_FLAG_AUTO_BSF) 
{
+av_log(s, AV_LOG_VERBOSE, "Empty MOOV enabled; disabling automatic 
bitstream filtering\n");
+s->flags &= ~AVFMT_FLAG_AUTO_BSF;
+}
+
 if (mov->flags & FF_MOV_FLAG_FASTSTART) {
 mov->reserved_moov_size = -1;
 }
@@ -5203,11 +5207,6 @@ static int mov_write_header(AVFormatContext *s)
 return AVERROR(EINVAL);
 }
 
-if (!(mov->flags & FF_MOV_FLAG_DELAY_MOOV)) {
-if ((ret = mov_write_identification(pb, s)) < 0)
-return ret;
-}
-
 mov->nb_streams = s->nb_streams;
 if (mov->mode & (MODE_MP4|MODE_MOV|MODE_IPOD) && s->nb_chapters)
 mov->chapter_track = mov->nb_streams++;
@@ -5391,6 +5390,48 @@ static int mov_write_header(AVFormatContext *s)
 
 avpriv_set_pts_info(st, 64, 1, track->timescale);
 
+if (mov->encryption_scheme == MOV_ENC_CENC_AES_CTR) {
+ret = 

[FFmpeg-devel] [PATCH 02/11] lavf: add a flag to enable/disable automatic bitstream filtering

2016-04-15 Thread Rodger Combs
This is mostly useful for muxers that wrap other muxers, such as dashenc
and segment. The actual duplicated bitstream filtering is largely harmless,
but delaying the header can cause problems when the muxer intended the header
to be written to a separate file.
---
 libavformat/avformat.h  | 1 +
 libavformat/mux.c   | 4 ++--
 libavformat/options_table.h | 3 ++-
 3 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/libavformat/avformat.h b/libavformat/avformat.h
index 02113f5..f240ab3 100644
--- a/libavformat/avformat.h
+++ b/libavformat/avformat.h
@@ -1440,6 +1440,7 @@ typedef struct AVFormatContext {
 #define AVFMT_FLAG_PRIV_OPT0x2 ///< Enable use of private options by 
delaying codec open (this could be made default once all code is converted)
 #define AVFMT_FLAG_KEEP_SIDE_DATA 0x4 ///< Don't merge side data but keep 
it separate.
 #define AVFMT_FLAG_FAST_SEEK   0x8 ///< Enable fast, but inaccurate seeks 
for some formats
+#define AVFMT_FLAG_AUTO_BSF0x10 ///< Wait for packet data before 
writing a header, and add bitstream filters as requested by the muxer
 
 /**
  * Maximum size of the data read from input for determining
diff --git a/libavformat/mux.c b/libavformat/mux.c
index 0ed0c3d..aea9095 100644
--- a/libavformat/mux.c
+++ b/libavformat/mux.c
@@ -473,7 +473,7 @@ int avformat_write_header(AVFormatContext *s, AVDictionary 
**options)
 if ((ret = init_muxer(s, options)) < 0)
 return ret;
 
-if (s->oformat->write_header && !s->oformat->check_bitstream) {
+if (s->oformat->write_header && !(s->oformat->check_bitstream && s->flags 
& AVFMT_FLAG_AUTO_BSF)) {
 ret = s->oformat->write_header(s);
 if (ret >= 0 && s->pb && s->pb->error < 0)
 ret = s->pb->error;
@@ -1045,7 +1045,7 @@ int av_interleaved_write_frame(AVFormatContext *s, 
AVPacket *pkt)
 if (pkt) {
 AVStream *st = s->streams[pkt->stream_index];
 
-if (s->oformat->check_bitstream) {
+if (s->oformat->check_bitstream && s->flags & AVFMT_FLAG_AUTO_BSF) {
 if (!st->internal->bitstream_checked) {
 if ((ret = s->oformat->check_bitstream(s, pkt)) < 0)
 goto fail;
diff --git a/libavformat/options_table.h b/libavformat/options_table.h
index 0be5221..235cd01 100644
--- a/libavformat/options_table.h
+++ b/libavformat/options_table.h
@@ -39,7 +39,7 @@ static const AVOption avformat_options[] = {
 {"probesize", "set probing size", OFFSET(probesize), AV_OPT_TYPE_INT64, {.i64 
= 500 }, 32, INT64_MAX, D},
 {"formatprobesize", "number of bytes to probe file format", 
OFFSET(format_probesize), AV_OPT_TYPE_INT, {.i64 = PROBE_BUF_MAX}, 0, 
INT_MAX-1, D},
 {"packetsize", "set packet size", OFFSET(packet_size), AV_OPT_TYPE_INT, {.i64 
= DEFAULT }, 0, INT_MAX, E},
-{"fflags", NULL, OFFSET(flags), AV_OPT_TYPE_FLAGS, {.i64 = 
AVFMT_FLAG_FLUSH_PACKETS }, INT_MIN, INT_MAX, D|E, "fflags"},
+{"fflags", NULL, OFFSET(flags), AV_OPT_TYPE_FLAGS, {.i64 = 
AVFMT_FLAG_FLUSH_PACKETS | AVFMT_FLAG_AUTO_BSF }, INT_MIN, INT_MAX, D|E, 
"fflags"},
 {"flush_packets", "reduce the latency by flushing out packets immediately", 0, 
AV_OPT_TYPE_CONST, {.i64 = AVFMT_FLAG_FLUSH_PACKETS }, INT_MIN, INT_MAX, E, 
"fflags"},
 {"ignidx", "ignore index", 0, AV_OPT_TYPE_CONST, {.i64 = AVFMT_FLAG_IGNIDX }, 
INT_MIN, INT_MAX, D, "fflags"},
 {"genpts", "generate pts", 0, AV_OPT_TYPE_CONST, {.i64 = AVFMT_FLAG_GENPTS }, 
INT_MIN, INT_MAX, D, "fflags"},
@@ -54,6 +54,7 @@ static const AVOption avformat_options[] = {
 {"nobuffer", "reduce the latency introduced by optional buffering", 0, 
AV_OPT_TYPE_CONST, {.i64 = AVFMT_FLAG_NOBUFFER }, 0, INT_MAX, D, "fflags"},
 {"seek2any", "allow seeking to non-keyframes on demuxer level when supported", 
OFFSET(seek2any), AV_OPT_TYPE_BOOL, {.i64 = 0 }, 0, 1, D},
 {"bitexact", "do not write random/volatile data", 0, AV_OPT_TYPE_CONST, { .i64 
= AVFMT_FLAG_BITEXACT }, 0, 0, E, "fflags" },
+{"autobsf", "add needed bsfs automatically (delays header until each stream's 
first packet is written)", 0, AV_OPT_TYPE_CONST, { .i64 = AVFMT_FLAG_AUTO_BSF 
}, 0, 0, E, "fflags" },
 {"analyzeduration", "specify how many microseconds are analyzed to probe the 
input", OFFSET(max_analyze_duration), AV_OPT_TYPE_INT64, {.i64 = 0 }, 0, 
INT64_MAX, D},
 {"cryptokey", "decryption key", OFFSET(key), AV_OPT_TYPE_BINARY, {.dbl = 0}, 
0, 0, D},
 {"indexmem", "max memory used for timestamp index (per stream)", 
OFFSET(max_index_size), AV_OPT_TYPE_INT, {.i64 = 1<<20 }, 0, INT_MAX, D},
-- 
2.7.3

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


[FFmpeg-devel] [PATCH 04/11] lavf/mux: add avformat_init_output

2016-04-15 Thread Rodger Combs
This allows a consumer to run the muxer's init function without actually
writing the header, which is useful in chained muxers that support
automatic bitstream filtering.
---
 libavformat/avformat.h | 34 ++--
 libavformat/internal.h | 10 +
 libavformat/mux.c  | 61 +++---
 libavformat/version.h  |  2 +-
 4 files changed, 91 insertions(+), 16 deletions(-)

diff --git a/libavformat/avformat.h b/libavformat/avformat.h
index f240ab3..c331667 100644
--- a/libavformat/avformat.h
+++ b/libavformat/avformat.h
@@ -616,6 +616,8 @@ typedef struct AVOutputFormat {
  * AVStream parameters that need to be set before packets are sent.
  * This method must not write output.
  *
+ * Return 0 if streams were fully configured, 1 if not, negative AVERROR 
on failure
+ *
  * Any allocations made here must be freed in deinit().
  */
 int (*init)(struct AVFormatContext *);
@@ -2357,6 +2359,10 @@ void avformat_close_input(AVFormatContext **s);
  * @addtogroup lavf_encoding
  * @{
  */
+
+#define AVSTREAM_INIT_IN_WRITE_HEADER 0 ///< stream parameters initialized in 
avformat_write_header
+#define AVSTREAM_INIT_IN_INIT_OUTPUT  1 ///< stream parameters initialized in 
avformat_init_output
+
 /**
  * Allocate the stream private data and write the stream header to
  * an output media file.
@@ -2368,14 +2374,38 @@ void avformat_close_input(AVFormatContext **s);
  * On return this parameter will be destroyed and replaced 
with a dict containing
  * options that were not found. May be NULL.
  *
- * @return 0 on success, negative AVERROR on failure.
+ * @return AVSTREAM_INIT_IN_WRITE_HEADER on success if the codec had not 
already been fully initialized in avformat_init,
+ * AVSTREAM_INIT_IN_INIT_OUTPUT  on success if the codec had already 
been fully initialized in avformat_init,
+ * negative AVERROR on failure.
  *
- * @see av_opt_find, av_dict_set, avio_open, av_oformat_next.
+ * @see av_opt_find, av_dict_set, avio_open, av_oformat_next, 
avformat_init_output.
  */
 av_warn_unused_result
 int avformat_write_header(AVFormatContext *s, AVDictionary **options);
 
 /**
+ * Allocate the stream private data and initialize the codec, but do not write 
the header.
+ * May optionally be used before avformat_write_header to initialize stream 
parameters
+ * before actually writing the header.
+ * If using this function, do not pass the same options to 
avformat_write_header.
+ *
+ * @param s Media file handle, must be allocated with avformat_alloc_context().
+ *  Its oformat field must be set to the desired output format;
+ *  Its pb field must be set to an already opened AVIOContext.
+ * @param options  An AVDictionary filled with AVFormatContext and 
muxer-private options.
+ * On return this parameter will be destroyed and replaced 
with a dict containing
+ * options that were not found. May be NULL.
+ *
+ * @return AVSTREAM_INIT_IN_WRITE_HEADER on success if the codec requires 
avformat_write_header to fully initialize,
+ * AVSTREAM_INIT_IN_INIT_OUTPUT  on success if the codec has been 
fully initialized,
+ * negative AVERROR on failure.
+ *
+ * @see av_opt_find, av_dict_set, avio_open, av_oformat_next, 
avformat_write_header.
+ */
+av_warn_unused_result
+int avformat_init_output(AVFormatContext *s, AVDictionary **options);
+
+/**
  * Write a packet to an output media file.
  *
  * This function passes the packet directly to the muxer, without any buffering
diff --git a/libavformat/internal.h b/libavformat/internal.h
index 40ba089..964faa3 100644
--- a/libavformat/internal.h
+++ b/libavformat/internal.h
@@ -124,6 +124,16 @@ struct AVFormatInternal {
  * Whether or not a header has already been written
  */
 int header_written;
+
+/**
+ * Whether or not avformat_init has already been called
+ */
+int initialized;
+
+/**
+ * Whether or not avformat_init fully initialized streams
+ */
+int streams_initialized;
 };
 
 struct AVStreamInternal {
diff --git a/libavformat/mux.c b/libavformat/mux.c
index 5bc237f..5236afb 100644
--- a/libavformat/mux.c
+++ b/libavformat/mux.c
@@ -417,9 +417,12 @@ FF_ENABLE_DEPRECATION_WARNINGS
  *options = tmp;
 }
 
-if (s->oformat->init && (ret = s->oformat->init(s)) < 0) {
-s->oformat->deinit(s);
-goto fail;
+if (s->oformat->init) {
+if ((ret = s->oformat->init(s)) < 0) {
+s->oformat->deinit(s);
+return ret;
+}
+return ret == 0;
 }
 
 return 0;
@@ -466,13 +469,43 @@ static int init_pts(AVFormatContext *s)
 return 0;
 }
 
-int avformat_write_header(AVFormatContext *s, AVDictionary **options)
+int avformat_init_output(AVFormatContext *s, AVDictionary **options)
 {
 int ret = 0;
 
 if ((ret = init_muxer(s, options)) < 0)
 return ret;
 
+

[FFmpeg-devel] [PATCH 10/11] fate/h264: add automatic bsf test

2016-04-15 Thread Rodger Combs
---
 tests/fate/h264.mak | 2 ++
 tests/ref/fate/h264-autobsf-mp4toannexb | 1 +
 2 files changed, 3 insertions(+)
 create mode 100644 tests/ref/fate/h264-autobsf-mp4toannexb

diff --git a/tests/fate/h264.mak b/tests/fate/h264.mak
index eb42b12..0cdfc1f 100644
--- a/tests/fate/h264.mak
+++ b/tests/fate/h264.mak
@@ -197,6 +197,7 @@ FATE_H264-$(call DEMDEC, H264, H264) += $(FATE_H264)
 FATE_H264-$(call DEMDEC,  MOV, H264) += fate-h264-crop-to-container
 FATE_H264-$(call DEMDEC,  MOV, H264) += fate-h264-interlace-crop
 FATE_H264-$(call ALLYES, MOV_DEMUXER H264_MP4TOANNEXB_BSF) += 
fate-h264-bsf-mp4toannexb
+FATE_H264-$(call ALLYES, MOV_DEMUXER H264_MP4TOANNEXB_BSF MPEGTS_MUXER) += 
fate-h264-autobsf-mp4toannexb
 FATE_H264-$(call DEMDEC, MATROSKA, H264) += fate-h264-direct-bff
 FATE_H264_FFPROBE-$(call DEMDEC, MATROSKA, H264) += fate-h264-dts_5frames
 
@@ -393,6 +394,7 @@ fate-h264-conformance-sva_nl1_b:  CMD = 
framecrc -vsync drop -i
 fate-h264-conformance-sva_nl2_e:  CMD = framecrc -vsync drop 
-i $(TARGET_SAMPLES)/h264-conformance/SVA_NL2_E.264
 
 fate-h264-bsf-mp4toannexb:CMD = md5 -i 
$(TARGET_SAMPLES)/h264/interlaced_crop.mp4 -vcodec copy -bsf h264_mp4toannexb 
-f h264
+fate-h264-autobsf-mp4toannexb:CMD = md5 -i 
$(TARGET_SAMPLES)/h264/interlaced_crop.mp4 -vcodec copy -fflags +bitexact -f 
mpegts
 fate-h264-crop-to-container:  CMD = framemd5 -i 
$(TARGET_SAMPLES)/h264/crop-to-container-dims-canon.mov
 fate-h264-extreme-plane-pred: CMD = framemd5 -i 
$(TARGET_SAMPLES)/h264/extreme-plane-pred.h264
 fate-h264-interlace-crop: CMD = framecrc -i 
$(TARGET_SAMPLES)/h264/interlaced_crop.mp4 -vframes 3
diff --git a/tests/ref/fate/h264-autobsf-mp4toannexb 
b/tests/ref/fate/h264-autobsf-mp4toannexb
new file mode 100644
index 000..f2009d5
--- /dev/null
+++ b/tests/ref/fate/h264-autobsf-mp4toannexb
@@ -0,0 +1 @@
+9828dd0076b3f08da917fd92b4ca14ff
-- 
2.7.3

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


[FFmpeg-devel] [PATCH 05/11] lavf/segment: add deinit function

2016-04-15 Thread Rodger Combs
---
 libavformat/segment.c | 47 ---
 1 file changed, 20 insertions(+), 27 deletions(-)

diff --git a/libavformat/segment.c b/libavformat/segment.c
index df6f4b5..41d8e53 100644
--- a/libavformat/segment.c
+++ b/libavformat/segment.c
@@ -627,8 +627,9 @@ static int select_reference_stream(AVFormatContext *s)
 return 0;
 }
 
-static void seg_free_context(SegmentContext *seg)
+static void seg_free(AVFormatContext *s)
 {
+SegmentContext *seg = s->priv_data;
 ff_format_io_close(seg->avf, >list_pb);
 avformat_free_context(seg->avf);
 seg->avf = NULL;
@@ -688,7 +689,7 @@ static int seg_init(AVFormatContext *s)
 if (ret < 0) {
 av_log(s, AV_LOG_ERROR, "Could not parse format options list 
'%s'\n",
seg->format_options_str);
-goto fail;
+return ret;
 }
 }
 
@@ -702,7 +703,7 @@ static int seg_init(AVFormatContext *s)
 }
 if (!seg->list_size && seg->list_type != LIST_TYPE_M3U8) {
 if ((ret = segment_list_open(s)) < 0)
-goto fail;
+return ret;
 } else {
 const char *proto = avio_find_protocol_name(s->filename);
 seg->use_rename = proto && !strcmp(proto, "file");
@@ -713,29 +714,26 @@ static int seg_init(AVFormatContext *s)
 av_log(s, AV_LOG_WARNING, "'ext' list type option is deprecated in 
favor of 'csv'\n");
 
 if ((ret = select_reference_stream(s)) < 0)
-goto fail;
+return ret;
 av_log(s, AV_LOG_VERBOSE, "Selected stream id:%d type:%s\n",
seg->reference_stream_index,

av_get_media_type_string(s->streams[seg->reference_stream_index]->codecpar->codec_type));
 
 seg->oformat = av_guess_format(seg->format, s->filename, NULL);
 
-if (!seg->oformat) {
-ret = AVERROR_MUXER_NOT_FOUND;
-goto fail;
-}
+if (!seg->oformat)
+return AVERROR_MUXER_NOT_FOUND;
 if (seg->oformat->flags & AVFMT_NOFILE) {
 av_log(s, AV_LOG_ERROR, "format %s not supported.\n",
seg->oformat->name);
-ret = AVERROR(EINVAL);
-goto fail;
+return AVERROR(EINVAL);
 }
 
 if ((ret = segment_mux_init(s)) < 0)
-goto fail;
+return ret;
 
 if ((ret = set_segment_filename(s)) < 0)
-goto fail;
+return ret;
 oc = seg->avf;
 
 if (seg->write_header_trailer) {
@@ -743,13 +741,13 @@ static int seg_init(AVFormatContext *s)
   seg->header_filename ? seg->header_filename : 
oc->filename,
   AVIO_FLAG_WRITE, NULL)) < 0) {
 av_log(s, AV_LOG_ERROR, "Failed to open segment '%s'\n", 
oc->filename);
-goto fail;
+return ret;
 }
 if (!seg->individual_header_trailer)
 oc->pb->seekable = 0;
 } else {
 if ((ret = open_null_ctx(>pb)) < 0)
-goto fail;
+return ret;
 }
 
 av_dict_copy(, seg->format_options, 0);
@@ -757,13 +755,14 @@ static int seg_init(AVFormatContext *s)
 if (av_dict_count(options)) {
 av_log(s, AV_LOG_ERROR,
"Some of the provided format options in '%s' are not 
recognized\n", seg->format_options_str);
-ret = AVERROR(EINVAL);
-goto fail;
+av_dict_free();
+return AVERROR(EINVAL);
 }
+av_dict_free();
 
 if (ret < 0) {
 ff_format_io_close(oc, >pb);
-goto fail;
+return ret;
 }
 seg->segment_frame_count = 0;
 
@@ -785,17 +784,12 @@ static int seg_init(AVFormatContext *s)
 close_null_ctxp(>pb);
 }
 if ((ret = oc->io_open(oc, >pb, oc->filename, AVIO_FLAG_WRITE, 
NULL)) < 0)
-goto fail;
+return ret;
 if (!seg->individual_header_trailer)
 oc->pb->seekable = 0;
 }
 
-fail:
-av_dict_free();
-if (ret < 0)
-seg_free_context(seg);
-
-return ret;
+return 0;
 }
 
 static int seg_write_packet(AVFormatContext *s, AVPacket *pkt)
@@ -908,9 +902,6 @@ fail:
 seg->segment_frame_count++;
 }
 
-if (ret < 0)
-seg_free_context(seg);
-
 return ret;
 }
 
@@ -1035,6 +1026,7 @@ AVOutputFormat ff_segment_muxer = {
 .init   = seg_init,
 .write_packet   = seg_write_packet,
 .write_trailer  = seg_write_trailer,
+.deinit = seg_free,
 .check_bitstream = seg_check_bitstream,
 .priv_class = _class,
 };
@@ -1054,6 +1046,7 @@ AVOutputFormat ff_stream_segment_muxer = {
 .init   = seg_init,
 .write_packet   = seg_write_packet,
 .write_trailer  = seg_write_trailer,
+.deinit = seg_free,
 .check_bitstream = seg_check_bitstream,
 .priv_class = _class,
 };
-- 
2.7.3

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


[FFmpeg-devel] [PATCH 11/11] fate/aac: add automatic bsf test

2016-04-15 Thread Rodger Combs
---
 tests/fate/aac.mak   | 3 +++
 tests/ref/fate/aac-autobsf-adtstoasc | 1 +
 2 files changed, 4 insertions(+)
 create mode 100644 tests/ref/fate/aac-autobsf-adtstoasc

diff --git a/tests/fate/aac.mak b/tests/fate/aac.mak
index 3d64031..c71f990 100644
--- a/tests/fate/aac.mak
+++ b/tests/fate/aac.mak
@@ -241,10 +241,13 @@ FATE_AAC_LATM += fate-aac-latm_stereo_to_51
 fate-aac-latm_stereo_to_51: CMD = pcm -i 
$(TARGET_SAMPLES)/aac/latm_stereo_to_51.ts -channel_layout 5.1
 fate-aac-latm_stereo_to_51: REF = $(SAMPLES)/aac/latm_stereo_to_51_ref.s16
 
+fate-aac-autobsf-adtstoasc: CMD = md5 -i 
$(TARGET_SAMPLES)/audiomatch/tones_afconvert_16000_mono_aac_lc.adts -acodec 
copy -fflags +bitexact -f matroska
+
 FATE_AAC-$(call  DEMDEC, AAC,AAC)  += $(FATE_AAC_CT_RAW)
 FATE_AAC-$(call  DEMDEC, MOV,AAC)  += $(FATE_AAC)
 FATE_AAC_LATM-$(call DEMDEC, MPEGTS, AAC_LATM) += $(FATE_AAC_LATM)
 FATE_AAC-$(call  DEMDEC, AAC,AAC_FIXED)+= $(FATE_AAC_FIXED)
+FATE_AAC-$(call  DEMMUX, AAC,MATROSKA) += fate-aac-autobsf-adtstoasc
 
 FATE_AAC_ALL = $(FATE_AAC-yes) $(FATE_AAC_LATM-yes) $(FATE_AAC_FIXED-yes)
 
diff --git a/tests/ref/fate/aac-autobsf-adtstoasc 
b/tests/ref/fate/aac-autobsf-adtstoasc
new file mode 100644
index 000..41e8e7a
--- /dev/null
+++ b/tests/ref/fate/aac-autobsf-adtstoasc
@@ -0,0 +1 @@
+b25ed78285f5c9004e2b027b347d33b7
-- 
2.7.3

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


[FFmpeg-devel] [PATCH 01/11] lavf/mux: fix auto-inserted bsfs that read extradata

2016-04-15 Thread Rodger Combs
---
 libavformat/mux.c | 10 ++
 1 file changed, 10 insertions(+)

diff --git a/libavformat/mux.c b/libavformat/mux.c
index 33301f1..0ed0c3d 100644
--- a/libavformat/mux.c
+++ b/libavformat/mux.c
@@ -1054,6 +1054,16 @@ int av_interleaved_write_frame(AVFormatContext *s, 
AVPacket *pkt)
 }
 }
 
+if (!st->internal->avctx->extradata && st->codecpar->extradata) {
+int size = st->codecpar->extradata_size;
+if (size < 0 || size >= INT32_MAX - AV_INPUT_BUFFER_PADDING_SIZE)
+return AVERROR(EINVAL);
+st->internal->avctx->extradata = av_mallocz(size + 
AV_INPUT_BUFFER_PADDING_SIZE);
+if (!st->internal->avctx->extradata)
+return AVERROR(ENOMEM);
+st->internal->avctx->extradata_size = size;
+memcpy(st->internal->avctx->extradata, st->codecpar->extradata, 
size);
+}
 av_apply_bitstream_filters(st->internal->avctx, pkt, 
st->internal->bsfc);
 if (pkt->size == 0 && pkt->side_data_elems == 0)
 return 0;
-- 
2.7.3

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


[FFmpeg-devel] [PATCH 03/11] lavf/mux: run AVCodec::deinit if write_header fails

2016-04-15 Thread Rodger Combs
---
 libavformat/mux.c | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/libavformat/mux.c b/libavformat/mux.c
index aea9095..5bc237f 100644
--- a/libavformat/mux.c
+++ b/libavformat/mux.c
@@ -477,8 +477,11 @@ int avformat_write_header(AVFormatContext *s, AVDictionary 
**options)
 ret = s->oformat->write_header(s);
 if (ret >= 0 && s->pb && s->pb->error < 0)
 ret = s->pb->error;
-if (ret < 0)
+if (ret < 0) {
+if (s->oformat->deinit)
+s->oformat->deinit(s);
 return ret;
+}
 if (s->flush_packets && s->pb && s->pb->error >= 0 && s->flags & 
AVFMT_FLAG_FLUSH_PACKETS)
 avio_flush(s->pb);
 s->internal->header_written = 1;
-- 
2.7.3

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


Re: [FFmpeg-devel] [PATCH 2/2 v2] fate: add readvitc filter test

2016-04-15 Thread Tobias Rapp
Attached an updated patch, rebased onto current git master.

The sample file for the FATE test can be found at:
https://cerebrum.noa-archive.com/noacloud/public.php?service=filest=88eeb716819bba39584be03c2d1f053b
 (1.4MB)
and is assumed to be stored as $FATE_SAMPLES/filter/sample-vitc.avi

Sample file checksum:
md5:150ca9d1f6283f136ce14bd7a7cf025e
sha256: ec39eeda7587536a4c90ae14288e895defa8fc64c536eeca88b34899a963d42f

Regards,
Tobias
>From 64016c9270773a0f269c85b5fa4f7461e118286d Mon Sep 17 00:00:00 2001
From: Tobias Rapp 
Date: Thu, 7 Apr 2016 14:39:33 +0200
Subject: [PATCH 2/2] fate: add readvitc filter test

Signed-off-by: Tobias Rapp 
---
 tests/fate/filter-video.mak | 10 ++
 tests/ref/fate/filter-metadata-readvitc-def |  5 +
 tests/ref/fate/filter-metadata-readvitc-thr |  5 +
 3 files changed, 20 insertions(+)
 create mode 100644 tests/ref/fate/filter-metadata-readvitc-def
 create mode 100644 tests/ref/fate/filter-metadata-readvitc-thr

diff --git a/tests/fate/filter-video.mak b/tests/fate/filter-video.mak
index 348cb93..4b17d59 100644
--- a/tests/fate/filter-video.mak
+++ b/tests/fate/filter-video.mak
@@ -622,6 +622,16 @@ FATE_METADATA_FILTER-$(call ALLYES, $(EBUR128_METADATA_DEPS)) += fate-filter-met
 fate-filter-metadata-ebur128: SRC = $(TARGET_SAMPLES)/filter/seq-3341-7_seq-3342-5-24bit.flac
 fate-filter-metadata-ebur128: CMD = run $(FILTER_METADATA_COMMAND) "amovie='$(SRC)',ebur128=metadata=1"
 
+READVITC_METADATA_DEPS = FFPROBE LAVFI_INDEV MOVIE_FILTER AVCODEC AVDEVICE \
+ AVI_DEMUXER FFVHUFF_DECODER READVITC_FILTER
+FATE_METADATA_FILTER-$(call ALLYES, $(READVITC_METADATA_DEPS)) += fate-filter-metadata-readvitc-def
+fate-filter-metadata-readvitc-def: SRC = $(TARGET_SAMPLES)/filter/sample-vitc.avi
+fate-filter-metadata-readvitc-def: CMD = run $(FILTER_METADATA_COMMAND) "movie='$(SRC)',readvitc"
+
+FATE_METADATA_FILTER-$(call ALLYES, $(READVITC_METADATA_DEPS)) += fate-filter-metadata-readvitc-thr
+fate-filter-metadata-readvitc-thr: SRC = $(TARGET_SAMPLES)/filter/sample-vitc.avi
+fate-filter-metadata-readvitc-thr: CMD = run $(FILTER_METADATA_COMMAND) "movie='$(SRC)',readvitc=thr_b=0.3:thr_w=0.5"
+
 tests/data/file4560-override2rotate0.mov: TAG = GEN
 tests/data/file4560-override2rotate0.mov: ffmpeg$(PROGSSUF)$(EXESUF) | tests/data
 	$(M)$(TARGET_EXEC) $(TARGET_PATH)/$< \
diff --git a/tests/ref/fate/filter-metadata-readvitc-def b/tests/ref/fate/filter-metadata-readvitc-def
new file mode 100644
index 000..8a650f1
--- /dev/null
+++ b/tests/ref/fate/filter-metadata-readvitc-def
@@ -0,0 +1,5 @@
+pkt_pts=0|tag:lavfi.readvitc.found=0
+pkt_pts=1|tag:lavfi.readvitc.found=1|tag:lavfi.readvitc.tc_str=05:01:02:21
+pkt_pts=2|tag:lavfi.readvitc.found=1|tag:lavfi.readvitc.tc_str=05:01:02:22
+pkt_pts=3|tag:lavfi.readvitc.found=1|tag:lavfi.readvitc.tc_str=05:01:02:23
+pkt_pts=4|tag:lavfi.readvitc.found=0
diff --git a/tests/ref/fate/filter-metadata-readvitc-thr b/tests/ref/fate/filter-metadata-readvitc-thr
new file mode 100644
index 000..4086663
--- /dev/null
+++ b/tests/ref/fate/filter-metadata-readvitc-thr
@@ -0,0 +1,5 @@
+pkt_pts=0|tag:lavfi.readvitc.found=1|tag:lavfi.readvitc.tc_str=05:01:02:20
+pkt_pts=1|tag:lavfi.readvitc.found=1|tag:lavfi.readvitc.tc_str=05:01:02:21
+pkt_pts=2|tag:lavfi.readvitc.found=1|tag:lavfi.readvitc.tc_str=05:01:02:22
+pkt_pts=3|tag:lavfi.readvitc.found=1|tag:lavfi.readvitc.tc_str=05:01:02:23
+pkt_pts=4|tag:lavfi.readvitc.found=1|tag:lavfi.readvitc.tc_str=05:01:02:24
-- 
1.9.1

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


Re: [FFmpeg-devel] [PATCH 1/2 v5] avfilter: add readvitc filter

2016-04-15 Thread Tobias Rapp

On 14.04.2016 22:29, Michael Niedermayer wrote:

On Thu, Apr 14, 2016 at 08:49:58AM +0200, Tobias Rapp wrote:

On 08.04.2016 17:01, Tobias Rapp wrote:

On 08.04.2016 15:24, Tobias Rapp wrote:

On 08.04.2016 14:54, Paul B Mahol wrote:

On 4/8/16, Tobias Rapp  wrote:

On 08.04.2016 12:48, Carl Eugen Hoyos wrote:

Tobias Rapp  noa-archive.com> writes:


AV_PIX_FMT_YUV440P? Also J variants...


Good catch, I was lazy and just copied the function from vf_eq.c. The
updated patch should contain all pixel formats with planar 8bit luma
component.


Instead of listing the formats, check for pix_fmts
that are 8bit and planar.


That might be an even better idea. Working on v3 of the patch I noticed
that YA8 (which was on the list of v2) is not planar, but NV12 and NV21
(which were missing in v2) have a planar Y.

Have attached version 3 of the patch which:
- filters the list of all pixel formats dynamically
- supports thr_b and thr_w parameters having the same value
- updates the warning if thr_b == thr_w to print the parameter value
instead of the internal 8-bit value
- has reduced number of parentheses in CRC code

Regards,
Tobias



Now, when someone adds 8bit X planar format which is not YUV it will
break.


It depends on whether the equation "is_yuv_or_gray = (desc->flags &
AV_PIX_FMT_FLAG_RGB) == 0)" can be made or not. The comment in
libavutil/pixdesc.h made me assume it is safe to do so:

"""
/**
  * The pixel format contains RGB-like data (as opposed to
YUV/grayscale).
  */
#define AV_PIX_FMT_FLAG_RGB  (1 << 5)
"""

So what has more weight, the aspect of defensive programming or the cost
of maintaining a static list?


Attached patch v4 contains the more defensive static-pixfmt-list
approach together with the threshold changes from v3.


Any further comments or suggestions? Who feels responsible for
pushing this (and the FATE test after uploading the sample) in case
nobody objects?


tried to apply the patch locally, but fails

[...]


Have attached an updated patch rebased upon current git master. Took the 
chance to add an example to doc/filters.texi.


Noticed that the libavfilter minor version bump got lost in the merge, 
apparently due to commit 8688d3af39e8cd8848e74407998777dd5aad3863. Hope 
it is OK?


Regards,
Tobias
>From 73e130023018a14d1f1c96f9e51c9a96e97cc9e6 Mon Sep 17 00:00:00 2001
From: Tobias Rapp 
Date: Wed, 6 Apr 2016 16:25:53 +0200
Subject: [PATCH 1/2] avfilter: add readvitc filter

Add a filter to scan the top lines of video frames for vertical interval
timecode (VITC) information and attach it as metadata keys.

Signed-off-by: Tobias Rapp 
---
 Changelog |   1 +
 MAINTAINERS   |   1 +
 doc/filters.texi  |  37 +++
 libavfilter/Makefile  |   1 +
 libavfilter/allfilters.c  |   1 +
 libavfilter/vf_readvitc.c | 258 ++
 6 files changed, 299 insertions(+)
 create mode 100644 libavfilter/vf_readvitc.c

diff --git a/Changelog b/Changelog
index 5c12d78..c837fde 100644
--- a/Changelog
+++ b/Changelog
@@ -24,6 +24,7 @@ version :
 - remap filter
 - hash and framehash muxers
 - colorspace filter
+- readvitc filter
 
 version 3.0:
 - Common Encryption (CENC) MP4 encoding and decoding support
diff --git a/MAINTAINERS b/MAINTAINERS
index a993a67..d2593e5 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -385,6 +385,7 @@ Filters:
   vf_neighbor.c Paul B Mahol
   vf_psnr.c Paul B Mahol
   vf_random.c   Paul B Mahol
+  vf_readvitc.c Tobias Rapp (CC t.rapp at noa-archive dot com)
   vf_scale.cMichael Niedermayer
   vf_separatefields.c   Paul B Mahol
   vf_ssim.c Paul B Mahol
diff --git a/doc/filters.texi b/doc/filters.texi
index 0b80fd1..1909176 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -10613,6 +10613,43 @@ less than @code{0}, the filter will try to use a good random seed on a
 best effort basis.
 @end table
 
+@section readvitc
+
+Read vertical interval timecode (VITC) information from the top lines of a
+video frame.
+
+The filter adds frame metadata key @code{lavfi.readvitc.tc_str} with the
+timecode value, if a valid timecode has been detected. Further metadata key
+@code{lavfi.readvitc.found} is set to 0/1 depending on whether
+timecode data has been found or not.
+
+This filter accepts the following options:
+
+@table @option
+@item scan_max
+Set the maximum number of lines to scan for VITC data. If the value is set to
+@code{-1} the full video frame is scanned. Default is @code{45}.
+
+@item thr_b
+Set the luma threshold for black. Accepts float numbers in the range [0.0,1.0],
+default value is @code{0.2}. The value must be equal or less than @code{thr_w}.
+
+@item thr_w
+Set the luma threshold for white. Accepts float numbers in the range [0.0,1.0],