Re: [FFmpeg-devel] [PATCH] lavf: add ffprobe demuxer

2016-09-23 Thread wm4
On Thu, 22 Sep 2016 18:50:27 +0200
Stefano Sabatini  wrote:

> On date Sunday 2016-09-18 15:28:45 +0200, Stefano Sabatini encoded:
> > On date Saturday 2016-09-17 18:42:35 +0200, Paul B Mahol encoded:  
> > > On 9/17/16, Stefano Sabatini  wrote:  
> > > > On date Sunday 2016-09-04 23:25:56 +0200, Michael Niedermayer encoded:  
> > > >> On Sun, Sep 04, 2016 at 06:24:37PM +0200, Stefano Sabatini wrote:  
> > > >> > From: Nicolas George 
> > > >> >
> > > >> > With several modifications and documentation by Stefano Sabatini
> > > >> > .
> > > >> >
> > > >> > Signed-off-by: Nicolas George 
> > > >> > ---
> > > >> >  doc/ffprobe-format.texi  | 130 
> > > >> >  libavformat/Makefile |   1 +
> > > >> >  libavformat/allformats.c |   2 +
> > > >> >  libavformat/ffprobedec.c | 397
> > > >> > +++
> > > >> >  4 files changed, 530 insertions(+)
> > > >> >  create mode 100644 doc/ffprobe-format.texi
> > > >> >  create mode 100644 libavformat/ffprobedec.c  
> > > >>
> > > >> this seems not to apply cleanly
> > > >>
> > > >> can i pick this from some git repo ? (should work better than patch
> > > >> with unavailable ancestors)  
> > > >
> > > > Updated, this should apply cleanly on master.  
> > > 
> > > Why we need this hack?  
> > 
> > My use case: I need to inject a metadata stream using the ff*
> > tools. Metadata must be specified in a textual format. I already
> > designed and implemented the fftextdata format, but that was regarded
> > too limited.
> > 
> > Example:
> > ffmpeg -i input.mp4 -copyts -i data.ffprobe -map 0:v -map 0:a -map 1:0 
> > -codec:d copy input+data.ts
> > 
> > With this format we allow to cover my use case, and it provides a more
> > generic format for such purposes (since you can specify multiple
> > streams). Also, it's inspired by the ffprobe output, so it can be used
> > together with ffprobe (via simple text editing) to generate files
> > which can be edited and feed to ffmpeg.
> > 
> > It would be possible to use any binary format for injecting the
> > metadata, but this approach is not very scriptable. Alternatively a
> > custom program to convert a custom textual format to any binary format
> > we support, but this would imply an additional step I want to avoid.
> > 
> > That said, if someone want/can propose an alternative path to this I'm
> > very open to suggestions.  
> 
> Ping. I'd like to commit this if there are no objections. Also,
> possibly add a muxer to generate output directly readable by the
> demuxer (this way we don't need ffprobe for generating the output, and
> we avoid the ordering issue).

I'm sorry to jump in as a nay-sayer, but it looks like a quite fishy
concept and I still don't get why it's supposed to be needed. The
documentation also doesn't say what this is supposed to be useful for.

It's also potentially a security issue (lots of text parsing, and can
construct inputs which might be tricky for API users).

I probably can't stop you from pushing this, but at least it shouldn't
be enabled by default.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] ffmpeg: switch to codecpar

2016-09-23 Thread wm4
On Tue, 20 Sep 2016 14:44:47 +0200
Clément Bœsch  wrote:

> On Tue, Sep 20, 2016 at 01:46:11PM +0200, Hendrik Leppkes wrote:
> [...]
> > > +/*
> > > + * For subtitles, this is required by the decoding process in 
> > > order to
> > > + * rescale the timestamps: in the current API the decoded 
> > > subtitles
> > > + * have their pts expressed in AV_TIME_BASE, and thus the lavc
> > > + * internals need to know the stream time base in order to 
> > > achieve the
> > > + * rescaling.
> > > + *
> > > + * That API is old and needs to be reworked to match behaviour 
> > > with A/V
> > > + * (FIXME).
> > > + *
> > > + * For Audio, this is apparently required for the
> > > + * fate-gaplessenc-itunes-to-ipod-aac test (FIXME).
> > > + */
> > > +if (ist->dec_ctx->codec_type == AVMEDIA_TYPE_SUBTITLE ||
> > > +ist->dec_ctx->codec_type == AVMEDIA_TYPE_AUDIO)
> > > +av_codec_set_pkt_timebase(ist->dec_ctx, ist->st->time_base);
> > > +  
> > 
> > I didn't look at the surrounding code much, so maybe I'm out of
> > context here, but I would think setting pkt_timebase on the decoder is
> > generally not a bad thing, for any type of codec?
> > Audio uses it to skip samples, subtitles for rescaling timestamps, at
> > least the cuvid video decoder uses it to rescale timestamps for the
> > external API as well.
> > 
> > So maybe set it unconditionally? Setting pkt_timebase is not a bad
> > thing, I would think. It was probably copied from the st->codec
> > before, as well.  

+1

> 
> If that's fine with everyone I can drop the condition and comment. But
> generally speaking, aside from subtitles it looks like it mostly works
> when it's not set, so should we warn when the user doesn't set it in order
> to avoid random undefined behaviour?

You mean within libavcodec? Maybe, but only f the decoder absolutely
needs it, not unconditionally.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] avfilter: add dynoverlay filter.

2016-09-23 Thread wm4
On Thu, 22 Sep 2016 18:45:43 +
"Priebe, Jason"  wrote:

> This patch adds a new filter that allows you to drive dynamic graphic overlays
> on a live encoding by creating/updating/deleting a specified 32-bit PNG.
> This is very different from the overlay filter, because it lets you change
> the overlay in real time during a live stream.  It doesn't allow you to 
> overlay
> video on top of video, but you can overlay still images over video, which is
> useful for things like lower-thirds and fullscreen graphics.

This seems like a very odd approach, and the filter seems to have very
limited usefulness.

Why can't this be a bit more general? Like providing an API to set
overlay images, and letting ffmpeg.c use it to e.g. load from a file in
intervals. Rather than hardcoding yet another CLU use-case in the libs.

We already have a long list of filters that seem to hardcode such
things.

Most importantly, it definitely shouldn't duplicate any blending code.

> +
> +static unsigned long long get_current_time_ms (void)
> +{
> + unsigned long long ms_since_epoch;
> + struct timespec spec;
> +
> + clock_gettime(CLOCK_REALTIME, &spec);

Unportable.

> +
> + ms_since_epoch =
> + (unsigned long long)(spec.tv_sec) * 1000 +
> + (unsigned long long)(spec.tv_nsec) / 1.0e6;
> +
> + return ms_since_epoch;
> +}
> +
> +static int load_overlay (AVFilterContext *fctx)
> +{
> + DynOverlayContext *ctx = fctx->priv;
> +
> + AVFrame *rgba_frame;
> +
> + struct stat attrib;
> + int ret;
> +
> + if ((ret = stat(ctx->overlayfile, &attrib)) != 0)

Not sure if portable.

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


[FFmpeg-devel] Searchable archives for ffmpeg-devel and ffmpeg-cvslog

2016-09-23 Thread Robert Krüger
Hi,

I am looking for searchable archives of ffmpeg-devel and ffmpeg-cvslog. I
used to use gmane but that seems to no longer work.

Would be great if someone has a hint. I can't imagine that people out there
search ml archives by going through them month by month.

Cheers,

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


Re: [FFmpeg-devel] Searchable archives for ffmpeg-devel and ffmpeg-cvslog

2016-09-23 Thread Paul B Mahol
On 9/23/16, Robert Krueger  wrote:
> Hi,
>
> I am looking for searchable archives of ffmpeg-devel and ffmpeg-cvslog. I
> used to use gmane but that seems to no longer work.
>
> Would be great if someone has a hint. I can't imagine that people out there
> search ml archives by going through them month by month.

Simply fetch all gziped archives on your local disk?
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH] x86/h264_weight: use appropriate register size for weight parameters

2016-09-23 Thread Hendrik Leppkes
Fixes trac 5579
---
 libavcodec/x86/h264_weight.asm | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/libavcodec/x86/h264_weight.asm b/libavcodec/x86/h264_weight.asm
index 6c57d57..0975d74 100644
--- a/libavcodec/x86/h264_weight.asm
+++ b/libavcodec/x86/h264_weight.asm
@@ -134,16 +134,16 @@ WEIGHT_FUNC_HALF_MM 8, 8
 mov  off_regd, r7m
 add  off_regd, 1
 or   off_regd, 1
-addr4, 1
-cmpr6d, 128
+add   r4d, 1
+cmp   r6d, 128
 je .nonnormal
-cmpr5, 128
+cmp   r5d, 128
 jne .normal
 .nonnormal:
-sarr5, 1
-sarr6, 1
+sar   r5d, 1
+sar   r6d, 1
 sar  off_regd, 1
-subr4, 1
+sub   r4d, 1
 .normal:
 %if cpuflag(ssse3)
 movd   m4, r5d
-- 
2.10.0.windows.1

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


Re: [FFmpeg-devel] [PATCH] avfilter: add dynoverlay filter.

2016-09-23 Thread Paul B Mahol
On 9/23/16, Priebe, Jason  wrote:
> Thanks for the detailed review of the code, Paul.  You caught some dumb
> mistakes that I should have picked up on before I sent the submission.
>
>> dynoverlay sounds very powerful, but this filter funcionality is very
>> limited.
>
> True, it is limited, but it does something that no other filter does (I am
> interested in your named pipe idea, though -- see note at the end).
>
>> What's up with code identation?
>
> I don't know -- I didn't realize there was a problem.  I'm just using vi;
> maybe
> it formatted stuff in a funny way.  Or maybe you don't like my braces on new
> lines?
>
>> > +If the named PNG file does not exist, the filter will do nothing.
>>
>> I do not like this design. Supporting only PNG with RGBA, working only
>> in YUV420P.
>
> I built the filter to satisfy a specific need; I thought that maybe others
> who needed other formats could add in the support for those formats later.
> I thought I saw some filters in ffmpeg that only support specific formats,
> so I didn't realize that was a problem.
>
>> > +@item check_interval
>> > +(optional) The interval (in ms) between checks for updates to the
>> > overlay
>> > file. For
>> > +efficiency, the filter does not check the filesystem on every frame.
>> > You
>> > can make
>> > +it check more frequently (less efficient, but more responsive to
>> > changes in
>> > the
>> > +overlay PNG) by specifying a lower number. Or you can make it check
>> > less
>> > frequently
>> > +(more efficient, but less responsive to changes in the overlay PNG) by
>> > specifying
>> > +a higher number.
>> > +
>> > +Default value is @code{250}.
>> > +@end table
>>
>> This approach is bad to provide such functionality.
>
> Why?  Yes, it's a lot of system calls, but it's still performant, so is
> it fundamentally wrong?
>
>> > + -vf format=pix_fmts=yuv420p \
>> > + -vf dynoverlay=overlayfile=/var/tmp/overlay.png:check_interval=100 \
>>
>> You can not give more than one -vf's, only one will ever be used.
>
> My mistake - I was trying to take a much more complicated example and
> distill it
> down and anonymize it.
>
>> > +#include 
>> > ... many headers omitted ...
>> > +#include "libavutil/lfg.h"
>>
>> Are all those headers really needed?
>
> Probably not; I could try to pare it down.
>
>> > + if (ctx->overlay_frame)
>> > + {
>> > + // TODO - make sure we have freed everything
>> > + av_freep(&ctx->overlay_frame->data[0]);
>> > + }
>> > + ctx->overlay_frame = NULL;
>>
>> This is wrong.
>
> Thanks for catching this; I should use av_frame_free(), right?
>
>> > + if (ctx->overlay_frame)
>> > + {
>>
>> Check is not needed.
>>
>> > + av_frame_free (&ctx->overlay_frame);
>> > + }
>> > + ctx->overlay_frame = NULL;
>>
>> Not needed.
>
> Does this mean that it is safe to call av_frame_free() with NULL ?
>
>> I think much better approach is to use named pipes, probably as
>> separate video filter source.
>
> I would love to see an example of this technique.  Based on what I read
> online
> (http://ffmpeg.gusari.org/viewtopic.php?f=11&t=2774 for example), I didn't
> think this technique worked.  And even if it could work, wouldn't I need a
> process
> that is constantly generating frame data from PNGs to feed it to ffmpeg,
> which
> then has to read it 30 times a second (when it only changes every 2-3
> *minutes*).

Named pipe approach would implement video source which would read images
from named pipe. It would read from named pipe until it decodes single frame
and then would use that frame as input to next filter, for example
overlay filter.
If it encounters EOF in named pipe it would not abort but would instead keep
sending last frame it got, for example completely transparent frame.
If it suddenly get more data from pipe it would update its internal
frame and output
it as input to next filter in chain.

So command would look like this:

imagepipe=named_pipe:rate=30[o],[0:v][o]overlay=x=0:y=0 ...

And than in another terminal, you would use commands like this:

cat random_image.format > named_pipe
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] avformat/matroskadec: retain error codes in matroska_resync() and matroska_read_packet()

2016-09-23 Thread Benoit Fouet

Hi,


On 22/09/2016 23:03, Sophia Wang wrote:

Signed-off-by: Sophia Wang 
---
  libavformat/matroskadec.c | 13 -
  1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
index 77b8a5d..936690d 100644
--- a/libavformat/matroskadec.c
+++ b/libavformat/matroskadec.c
@@ -738,13 +738,16 @@ static int matroska_read_close(AVFormatContext *s);
  static int matroska_resync(MatroskaDemuxContext *matroska, int64_t last_pos)
  {
  AVIOContext *pb = matroska->ctx->pb;
+int64_t ret;
  uint32_t id;
  matroska->current_id = 0;
  matroska->num_levels = 0;
  
  /* seek to next position to resync from */

-if (avio_seek(pb, last_pos + 1, SEEK_SET) < 0)
-goto eof;
+if ((ret = avio_seek(pb, last_pos + 1, SEEK_SET)) < 0) {
+matroska->done = 1;
+return ret;


doesn't this generate a warning, returning an int64 from a function 
supposed to return an int?



+}
  
  id = avio_rb32(pb);
  
@@ -760,7 +763,6 @@ static int matroska_resync(MatroskaDemuxContext *matroska, int64_t last_pos)

  id = (id << 8) | avio_r8(pb);
  }
  
-eof:

  matroska->done = 1;
  return AVERROR_EOF;
  }
@@ -3317,13 +3319,14 @@ static int matroska_parse_cluster(MatroskaDemuxContext 
*matroska)
  static int matroska_read_packet(AVFormatContext *s, AVPacket *pkt)
  {
  MatroskaDemuxContext *matroska = s->priv_data;
+int ret = 0;
  
  while (matroska_deliver_packet(matroska, pkt)) {

  int64_t pos = avio_tell(matroska->ctx->pb);
  if (matroska->done)
-return AVERROR_EOF;
+return (ret < 0) ? ret : AVERROR_EOF;
  if (matroska_parse_cluster(matroska) < 0)
-matroska_resync(matroska, pos);
+ret = matroska_resync(matroska, pos);
  }
  
  return 0;


You might want to return ret instead of 0 here.

--
Ben

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


Re: [FFmpeg-devel] Searchable archives for ffmpeg-devel and ffmpeg-cvslog

2016-09-23 Thread Robert Krüger
On Fri, Sep 23, 2016 at 10:13 AM, Paul B Mahol  wrote:

> On 9/23/16, Robert Krueger  wrote:
> > Hi,
> >
> > I am looking for searchable archives of ffmpeg-devel and ffmpeg-cvslog. I
> > used to use gmane but that seems to no longer work.
> >
> > Would be great if someone has a hint. I can't imagine that people out
> there
> > search ml archives by going through them month by month.
>
> Simply fetch all gziped archives on your local disk?


as a last resort, yes but find/grep is not really a good replacement for an
archive search. I just thought there must be a place where the mls of one
of the most important oss projects of the planet are archived in such a way.

I just found that they are both at mail-archive.com in case someone else is
looking.


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


Re: [FFmpeg-devel] [PATCH 1/3] avcodec: add new AVOID_PROBING capability

2016-09-23 Thread Timo Rothenpieler
series applied
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] avformat/hlsenc: refine EXT-X-BYTERANGE support for segments

2016-09-23 Thread Steven Liu
ping

2016-09-19 7:01 GMT+08:00 Steven Liu :

>
>
> 2016-09-19 0:24 GMT+08:00 Moritz Barsnick :
>
>> On Sun, Sep 18, 2016 at 23:40:34 +0800, Steven Liu wrote:
>>
>> > +if (byterange_mode) {
>> > +version = 4;
>> > +sequence = byterange_mode ? 0 : sequence;
>>
>> What does the ternary if-then-else operation do here? Two lines above,
>> byterange_mode was checked for !=0, how can it be anything else here?
>>
>> > +av_log(oc, AV_LOG_ERROR, "Invalid segment filename
>> template '%s', you can try use -use_localtime 1 with it\n", c->basename);
>>
>> "try to use"
>>
>> > +if ((outer_st->codecpar->codec_type ==
>> AVMEDIA_TYPE_VIDEO) &&
>> > +outer_st->codecpar->bit_rate > hls->max_seg_size) {
>>
>> Inconsistent use of brackets: The "==" comparison has extra brackets,
>> the ">" comparison doesn't. (Or am I missing something with operator
>> precedence?)
>>
>> > +av_log(s, AV_LOG_WARNING, "Your video bitrate is
>> bigger than hls_segment_size, "
>> > +   "%"PRId64 " > %" PRId64" ( video birate >
>> hls_segment_size ),the result maybe not you want.",
>>
>> Apart from the peculiar placement of brackets in the message, I think
>> the brackets and their content is not needed, duplicate.
>>
>> And the sentence should end "the result may not be what you want".
>>
>> > +if (hls->start_pos >= hls->max_seg_size ) {
>>
>> Wrong bracket style (whitespace).
>>
>> > +{"hls_segment_size", "set maximum size per segment file, (in
>> bytes)",  OFFSET(max_seg_size),AV_OPT_TYPE_INT,{.i64 = 0},
>>  0,   INT_MAX,   E},
>>
>> You can actually drop the word "set ", as well as the comma before the
>> brackets.
>>
>> Moritz
>> ___
>> ffmpeg-devel mailing list
>> ffmpeg-devel@ffmpeg.org
>> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>>
>
>
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] x86/h264_weight: use appropriate register size for weight parameters

2016-09-23 Thread Ronald S. Bultje
Hi,

On Fri, Sep 23, 2016 at 4:21 AM, Hendrik Leppkes 
wrote:

> Fixes trac 5579
> ---
>  libavcodec/x86/h264_weight.asm | 12 ++--
>  1 file changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/libavcodec/x86/h264_weight.asm b/libavcodec/x86/h264_weight.
> asm
> index 6c57d57..0975d74 100644
> --- a/libavcodec/x86/h264_weight.asm
> +++ b/libavcodec/x86/h264_weight.asm
> @@ -134,16 +134,16 @@ WEIGHT_FUNC_HALF_MM 8, 8
>  mov  off_regd, r7m
>  add  off_regd, 1
>  or   off_regd, 1
> -addr4, 1
> -cmpr6d, 128
> +add   r4d, 1
> +cmp   r6d, 128
>  je .nonnormal
> -cmpr5, 128
> +cmp   r5d, 128
>  jne .normal
>  .nonnormal:
> -sarr5, 1
> -sarr6, 1
> +sar   r5d, 1
> +sar   r6d, 1
>  sar  off_regd, 1
> -subr4, 1
> +sub   r4d, 1
>  .normal:
>  %if cpuflag(ssse3)
>  movd   m4, r5d
>

LGTM.

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


Re: [FFmpeg-devel] [PATCH] x86/h264_weight: use appropriate register size for weight parameters

2016-09-23 Thread Michael Niedermayer
On Fri, Sep 23, 2016 at 10:21:27AM +0200, Hendrik Leppkes wrote:
> Fixes trac 5579
> ---
>  libavcodec/x86/h264_weight.asm | 12 ++--
>  1 file changed, 6 insertions(+), 6 deletions(-)

acked-by: michael
i saw these too but hadnt had the time to write and test a fix yet

thanks!

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

Its not that you shouldnt use gotos but rather that you should write
readable code and code with gotos often but not always is less readable


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


Re: [FFmpeg-devel] [PATCH] x86/h264_weight: use appropriate register size for weight parameters

2016-09-23 Thread Hendrik Leppkes
On Fri, Sep 23, 2016 at 4:19 PM, Michael Niedermayer
 wrote:
> On Fri, Sep 23, 2016 at 10:21:27AM +0200, Hendrik Leppkes wrote:
>> Fixes trac 5579
>> ---
>>  libavcodec/x86/h264_weight.asm | 12 ++--
>>  1 file changed, 6 insertions(+), 6 deletions(-)
>
> acked-by: michael
> i saw these too but hadnt had the time to write and test a fix yet
>
> thanks!
>

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


[FFmpeg-devel] [PATCH v2 1/5] lavd: Add SDL2 output device

2016-09-23 Thread Josh de Kock
Acked-by: Michael Niedermayer
Signed-off-by: Josh de Kock 
---
 Changelog|   1 +
 configure|  28 +++-
 libavdevice/Makefile |   1 +
 libavdevice/alldevices.c |   1 +
 libavdevice/sdl2.c   | 377 +++
 5 files changed, 407 insertions(+), 1 deletion(-)
 create mode 100644 libavdevice/sdl2.c

diff --git a/Changelog b/Changelog
index 2d0a449..5d9141b 100644
--- a/Changelog
+++ b/Changelog
@@ -31,6 +31,7 @@ version :
 - MediaCodec HEVC decoding
 - TrueHD encoder
 - Meridian Lossless Packing (MLP) encoder
+- sdl2 output device
 
 
 version 3.1:
diff --git a/configure b/configure
index af3fbf4..d76b846 100755
--- a/configure
+++ b/configure
@@ -292,6 +292,7 @@ External library support:
   --disable-schannel   disable SChannel SSP, needed for TLS support on
Windows if openssl and gnutls are not used 
[autodetect]
   --disable-sdldisable sdl [autodetect]
+  --disable-sdl2   disable sdl2 [autodetect]
   --disable-securetransport disable Secure Transport, needed for TLS support
on OSX if openssl and gnutls are not used 
[autodetect]
   --enable-x11grab enable X11 grabbing (legacy) [no]
@@ -1548,6 +1549,7 @@ EXTERNAL_LIBRARY_LIST="
 openssl
 schannel
 sdl
+sdl2
 securetransport
 videotoolbox
 x11grab
@@ -2022,6 +2024,7 @@ HAVE_LIST="
 perl
 pod2man
 sdl
+sdl2
 section_data_rel_ro
 texi2html
 threads
@@ -2948,6 +2951,7 @@ pulse_outdev_deps="libpulse"
 qtkit_indev_extralibs="-framework QTKit -framework Foundation -framework 
QuartzCore"
 qtkit_indev_select="qtkit"
 sdl_outdev_deps="sdl"
+sdl2_outdev_deps="sdl2"
 sndio_indev_deps="sndio_h"
 sndio_outdev_deps="sndio_h"
 v4l_indev_deps="linux_videodev_h"
@@ -5853,7 +5857,28 @@ if enabled gcrypt; then
 fi
 fi
 
-if ! disabled sdl; then
+if ! disabled sdl2 && ! enabled sdl; then
+SDL2_CONFIG="${cross_prefix}sdl2-config"
+if check_pkg_config sdl2 SDL_events.h SDL_PollEvent; then
+check_cpp_condition SDL.h "(SDL_MAJOR_VERSION<<16 | 
SDL_MINOR_VERSION<<8 | SDL_PATCHLEVEL) >= 0x020001" $sdl2_cflags &&
+check_cpp_condition SDL.h "(SDL_MAJOR_VERSION<<16 | 
SDL_MINOR_VERSION<<8 | SDL_PATCHLEVEL) < 0x020100" $sdl2_cflags &&
+check_lib SDL.h $sdl2_libs $sdl2_cflags && enable sdl2
+else
+  if "${SDL2_CONFIG}" --version > /dev/null 2>&1; then
+sdl2_cflags=$("${SDL2_CONFIG}" --cflags)
+sdl2_libs=$("${SDL2_CONFIG}" --libs)
+check_cpp_condition SDL.h "(SDL_MAJOR_VERSION<<16 | 
SDL_MINOR_VERSION<<8 | SDL_PATCHLEVEL) >= 0x020001" $sdl2_cflags &&
+check_cpp_condition SDL.h "(SDL_MAJOR_VERSION<<16 | 
SDL_MINOR_VERSION<<8 | SDL_PATCHLEVEL) < 0x020100" $sdl2_cflags &&
+check_lib SDL.h $sdl2_libs $sdl2_cflags && enable sdl2
+  fi
+fi
+if test $target_os = "mingw32"; then
+sdl2_libs="$sdl2_libs -mconsole"
+fi
+fi
+enabled sdl2 && add_cflags $sdl2_cflags && add_extralibs $sdl2_libs
+
+if ! disabled sdl && ! enabled sdl2; then
 SDL_CONFIG="${cross_prefix}sdl-config"
 if check_pkg_config sdl SDL_events.h SDL_PollEvent; then
 check_cpp_condition SDL.h "(SDL_MAJOR_VERSION<<16 | 
SDL_MINOR_VERSION<<8 | SDL_PATCHLEVEL) >= 0x010201" $sdl_cflags &&
@@ -6483,6 +6508,7 @@ echo "network support   ${network-no}"
 echo "threading support ${thread_type-no}"
 echo "safe bitstream reader ${safe_bitstream_reader-no}"
 echo "SDL support   ${sdl-no}"
+echo "SDL2 support  ${sdl2-no}"
 echo "opencl enabled${opencl-no}"
 echo "JNI support   ${jni-no}"
 echo "texi2html enabled ${texi2html-no}"
diff --git a/libavdevice/Makefile b/libavdevice/Makefile
index 585827b..1c4b4d3 100644
--- a/libavdevice/Makefile
+++ b/libavdevice/Makefile
@@ -41,6 +41,7 @@ OBJS-$(CONFIG_PULSE_OUTDEV)  += pulse_audio_enc.o 
\
 pulse_audio_common.o
 OBJS-$(CONFIG_QTKIT_INDEV)   += qtkit.o
 OBJS-$(CONFIG_SDL_OUTDEV)+= sdl.o
+OBJS-$(CONFIG_SDL2_OUTDEV)   += sdl2.o
 OBJS-$(CONFIG_SNDIO_INDEV)   += sndio_dec.o sndio.o
 OBJS-$(CONFIG_SNDIO_OUTDEV)  += sndio_enc.o sndio.o
 OBJS-$(CONFIG_V4L2_INDEV)+= v4l2.o v4l2-common.o timefilter.o
diff --git a/libavdevice/alldevices.c b/libavdevice/alldevices.c
index 26aecf2..c0a9d9a 100644
--- a/libavdevice/alldevices.c
+++ b/libavdevice/alldevices.c
@@ -64,6 +64,7 @@ void avdevice_register_all(void)
 REGISTER_INOUTDEV(PULSE,pulse);
 REGISTER_INDEV   (QTKIT,qtkit);
 REGISTER_OUTDEV  (SDL,  sdl);
+REGISTER_OUTDEV  (SDL2, sdl2);
 REGISTER_INOUTDEV(SNDIO,sndio);
 REGISTER_INOUTDEV(V4L2, v4l2);
 //REGISTER_INDEV   (V4L,  v4l
diff --git a/libavdevice/sdl2.c 

[FFmpeg-devel] ffserver: current status and future plans

2016-09-23 Thread Michael Fritscher

Hello,

as promised I started to work on ffserver. The focus of the first week 
was to remake a fresh building environment - incl. FATE - and get an 
overview what it is needed to be done.


1. FATE
There is already a test for ffserver, but out of FATE. This test does 
not work for me, but this is a cygwin related problem (wget  | dd 
bs=1 count=20k : wget isn't exited automatically if dd exits, and 
because of that the test hangs) Does anybody know more details of the 
warning


"
Unfortunately ffserver is broken and therefore its regression test fails 
randomly. Treat the results accordingly.

"
in the Makefile regarding this test?

2. rtsp server
I was told that the rtsp-demuxer can listen now as well. Can this 
demuxer cope with multiple concurrent connections as well? If not, is 
this a problem with this demuxer or the demuxer API in general? If the 
later one I would like to get some advise how to solve this.


3. ffm
3.1. Using it as a ring buffer.
I think that can be solved rather easy.
3.2. Using it for transfering the streams.
Not that big story either - there are other formats like nut.
3.3. Using it for negotiating the needed video formats.
This is by far(!) the biggest obstacle I found. This is the main cause 
ffm is plant to be removed I guess (because of the AVCodecContext 
problem). Additionally, some people doesn't like the idea that ffserver 
sets the streaming options. Honestly, I personally like this, and there 
is a ffserver_ignore flag even today. I think that via a new protocol 
this can be solved. This protocol will be only used to configure the 
streams of ffmpeg.


4. other issues
The other internal includes are less critical I think - rather utility 
functions etc. Did I miss something?


5. time frame
I know that ffserver hinders removal of some internal stuff (most 
importantly ffm with its usage of AVCodecContext). On IRC, the idea of a 
deadline popped up. Honestly I like this idea - it would be a clear rule 
and would avoid a lot of confusion. I propose the 2016-12-31 - if by 
then the usage of the internal things is not solved ffserver is going to 
be removed. At least the things which are announced to me by 2016-10-15. 
I would be more than happy making a detailed list what is to be done - 
this mail being the first step.


Best regards,
Michael Fritscher
--
ZfT - Zentrum für Telematik e.V.
Michael Fritscher
Magdalene-Schoch-Straße 5
97074 Würzburg
Tel: +49 (931) 615 633 - 57
Fax: +49 (931) 615 633 - 11
Email: michael.fritsc...@telematik-zentrum.de
Web: http://www.telematik-zentrum.de

Vorstand:
Prof. Dr. Klaus Schilling, Hans-Joachim Leistner
Sitz: Gerbrunn
USt.-ID Nr.: DE 257 244 580, Steuer-Nr.:  257/111/70203
Amtsgericht Würzburg, Vereinsregister-Nr.: VR 200 167
<>

smime.p7s
Description: S/MIME Cryptographic Signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] ffserver: current status and future plans

2016-09-23 Thread Michael Niedermayer
On Fri, Sep 23, 2016 at 05:46:06PM +0200, Michael Fritscher wrote:
> Hello,
> 
> as promised I started to work on ffserver. The focus of the first
> week was to remake a fresh building environment - incl. FATE - and
> get an overview what it is needed to be done.
> 
> 1. FATE
> There is already a test for ffserver, but out of FATE. This test
> does not work for me, but this is a cygwin related problem (wget
>  | dd bs=1 count=20k : wget isn't exited automatically if dd
> exits, and because of that the test hangs) Does anybody know more
> details of the warning
> 
> "
> Unfortunately ffserver is broken and therefore its regression test
> fails randomly. Treat the results accordingly.
> "
> in the Makefile regarding this test?

In the very distant past the tests gave not always the same results.
I dont know why xactly that was that way or if it still is
my gut feeling pointed to timing/race stuff but i dont remember that
i debugged this to find the true cause

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

No snowflake in an avalanche ever feels responsible. -- Voltaire


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


[FFmpeg-devel] [PATCH v3 1/5] lavd: Add SDL2 output device

2016-09-23 Thread Josh de Kock
Acked-by: Michael Niedermayer
Signed-off-by: Josh de Kock 
---
 Changelog|   1 +
 configure|  28 +++-
 libavdevice/Makefile |   1 +
 libavdevice/alldevices.c |   1 +
 libavdevice/sdl2.c   | 377 +++
 5 files changed, 407 insertions(+), 1 deletion(-)
 create mode 100644 libavdevice/sdl2.c

diff --git a/Changelog b/Changelog
index 2d0a449..5d9141b 100644
--- a/Changelog
+++ b/Changelog
@@ -31,6 +31,7 @@ version :
 - MediaCodec HEVC decoding
 - TrueHD encoder
 - Meridian Lossless Packing (MLP) encoder
+- sdl2 output device
 
 
 version 3.1:
diff --git a/configure b/configure
index af3fbf4..718f6f4 100755
--- a/configure
+++ b/configure
@@ -292,6 +292,7 @@ External library support:
   --disable-schannel   disable SChannel SSP, needed for TLS support on
Windows if openssl and gnutls are not used 
[autodetect]
   --disable-sdldisable sdl [autodetect]
+  --disable-sdl2   disable sdl2 [autodetect]
   --disable-securetransport disable Secure Transport, needed for TLS support
on OSX if openssl and gnutls are not used 
[autodetect]
   --enable-x11grab enable X11 grabbing (legacy) [no]
@@ -1548,6 +1549,7 @@ EXTERNAL_LIBRARY_LIST="
 openssl
 schannel
 sdl
+sdl2
 securetransport
 videotoolbox
 x11grab
@@ -2022,6 +2024,7 @@ HAVE_LIST="
 perl
 pod2man
 sdl
+sdl2
 section_data_rel_ro
 texi2html
 threads
@@ -2948,6 +2951,7 @@ pulse_outdev_deps="libpulse"
 qtkit_indev_extralibs="-framework QTKit -framework Foundation -framework 
QuartzCore"
 qtkit_indev_select="qtkit"
 sdl_outdev_deps="sdl"
+sdl2_outdev_deps="sdl2"
 sndio_indev_deps="sndio_h"
 sndio_outdev_deps="sndio_h"
 v4l_indev_deps="linux_videodev_h"
@@ -5853,7 +5857,28 @@ if enabled gcrypt; then
 fi
 fi
 
-if ! disabled sdl; then
+if ! disabled sdl2 && ! enabled sdl; then
+SDL2_CONFIG="${cross_prefix}sdl2-config"
+if check_pkg_config sdl2 SDL_events.h SDL_PollEvent; then
+check_cpp_condition SDL.h "(SDL_MAJOR_VERSION<<16 | 
SDL_MINOR_VERSION<<8 | SDL_PATCHLEVEL) >= 0x020001" $sdl2_cflags &&
+check_cpp_condition SDL.h "(SDL_MAJOR_VERSION<<16 | 
SDL_MINOR_VERSION<<8 | SDL_PATCHLEVEL) < 0x020100" $sdl2_cflags &&
+check_func SDL_Init $sdl2_libs $sdl2_cflags && enable sdl2
+else
+  if "${SDL2_CONFIG}" --version > /dev/null 2>&1; then
+sdl2_cflags=$("${SDL2_CONFIG}" --cflags)
+sdl2_libs=$("${SDL2_CONFIG}" --libs)
+check_cpp_condition SDL.h "(SDL_MAJOR_VERSION<<16 | 
SDL_MINOR_VERSION<<8 | SDL_PATCHLEVEL) >= 0x020001" $sdl2_cflags &&
+check_cpp_condition SDL.h "(SDL_MAJOR_VERSION<<16 | 
SDL_MINOR_VERSION<<8 | SDL_PATCHLEVEL) < 0x020100" $sdl2_cflags &&
+check_func SDL_Init $sdl2_libs $sdl2_cflags && enable sdl2
+  fi
+fi
+if test $target_os = "mingw32"; then
+sdl2_libs="$sdl2_libs -mconsole"
+fi
+fi
+enabled sdl2 && add_cflags $sdl2_cflags && add_extralibs $sdl2_libs
+
+if ! disabled sdl && ! enabled sdl2; then
 SDL_CONFIG="${cross_prefix}sdl-config"
 if check_pkg_config sdl SDL_events.h SDL_PollEvent; then
 check_cpp_condition SDL.h "(SDL_MAJOR_VERSION<<16 | 
SDL_MINOR_VERSION<<8 | SDL_PATCHLEVEL) >= 0x010201" $sdl_cflags &&
@@ -6483,6 +6508,7 @@ echo "network support   ${network-no}"
 echo "threading support ${thread_type-no}"
 echo "safe bitstream reader ${safe_bitstream_reader-no}"
 echo "SDL support   ${sdl-no}"
+echo "SDL2 support  ${sdl2-no}"
 echo "opencl enabled${opencl-no}"
 echo "JNI support   ${jni-no}"
 echo "texi2html enabled ${texi2html-no}"
diff --git a/libavdevice/Makefile b/libavdevice/Makefile
index 585827b..1c4b4d3 100644
--- a/libavdevice/Makefile
+++ b/libavdevice/Makefile
@@ -41,6 +41,7 @@ OBJS-$(CONFIG_PULSE_OUTDEV)  += pulse_audio_enc.o 
\
 pulse_audio_common.o
 OBJS-$(CONFIG_QTKIT_INDEV)   += qtkit.o
 OBJS-$(CONFIG_SDL_OUTDEV)+= sdl.o
+OBJS-$(CONFIG_SDL2_OUTDEV)   += sdl2.o
 OBJS-$(CONFIG_SNDIO_INDEV)   += sndio_dec.o sndio.o
 OBJS-$(CONFIG_SNDIO_OUTDEV)  += sndio_enc.o sndio.o
 OBJS-$(CONFIG_V4L2_INDEV)+= v4l2.o v4l2-common.o timefilter.o
diff --git a/libavdevice/alldevices.c b/libavdevice/alldevices.c
index 26aecf2..c0a9d9a 100644
--- a/libavdevice/alldevices.c
+++ b/libavdevice/alldevices.c
@@ -64,6 +64,7 @@ void avdevice_register_all(void)
 REGISTER_INOUTDEV(PULSE,pulse);
 REGISTER_INDEV   (QTKIT,qtkit);
 REGISTER_OUTDEV  (SDL,  sdl);
+REGISTER_OUTDEV  (SDL2, sdl2);
 REGISTER_INOUTDEV(SNDIO,sndio);
 REGISTER_INOUTDEV(V4L2, v4l2);
 //REGISTER_INDEV   (V4L,  v4l
diff --git a/libavdevice

Re: [FFmpeg-devel] Searchable archives for ffmpeg-devel and ffmpeg-cvslog

2016-09-23 Thread compn
On Fri, 23 Sep 2016 09:57:02 +0200
Robert Krüger  wrote:

> Hi,
> 
> I am looking for searchable archives of ffmpeg-devel and
> ffmpeg-cvslog. I used to use gmane but that seems to no longer work.
> 
> Would be great if someone has a hint. I can't imagine that people out
> there search ml archives by going through them month by month.

possible with google using:

searchterm site:ffmpeg.org inurl:ffmpeg-cvslog
searchterm site:ffmpeg.org inurl:ffmpeg-devel

i dont know if mailman has a search feature.

https://wiki.list.org/DOC/How%20do%20I%20make%20the%20archives%20searchable

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


Re: [FFmpeg-devel] Searchable archives for ffmpeg-devel and ffmpeg-cvslog

2016-09-23 Thread Robert Krüger
On Fri, Sep 23, 2016 at 6:12 PM, compn  wrote:

> On Fri, 23 Sep 2016 09:57:02 +0200
> Robert Krüger  wrote:
>
> > Hi,
> >
> > I am looking for searchable archives of ffmpeg-devel and
> > ffmpeg-cvslog. I used to use gmane but that seems to no longer work.
> >
> > Would be great if someone has a hint. I can't imagine that people out
> > there search ml archives by going through them month by month.
>
> possible with google using:
>
> searchterm site:ffmpeg.org inurl:ffmpeg-cvslog
> searchterm site:ffmpeg.org inurl:ffmpeg-devel
>
> i dont know if mailman has a search feature.
>
> https://wiki.list.org/DOC/How%20do%20I%20make%20the%
> 20archives%20searchable
>
>
>
Thanks for the hint.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] Searchable archives for ffmpeg-devel and ffmpeg-cvslog

2016-09-23 Thread Lou Logan
On Thu, Sep 22, 2016, at 11:57 PM, Robert Krüger wrote:
> Hi,
> 
> I am looking for searchable archives of ffmpeg-devel and ffmpeg-cvslog. I
> used to use gmane but that seems to no longer work.

It appears that some new volunteers are working on Gmane. Not everything
is back yet, but that is why I did not remove any Gmane links on the
site...it's certainly not due to me being a worthless layabout.

Also, the method compn mentioned is basically what I do. Perhaps if I
weren't such a worthless layabout I could add a Google custom search box
to the archives.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] lavf: add ffprobe demuxer

2016-09-23 Thread Stefano Sabatini
On date Friday 2016-09-23 09:34:19 +0200, wm4 encoded:
> On Thu, 22 Sep 2016 18:50:27 +0200
> Stefano Sabatini  wrote:
[...]
> > Ping. I'd like to commit this if there are no objections. Also,
> > possibly add a muxer to generate output directly readable by the
> > demuxer (this way we don't need ffprobe for generating the output, and
> > we avoid the ordering issue).
> 
> I'm sorry to jump in as a nay-sayer, but it looks like a quite fishy
> concept and I still don't get why it's supposed to be needed. The
> documentation also doesn't say what this is supposed to be useful for.

I'll extend the documentation to add some possibly useful use cases.

My use case: I need to build a data stream with scripting/manual
editing. Since I don't want to have to rely on a binary format (which
is not ideal for that use case) I needed a format simple enough to be
written and analysed without special tools, but with a simple text
editor.

Also, if coupled with a muxer it allows to create an output, tweak it
(e.g. to change the timestamps) and feed it to FFmpeg, which might be
useful from time to time to test/debug specific features.

The alternative might be to build a tool for converting to
custom-format to a "binary" format accepted by FFmpeg, but I want
to avoid the need for an additional tool.

This format is my second attempt after the fftextdata format, which
was regarded too limited. This one is based on the ffprobe default
output (although it's simplified).

> It's also potentially a security issue (lots of text parsing, and can
> construct inputs which might be tricky for API users).
> 
> I probably can't stop you from pushing this, but at least it shouldn't
> be enabled by default.

I understand the security concerns, and I have no objections against
disabling this by default if developers prefer this way.
-- 
FFmpeg = Freak Frightening Merciless Pacific Erroneous Glue
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH]lavf/movenc: Put correct display aspect ratio in ARES atom

2016-09-23 Thread Carl Eugen Hoyos
2016-09-20 19:02 GMT+02:00 Paul B Mahol :

> How do you have tested that this patch is correct?

Remuxing the sample from ticket #2125 is broken without this patch.

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


Re: [FFmpeg-devel] [PATCH] lavf: add ffprobe demuxer

2016-09-23 Thread Carl Eugen Hoyos
2016-09-23 19:46 GMT+02:00 Stefano Sabatini :
> On date Friday 2016-09-23 09:34:19 +0200, wm4 encoded:
>> at least it shouldn't be enabled by default.
>
> I understand the security concerns, and I have no objections
> against disabling this by default if developers prefer this way.

Disabling features in configure by default is a bad idea,
a demuxer that has to be forced by the user is ok imo.

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


Re: [FFmpeg-devel] [PATCH]lavf/movenc: Put correct display aspect ratio in ARES atom

2016-09-23 Thread Paul B Mahol
On 9/23/16, Carl Eugen Hoyos  wrote:
> 2016-09-20 19:02 GMT+02:00 Paul B Mahol :
>
>> How do you have tested that this patch is correct?
>
> Remuxing the sample from ticket #2125 is broken without this patch.

Have you tested with QuickTime player?
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH]lavf/movenc: Put correct display aspect ratio in ARES atom

2016-09-23 Thread Paul B Mahol
On 9/23/16, Paul B Mahol  wrote:
> On 9/23/16, Carl Eugen Hoyos  wrote:
>> 2016-09-20 19:02 GMT+02:00 Paul B Mahol :
>>
>>> How do you have tested that this patch is correct?
>>
>> Remuxing the sample from ticket #2125 is broken without this patch.
>
> Have you tested with QuickTime player?
>

Also doesnt this allows division by zero?
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH]lavf/movenc: Put correct display aspect ratio in ARES atom

2016-09-23 Thread Carl Eugen Hoyos
2016-09-23 22:38 GMT+02:00 Paul B Mahol :
> On 9/23/16, Paul B Mahol  wrote:
>> On 9/23/16, Carl Eugen Hoyos  wrote:
>>> 2016-09-20 19:02 GMT+02:00 Paul B Mahol :
>>>
 How do you have tested that this patch is correct?
>>>
>>> Remuxing the sample from ticket #2125 is broken without this patch.
>>
>> Have you tested with QuickTime player?

Yes, how did you test?

> Also doesnt this allows division by zero?

Locally changed to ">0".

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


[FFmpeg-devel] [PATCH/RFC]lavf/aacdec: Do not auto-detect a single frame

2016-09-23 Thread Carl Eugen Hoyos
Hi!

I use this patch locally for some time. It fixes 
many misdetections, a similar patch was applied to 
loas detection three years ago.
An alternative would be to return "1" for two frames.

Please comment, Carl Eugen
From f3d9ebedcbc137c4d639efdbed485298f9dc9f3e Mon Sep 17 00:00:00 2001
From: Carl Eugen Hoyos 
Date: Fri, 23 Sep 2016 23:57:03 +0200
Subject: [PATCH] lavf/aacdec: Do not autodetect a single frame.

---
 libavformat/aacdec.c |2 --
 1 file changed, 2 deletions(-)

diff --git a/libavformat/aacdec.c b/libavformat/aacdec.c
index aa23756..39624e4 100644
--- a/libavformat/aacdec.c
+++ b/libavformat/aacdec.c
@@ -70,8 +70,6 @@ static int adts_aac_probe(AVProbeData *p)
 return AVPROBE_SCORE_EXTENSION;
 else if (max_frames >= 3)
 return AVPROBE_SCORE_EXTENSION / 2;
-else if (max_frames >= 1)
-return 1;
 else
 return 0;
 }
-- 
1.7.10.4

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


Re: [FFmpeg-devel] [PATCH 6/6] ffprobe.c: Indicate decode-but-discard packets when doing -show_packets.

2016-09-23 Thread Michael Niedermayer
On Thu, Sep 15, 2016 at 01:36:19PM -0700, Sasi Inguva wrote:
> Signed-off-by: Sasi Inguva 
> ---
>  ffprobe.c  |   3 +-
>  tests/ref/fate/concat-demuxer-extended-lavf-mxf|   2 +-
>  .../ref/fate/concat-demuxer-extended-lavf-mxf_d10  |   2 +-
>  tests/ref/fate/concat-demuxer-simple1-lavf-mxf | 242 -
>  tests/ref/fate/concat-demuxer-simple1-lavf-mxf_d10 | 140 +-
>  tests/ref/fate/concat-demuxer-simple2-lavf-ts  | 298 
> ++---
>  tests/ref/fate/ffprobe_compact |  28 +-
>  tests/ref/fate/ffprobe_csv |  28 +-
>  tests/ref/fate/ffprobe_default |  28 +-
>  tests/ref/fate/ffprobe_flat|  28 +-
>  tests/ref/fate/ffprobe_ini |  28 +-
>  tests/ref/fate/ffprobe_json|  28 +-
>  tests/ref/fate/ffprobe_xml |  28 +-
>  13 files changed, 442 insertions(+), 441 deletions(-)
> 
> diff --git a/ffprobe.c b/ffprobe.c
> index 657867d..e64c66e 100644
> --- a/ffprobe.c
> +++ b/ffprobe.c
> @@ -1815,7 +1815,8 @@ static void show_packet(WriterContext *w, InputFile 
> *ifile, AVPacket *pkt, int p
>  print_val("size", pkt->size, unit_byte_str);
>  if (pkt->pos != -1) print_fmt("pos", "%"PRId64, pkt->pos);
>  elseprint_str_opt("pos", "N/A");
> -print_fmt("flags", "%c",  pkt->flags & AV_PKT_FLAG_KEY ? 'K' : '_');
> +print_fmt("flags", "%c%c",  pkt->flags & AV_PKT_FLAG_KEY ? 'K' : '_',
> +  pkt->flags & AV_PKT_FLAG_DISCARD ? 'D' : '_');

applied

thanks

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

When the tyrant has disposed of foreign enemies by conquest or treaty, and
there is nothing more to fear from them, then he is always stirring up
some war or other, in order that the people may require a leader. -- 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 1/5] lavc : yami : add libyami decoder/encoder

2016-09-23 Thread Michael Niedermayer
On Mon, Aug 15, 2016 at 04:22:33PM +0800, Jun Zhao wrote:
> add libyami decoder/encoder/vpp in ffmpeg, about build step, 
> please refer to the link: https://github.com/01org/ffmpeg_libyami/wiki/Build

>  Makefile   |1 
>  configure  |   27 ++
>  ffmpeg.c   |4 
>  ffmpeg.h   |1 
>  ffmpeg_libyami.c   |   85 ++
>  libavcodec/Makefile|8 
>  libavcodec/allcodecs.c |6 
>  libavcodec/libyami.cpp |  429 +++
>  libavcodec/libyami.h   |   59 
>  libavcodec/libyami_dec.cpp |  527 +++
>  libavcodec/libyami_dec.h   |   56 
>  libavcodec/libyami_enc.cpp |  551 
> +
>  libavcodec/libyami_enc.h   |   70 +
>  libavutil/pixdesc.c|4 
>  libavutil/pixfmt.h |5 
>  15 files changed, 1833 insertions(+)
> d5ebbaa497e6f36026a4482dc6e0f26b370561b5  
> 0001-lavc-yami-add-libyami-decoder-encoder.patch
> From 7147fdb375cb7241d69823d8b9b6e94f66df3a32 Mon Sep 17 00:00:00 2001
> From: Jun Zhao 
> Date: Mon, 15 Aug 2016 15:36:14 +0800
> Subject: [[PATCH] 1/5] lavc : yami : add libyami decoder/encoder.

it seems people are not in favor of this patchset, judging from this
thread.
If you are interrested in maintaining this code externally as a patch
or git repository, then please add some reasonable link/mention to
some page on https://trac.ffmpeg.org/wiki so users are aware of its
existence and can find it

If you belive thats incorret and people in fact majorly support this
patchset then you can also start a vote of course.

ill mark this patchset as rejected on patchwork as that seems the
de-facto current situation

Thanks

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

The bravest are surely those who have the clearest vision
of what is before them, glory and danger alike, and yet
notwithstanding go out to meet it. -- Thucydides


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/mov.c: Make audio timestamps strictly monotonically increasing inside an edit list. Fixes gapless decoding.

2016-09-23 Thread Sasi Inguva
I have updated the patch with flag values for fate tests.

On Thu, Sep 22, 2016 at 11:38 AM, Sasi Inguva  wrote:

>
> On Thu, Sep 22, 2016 at 5:49 AM, wm4  wrote:
>
>> On Tue, 20 Sep 2016 14:29:46 -0700
>> Sasi Inguva  wrote:
>>
>> > Signed-off-by: Sasi Inguva 
>> > ---
>> >  libavcodec/utils.c   | 15 +++---
>> >  libavformat/mov.c| 81
>> 
>> >  tests/ref/fate/gaplessenc-itunes-to-ipod-aac |  2 +-
>> >  tests/ref/fate/gaplessenc-pcm-to-mov-aac |  2 +-
>> >  4 files changed, 78 insertions(+), 22 deletions(-)
>> >
>> > diff --git a/libavcodec/utils.c b/libavcodec/utils.c
>> > index b0345b6..e18476c 100644
>> > --- a/libavcodec/utils.c
>> > +++ b/libavcodec/utils.c
>> > @@ -2320,7 +2320,6 @@ int attribute_align_arg
>> avcodec_decode_audio4(AVCodecContext *avctx,
>> >  uint32_t discard_padding = 0;
>> >  uint8_t skip_reason = 0;
>> >  uint8_t discard_reason = 0;
>> > -int demuxer_skip_samples = 0;
>> >  // copy to ensure we do not change avpkt
>> >  AVPacket tmp = *avpkt;
>> >  int did_split = av_packet_split_side_data(&tmp);
>> > @@ -2328,7 +2327,6 @@ int attribute_align_arg
>> avcodec_decode_audio4(AVCodecContext *avctx,
>> >  if (ret < 0)
>> >  goto fail;
>> >
>> > -demuxer_skip_samples = avctx->internal->skip_samples;
>> >  avctx->internal->pkt = &tmp;
>> >  if (HAVE_THREADS && avctx->active_thread_type &
>> FF_THREAD_FRAME)
>> >  ret = ff_thread_decode_frame(avctx, frame, got_frame_ptr,
>> &tmp);
>> > @@ -2353,13 +2351,6 @@ int attribute_align_arg
>> avcodec_decode_audio4(AVCodecContext *avctx,
>> >  frame->sample_rate = avctx->sample_rate;
>> >  }
>> >
>> > -
>> > -if (frame->flags & AV_FRAME_FLAG_DISCARD) {
>> > -// If using discard frame flag, ignore skip_samples set by
>> the decoder.
>> > -avctx->internal->skip_samples = demuxer_skip_samples;
>> > -*got_frame_ptr = 0;
>> > -}
>> > -
>> >  side= av_packet_get_side_data(avctx->internal->pkt,
>> AV_PKT_DATA_SKIP_SAMPLES, &side_size);
>> >  if(side && side_size>=10) {
>> >  avctx->internal->skip_samples = AV_RL32(side);
>> > @@ -2369,6 +2360,12 @@ int attribute_align_arg
>> avcodec_decode_audio4(AVCodecContext *avctx,
>> >  skip_reason = AV_RL8(side + 8);
>> >  discard_reason = AV_RL8(side + 9);
>> >  }
>> > +
>> > +if ((frame->flags & AV_FRAME_FLAG_DISCARD) && *got_frame_ptr) {
>> > +avctx->internal->skip_samples -= frame->nb_samples;
>> > +*got_frame_ptr = 0;
>> > +}
>> > +
>> >  if (avctx->internal->skip_samples > 0 && *got_frame_ptr &&
>> >  !(avctx->flags2 & AV_CODEC_FLAG2_SKIP_MANUAL)) {
>> >  if(frame->nb_samples <= avctx->internal->skip_samples){
>> > diff --git a/libavformat/mov.c b/libavformat/mov.c
>> > index b84d9c0..bb86780 100644
>> > --- a/libavformat/mov.c
>> > +++ b/libavformat/mov.c
>> > @@ -2856,6 +2856,21 @@ static int64_t add_index_entry(AVStream *st,
>> int64_t pos, int64_t timestamp,
>> >  }
>> >
>> >  /**
>> > + * Rewrite timestamps of index entries in the range [end_index -
>> frame_duration_buffer_size, end_index)
>> > + * by subtracting end_ts successively by the amounts given in
>> frame_duration_buffer.
>> > + */
>> > +static void fix_index_entry_timestamps(AVStream* st, int end_index,
>> int64_t end_ts,
>> > +   int64_t* frame_duration_buffer,
>> > +   int frame_duration_buffer_size)
>> {
>> > +int i = 0;
>> > +av_assert0(end_index >= 0 && end_index <= st->nb_index_entries);
>> > +for (i = 0; i < frame_duration_buffer_size; i++) {
>> > +end_ts -= frame_duration_buffer[frame_duration_buffer_size -
>> 1 - i];
>> > +st->index_entries[end_index - 1 - i].timestamp = end_ts;
>> > +}
>> > +}
>> > +
>> > +/**
>> >   * Append a new ctts entry to ctts_data.
>> >   * Returns the new ctts_count if successful, else returns -1.
>> >   */
>> > @@ -2919,7 +2934,10 @@ static void mov_fix_index(MOVContext *mov,
>> AVStream *st)
>> >  int64_t edit_list_media_time_dts = 0;
>> >  int64_t edit_list_start_encountered = 0;
>> >  int64_t search_timestamp = 0;
>> > -
>> > +int64_t* frame_duration_buffer = NULL;
>> > +int num_discarded_begin = 0;
>> > +int first_non_zero_audio_edit = -1;
>> > +int packet_skip_samples = 0;
>> >
>> >  if (!msc->elst_data || msc->elst_count <= 0) {
>> >  return;
>> > @@ -2955,6 +2973,7 @@ static void mov_fix_index(MOVContext *mov,
>> AVStream *st)
>> >  edit_list_index++;
>> >  edit_list_dts_counter = edit_list_dts_entry_end;
>> >  edit_list_dts_entry_end += edit_list_duration;
>> > +num_discarded_begin = 0;
>> >  if (edit_list_media_time == -1

[FFmpeg-devel] [PATCH] lavf/mov.c: Make audio timestamps strictly monotonically increasing inside an edit list. Fixes gapless decoding.

2016-09-23 Thread Sasi Inguva
Signed-off-by: Sasi Inguva 
---
 libavcodec/utils.c   | 16 +++---
 libavformat/mov.c| 81 
 tests/fate-run.sh|  2 +-
 tests/ref/fate/gaplessenc-itunes-to-ipod-aac | 32 +--
 tests/ref/fate/gaplessenc-pcm-to-mov-aac | 32 +--
 tests/ref/fate/gaplessinfo-itunes1   | 32 +--
 tests/ref/fate/gaplessinfo-itunes2   | 32 +--
 7 files changed, 142 insertions(+), 85 deletions(-)

diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index b0345b6..6323156 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -2320,7 +2320,6 @@ int attribute_align_arg 
avcodec_decode_audio4(AVCodecContext *avctx,
 uint32_t discard_padding = 0;
 uint8_t skip_reason = 0;
 uint8_t discard_reason = 0;
-int demuxer_skip_samples = 0;
 // copy to ensure we do not change avpkt
 AVPacket tmp = *avpkt;
 int did_split = av_packet_split_side_data(&tmp);
@@ -2328,7 +2327,6 @@ int attribute_align_arg 
avcodec_decode_audio4(AVCodecContext *avctx,
 if (ret < 0)
 goto fail;
 
-demuxer_skip_samples = avctx->internal->skip_samples;
 avctx->internal->pkt = &tmp;
 if (HAVE_THREADS && avctx->active_thread_type & FF_THREAD_FRAME)
 ret = ff_thread_decode_frame(avctx, frame, got_frame_ptr, &tmp);
@@ -2353,13 +2351,6 @@ int attribute_align_arg 
avcodec_decode_audio4(AVCodecContext *avctx,
 frame->sample_rate = avctx->sample_rate;
 }
 
-
-if (frame->flags & AV_FRAME_FLAG_DISCARD) {
-// If using discard frame flag, ignore skip_samples set by the 
decoder.
-avctx->internal->skip_samples = demuxer_skip_samples;
-*got_frame_ptr = 0;
-}
-
 side= av_packet_get_side_data(avctx->internal->pkt, 
AV_PKT_DATA_SKIP_SAMPLES, &side_size);
 if(side && side_size>=10) {
 avctx->internal->skip_samples = AV_RL32(side);
@@ -2369,6 +2360,13 @@ int attribute_align_arg 
avcodec_decode_audio4(AVCodecContext *avctx,
 skip_reason = AV_RL8(side + 8);
 discard_reason = AV_RL8(side + 9);
 }
+
+if ((frame->flags & AV_FRAME_FLAG_DISCARD) && *got_frame_ptr &&
+!(avctx->flags2 & AV_CODEC_FLAG2_SKIP_MANUAL)) {
+avctx->internal->skip_samples -= frame->nb_samples;
+*got_frame_ptr = 0;
+}
+
 if (avctx->internal->skip_samples > 0 && *got_frame_ptr &&
 !(avctx->flags2 & AV_CODEC_FLAG2_SKIP_MANUAL)) {
 if(frame->nb_samples <= avctx->internal->skip_samples){
diff --git a/libavformat/mov.c b/libavformat/mov.c
index b84d9c0..bb86780 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -2856,6 +2856,21 @@ static int64_t add_index_entry(AVStream *st, int64_t 
pos, int64_t timestamp,
 }
 
 /**
+ * Rewrite timestamps of index entries in the range [end_index - 
frame_duration_buffer_size, end_index)
+ * by subtracting end_ts successively by the amounts given in 
frame_duration_buffer.
+ */
+static void fix_index_entry_timestamps(AVStream* st, int end_index, int64_t 
end_ts,
+   int64_t* frame_duration_buffer,
+   int frame_duration_buffer_size) {
+int i = 0;
+av_assert0(end_index >= 0 && end_index <= st->nb_index_entries);
+for (i = 0; i < frame_duration_buffer_size; i++) {
+end_ts -= frame_duration_buffer[frame_duration_buffer_size - 1 - i];
+st->index_entries[end_index - 1 - i].timestamp = end_ts;
+}
+}
+
+/**
  * Append a new ctts entry to ctts_data.
  * Returns the new ctts_count if successful, else returns -1.
  */
@@ -2919,7 +2934,10 @@ static void mov_fix_index(MOVContext *mov, AVStream *st)
 int64_t edit_list_media_time_dts = 0;
 int64_t edit_list_start_encountered = 0;
 int64_t search_timestamp = 0;
-
+int64_t* frame_duration_buffer = NULL;
+int num_discarded_begin = 0;
+int first_non_zero_audio_edit = -1;
+int packet_skip_samples = 0;
 
 if (!msc->elst_data || msc->elst_count <= 0) {
 return;
@@ -2955,6 +2973,7 @@ static void mov_fix_index(MOVContext *mov, AVStream *st)
 edit_list_index++;
 edit_list_dts_counter = edit_list_dts_entry_end;
 edit_list_dts_entry_end += edit_list_duration;
+num_discarded_begin = 0;
 if (edit_list_media_time == -1) {
 continue;
 }
@@ -2962,7 +2981,14 @@ static void mov_fix_index(MOVContext *mov, AVStream *st)
 // If we encounter a non-negative edit list reset the 
skip_samples/start_pad fields and set them
 // according to the edit list below.
 if (st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO) {
-st->skip_samples = msc->start_pad = 0;
+if (first_non_zero_audio_edit < 0) {
+first_non_zero_audio_edit = 1;
+  

Re: [FFmpeg-devel] [PATCH] lavf/mov.c: Make audio timestamps strictly monotonically increasing inside an edit list. Fixes gapless decoding.

2016-09-23 Thread Michael Niedermayer
On Fri, Sep 23, 2016 at 06:20:18PM -0700, Sasi Inguva wrote:
> Signed-off-by: Sasi Inguva 
> ---
>  libavcodec/utils.c   | 16 +++---
>  libavformat/mov.c| 81 
> 

>  tests/fate-run.sh|  2 +-

this belongs in a seperate patch

libavcodec and libavformat changes should also be split into 2
patches to keep things cleanly seperated

thx

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

Breaking DRM is a little like attempting to break through a door even
though the window is wide open and the only thing in the house is a bunch
of things you dont want and which you would get tomorrow for free anyway


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


Re: [FFmpeg-devel] [PATCH] avformat/hlsenc: refine EXT-X-BYTERANGE support for segments

2016-09-23 Thread Michael Niedermayer
On Mon, Sep 19, 2016 at 07:01:49AM +0800, Steven Liu wrote:
> 2016-09-19 0:24 GMT+08:00 Moritz Barsnick :
> 
> > On Sun, Sep 18, 2016 at 23:40:34 +0800, Steven Liu wrote:
> >
> > > +if (byterange_mode) {
> > > +version = 4;
> > > +sequence = byterange_mode ? 0 : sequence;
> >
> > What does the ternary if-then-else operation do here? Two lines above,
> > byterange_mode was checked for !=0, how can it be anything else here?
> >
> > > +av_log(oc, AV_LOG_ERROR, "Invalid segment filename
> > template '%s', you can try use -use_localtime 1 with it\n", c->basename);
> >
> > "try to use"
> >
> > > +if ((outer_st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO)
> > &&
> > > +outer_st->codecpar->bit_rate > hls->max_seg_size) {
> >
> > Inconsistent use of brackets: The "==" comparison has extra brackets,
> > the ">" comparison doesn't. (Or am I missing something with operator
> > precedence?)
> >
> > > +av_log(s, AV_LOG_WARNING, "Your video bitrate is bigger
> > than hls_segment_size, "
> > > +   "%"PRId64 " > %" PRId64" ( video birate >
> > hls_segment_size ),the result maybe not you want.",
> >
> > Apart from the peculiar placement of brackets in the message, I think
> > the brackets and their content is not needed, duplicate.
> >
> > And the sentence should end "the result may not be what you want".
> >
> > > +if (hls->start_pos >= hls->max_seg_size ) {
> >
> > Wrong bracket style (whitespace).
> >
> > > +{"hls_segment_size", "set maximum size per segment file, (in
> > bytes)",  OFFSET(max_seg_size),AV_OPT_TYPE_INT,{.i64 = 0},
> >  0,   INT_MAX,   E},
> >
> > You can actually drop the word "set ", as well as the comma before the
> > brackets.
> >
> > Moritz
> > ___
> > ffmpeg-devel mailing list
> > ffmpeg-devel@ffmpeg.org
> > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> >

>  hlsenc.c |   49 ++---
>  1 file changed, 46 insertions(+), 3 deletions(-)
> 32c8c1dad25c71a089d1ef4c912de46e8b05f17a  
> 0001-avformat-hlsenc-refine-EXT-X-BYTERANGE-support-for-s.patch
> From 3a8731792d681caec8ff49e01b1b175c00b9e1ee Mon Sep 17 00:00:00 2001
> From: Steven Liu 
> Date: Mon, 19 Sep 2016 07:00:42 +0800
> Subject: [PATCH] avformat/hlsenc: refine EXT-X-BYTERANGE support for segments

applied

thanks

[...]

-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

If you drop bombs on a foreign country and kill a hundred thousand
innocent people, expect your government to call the consequence
"unprovoked inhuman terrorist attacks" and use it to justify dropping
more bombs and killing more people. The technology changed, the idea is old.


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


[FFmpeg-devel] [PATCH 1/2] [avformat/mxf] Add core colorimetry support to MXF.

2016-09-23 Thread Steven Robertson
Signed-off-by: Steven Robertson 
---
 libavformat/mxf.c| 33 +
 libavformat/mxf.h|  3 +++
 libavformat/mxfdec.c | 29 +
 libavformat/mxfenc.c | 36 +++-
 4 files changed, 96 insertions(+), 5 deletions(-)

diff --git a/libavformat/mxf.c b/libavformat/mxf.c
index e9c48e8..ea7c1db 100644
--- a/libavformat/mxf.c
+++ b/libavformat/mxf.c
@@ -84,6 +84,39 @@ const MXFCodecUL ff_mxf_codec_tag_uls[] = {
 { { 
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 
},  0, 0 },
 };
 
+const MXFCodecUL ff_mxf_transfer_characteristics_uls[] = {
+{ { 
0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x01,0x04,0x01,0x01,0x01,0x01,0x01,0x00,0x00 
}, 14, AVCOL_TRC_GAMMA22 },
+{ { 
0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x01,0x04,0x01,0x01,0x01,0x01,0x02,0x00,0x00 
}, 14, AVCOL_TRC_BT709 },
+{ { 
0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x01,0x04,0x01,0x01,0x01,0x01,0x03,0x00,0x00 
}, 14, AVCOL_TRC_SMPTE240M },
+{ { 
0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x01,0x04,0x01,0x01,0x01,0x01,0x04,0x00,0x00 
}, 14, AVCOL_TRC_BT709 },
+{ { 
0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x06,0x04,0x01,0x01,0x01,0x01,0x05,0x00,0x00 
}, 14, AVCOL_TRC_BT1361_ECG },
+{ { 
0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x06,0x04,0x01,0x01,0x01,0x01,0x06,0x00,0x00 
}, 14, AVCOL_TRC_LINEAR },
+{ { 
0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x08,0x04,0x01,0x01,0x01,0x01,0x07,0x00,0x00 
}, 14, AVCOL_TRC_SMPTEST428_1 },
+{ { 
0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x0D,0x04,0x01,0x01,0x01,0x01,0x08,0x00,0x00 
}, 14, AVCOL_TRC_IEC61966_2_4 },
+{ { 
0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x0E,0x04,0x01,0x01,0x01,0x01,0x09,0x00,0x00 
}, 14, AVCOL_TRC_BT2020_10 },
+{ { 
0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x0D,0x04,0x01,0x01,0x01,0x01,0x0A,0x00,0x00 
}, 14, AVCOL_TRC_SMPTEST2084 },
+{ { 
0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x0D,0x04,0x01,0x01,0x01,0x01,0x0B,0x00,0x00 
}, 14, AVCOL_TRC_ARIB_STD_B67 },
+{ { 
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 
},  0, AVCOL_TRC_RESERVED0 },
+};
+
+const MXFCodecUL ff_mxf_coding_equations_uls[] = {
+{ { 
0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x01,0x04,0x01,0x01,0x01,0x02,0x01,0x00,0x00 
}, 14, AVCOL_SPC_BT470BG },
+{ { 
0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x01,0x04,0x01,0x01,0x01,0x02,0x02,0x00,0x00 
}, 14, AVCOL_SPC_BT709 },
+{ { 
0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x06,0x04,0x01,0x01,0x01,0x02,0x03,0x00,0x00 
}, 14, AVCOL_SPC_SMPTE240M },
+{ { 
0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x0D,0x04,0x01,0x01,0x01,0x02,0x04,0x00,0x00 
}, 14, AVCOL_SPC_YCOCG },
+{ { 
0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x0D,0x04,0x01,0x01,0x01,0x02,0x05,0x00,0x00 
}, 14, AVCOL_SPC_RGB },
+{ { 
0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x0D,0x04,0x01,0x01,0x01,0x02,0x06,0x00,0x00 
}, 14, AVCOL_SPC_BT2020_NCL },
+{ { 
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 
},  0, AVCOL_SPC_UNSPECIFIED },
+};
+
+const MXFCodecUL ff_mxf_color_primaries_uls[] = {
+{ { 
0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x06,0x04,0x01,0x01,0x01,0x03,0x01,0x00,0x00 
}, 14, AVCOL_PRI_SMPTE170M },
+{ { 
0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x06,0x04,0x01,0x01,0x01,0x03,0x02,0x00,0x00 
}, 14, AVCOL_PRI_BT470M },
+{ { 
0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x06,0x04,0x01,0x01,0x01,0x03,0x03,0x00,0x00 
}, 14, AVCOL_PRI_BT709 },
+{ { 
0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x0D,0x04,0x01,0x01,0x01,0x03,0x04,0x00,0x00 
}, 14, AVCOL_PRI_BT2020 },
+{ { 
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 
},  0, AVCOL_PRI_RESERVED0 },
+};
+
 static const struct {
 enum AVPixelFormat pix_fmt;
 const char data[16];
diff --git a/libavformat/mxf.h b/libavformat/mxf.h
index f3db1f9..1c9ca2a 100644
--- a/libavformat/mxf.h
+++ b/libavformat/mxf.h
@@ -79,6 +79,9 @@ extern const MXFCodecUL ff_mxf_data_definition_uls[];
 extern const MXFCodecUL ff_mxf_codec_uls[];
 extern const MXFCodecUL ff_mxf_pixel_format_uls[];
 extern const MXFCodecUL ff_mxf_codec_tag_uls[];
+extern const MXFCodecUL ff_mxf_transfer_characteristics_uls[];
+extern const MXFCodecUL ff_mxf_coding_equations_uls[];
+extern const MXFCodecUL ff_mxf_color_primaries_uls[];
 
 int ff_mxf_decode_pixel_layout(const char pixel_layout[16], enum AVPixelFormat 
*pix_fmt);
 const MXFSamplesPerFrame *ff_mxf_get_samples_per_frame(AVFormatContext *s, 
AVRational time_base);
diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c
index 1939761..d012e41 100644
--- a/libavformat/mxfdec.c
+++ b/libavformat/mxfdec.c
@@ -188,6 +188,9 @@ typedef struct MXFDescriptor {
 uint8_t *extradata;
 int extradata_size;
 enum AVPixelFormat pix_fmt;
+UID color_trc_ul;
+UID color_primaries_ul;
+UID color_space_ul;
 } MXFDescriptor;
 
 typedef struct MXFIndexTableSegment {
@@ -1000,9 +1003,18 @@ static int mxf_read_generic_descriptor(void *arg, 
AVIOContext *pb, int tag, in

[FFmpeg-devel] [PATCH 2/2] [avformat/mxf] Add support for ST 2084 / ST 2067-21 mastering metadata.

2016-09-23 Thread Steven Robertson
Signed-off-by: Steven Robertson 
---
 libavformat/mxfdec.c | 132 ---
 libavformat/mxfenc.c |  43 -
 2 files changed, 145 insertions(+), 30 deletions(-)

diff --git a/libavformat/mxfdec.c b/libavformat/mxfdec.c
index d012e41..761aa1f 100644
--- a/libavformat/mxfdec.c
+++ b/libavformat/mxfdec.c
@@ -52,6 +52,7 @@
 #include "libavutil/intreadwrite.h"
 #include "libavutil/parseutils.h"
 #include "libavutil/timecode.h"
+#include "libavutil/mastering_display_metadata.h"
 #include "avformat.h"
 #include "internal.h"
 #include "mxf.h"
@@ -191,6 +192,10 @@ typedef struct MXFDescriptor {
 UID color_trc_ul;
 UID color_primaries_ul;
 UID color_space_ul;
+uint16_t mastering_primaries[3][2];
+uint16_t mastering_white_point[2];
+uint32_t mastering_max_luminance;
+uint32_t mastering_min_luminance;
 } MXFDescriptor;
 
 typedef struct MXFIndexTableSegment {
@@ -284,22 +289,26 @@ typedef struct MXFMetadataReadTableEntry {
 static int mxf_read_close(AVFormatContext *s);
 
 /* partial keys to match */
-static const uint8_t mxf_header_partition_pack_key[]   = { 
0x06,0x0e,0x2b,0x34,0x02,0x05,0x01,0x01,0x0d,0x01,0x02,0x01,0x01,0x02 };
-static const uint8_t mxf_essence_element_key[] = { 
0x06,0x0e,0x2b,0x34,0x01,0x02,0x01,0x01,0x0d,0x01,0x03,0x01 };
-static const uint8_t mxf_avid_essence_element_key[]= { 
0x06,0x0e,0x2b,0x34,0x01,0x02,0x01,0x01,0x0e,0x04,0x03,0x01 };
-static const uint8_t mxf_canopus_essence_element_key[] = { 
0x06,0x0e,0x2b,0x34,0x01,0x02,0x01,0x0a,0x0e,0x0f,0x03,0x01 };
-static const uint8_t mxf_system_item_key[] = { 
0x06,0x0e,0x2b,0x34,0x02,0x05,0x01,0x01,0x0d,0x01,0x03,0x01,0x04 };
-static const uint8_t mxf_klv_key[] = { 
0x06,0x0e,0x2b,0x34 };
+static const uint8_t mxf_header_partition_pack_key[]  = { 
0x06,0x0e,0x2b,0x34,0x02,0x05,0x01,0x01,0x0d,0x01,0x02,0x01,0x01,0x02 };
+static const uint8_t mxf_essence_element_key[]= { 
0x06,0x0e,0x2b,0x34,0x01,0x02,0x01,0x01,0x0d,0x01,0x03,0x01 };
+static const uint8_t mxf_avid_essence_element_key[]   = { 
0x06,0x0e,0x2b,0x34,0x01,0x02,0x01,0x01,0x0e,0x04,0x03,0x01 };
+static const uint8_t mxf_canopus_essence_element_key[]= { 
0x06,0x0e,0x2b,0x34,0x01,0x02,0x01,0x0a,0x0e,0x0f,0x03,0x01 };
+static const uint8_t mxf_system_item_key[]= { 
0x06,0x0e,0x2b,0x34,0x02,0x05,0x01,0x01,0x0d,0x01,0x03,0x01,0x04 };
+static const uint8_t mxf_klv_key[]= { 
0x06,0x0e,0x2b,0x34 };
 /* complete keys to match */
-static const uint8_t mxf_crypto_source_container_ul[]  = { 
0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x09,0x06,0x01,0x01,0x02,0x02,0x00,0x00,0x00 
};
-static const uint8_t mxf_encrypted_triplet_key[]   = { 
0x06,0x0e,0x2b,0x34,0x02,0x04,0x01,0x07,0x0d,0x01,0x03,0x01,0x02,0x7e,0x01,0x00 
};
-static const uint8_t mxf_encrypted_essence_container[] = { 
0x06,0x0e,0x2b,0x34,0x04,0x01,0x01,0x07,0x0d,0x01,0x03,0x01,0x02,0x0b,0x01,0x00 
};
-static const uint8_t mxf_random_index_pack_key[]   = { 
0x06,0x0e,0x2b,0x34,0x02,0x05,0x01,0x01,0x0d,0x01,0x02,0x01,0x01,0x11,0x01,0x00 
};
-static const uint8_t mxf_sony_mpeg4_extradata[]= { 
0x06,0x0e,0x2b,0x34,0x04,0x01,0x01,0x01,0x0e,0x06,0x06,0x02,0x02,0x01,0x00,0x00 
};
-static const uint8_t mxf_avid_project_name[]   = { 
0xa5,0xfb,0x7b,0x25,0xf6,0x15,0x94,0xb9,0x62,0xfc,0x37,0x17,0x49,0x2d,0x42,0xbf 
};
-static const uint8_t mxf_jp2k_rsiz[]   = { 
0x06,0x0e,0x2b,0x34,0x02,0x05,0x01,0x01,0x0d,0x01,0x02,0x01,0x01,0x02,0x01,0x00 
};
-static const uint8_t mxf_indirect_value_utf16le[]  = { 
0x4c,0x00,0x02,0x10,0x01,0x00,0x00,0x00,0x00,0x06,0x0e,0x2b,0x34,0x01,0x04,0x01,0x01
 };
-static const uint8_t mxf_indirect_value_utf16be[]  = { 
0x42,0x01,0x10,0x02,0x00,0x00,0x00,0x00,0x00,0x06,0x0e,0x2b,0x34,0x01,0x04,0x01,0x01
 };
+static const uint8_t mxf_crypto_source_container_ul[] = { 
0x06,0x0e,0x2b,0x34,0x01,0x01,0x01,0x09,0x06,0x01,0x01,0x02,0x02,0x00,0x00,0x00 
};
+static const uint8_t mxf_encrypted_triplet_key[]  = { 
0x06,0x0e,0x2b,0x34,0x02,0x04,0x01,0x07,0x0d,0x01,0x03,0x01,0x02,0x7e,0x01,0x00 
};
+static const uint8_t mxf_encrypted_essence_container[]= { 
0x06,0x0e,0x2b,0x34,0x04,0x01,0x01,0x07,0x0d,0x01,0x03,0x01,0x02,0x0b,0x01,0x00 
};
+static const uint8_t mxf_random_index_pack_key[]  = { 
0x06,0x0e,0x2b,0x34,0x02,0x05,0x01,0x01,0x0d,0x01,0x02,0x01,0x01,0x11,0x01,0x00 
};
+static const uint8_t mxf_sony_mpeg4_extradata[]   = { 
0x06,0x0e,0x2b,0x34,0x04,0x01,0x01,0x01,0x0e,0x06,0x06,0x02,0x02,0x01,0x00,0x00 
};
+static const uint8_t mxf_avid_project_name[]  = { 
0xa5,0xfb,0x7b,0x25,0xf6,0x15,0x94,0xb9,0x62,0xfc,0x37,0x17,0x49,0x2d,0x42,0xbf 
};
+static const uint8_t mxf_jp2k_rsiz[]  = { 
0x06,0x0e,0x2b,0x34,0x02,0x05,0x01,0x01,0x0d,0x