[FFmpeg-devel] [PATCH] avformat/concatdec: don't call open_file when seek position within a file

2016-09-19 Thread raymond
---
 libavformat/concatdec.c | 27 ---
 1 file changed, 20 insertions(+), 7 deletions(-)

diff --git a/libavformat/concatdec.c b/libavformat/concatdec.c
index b3a430e..1cd9ec1 100644
--- a/libavformat/concatdec.c
+++ b/libavformat/concatdec.c
@@ -64,6 +64,8 @@ typedef struct {
 ConcatMatchMode stream_match_mode;
 unsigned auto_convert;
 int segment_time_metadata;
+int cur_fileno;
+AVFormatContext *cur_avf_saved;
 } ConcatContext;
 
 static int concat_probe(AVProbeData *probe)
@@ -333,6 +335,8 @@ static int open_file(AVFormatContext *avf, unsigned fileno)
 avformat_close_input(>avf);
 return ret;
 }
+
+cat->cur_fileno = fileno;
 cat->cur_file = file;
 if (file->start_time == AV_NOPTS_VALUE)
 file->start_time = !fileno ? 0 :
@@ -711,13 +715,18 @@ static int real_seek(AVFormatContext *avf, int stream,
 left  = mid;
 }
 
-if ((ret = open_file(avf, left)) < 0)
-return ret;
+if (cat->cur_fileno != left) {
+if ((ret = open_file(avf, left)) < 0)
+return ret;
+} else {
+cat->avf = cat->cur_avf_saved;
+}
 
 ret = try_seek(avf, stream, min_ts, ts, max_ts, flags);
 if (ret < 0 &&
 left < cat->nb_files - 1 &&
 cat->files[left + 1].start_time < max_ts) {
+cat->avf = NULL;
 if ((ret = open_file(avf, left + 1)) < 0)
 return ret;
 ret = try_seek(avf, stream, min_ts, ts, max_ts, flags);
@@ -730,7 +739,7 @@ static int concat_seek(AVFormatContext *avf, int stream,
 {
 ConcatContext *cat = avf->priv_data;
 ConcatFile *cur_file_saved = cat->cur_file;
-AVFormatContext *cur_avf_saved = cat->avf;
+cat->cur_avf_saved = cat->avf;
 int ret;
 
 if (!cat->seekable)
@@ -739,12 +748,16 @@ static int concat_seek(AVFormatContext *avf, int stream,
 return AVERROR(ENOSYS);
 cat->avf = NULL;
 if ((ret = real_seek(avf, stream, min_ts, ts, max_ts, flags)) < 0) {
-if (cat->avf)
-avformat_close_input(>avf);
-cat->avf  = cur_avf_saved;
+if (cat->cur_file != cur_file_saved) {
+if (cat->avf)
+avformat_close_input(>avf);
+}
+cat->avf  = cat->cur_avf_saved;
 cat->cur_file = cur_file_saved;
 } else {
-avformat_close_input(_avf_saved);
+if (cat->cur_file != cur_file_saved) {
+avformat_close_input(>cur_avf_saved);
+}
 cat->eof = 0;
 }
 return ret;
-- 
2.7.4

___
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-19 Thread Michael Niedermayer
On Mon, Sep 19, 2016 at 06:31:31PM -0700, Sasi Inguva wrote:
> Signed-off-by: Sasi Inguva 
> ---
>  libavcodec/utils.c   | 15 +++---
>  libavformat/mov.c| 75 
> 
>  tests/ref/fate/gaplessenc-itunes-to-ipod-aac |  2 +-
>  tests/ref/fate/gaplessenc-pcm-to-mov-aac |  2 +-
>  4 files changed, 74 insertions(+), 20 deletions(-)

with this
./ffmpeg -i H263_NM_f.mp4
segfaults

also theres a problem with initial padding with libvorbis with this
change (similar to past acc/mp3 issues)

i can provide proper testcases if needed tomorrow ?
(too late ATM need to sleep)


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

Modern terrorism, a quick summary: Need oil, start war with country that
has oil, kill hundread thousand in war. Let country fall into chaos,
be surprised about raise of fundamantalists. Drop more bombs, kill more
people, be surprised about them taking revenge and drop even more bombs
and strip your own citizens of their rights and freedoms. to be continued


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


Re: [FFmpeg-devel] Dropping SDL1 support [VOTE]

2016-09-19 Thread Lukasz Marek
On Sep 18, 2016 04:57, "Ronald S. Bultje"  wrote:
>
> Hi,
>
> On Sat, Sep 17, 2016 at 4:26 PM, Marton Balint  wrote:
>
> > I think we should wait until Lukasz does the port of the opengl device
to
> > SDL2, and do the switch after that.
>
>
> When do we think that'll be finished?

I missed this, I alredy posted a patch, it needs just one line fix so not
consider it as a blocker.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH 4/4] lavf/mov: Add support for edit list parsing.

2016-09-19 Thread Sasi Inguva
I have sent a patch fixing the gapless playback . PTAL. Basically the patch
will make sure that , at least in case of one edit list for audio, the
timestamps provided by the demuxer are strictly monotonically increasing ,
and also that the skip_samples field is correctly set to the edit list
media time, exactly as before the edit list patch.

On Mon, Sep 19, 2016 at 11:37 AM, wm4  wrote:

> On Tue,  9 Aug 2016 18:48:22 -0700
> Sasi Inguva  wrote:
>
>
> > diff --git a/tests/ref/fate/gaplessenc-itunes-to-ipod-aac
> b/tests/ref/fate/gaplessenc-itunes-to-ipod-aac
> > index aacb058..145bd09 100644
> > --- a/tests/ref/fate/gaplessenc-itunes-to-ipod-aac
> > +++ b/tests/ref/fate/gaplessenc-itunes-to-ipod-aac
>
>
> > -packet|pts=-1024|dts=-1024|duration=1024
> > +packet|pts=0|dts=0|duration=N/A
> >  packet|pts=0|dts=0|duration=1024
>
> You've just got to be kidding me. Things wrong here:
> - demuxer returns packets with broken timestamps (dts not strictly
>   monotonic, decoded pts won't be strictly monotonic either)
> - the entirely correct pts is broken and will silently break gapless
>   decoding in existing API users (but I guess you don't care and
>   neither did whoever pushed this?)
> - I know there's supposed to be a "discard frame" flag here (which
>   existing API users will ignore, leading to broken decoding and all),
>   but it's not tested??? This makes the entire gapless test for
>   dumping packet metadata useless, you may as well have deleted the
>   tests!
>
> And of course you could just have let the mov demuxer export the edit
> list explicitly, and assembled it after decoding. But I guess you
> didn't want to deal with that ffmpeg.c garbage dump (and neither did
> whoever reviewed/pushed this), so you moved it into the libs as uaual?
>
> This is all very disappointing.
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


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

2016-09-19 Thread Sasi Inguva
Signed-off-by: Sasi Inguva 
---
 libavcodec/utils.c   | 15 +++---
 libavformat/mov.c| 75 
 tests/ref/fate/gaplessenc-itunes-to-ipod-aac |  2 +-
 tests/ref/fate/gaplessenc-pcm-to-mov-aac |  2 +-
 4 files changed, 74 insertions(+), 20 deletions(-)

diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index b0345b6..0c2d48c 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();
@@ -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 = 
 if (HAVE_THREADS && avctx->active_thread_type & FF_THREAD_FRAME)
 ret = ff_thread_decode_frame(avctx, frame, got_frame_ptr, );
@@ -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, _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) {
+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..0805139 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;
+} else {
+first_non_zero_audio_edit = 0;
+}
+
+if (first_non_zero_audio_edit > 0)
+st->skip_samples = msc->start_pad = 0;
 }
 
 //find closest previous key frame
@@ -3042,23 +3068,54 @@ static void 

Re: [FFmpeg-devel] [PATCH]lavc/rscc: Support pal8

2016-09-19 Thread Carl Eugen Hoyos
2016-09-19 21:42 GMT+02:00 Paul B Mahol :
> On 9/19/16, Carl Eugen Hoyos  wrote:
>> 2016-09-19 20:28 GMT+02:00 Paul B Mahol :
>>> On 9/19/16, Carl Eugen Hoyos  wrote:
>>>
 Attached patch fixes the colours for the sample in ticket #5611.
>>
>>> You should use av_packet_get_side_data instead.
>>
>> New patch attached, thank you!

> OK

Patch applied.

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


[FFmpeg-devel] [PATCH 1/2] avcodec: add pcm_f16le and pcm_f24le decoder

2016-09-19 Thread Paul B Mahol
Signed-off-by: Paul B Mahol 
---
 libavcodec/Makefile |  2 ++
 libavcodec/allcodecs.c  |  2 ++
 libavcodec/avcodec.h|  2 ++
 libavcodec/codec_desc.c | 14 ++
 libavcodec/pcm.c| 34 ++
 libavcodec/utils.c  |  2 ++
 6 files changed, 56 insertions(+)

diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index 276308b..72db88a 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -655,6 +655,8 @@ OBJS-$(CONFIG_PCM_ALAW_DECODER)   += pcm.o
 OBJS-$(CONFIG_PCM_ALAW_ENCODER)   += pcm.o
 OBJS-$(CONFIG_PCM_BLURAY_DECODER) += pcm-bluray.o
 OBJS-$(CONFIG_PCM_DVD_DECODER)+= pcm-dvd.o
+OBJS-$(CONFIG_PCM_F16LE_DECODER)  += pcm.o
+OBJS-$(CONFIG_PCM_F24LE_DECODER)  += pcm.o
 OBJS-$(CONFIG_PCM_F32BE_DECODER)  += pcm.o
 OBJS-$(CONFIG_PCM_F32BE_ENCODER)  += pcm.o
 OBJS-$(CONFIG_PCM_F32LE_DECODER)  += pcm.o
diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
index b403bf2..6acd753 100644
--- a/libavcodec/allcodecs.c
+++ b/libavcodec/allcodecs.c
@@ -474,6 +474,8 @@ void avcodec_register_all(void)
 REGISTER_ENCDEC (PCM_ALAW,  pcm_alaw);
 REGISTER_DECODER(PCM_BLURAY,pcm_bluray);
 REGISTER_DECODER(PCM_DVD,   pcm_dvd);
+REGISTER_DECODER(PCM_F16LE, pcm_f16le);
+REGISTER_DECODER(PCM_F24LE, pcm_f24le);
 REGISTER_ENCDEC (PCM_F32BE, pcm_f32be);
 REGISTER_ENCDEC (PCM_F32LE, pcm_f32le);
 REGISTER_ENCDEC (PCM_F64BE, pcm_f64be);
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index db1061d..217bb27 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -448,6 +448,8 @@ enum AVCodecID {
 
 AV_CODEC_ID_PCM_S64LE = 0x10800,
 AV_CODEC_ID_PCM_S64BE,
+AV_CODEC_ID_PCM_F16LE,
+AV_CODEC_ID_PCM_F24LE,
 
 /* various ADPCM codecs */
 AV_CODEC_ID_ADPCM_IMA_QT = 0x11000,
diff --git a/libavcodec/codec_desc.c b/libavcodec/codec_desc.c
index 24948ca..0eebf41 100644
--- a/libavcodec/codec_desc.c
+++ b/libavcodec/codec_desc.c
@@ -1742,6 +1742,20 @@ static const AVCodecDescriptor codec_descriptors[] = {
 .props = AV_CODEC_PROP_LOSSLESS,
 },
 {
+.id= AV_CODEC_ID_PCM_F16LE,
+.type  = AVMEDIA_TYPE_AUDIO,
+.name  = "pcm_f16le",
+.long_name = NULL_IF_CONFIG_SMALL("PCM 16.8 floating point 
little-endian"),
+.props = AV_CODEC_PROP_LOSSLESS,
+},
+{
+.id= AV_CODEC_ID_PCM_F24LE,
+.type  = AVMEDIA_TYPE_AUDIO,
+.name  = "pcm_f24le",
+.long_name = NULL_IF_CONFIG_SMALL("PCM 24.0 floating point 
little-endian"),
+.props = AV_CODEC_PROP_LOSSLESS,
+},
+{
 .id= AV_CODEC_ID_PCM_F32BE,
 .type  = AVMEDIA_TYPE_AUDIO,
 .name  = "pcm_f32be",
diff --git a/libavcodec/pcm.c b/libavcodec/pcm.c
index 2e8e8e7..8c326c6 100644
--- a/libavcodec/pcm.c
+++ b/libavcodec/pcm.c
@@ -25,6 +25,7 @@
  */
 
 #include "libavutil/attributes.h"
+#include "libavutil/float_dsp.h"
 #include "avcodec.h"
 #include "bytestream.h"
 #include "internal.h"
@@ -225,6 +226,8 @@ static int pcm_encode_frame(AVCodecContext *avctx, AVPacket 
*avpkt,
 
 typedef struct PCMDecode {
 short   table[256];
+AVFloatDSPContext *fdsp;
+float   scale;
 } PCMDecode;
 
 static av_cold int pcm_decode_init(AVCodecContext *avctx)
@@ -246,6 +249,13 @@ static av_cold int pcm_decode_init(AVCodecContext *avctx)
 for (i = 0; i < 256; i++)
 s->table[i] = ulaw2linear(i);
 break;
+case AV_CODEC_ID_PCM_F16LE:
+case AV_CODEC_ID_PCM_F24LE:
+s->scale = 1. / (1 << (avctx->bits_per_coded_sample - 1));
+s->fdsp = avpriv_float_dsp_alloc(0);
+if (!s->fdsp)
+return AVERROR(ENOMEM);
+break;
 default:
 break;
 }
@@ -258,6 +268,15 @@ static av_cold int pcm_decode_init(AVCodecContext *avctx)
 return 0;
 }
 
+static av_cold int pcm_decode_close(AVCodecContext *avctx)
+{
+PCMDecode *s = avctx->priv_data;
+
+av_freep(>fdsp);
+
+return 0;
+}
+
 /**
  * Read PCM samples macro
  * @param size   Data size of native machine format
@@ -400,6 +419,8 @@ static int pcm_decode_frame(AVCodecContext *avctx, void 
*data,
 break;
 case AV_CODEC_ID_PCM_S32LE:
 case AV_CODEC_ID_PCM_F32LE:
+case AV_CODEC_ID_PCM_F24LE:
+case AV_CODEC_ID_PCM_F16LE:
 DECODE(32, le32, src, samples, n, 0, 0)
 break;
 case AV_CODEC_ID_PCM_S32LE_PLANAR:
@@ -433,6 +454,8 @@ static int pcm_decode_frame(AVCodecContext *avctx, void 
*data,
 break;
 case AV_CODEC_ID_PCM_F64LE:
 case AV_CODEC_ID_PCM_F32LE:
+case AV_CODEC_ID_PCM_F24LE:
+case AV_CODEC_ID_PCM_F16LE:
 case AV_CODEC_ID_PCM_S64LE:
 case AV_CODEC_ID_PCM_S32LE:
 case AV_CODEC_ID_PCM_S16LE:
@@ -495,6 +518,14 @@ static int 

[FFmpeg-devel] [PATCH 2/2] avformat/wavdec: add support for decoding 24.0 and 16.8 floating point pcm formats

2016-09-19 Thread Paul B Mahol
Fixes #5602 and #5603.

Signed-off-by: Paul B Mahol 
---
 libavformat/wavdec.c | 13 +
 1 file changed, 13 insertions(+)

diff --git a/libavformat/wavdec.c b/libavformat/wavdec.c
index 7176cd6..9f760c1 100644
--- a/libavformat/wavdec.c
+++ b/libavformat/wavdec.c
@@ -560,6 +560,19 @@ break_loop:
 if (sample_count)
 st->duration = sample_count;
 
+if (st->codecpar->codec_id == AV_CODEC_ID_PCM_S32LE &&
+st->codecpar->block_align == st->codecpar->channels * 4 &&
+st->codecpar->bits_per_coded_sample == 32 &&
+st->codecpar->extradata_size == 2 &&
+AV_RL16(st->codecpar->extradata) == 1) {
+st->codecpar->codec_id = AV_CODEC_ID_PCM_F16LE;
+st->codecpar->bits_per_coded_sample = 16;
+} else if (st->codecpar->codec_id == AV_CODEC_ID_PCM_S24LE &&
+   st->codecpar->block_align == st->codecpar->channels * 4 &&
+   st->codecpar->bits_per_coded_sample == 24) {
+st->codecpar->codec_id = AV_CODEC_ID_PCM_F24LE;
+}
+
 ff_metadata_conv_ctx(s, NULL, wav_metadata_conv);
 ff_metadata_conv_ctx(s, NULL, ff_riff_info_conv);
 
-- 
2.5.0

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


Re: [FFmpeg-devel] [PATCH]lavc/rscc: Support pal8

2016-09-19 Thread Paul B Mahol
On 9/19/16, Carl Eugen Hoyos  wrote:
> 2016-09-19 20:28 GMT+02:00 Paul B Mahol :
>> On 9/19/16, Carl Eugen Hoyos  wrote:
>>
>>> Attached patch fixes the colours for the sample in ticket #5611.
>
>> You should use av_packet_get_side_data instead.
>
> New patch attached, thank you!
>
> Carl Eugen
>

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


Re: [FFmpeg-devel] [PATCH 4/6] lavf/mov: Add support for edit list parsing.

2016-09-19 Thread Sasi Inguva
For the gapless playback:
I can hack so that we have monotonically increasing timestamps for the
audio , when demuxing . Basically going back in the index and setting
correct timestamps for the discarded packets.
But, as pointed out in the IRC  channel, I modify skip_samples field too in
the mov_fix_index function, which might be harder to fix. I want to know if
we need to have skip_samples field as exactly the same as before , for the
gapless decoding by "external decoder wrappers " to work.

On Mon, Sep 19, 2016 at 12:02 PM, Michael Niedermayer <
mich...@niedermayer.cc> wrote:

> On Mon, Sep 19, 2016 at 11:08:30AM -0700, Sasi Inguva wrote:
> > Thanks Michael, for the assiduous review. We caught 2-3 audio decoding
> bugs
> > because of it, and implemented basic seek functionality.
>
> It seems this causes a regression
> durandal117 and wm4 on IRC pointed out that the change to the gapless
> fate test seems wrong
>
> [...]
> > > >  tests/ref/fate/gaplessenc-itunes-to-ipod-aac   |8 +-
> > > >  tests/ref/fate/gaplessenc-pcm-to-mov-aac   |8 +-
>
> Can you look at this ?
>
> 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
>
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH]lavc/rscc: Support pal8

2016-09-19 Thread Carl Eugen Hoyos
2016-09-19 20:28 GMT+02:00 Paul B Mahol :
> On 9/19/16, Carl Eugen Hoyos  wrote:
>
>> Attached patch fixes the colours for the sample in ticket #5611.

> You should use av_packet_get_side_data instead.

New patch attached, thank you!

Carl Eugen
From 233b857e263c7e948ddc12ee2c85d624593a9a09 Mon Sep 17 00:00:00 2001
From: Carl Eugen Hoyos 
Date: Mon, 19 Sep 2016 21:21:27 +0200
Subject: [PATCH] lavc/rscc: Support pal8 in rscc.

Fixes the colours of the sample for ticket #5611.
---
 libavcodec/rscc.c |   15 +--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/libavcodec/rscc.c b/libavcodec/rscc.c
index 3b3703c..7f280a9 100644
--- a/libavcodec/rscc.c
+++ b/libavcodec/rscc.c
@@ -31,7 +31,7 @@
  * and it can be deflated or not. Similarly, pixel data comes after the header
  * and a variable size value, and it can be deflated or just raw.
  *
- * Supports: GRAY8, BGRA, BGR24, RGB555, RGB8
+ * Supports: BGRA, BGR24, RGB555, PAL8
  */
 
 #include 
@@ -58,6 +58,7 @@ typedef struct RsccContext {
 Tile *tiles;
 unsigned int tiles_size;
 int component_size;
+uint32_t pal[AVPALETTE_COUNT];
 
 /* zlib interaction */
 uint8_t *inflated_buf;
@@ -89,7 +90,7 @@ static av_cold int rscc_init(AVCodecContext *avctx)
 ctx->component_size = avctx->bits_per_coded_sample / 8;
 switch (avctx->bits_per_coded_sample) {
 case 8:
-avctx->pix_fmt = AV_PIX_FMT_GRAY8;
+avctx->pix_fmt = AV_PIX_FMT_PAL8;
 break;
 case 16:
 avctx->pix_fmt = AV_PIX_FMT_RGB555LE;
@@ -308,6 +309,16 @@ static int rscc_decode_frame(AVCodecContext *avctx, void *data,
 } else {
 frame->pict_type = AV_PICTURE_TYPE_P;
 }
+if (avctx->pix_fmt == AV_PIX_FMT_PAL8) {
+const uint8_t *pal = av_packet_get_side_data(avpkt,
+ AV_PKT_DATA_PALETTE,
+ NULL);
+if (pal) {
+frame->palette_has_changed = 1;
+memcpy(ctx->pal, pal, AVPALETTE_SIZE);
+}
+memcpy (frame->data[1], ctx->pal, AVPALETTE_SIZE);
+}
 *got_frame = 1;
 
 end:
-- 
1.7.10.4

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


Re: [FFmpeg-devel] [PATCH 3/4] lavc: Add a flag in AVPacket to discard packet after decoding. Discard frames after decoding based on the flag.

2016-09-19 Thread Carl Eugen Hoyos
2016-09-19 20:32 GMT+02:00 wm4 :

> But I guess you don't care, neither did whoever pushed this
> low quality patch before the patch was fixed?

I believe you didn't oppose the current mailing list rules so
please refrain from personal attacks.

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


Re: [FFmpeg-devel] [PATCH 4/6] lavf/mov: Add support for edit list parsing.

2016-09-19 Thread Michael Niedermayer
On Mon, Sep 19, 2016 at 11:08:30AM -0700, Sasi Inguva wrote:
> Thanks Michael, for the assiduous review. We caught 2-3 audio decoding bugs
> because of it, and implemented basic seek functionality.

It seems this causes a regression
durandal117 and wm4 on IRC pointed out that the change to the gapless
fate test seems wrong

[...]
> > >  tests/ref/fate/gaplessenc-itunes-to-ipod-aac   |8 +-
> > >  tests/ref/fate/gaplessenc-pcm-to-mov-aac   |8 +-

Can you look at this ?

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 3/4] lavc: Add a flag in AVPacket to discard packet after decoding. Discard frames after decoding based on the flag.

2016-09-19 Thread wm4
On Tue,  9 Aug 2016 18:48:21 -0700
Sasi Inguva  wrote:

> Signed-off-by: Sasi Inguva 
> ---
>  libavcodec/avcodec.h |  6 ++
>  libavcodec/utils.c   | 14 +-
>  libavcodec/version.h |  2 +-
>  3 files changed, 20 insertions(+), 2 deletions(-)
> 
> diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
> index 3b21537..d68da01 100644
> --- a/libavcodec/avcodec.h
> +++ b/libavcodec/avcodec.h
> @@ -1621,6 +1621,12 @@ typedef struct AVPacket {
>  } AVPacket;
>  #define AV_PKT_FLAG_KEY 0x0001 ///< The packet contains a keyframe
>  #define AV_PKT_FLAG_CORRUPT 0x0002 ///< The packet content is corrupted
> +/**
> + * Flag is used to discard packets which are required to maintain valid
> + * decoder state but are not required for output and should be dropped
> + * after decoding.
> + **/
> +#define AV_PKT_FLAG_DISCARD   0x0004
>  
>  enum AVSideDataParamChangeFlags {
>  AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_COUNT  = 0x0001,
> diff --git a/libavcodec/utils.c b/libavcodec/utils.c
> index f7adb52..399cf72 100644
> --- a/libavcodec/utils.c
> +++ b/libavcodec/utils.c
> @@ -784,6 +784,12 @@ int ff_init_buffer_info(AVCodecContext *avctx, AVFrame 
> *frame)
>  }
>  }
>  add_metadata_from_side_data(pkt, frame);
> +
> +if (pkt->flags & AV_PKT_FLAG_DISCARD) {
> +frame->flags |= AV_FRAME_FLAG_DISCARD;
> +} else {
> +frame->flags = (frame->flags & ~AV_FRAME_FLAG_DISCARD);
> +}

Many external decoders won't be able to do this correctly, because they
won't call ff_init_buffer_info in the "right moment". They're
asynchronous, buffered, opaque.

But I guess you don't care, neither did whoever pushed this low quality
patch before the patch was fixed?

>  } else {
>  frame->pkt_pts = AV_NOPTS_VALUE;
>  av_frame_set_pkt_pos (frame, -1);
> @@ -2248,7 +2254,9 @@ fail:
>  if(ret == tmp.size)
>  ret = avpkt->size;
>  }
> -
> +if (picture->flags & AV_FRAME_FLAG_DISCARD) {
> +*got_picture_ptr = 0;
> +}
>  if (*got_picture_ptr) {
>  if (!avctx->refcounted_frames) {
>  int err = unrefcount_frame(avci, picture);
> @@ -2412,6 +2420,10 @@ int attribute_align_arg 
> avcodec_decode_audio4(AVCodecContext *avctx,
>  avctx->internal->skip_samples = 0;
>  }
>  }
> +
> +if ((frame->flags & AV_FRAME_FLAG_DISCARD) && 
> avctx->internal->skip_samples <= 0) {
> +*got_frame_ptr = 0;
> +}
>  fail:
>  avctx->internal->pkt = NULL;
>  if (did_split) {
> diff --git a/libavcodec/version.h b/libavcodec/version.h
> index 4ded1ee..a697261 100644
> --- a/libavcodec/version.h
> +++ b/libavcodec/version.h
> @@ -28,7 +28,7 @@
>  #include "libavutil/version.h"
>  
>  #define LIBAVCODEC_VERSION_MAJOR  57
> -#define LIBAVCODEC_VERSION_MINOR  51
> +#define LIBAVCODEC_VERSION_MINOR  52
>  #define LIBAVCODEC_VERSION_MICRO 100
>  
>  #define LIBAVCODEC_VERSION_INT  AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \

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


Re: [FFmpeg-devel] [PATCH 4/4] lavf/mov: Add support for edit list parsing.

2016-09-19 Thread wm4
On Tue,  9 Aug 2016 18:48:22 -0700
Sasi Inguva  wrote:


> diff --git a/tests/ref/fate/gaplessenc-itunes-to-ipod-aac 
> b/tests/ref/fate/gaplessenc-itunes-to-ipod-aac
> index aacb058..145bd09 100644
> --- a/tests/ref/fate/gaplessenc-itunes-to-ipod-aac
> +++ b/tests/ref/fate/gaplessenc-itunes-to-ipod-aac


> -packet|pts=-1024|dts=-1024|duration=1024
> +packet|pts=0|dts=0|duration=N/A
>  packet|pts=0|dts=0|duration=1024

You've just got to be kidding me. Things wrong here:
- demuxer returns packets with broken timestamps (dts not strictly
  monotonic, decoded pts won't be strictly monotonic either)
- the entirely correct pts is broken and will silently break gapless
  decoding in existing API users (but I guess you don't care and
  neither did whoever pushed this?)
- I know there's supposed to be a "discard frame" flag here (which
  existing API users will ignore, leading to broken decoding and all),
  but it's not tested??? This makes the entire gapless test for
  dumping packet metadata useless, you may as well have deleted the
  tests!

And of course you could just have let the mov demuxer export the edit
list explicitly, and assembled it after decoding. But I guess you
didn't want to deal with that ffmpeg.c garbage dump (and neither did
whoever reviewed/pushed this), so you moved it into the libs as uaual?

This is all very disappointing.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH]lavc/rscc: Support pal8

2016-09-19 Thread Paul B Mahol
On 9/19/16, Carl Eugen Hoyos  wrote:
> Hi!
>
> Attached patch fixes the colours for the sample in ticket #5611.
>
> Please comment, Carl Eugen
>

You should use av_packet_get_side_data instead.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH] doc/encoders: minor aac encoder formatting improvements

2016-09-19 Thread Rostislav Pehlivanov
On 18 September 2016 at 23:01, Moritz Barsnick  wrote:

> Minor changes for markup consistency.
>
> That line I shifted is probably redundant.
>
> Moritz
>
> ___
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
>
Applied and pushed

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


Re: [FFmpeg-devel] [PATCH 4/6] lavf/mov: Add support for edit list parsing.

2016-09-19 Thread Sasi Inguva
Thanks Michael, for the assiduous review. We caught 2-3 audio decoding bugs
because of it, and implemented basic seek functionality.

On Mon, Sep 19, 2016 at 10:54 AM, Michael Niedermayer <
mich...@niedermayer.cc> wrote:

> On Sun, Sep 18, 2016 at 10:09:03PM -0700, Sasi Inguva wrote:
> > Signed-off-by: Sasi Inguva 
> > ---
> >  libavcodec/utils.c |4 +
> >  libavformat/mov.c  |  361 -
> >  tests/Makefile |1 +
> >  tests/fate/mov.mak |   28 +
> >  tests/ref/fate/copy-trac236|4 +-
> >  tests/ref/fate/filter-fps-cfr  |1 -
> >  tests/ref/fate/gaplessenc-itunes-to-ipod-aac   |8 +-
> >  tests/ref/fate/gaplessenc-pcm-to-mov-aac   |8 +-
> >  tests/ref/fate/gsm-toast   | 1001
> 
> >  tests/ref/fate/h264-invalid-ref-mod|   20 +-
> >  tests/ref/fate/mov-1elist-1ctts|   57 ++
> >  tests/ref/fate/mov-1elist-ends-last-bframe |   56 ++
> >  tests/ref/fate/mov-1elist-noctts   |   57 ++
> >  tests/ref/fate/mov-2elist-elist1-ends-bframe   |   51 ++
> >  tests/ref/fate/mov-3elist  |   57 ++
> >  tests/ref/fate/mov-3elist-1ctts|   57 ++
> >  tests/ref/fate/mov-elist-starts-ctts-2ndsample |   57 ++
> >  tests/ref/fate/pcm_s16be-stereo|2 +-
> >  tests/ref/fate/quickdraw   |   12 +-
> >  tests/ref/fate/tscc2-mov   |   20 +-
> >  tests/ref/lavf-fate/mov_qtrle_mace6|2 +-
> >  21 files changed, 1315 insertions(+), 549 deletions(-)
> >  create mode 100644 tests/fate/mov.mak
> >  create mode 100644 tests/ref/fate/mov-1elist-1ctts
> >  create mode 100644 tests/ref/fate/mov-1elist-ends-last-bframe
> >  create mode 100644 tests/ref/fate/mov-1elist-noctts
> >  create mode 100644 tests/ref/fate/mov-2elist-elist1-ends-bframe
> >  create mode 100644 tests/ref/fate/mov-3elist
> >  create mode 100644 tests/ref/fate/mov-3elist-1ctts
> >  create mode 100644 tests/ref/fate/mov-elist-starts-ctts-2ndsample
>
> applied
>
> thanks alot
>
> [...]
> --
> Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
>
> Concerning the gods, I have no means of knowing whether they exist or not
> or of what sort they may be, because of the obscurity of the subject, and
> the brevity of human life -- Protagoras
>
> ___
> 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 1/6] avutil/frame: Add a flag to discard frame after decode.

2016-09-19 Thread Michael Niedermayer
On Thu, Sep 15, 2016 at 01:36:14PM -0700, Sasi Inguva wrote:
> Signed-off-by: Sasi Inguva 
> ---
>  libavutil/frame.c   | 1 +
>  libavutil/frame.h   | 4 
>  libavutil/version.h | 2 +-
>  3 files changed, 6 insertions(+), 1 deletion(-)

applied

thx

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

Let us carefully observe those good qualities wherein our enemies excel us
and endeavor to excel them, by avoiding what is faulty, and imitating what
is excellent in them. -- Plutarch


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


Re: [FFmpeg-devel] [PATCH 5/6] lavf/utils: Support av_index_search_timestamp in case of AVIndexEntry with discarded packets.

2016-09-19 Thread Michael Niedermayer
On Thu, Sep 15, 2016 at 01:36:18PM -0700, Sasi Inguva wrote:
> Signed-off-by: Sasi Inguva 
> ---
>  libavformat/utils.c | 10 ++
>  1 file changed, 10 insertions(+)

applied

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 3/6] lavc: Add a flag in AVPacket to discard packet after decoding. Discard frames after decoding based on the flag.

2016-09-19 Thread Michael Niedermayer
On Thu, Sep 15, 2016 at 01:36:16PM -0700, Sasi Inguva wrote:
> Signed-off-by: Sasi Inguva 
> ---
>  libavcodec/avcodec.h |  6 ++
>  libavcodec/utils.c   | 15 ++-
>  2 files changed, 20 insertions(+), 1 deletion(-)

applied

thx

[...]
-- 
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 2/6] avformat/avframe.h: Add a flag in AVIndexEntry to discard frame after decoding.

2016-09-19 Thread Michael Niedermayer
On Thu, Sep 15, 2016 at 01:36:15PM -0700, Sasi Inguva wrote:
> Signed-off-by: Sasi Inguva 
> ---
>  libavformat/avformat.h | 3 +++
>  1 file changed, 3 insertions(+)

applied

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


[FFmpeg-devel] [PATCH]lavc/rscc: Support pal8

2016-09-19 Thread Carl Eugen Hoyos
Hi!

Attached patch fixes the colours for the sample in ticket #5611.

Please comment, Carl Eugen
From 7af0c224f5c0fd8dec095ba5333a87257ffccd85 Mon Sep 17 00:00:00 2001
From: Carl Eugen Hoyos 
Date: Mon, 19 Sep 2016 19:12:12 +0200
Subject: [PATCH] lavc/rscc: Support pal8 in rscc.

Fixes the colours for the sample in ticket #5611.
---
 libavcodec/rscc.c |   16 ++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/libavcodec/rscc.c b/libavcodec/rscc.c
index 3b3703c..6d4b5af 100644
--- a/libavcodec/rscc.c
+++ b/libavcodec/rscc.c
@@ -31,7 +31,7 @@
  * and it can be deflated or not. Similarly, pixel data comes after the header
  * and a variable size value, and it can be deflated or just raw.
  *
- * Supports: GRAY8, BGRA, BGR24, RGB555, RGB8
+ * Supports: PAL8, BGRA, BGR24, RGB555, RGB8
  */
 
 #include 
@@ -58,6 +58,8 @@ typedef struct RsccContext {
 Tile *tiles;
 unsigned int tiles_size;
 int component_size;
+uint32_t pal[AVPALETTE_COUNT];
+int pal_size;
 
 /* zlib interaction */
 uint8_t *inflated_buf;
@@ -86,10 +88,18 @@ static av_cold int rscc_init(AVCodecContext *avctx)
 avctx->pix_fmt = AV_PIX_FMT_BGRA;
 ctx->component_size = 4;
 } else if (avctx->codec_tag == MKTAG('R', 'S', 'C', 'C')) {
+int i;
+uint8_t *pal;
 ctx->component_size = avctx->bits_per_coded_sample / 8;
 switch (avctx->bits_per_coded_sample) {
 case 8:
-avctx->pix_fmt = AV_PIX_FMT_GRAY8;
+avctx->pix_fmt = AV_PIX_FMT_PAL8;
+pal = avctx->extradata;
+ctx->pal_size = FFMIN(avctx->extradata_size, AVPALETTE_SIZE);
+for (i = 0; i < ctx->pal_size / 4; i++) {
+ctx->pal[i] = 0xFFU << 24 | AV_RL32(pal);
+pal += 4;
+}
 break;
 case 16:
 avctx->pix_fmt = AV_PIX_FMT_RGB555LE;
@@ -308,6 +318,8 @@ static int rscc_decode_frame(AVCodecContext *avctx, void 
*data,
 } else {
 frame->pict_type = AV_PICTURE_TYPE_P;
 }
+if (avctx->pix_fmt == AV_PIX_FMT_PAL8)
+memcpy(frame->data[1], ctx->pal, ctx->pal_size);
 *got_frame = 1;
 
 end:
-- 
1.7.10.4

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


Re: [FFmpeg-devel] [PATCH] lavc/videotoolboxenc: implement a53cc

2016-09-19 Thread Aman Gupta
On Monday, September 19, 2016, Richard Kern  wrote:

>
> On Sep 10, 2016, at 10:33 PM, Aman Gupta  > wrote:
>
>
>
> On Sunday, September 11, 2016, Richard Kern  > wrote:
>
>>
>> > On Sep 8, 2016, at 4:19 AM, Aman Gupta  wrote:
>> >
>> > From: Aman Gupta 
>> >
>> > ---
>> > libavcodec/videotoolboxenc.c | 76 ++
>> --
>> > 1 file changed, 67 insertions(+), 9 deletions(-)
>> >
>> > diff --git a/libavcodec/videotoolboxenc.c b/libavcodec/videotoolboxenc.c
>> > index 4345ca3..859dde9 100644
>> > --- a/libavcodec/videotoolboxenc.c
>> > +++ b/libavcodec/videotoolboxenc.c
>> > @@ -32,6 +32,7 @@
>> > #include "libavutil/pixdesc.h"
>> > #include "internal.h"
>> > #include 
>> > +#include "h264.h"
>> >
>> > #if !CONFIG_VT_BT2020
>> > # define kCVImageBufferColorPrimaries_ITU_R_2020   CFSTR("ITU_R_2020")
>> > @@ -55,8 +56,14 @@ typedef enum VTH264Entropy{
>> >
>> > static const uint8_t start_code[] = { 0, 0, 0, 1 };
>> >
>> > +typedef struct ExtraSEI {
>> > +  void *data;
>> > +  size_t size;
>> > +} ExtraSEI;
>> > +
>> > typedef struct BufNode {
>> > CMSampleBufferRef cm_buffer;
>> > +ExtraSEI *sei;
>> > struct BufNode* next;
>> > int error;
>> > } BufNode;
>> > @@ -94,6 +101,7 @@ typedef struct VTEncContext {
>> > bool flushing;
>> > bool has_b_frames;
>> > bool warned_color_range;
>> > +bool a53_cc;
>> > } VTEncContext;
>> >
>> > static int vtenc_populate_extradata(AVCodecContext   *avctx,
>> > @@ -136,7 +144,7 @@ static void set_async_error(VTEncContext *vtctx,
>> int err)
>> > pthread_mutex_unlock(>lock);
>> > }
>> >
>> > -static int vtenc_q_pop(VTEncContext *vtctx, bool wait,
>> CMSampleBufferRef *buf)
>> > +static int vtenc_q_pop(VTEncContext *vtctx, bool wait,
>> CMSampleBufferRef *buf, ExtraSEI **sei)
>> > {
>> > BufNode *info;
>> >
>> > @@ -173,6 +181,12 @@ static int vtenc_q_pop(VTEncContext *vtctx, bool
>> wait, CMSampleBufferRef *buf)
>> > pthread_mutex_unlock(>lock);
>> >
>> > *buf = info->cm_buffer;
>> > +if (sei && *buf) {
>> > +*sei = info->sei;
>> > +} else if (info->sei) {
>> > +if (info->sei->data) av_free(info->sei->data);
>> > +av_free(info->sei);
>> > +}
>> > av_free(info);
>> >
>> > vtctx->frame_ct_out++;
>> > @@ -180,7 +194,7 @@ static int vtenc_q_pop(VTEncContext *vtctx, bool
>> wait, CMSampleBufferRef *buf)
>> > return 0;
>> > }
>> >
>> > -static void vtenc_q_push(VTEncContext *vtctx, CMSampleBufferRef buffer)
>> > +static void vtenc_q_push(VTEncContext *vtctx, CMSampleBufferRef
>> buffer, ExtraSEI *sei)
>> > {
>> > BufNode *info = av_malloc(sizeof(BufNode));
>> > if (!info) {
>> > @@ -190,6 +204,7 @@ static void vtenc_q_push(VTEncContext *vtctx,
>> CMSampleBufferRef buffer)
>> >
>> > CFRetain(buffer);
>> > info->cm_buffer = buffer;
>> > +info->sei = sei;
>> > info->next = NULL;
>> >
>> > pthread_mutex_lock(>lock);
>> > @@ -420,6 +435,7 @@ static void vtenc_output_callback(
>> > {
>> > AVCodecContext *avctx = ctx;
>> > VTEncContext   *vtctx = avctx->priv_data;
>> > +ExtraSEI *sei = sourceFrameCtx;
>> >
>> > if (vtctx->async_error) {
>> > if(sample_buffer) CFRelease(sample_buffer);
>> > @@ -440,7 +456,7 @@ static void vtenc_output_callback(
>> > }
>> > }
>> >
>> > -vtenc_q_push(vtctx, sample_buffer);
>> > +vtenc_q_push(vtctx, sample_buffer, sei);
>> > }
>> >
>> > static int get_length_code_size(
>> > @@ -1258,7 +1274,8 @@ static int copy_replace_length_codes(
>> > static int vtenc_cm_to_avpacket(
>> > AVCodecContext*avctx,
>> > CMSampleBufferRef sample_buffer,
>> > -AVPacket  *pkt)
>> > +AVPacket  *pkt,
>> > +ExtraSEI  *sei)
>> > {
>> > VTEncContext *vtctx = avctx->priv_data;
>> >
>> > @@ -1269,6 +1286,7 @@ static int vtenc_cm_to_avpacket(
>> > size_t  header_size = 0;
>> > size_t  in_buf_size;
>> > size_t  out_buf_size;
>> > +size_t  sei_nalu_size = 0;
>> > int64_t dts_delta;
>> > int64_t time_base_num;
>> > int nalu_count;
>> > @@ -1298,9 +1316,14 @@ static int vtenc_cm_to_avpacket(
>> > if(status)
>> > return status;
>> >
>> > +if (sei) {
>> > +sei_nalu_size = sizeof(start_code) + 3 + sei->size + 1;
>> > +}
>> > +
>> > in_buf_size = CMSampleBufferGetTotalSampleSize(sample_buffer);
>> > out_buf_size = header_size +
>> >in_buf_size +
>> > +   sei_nalu_size +
>> >nalu_count * ((int)sizeof(start_code) -
>> (int)length_code_size);
>> >
>> > status = ff_alloc_packet2(avctx, pkt, out_buf_size, out_buf_size);
>> > @@ -1317,7 +1340,7 @@ static int vtenc_cm_to_avpacket(
>> > length_code_size,
>> > sample_buffer,
>> > 

Re: [FFmpeg-devel] [PATCH] MAINTAINERS: add myself for mlp/truehd

2016-09-19 Thread Michael Niedermayer
On Sun, Sep 18, 2016 at 11:22:27AM +0530, Jai Luthra wrote:
> Signed-off-by: Jai Luthra 
> ---
>  MAINTAINERS | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

applied

thanks

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

I am the wisest man alive, for I know one thing, and that is that I know
nothing. -- Socrates


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: Read aspect ratio from ares atom for dnxhd

2016-09-19 Thread Carl Eugen Hoyos
2016-09-19 15:27 GMT+02:00 Paul B Mahol :
> On 9/19/16, Carl Eugen Hoyos  wrote:
>> 2016-09-19 14:57 GMT+02:00 Paul B Mahol :
>>
>>> title should mentioned what kind of aspect ratio this is about.
>>> As I thought it is about sar.
>>
>> I don't understand: FFmpeg only knows about sample aspect
>> ratio (also known as pixel aspect ratio), display aspect ratio is
>> only shown on the console for convenience.
>> Without this patch, sar is 1:1 and (I suspect) the sample is not
>> decoded correctly, with my patch sar is 4:3 and the sample
>> looks better.
>>
>> What do I miss?
>
> ARES atom does not store sar. And this patch sets dar for AVdn.

Which is converted to sar (the only thing libavcodec cares
about and the only thing FFmpeg exports) in utils.c.

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


Re: [FFmpeg-devel] [PATCH] lavc/videotoolboxenc: implement a53cc

2016-09-19 Thread Richard Kern

> On Sep 10, 2016, at 10:33 PM, Aman Gupta  wrote:
> 
> 
> 
> On Sunday, September 11, 2016, Richard Kern  > wrote:
> 
> > On Sep 8, 2016, at 4:19 AM, Aman Gupta > wrote:
> >
> > From: Aman Gupta >
> >
> > ---
> > libavcodec/videotoolboxenc.c | 76 
> > ++--
> > 1 file changed, 67 insertions(+), 9 deletions(-)
> >
> > diff --git a/libavcodec/videotoolboxenc.c b/libavcodec/videotoolboxenc.c
> > index 4345ca3..859dde9 100644
> > --- a/libavcodec/videotoolboxenc.c
> > +++ b/libavcodec/videotoolboxenc.c
> > @@ -32,6 +32,7 @@
> > #include "libavutil/pixdesc.h"
> > #include "internal.h"
> > #include 
> > +#include "h264.h"
> >
> > #if !CONFIG_VT_BT2020
> > # define kCVImageBufferColorPrimaries_ITU_R_2020   CFSTR("ITU_R_2020")
> > @@ -55,8 +56,14 @@ typedef enum VTH264Entropy{
> >
> > static const uint8_t start_code[] = { 0, 0, 0, 1 };
> >
> > +typedef struct ExtraSEI {
> > +  void *data;
> > +  size_t size;
> > +} ExtraSEI;
> > +
> > typedef struct BufNode {
> > CMSampleBufferRef cm_buffer;
> > +ExtraSEI *sei;
> > struct BufNode* next;
> > int error;
> > } BufNode;
> > @@ -94,6 +101,7 @@ typedef struct VTEncContext {
> > bool flushing;
> > bool has_b_frames;
> > bool warned_color_range;
> > +bool a53_cc;
> > } VTEncContext;
> >
> > static int vtenc_populate_extradata(AVCodecContext   *avctx,
> > @@ -136,7 +144,7 @@ static void set_async_error(VTEncContext *vtctx, int 
> > err)
> > pthread_mutex_unlock(>lock);
> > }
> >
> > -static int vtenc_q_pop(VTEncContext *vtctx, bool wait, CMSampleBufferRef 
> > *buf)
> > +static int vtenc_q_pop(VTEncContext *vtctx, bool wait, CMSampleBufferRef 
> > *buf, ExtraSEI **sei)
> > {
> > BufNode *info;
> >
> > @@ -173,6 +181,12 @@ static int vtenc_q_pop(VTEncContext *vtctx, bool wait, 
> > CMSampleBufferRef *buf)
> > pthread_mutex_unlock(>lock);
> >
> > *buf = info->cm_buffer;
> > +if (sei && *buf) {
> > +*sei = info->sei;
> > +} else if (info->sei) {
> > +if (info->sei->data) av_free(info->sei->data);
> > +av_free(info->sei);
> > +}
> > av_free(info);
> >
> > vtctx->frame_ct_out++;
> > @@ -180,7 +194,7 @@ static int vtenc_q_pop(VTEncContext *vtctx, bool wait, 
> > CMSampleBufferRef *buf)
> > return 0;
> > }
> >
> > -static void vtenc_q_push(VTEncContext *vtctx, CMSampleBufferRef buffer)
> > +static void vtenc_q_push(VTEncContext *vtctx, CMSampleBufferRef buffer, 
> > ExtraSEI *sei)
> > {
> > BufNode *info = av_malloc(sizeof(BufNode));
> > if (!info) {
> > @@ -190,6 +204,7 @@ static void vtenc_q_push(VTEncContext *vtctx, 
> > CMSampleBufferRef buffer)
> >
> > CFRetain(buffer);
> > info->cm_buffer = buffer;
> > +info->sei = sei;
> > info->next = NULL;
> >
> > pthread_mutex_lock(>lock);
> > @@ -420,6 +435,7 @@ static void vtenc_output_callback(
> > {
> > AVCodecContext *avctx = ctx;
> > VTEncContext   *vtctx = avctx->priv_data;
> > +ExtraSEI *sei = sourceFrameCtx;
> >
> > if (vtctx->async_error) {
> > if(sample_buffer) CFRelease(sample_buffer);
> > @@ -440,7 +456,7 @@ static void vtenc_output_callback(
> > }
> > }
> >
> > -vtenc_q_push(vtctx, sample_buffer);
> > +vtenc_q_push(vtctx, sample_buffer, sei);
> > }
> >
> > static int get_length_code_size(
> > @@ -1258,7 +1274,8 @@ static int copy_replace_length_codes(
> > static int vtenc_cm_to_avpacket(
> > AVCodecContext*avctx,
> > CMSampleBufferRef sample_buffer,
> > -AVPacket  *pkt)
> > +AVPacket  *pkt,
> > +ExtraSEI  *sei)
> > {
> > VTEncContext *vtctx = avctx->priv_data;
> >
> > @@ -1269,6 +1286,7 @@ static int vtenc_cm_to_avpacket(
> > size_t  header_size = 0;
> > size_t  in_buf_size;
> > size_t  out_buf_size;
> > +size_t  sei_nalu_size = 0;
> > int64_t dts_delta;
> > int64_t time_base_num;
> > int nalu_count;
> > @@ -1298,9 +1316,14 @@ static int vtenc_cm_to_avpacket(
> > if(status)
> > return status;
> >
> > +if (sei) {
> > +sei_nalu_size = sizeof(start_code) + 3 + sei->size + 1;
> > +}
> > +
> > in_buf_size = CMSampleBufferGetTotalSampleSize(sample_buffer);
> > out_buf_size = header_size +
> >in_buf_size +
> > +   sei_nalu_size +
> >nalu_count * ((int)sizeof(start_code) - 
> > (int)length_code_size);
> >
> > status = ff_alloc_packet2(avctx, pkt, out_buf_size, out_buf_size);
> > @@ -1317,7 +1340,7 @@ static int vtenc_cm_to_avpacket(
> > length_code_size,
> > sample_buffer,
> > pkt->data + header_size,
> > -pkt->size - header_size
> > +pkt->size - header_size - sei_nalu_size
> > );
> >
> > if (status) {
> > @@ -1325,6 +1348,19 @@ static int vtenc_cm_to_avpacket(
> > return status;
> > }
> >
> > +   

Re: [FFmpeg-devel] [PATCH]lavf/mov: Read aspect ratio from ares atom for dnxhd

2016-09-19 Thread Paul B Mahol
On 9/19/16, Carl Eugen Hoyos  wrote:
> 2016-09-19 14:57 GMT+02:00 Paul B Mahol :
>
>> title should mentioned what kind of aspect ratio this is about.
>> As I thought it is about sar.
>
> I don't understand: FFmpeg only knows about sample aspect
> ratio (also known as pixel aspect ratio), display aspect ratio is
> only shown on the console for convenience.
> Without this patch, sar is 1:1 and (I suspect) the sample is not
> decoded correctly, with my patch sar is 4:3 and the sample
> looks better.
>
> What do I miss?

ARES atom does not store sar. And this patch sets dar for AVdn.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH v3 25/25] doc/examples/muxing_with_metadata: example for dealing with timed meta data

2016-09-19 Thread Erkki Seppälä
Signed-off-by: Erkki Seppälä 
Signed-off-by: OZOPlayer 
---
 configure   |   2 +
 doc/examples/Makefile   |   2 +
 doc/examples/muxing_with_metadata.c | 885 
 3 files changed, 889 insertions(+)
 create mode 100644 doc/examples/muxing_with_metadata.c

diff --git a/configure b/configure
index b586353..00726e2 100755
--- a/configure
+++ b/configure
@@ -1459,6 +1459,7 @@ EXAMPLE_LIST="
 filtering_video_example
 metadata_example
 muxing_example
+muxing_with_metadata_example
 qsvdec_example
 remuxing_example
 resampling_audio_example
@@ -3095,6 +3096,7 @@ filtering_audio_example_deps="avfilter avcodec avformat 
avutil"
 filtering_video_example_deps="avfilter avcodec avformat avutil"
 metadata_example_deps="avformat avutil"
 muxing_example_deps="avcodec avformat avutil swscale"
+muxing_with_metadata_example_deps="avcodec avformat avutil swscale"
 qsvdec_example_deps="avcodec avutil libmfx h264_qsv_decoder vaapi_x11"
 remuxing_example_deps="avcodec avformat avutil"
 resampling_audio_example_deps="avutil swresample"
diff --git a/doc/examples/Makefile b/doc/examples/Makefile
index c10033e..d1f4e1f 100644
--- a/doc/examples/Makefile
+++ b/doc/examples/Makefile
@@ -22,6 +22,7 @@ EXAMPLES=   avio_dir_cmd   \
 http_multiclient   \
 metadata   \
 muxing \
+muxing_with_metadata   \
 remuxing   \
 resampling_audio   \
 scaling_video  \
@@ -35,6 +36,7 @@ avcodec:   LDLIBS += -lm
 decoding_encoding: LDLIBS += -lm
 muxing:LDLIBS += -lm
 resampling_audio:  LDLIBS += -lm
+muxing_with_metadata: LDLIBS += -lm
 
 .phony: all clean-test clean
 
diff --git a/doc/examples/muxing_with_metadata.c 
b/doc/examples/muxing_with_metadata.c
new file mode 100644
index 000..6631141
--- /dev/null
+++ b/doc/examples/muxing_with_metadata.c
@@ -0,0 +1,885 @@
+/*
+ * Copyright (c) 2003 Fabrice Bellard
+ * Copyright (c) 2015 Erkki Seppälä 
+ *
+ * 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
+ * libavformat API example.
+ *
+ * Output a media file in any supported libavformat format. The default
+ * codecs are used.
+ * @example muxing.c
+ */
+
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#define STREAM_DURATION   10.0
+#define STREAM_FRAME_RATE 25 /* 25 images/s */
+#define STREAM_PIX_FMTAV_PIX_FMT_YUV420P /* default pix_fmt */
+
+#define SCALE_FLAGS SWS_BICUBIC
+
+// a wrapper around a single output AVStream
+typedef struct OutputStream {
+AVStream *st;
+AVCodecContext *enc;
+
+/* pts of the next frame that will be generated */
+int64_t next_pts;
+int samples_count;
+
+AVFrame *frame;
+AVFrame *tmp_frame;
+
+float t, tincr, tincr2;
+
+struct SwsContext *sws_ctx;
+struct SwrContext *swr_ctx;
+} OutputStream;
+
+typedef struct StreamState {
+int (*writer)(AVFormatContext *oc, OutputStream *ost);
+int *flag;
+OutputStream *stream;
+} StreamState;
+
+static void log_packet(const AVFormatContext *fmt_ctx, const AVPacket *pkt)
+{
+AVRational *time_base = _ctx->streams[pkt->stream_index]->time_base;
+
+printf("pts:%s pts_time:%s dts:%s dts_time:%s duration:%s duration_time:%s 
stream_index:%d\n",
+   av_ts2str(pkt->pts), av_ts2timestr(pkt->pts, time_base),
+   av_ts2str(pkt->dts), av_ts2timestr(pkt->dts, time_base),
+   av_ts2str(pkt->duration), av_ts2timestr(pkt->duration, time_base),
+   pkt->stream_index);
+}
+
+static int write_frame(AVFormatContext 

[FFmpeg-devel] [PATCH v3 24/25] doc/examples/extract_timed_metadata: added a bare-bones metadata extractor; find only the frames

2016-09-19 Thread Erkki Seppälä
Signed-off-by: Erkki Seppälä 
Signed-off-by: OZOPlayer 
---
 configure |   2 +
 doc/examples/Makefile |   1 +
 doc/examples/extract_timed_metadata.c | 230 ++
 3 files changed, 233 insertions(+)
 create mode 100644 doc/examples/extract_timed_metadata.c

diff --git a/configure b/configure
index ded5452..b586353 100755
--- a/configure
+++ b/configure
@@ -1453,6 +1453,7 @@ EXAMPLE_LIST="
 decoding_encoding_example
 demuxing_decoding_example
 extract_mvs_example
+extract_timed_metadata_example
 filter_audio_example
 filtering_audio_example
 filtering_video_example
@@ -3088,6 +3089,7 @@ avio_reading="avformat avcodec avutil"
 decoding_encoding_example_deps="avcodec avformat avutil"
 demuxing_decoding_example_deps="avcodec avformat avutil"
 extract_mvs_example_deps="avcodec avformat avutil"
+extract_timed_metadata_example_deps="avcodec avformat avutil"
 filter_audio_example_deps="avfilter avutil"
 filtering_audio_example_deps="avfilter avcodec avformat avutil"
 filtering_video_example_deps="avfilter avcodec avformat avutil"
diff --git a/doc/examples/Makefile b/doc/examples/Makefile
index af38159..c10033e 100644
--- a/doc/examples/Makefile
+++ b/doc/examples/Makefile
@@ -16,6 +16,7 @@ EXAMPLES=   avio_dir_cmd   \
 decoding_encoding  \
 demuxing_decoding  \
 extract_mvs\
+extract_timed_metadata \
 filtering_video\
 filtering_audio\
 http_multiclient   \
diff --git a/doc/examples/extract_timed_metadata.c 
b/doc/examples/extract_timed_metadata.c
new file mode 100644
index 000..51de6bd
--- /dev/null
+++ b/doc/examples/extract_timed_metadata.c
@@ -0,0 +1,230 @@
+/*
+ * Copyright (c) 2010 Nicolas George
+ * Copyright (c) 2011 Stefano Sabatini
+ * Copyright (c) 2015 Erkki Seppälä 
+ *
+ * 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
+ * API example extracting timed metadata
+ * @example extract_timed_metadata.c
+ */
+
+#define _XOPEN_SOURCE 600 /* for usleep */
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#define MAX_METADATA_STREAMS 10
+
+static AVFormatContext *fmt_ctx;
+static AVCodecContext *dec_ctx[MAX_METADATA_STREAMS];
+static int metadata_stream_indices[MAX_METADATA_STREAMS + 1] = { -1 }; /* 
terminated with -1 */
+
+static int open_input_file(const char *filename)
+{
+int ret;
+AVCodec *dec = avcodec_find_decoder(AV_CODEC_ID_META);
+int i;
+int nb_metadata = 0;
+
+if ((ret = avformat_open_input(_ctx, filename, NULL, NULL)) < 0) {
+av_log(NULL, AV_LOG_ERROR, "Cannot open input file\n");
+return ret;
+}
+
+if ((ret = avformat_find_stream_info(fmt_ctx, NULL)) < 0) {
+av_log(NULL, AV_LOG_ERROR, "Cannot find stream information\n");
+return ret;
+}
+
+for (i = 0; i < fmt_ctx->nb_streams; i++) {
+if (fmt_ctx->streams[i]->codecpar->codec_type == AVMEDIA_TYPE_DATA) {
+assert(nb_metadata < MAX_METADATA_STREAMS);
+metadata_stream_indices[nb_metadata] = i;
+nb_metadata++;
+}
+}
+metadata_stream_indices[nb_metadata] = -1;
+
+if (nb_metadata == 0) {
+av_log(NULL, AV_LOG_ERROR, "Cannot find a video stream in the input 
file\n");
+return ret;
+}
+
+for (i = 0; i < nb_metadata; i++) {
+dec_ctx[i] = avcodec_alloc_context3(dec);
+if ((ret = avcodec_open2(dec_ctx[i], dec, NULL)) < 0) {
+av_log(NULL, AV_LOG_ERROR, "Cannot open metadata decoder for 
metadata stream on track %d\n", i);
+return ret;
+}
+}
+
+

[FFmpeg-devel] [PATCH v3 23/25] Updated Changelog

2016-09-19 Thread Erkki Seppälä
---
 Changelog | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/Changelog b/Changelog
index c642d08..3d63482 100644
--- a/Changelog
+++ b/Changelog
@@ -31,6 +31,9 @@ version :
 - Added support for muxing and demuxing timed metadata tracks
   (AV_CODEC_ID_META of type AMEDIA_TYPE_DATA). With examples.
 
+- Added support for setting and parsing advanced audio channel track
+  layout with side data AV_PKT_DATA_AUDIO_TRACK_CHANNEL_LAYOUT
+
 version 3.1:
 - DXVA2-accelerated HEVC Main10 decoding
 - fieldhint filter
-- 
2.7.4

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


[FFmpeg-devel] [PATCH v3 22/25] avutil: added channel_layout_isoiec23001_8.h to HEADERS

2016-09-19 Thread Erkki Seppälä
---
 libavutil/Makefile | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libavutil/Makefile b/libavutil/Makefile
index 1e06176..731b852 100644
--- a/libavutil/Makefile
+++ b/libavutil/Makefile
@@ -18,6 +18,7 @@ HEADERS = adler32.h   
  \
   cast5.h   \
   camellia.h\
   channel_layout.h  \
+  channel_layout_isoiec23001_8.h\
   common.h  \
   cpu.h \
   crc.h \
-- 
2.7.4

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


[FFmpeg-devel] [PATCH v3 21/25] avformat/mov: read the chnl box as side data AV_PKT_DATA_AUDIO_TRACK_CHANNEL_LAYOUT

2016-09-19 Thread Erkki Seppälä
Signed-off-by: Erkki Seppälä 
Signed-off-by: OZOPlayer 
---
 libavformat/mov.c | 96 +++
 1 file changed, 96 insertions(+)

diff --git a/libavformat/mov.c b/libavformat/mov.c
index 059c7c4..b48a5d2 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -915,6 +915,101 @@ static int mov_read_chan(MOVContext *c, AVIOContext *pb, 
MOVAtom atom)
 return 0;
 }
 
+static int mov_read_chnl(MOVContext *c, AVIOContext *pb, MOVAtom atom)
+{
+AVStream *st;
+AVAudioTrackChannelLayout *side_data;
+uint8_t stream_structure;
+uint8_t channel_structured;
+uint8_t object_structured;
+
+// ChannelConfiguration from ISO/IEC 23001-8
+AVChannelLayoutISOIEC23001_8 defined_layout;
+int expected_size = 0;
+
+if (c->fc->nb_streams < 1)
+return 0;
+st = c->fc->streams[c->fc->nb_streams-1];
+
+expected_size += 4;
+if (atom.size < expected_size)
+return 0;
+
+/* skip version */
+avio_skip(pb, 4);
+
+side_data = (void*) av_stream_new_side_data(st, 
AV_PKT_DATA_AUDIO_TRACK_CHANNEL_LAYOUT,
+
sizeof(AVAudioTrackChannelLayout));
+
+if (!side_data)
+return AVERROR(ENOMEM);
+
+side_data->type = AV_COMPLEX_CHANNEL_LAYOUT_OBJECTS_ONLY;
+side_data->nb_audio_objects = 0;
+
+expected_size += 1;
+if (atom.size < expected_size)
+return 0;
+
+stream_structure = avio_r8(pb);
+channel_structured = stream_structure & 1;
+object_structured = stream_structure & 2;
+if (channel_structured) {
+expected_size += 1;
+if (atom.size < expected_size)
+return 0;
+
+defined_layout = (AVChannelLayoutISOIEC23001_8) avio_r8(pb);
+if (defined_layout == 0) {
+int channel_count = st->codecpar->channels;
+for (int i = 0; i < channel_count; ++i) {
+AVAudioTrackChannelPositionISOIEC23001_8 *position = 
_data->complete.positions[i];
+AVSpeakerPositionISOIEC23001_8 speaker_position;
+
+expected_size += 1;
+if (atom.size < expected_size)
+return 0;
+
+speaker_position = (AVSpeakerPositionISOIEC23001_8) 
avio_r8(pb);
+position->speaker_position = speaker_position;
+if (speaker_position == 
AV_SPEAKER_POSITION_ISOIEC23001_8_EXPL) {
+expected_size += 3;
+if (atom.size < expected_size)
+return 0;
+
+position->azimuth = avio_rb16(pb);
+position->elevation = avio_r8(pb);
+
+if (position->azimuth < -180 || position->azimuth > 180 ||
+position->elevation < -90 || position->elevation > 90) 
{
+return 0;
+}
+} else {
+position->azimuth = 0;
+position->elevation = 0;
+}
+}
+side_data->type = AV_COMPLEX_CHANNEL_LAYOUT_COMPLETE_ISOIEC23001_8;
+side_data->complete.nb_positions = channel_count;
+} else {
+expected_size += 8;
+if (atom.size < expected_size)
+return 0;
+side_data->predefined.omitted_channels = avio_rb64(pb);
+side_data->type = 
AV_COMPLEX_CHANNEL_LAYOUT_PREDEFINED_ISOIEC23001_8;
+side_data->predefined.layout = defined_layout;
+}
+if (object_structured) {
+expected_size += 1;
+if (atom.size < expected_size)
+return 0;
+side_data->nb_audio_objects = avio_r8(pb);
+}
+}
+
+return 0;
+}
+
 static int mov_read_wfex(MOVContext *c, AVIOContext *pb, MOVAtom atom)
 {
 AVStream *st;
@@ -4708,6 +4803,7 @@ static const MOVParseTableEntry mov_default_parse_table[] 
= {
 { MKTAG('w','f','e','x'), mov_read_wfex },
 { MKTAG('c','m','o','v'), mov_read_cmov },
 { MKTAG('c','h','a','n'), mov_read_chan }, /* channel layout */
+{ MKTAG('c','h','n','l'), mov_read_chnl }, /* channel layout ISO/IEC 23001-8 */
 { MKTAG('d','v','c','1'), mov_read_dvc1 },
 { MKTAG('s','b','g','p'), mov_read_sbgp },
 { MKTAG('h','v','c','C'), mov_read_glbl },
-- 
2.7.4

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


[FFmpeg-devel] [PATCH v3 17/25] avformat/mov: read urim metadata from meta

2016-09-19 Thread Erkki Seppälä
The data is read into side packet AV_PKT_DATA_TIMED_METADATA_INFO of
format AVTimedMetadata.

Signed-off-by: Erkki Seppälä 
Signed-off-by: OZOPlayer 
---
 libavformat/mov.c | 141 ++
 1 file changed, 141 insertions(+)

diff --git a/libavformat/mov.c b/libavformat/mov.c
index f9126c4..059c7c4 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -2039,6 +2039,145 @@ static int mov_rewrite_dvd_sub_extradata(AVStream *st)
 return 0;
 }
 
+static int mov_parse_urim_uri_data(AVIOContext *pb, AVStream *st, MOVMeta 
*meta)
+{
+int64_t size = avio_rb32(pb);
+uint32_t uri = avio_rb32(pb); /* "uri " */
+avio_r8(pb);  /* version */
+avio_rb24(pb);/* flags */
+
+if (size < 12 || size >= 1024)
+return AVERROR(ENOMEM);
+
+if (uri == AV_RB32("uri ")) {
+int remaining = size - 12;
+int64_t pos = avio_tell(pb);
+uint32_t string_len = 0;
+
+while (string_len < remaining && avio_r8(pb) != 0) {
+++string_len;
+}
+avio_seek(pb, pos, SEEK_SET);
+
+if (string_len >= remaining)
+return AVERROR_INVALIDDATA;
+
+meta->tag = MKTAG('u', 'r', 'i', 'm');
+meta->data = av_malloc(string_len + 1);
+if (!meta->data)
+return AVERROR(ENOMEM);
+
+avio_read(pb, meta->data, string_len);
+((char*) meta->data)[string_len] = 0;
+meta->length = string_len;
+remaining -= string_len;
+avio_r8(pb);/* read the null terminator */
+remaining--;
+
+avio_skip(pb, remaining);
+} else {
+avio_skip(pb, size - 12);
+}
+
+return 0;
+}
+
+static int mov_parse_urim_conf_data(AVIOContext *pb, AVStream *st, int64_t 
remaining, MOVMeta *meta)
+{
+int64_t size;
+uint32_t tag;
+int64_t data_size;
+
+if (remaining < 12)
+return 0;
+
+size = avio_rb32(pb);
+tag = avio_rl32(pb);
+avio_r8(pb);/* version */
+avio_rb24(pb);  /* flags */
+remaining -= 12;
+data_size = size - 12;
+
+if (data_size < 0 || data_size > remaining) {
+avio_skip(pb, remaining);
+return 0;
+}
+
+meta->conf.data = av_malloc(data_size);
+if (!meta->conf.data)
+return AVERROR(ENOMEM);
+
+meta->conf.tag = tag;
+meta->conf.length = data_size;
+avio_read(pb, meta->conf.data, data_size);
+remaining -= data_size;
+avio_skip(pb, remaining);
+
+return 0;
+}
+
+static int mov_parse_urim_data(AVIOContext *pb, AVStream *st, int64_t 
remaining)
+{
+int64_t pos = avio_tell(pb);
+int ret;
+MOVMeta meta;
+
+memset(, 0, sizeof(meta));
+
+ret = mov_parse_urim_uri_data(pb, st, );
+if (ret)
+return ret;
+
+remaining -= avio_tell(pb) - pos;
+ret = mov_parse_urim_conf_data(pb, st, remaining, );
+
+// all data has been collected; now build the actual side channel
+// object from the collected data
+if (ret == 0) {
+int tmdLength = sizeof(AVTimedMetadataInfo) + meta.length + 
meta.conf.length;
+AVTimedMetadataInfo *tmd = av_malloc(tmdLength);
+if (!tmd) {
+ret = -1;
+} else {
+AVPacketSideData *sd;
+ret = av_reallocp_array(>side_data,
+st->nb_side_data + 1, sizeof(*sd));
+if (ret >= 0) {
+char* data;
+
+sd = st->side_data + st->nb_side_data;
+st->nb_side_data++;
+
+sd->type = AV_PKT_DATA_TIMED_METADATA_INFO;
+sd->size = sizeof(*tmd) + meta.length + meta.conf.length;
+sd->data = (uint8_t*) tmd;
+
+tmd->meta_tag[0] = (meta.tag >> 0) & 0xff;
+tmd->meta_tag[1] = (meta.tag >> 8) & 0xff;
+tmd->meta_tag[2] = (meta.tag >> 16) & 0xff;
+tmd->meta_tag[3] = (meta.tag >> 24) & 0xff;
+tmd->meta_length = meta.length;
+tmd->conf_tag[0] = (meta.conf.tag >> 0) & 0xff;
+tmd->conf_tag[1] = (meta.conf.tag >> 8) & 0xff;
+tmd->conf_tag[2] = (meta.conf.tag >> 16) & 0xff;
+tmd->conf_tag[3] = (meta.conf.tag >> 24) & 0xff;
+tmd->conf_length = meta.conf.length;
+data = (char*) (tmd + 1);
+
+memcpy(data, meta.data, meta.length);
+data += meta.length;
+memcpy(data, meta.conf.data, meta.conf.length);
+} else {
+av_freep();
+}
+}
+}
+av_freep();
+av_freep();
+
+return ret;
+}
+
 static int mov_parse_stsd_data(MOVContext *c, AVIOContext *pb,
 AVStream *st, MOVStreamContext *sc,
 int64_t size)
@@ -2098,6 +2237,8 @@ FF_ENABLE_DEPRECATION_WARNINGS
  

[FFmpeg-devel] [PATCH v3 16/25] avformat/mov: ff_mov_read_stsd_entries now deals with AVMEDIA_TYPE_DATA

2016-09-19 Thread Erkki Seppälä
Signed-off-by: Erkki Seppälä 
Signed-off-by: OZOPlayer 
---
 libavformat/mov.c | 9 +++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/libavformat/mov.c b/libavformat/mov.c
index 4dfe1eb..f9126c4 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -2257,6 +2257,7 @@ int ff_mov_read_stsd_entries(MOVContext *c, AVIOContext 
*pb, int entries)
 (format >> 0) & 0xff, (format >> 8) & 0xff, (format >> 16) & 
0xff,
 (format >> 24) & 0xff, format, st->codecpar->codec_type);
 
+ret = 0;
 if (st->codecpar->codec_type==AVMEDIA_TYPE_VIDEO) {
 st->codecpar->codec_id = id;
 mov_parse_stsd_video(c, pb, st, sc);
@@ -2267,12 +2268,16 @@ int ff_mov_read_stsd_entries(MOVContext *c, AVIOContext 
*pb, int entries)
 st->codecpar->codec_id = id;
 mov_parse_stsd_subtitle(c, pb, st, sc,
 size - (avio_tell(pb) - start_pos));
+} else if (st->codecpar->codec_type==AVMEDIA_TYPE_DATA){
+st->codecpar->codec_id = id;
+ret = mov_parse_stsd_data(c, pb, st, sc,
+  size - (avio_tell(pb) - start_pos));
 } else {
 ret = mov_parse_stsd_data(c, pb, st, sc,
   size - (avio_tell(pb) - start_pos));
-if (ret < 0)
-return ret;
 }
+if (ret < 0)
+return ret;
 /* this will read extra atoms at the end (wave, alac, damr, avcC, 
hvcC, SMI ...) */
 a.size = size - (avio_tell(pb) - start_pos);
 if (a.size > 8) {
-- 
2.7.4

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


[FFmpeg-devel] [PATCH v3 19/25] avcodec/avcodec, avformat/movenc: support embedding channel layout to stream side data

2016-09-19 Thread Erkki Seppälä
Added support for passing complex channel layout configuration as side
packet data (AV_PKT_DATA_AUDIO_TRACK_CHANNEL_LAYOUT) to ISO media files
as specified by ISO/IEC 14496-12. AVAudioTrackChannelLayout has the
fields to setting both predefined audio layouts, completely configuring
the azimuth and elevation of each speaker as well as describing the
number of audio objects in the scene.

This information isn't integrated into the existing channel layout
system though, which is much more restricted compared to what the
standard permits. However, the side packet data is structured so that it
does not require too much ISO base media file format knowledge in client
code. In addition, it should be possible to extend the enumeration and
the record to allow for using the same side data for a more native
solution.

The names of the channels and layouts are available in
channel_layout_isoiec23001_8.h with slightly obtuse names such as
AV_SPEAKER_POSITION_ISOIEC230081_8_L and
AV_CH_LAYOUT_ISOIEC230081_8_1_0_0 to encourage path forward to a more
native solution for FFmpeg.

This channel layout information ends up to a chnl box in the written
file in an isom track.

Signed-off-by: Erkki Seppälä 
Signed-off-by: OZOPlayer 
---
 libavcodec/avcodec.h | 71 +++
 libavformat/movenc.c | 87 +++-
 libavutil/channel_layout_isoiec23001_8.h | 97 
 3 files changed, 254 insertions(+), 1 deletion(-)
 create mode 100644 libavutil/channel_layout_isoiec23001_8.h

diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index 0079d22..7b52975 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -39,6 +39,7 @@
 #include "libavutil/log.h"
 #include "libavutil/pixfmt.h"
 #include "libavutil/rational.h"
+#include "libavutil/channel_layout_isoiec23001_8.h"
 
 #include "version.h"
 
@@ -1368,6 +1369,69 @@ typedef struct AVTrackReferences {
 /** followed by an optional gap for alignment purposes and another 
AVTrackReferences is applicaple */
 } AVTrackReferences;
 
+/**
+ * Describes the speaker position of a single audio channel of a single track
+ *
+ * The name is chosen in a slightly obscure manner as to allow a more
+ * natural name to take its place when the system supports FFmpeg's
+ * native channel positions.
+ */
+typedef struct AVAudioTrackChannelPositionISOIEC23001_8 {
+AVSpeakerPositionISOIEC23001_8 speaker_position; /**< an 
OutputChannelPosition from ISO/IEC 23001-8 */
+
+/** The following are used if speaker_position == 
AV_SPEAKER_POSITION_ISOIEC23001_8_EXPL */
+int16_t azimuth;/**< Degrees -180..180. Values increment 
counterclockwise from above. */
+int8_t  elevation;  /**< Degrees -90..90. >0 is above horizon. */
+} AVAudioTrackChannelPositionISOIEC23001_8;
+
+/**
+ * Describes the channel layout (ie. speaker position) of a single audio track
+ *
+ * The name is chosen in a slightly obscure manner as to allow a more
+ * natural name to take its place when the system supports FFmpeg's
+ * native channel positions.
+ */
+typedef struct AVAudioTrackChannelCompleteLayoutISOIEC23001_8 {
+int nb_positions;
+AVAudioTrackChannelPositionISOIEC23001_8 positions[64];
+} AVAudioTrackChannelCompleteLayoutISOIEC23001_8;
+
+/**
+ * Describes the channel layout based on predefined layout of a single
+ * track by providing the layout and the list of channels are are
+ * omitted. For example, you may choose a layout that has 6.1 channels
+ * and then choose to omit the LFE channel from your channels.
+ *
+ * The name is chosen in a slightly obscure manner as to allow a more natural 
+ * name to take its place when the system supports FFmpeg's native layouts.
+ */
+typedef struct AVAudioTrackChannelPredefinedLayoutISOIEC23001_8 {
+AVChannelLayoutISOIEC23001_8  layout; /**< ChannelConfiguration from 
ISO/IEC 23001-8 */
+uint64_t omitted_channels;  /**< lsb 1 means the first channel is omitted 
and so on */
+} AVAudioTrackChannelPredefinedLayoutISOIEC23001_8;
+
+typedef enum AVComplexAudioTrackChannelLayoutType {
+AV_COMPLEX_CHANNEL_LAYOUT_OBJECTS_ONLY,
+AV_COMPLEX_CHANNEL_LAYOUT_PREDEFINED_ISOIEC23001_8,
+AV_COMPLEX_CHANNEL_LAYOUT_COMPLETE_ISOIEC23001_8,
+} AVComplexAudioTrackChannelLayoutType;
+
+typedef struct AVAudioTrackChannelLayout {
+AVComplexAudioTrackChannelLayoutType type;
+union {
+AVAudioTrackChannelPredefinedLayoutISOIEC23001_8 predefined;
+AVAudioTrackChannelCompleteLayoutISOIEC23001_8   complete;
+};
+
+/**
+ * Describes the channel layout to be object-structured with given
+ * number of objects. Object-structured audio is means to describe
+ * an audio scene without a fixed channel layout that can be mixed
+ * to varying channel configurations.
+ */
+int nb_audio_objects; /**< Number of audio objects */
+} AVAudioTrackChannelLayout;
+
 

[FFmpeg-devel] [PATCH v3 20/25] avformat/movenc: mov_write_audio_tag can write the proper number of channels, not the hardcoded 2

2016-09-19 Thread Erkki Seppälä
It does it only when the chnl box is to be written. The specification
for the chnl box (ISO 14496-12) requires proper number of channels to be
written here is it is used, and without the proper number of channels
available it becomes tricky to parse the data, as the number of channels
in this box comes from that value.

Signed-off-by: Erkki Seppälä 
Signed-off-by: OZOPlayer 
---
 libavformat/movenc.c | 8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index 2543404..4245396 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -1045,7 +1045,13 @@ static int mov_write_audio_tag(AVFormatContext *s, 
AVIOContext *pb, MOVMuxContex
 avio_wb16(pb, 16);
 avio_wb16(pb, track->audio_vbr ? -2 : 0); /* compression ID */
 } else { /* reserved for mp4/3gp */
-avio_wb16(pb, 2);
+/* parsing chln box requires the proper number of channels having 
been
+   written into the audio header */
+if (av_stream_get_side_data(track->st, 
AV_PKT_DATA_AUDIO_TRACK_CHANNEL_LAYOUT,
+NULL))
+avio_wb16(pb, track->par->channels);
+else
+avio_wb16(pb, 2);
 avio_wb16(pb, 16);
 avio_wb16(pb, 0);
 }
-- 
2.7.4

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


[FFmpeg-devel] [PATCH v3 15/25] avformat/mov: basic support for identifying (and reading) timed metadata

2016-09-19 Thread Erkki Seppälä
mov_codec_id is now able to set AVMEDIA_TYPE_DATA to the
st->codec->codec_type field when the input is of type
AVMEDIA_TYPE_DATA; previously it used AVMEDIA_TYPE_SUBTITLE as the
value to set in that case.

Signed-off-by: Erkki Seppälä 
Signed-off-by: OZOPlayer 
---
 libavformat/mov.c | 18 --
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/libavformat/mov.c b/libavformat/mov.c
index 82450e9..4dfe1eb 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -1789,12 +1789,18 @@ static int mov_codec_id(AVStream *st, uint32_t format)
 id = ff_codec_get_id(ff_codec_bmp_tags, format);
 if (id > 0)
 st->codecpar->codec_type = AVMEDIA_TYPE_VIDEO;
-else if (st->codecpar->codec_type == AVMEDIA_TYPE_DATA ||
-(st->codecpar->codec_type == AVMEDIA_TYPE_SUBTITLE &&
-st->codecpar->codec_id == AV_CODEC_ID_NONE)) {
-id = ff_codec_get_id(ff_codec_movsubtitle_tags, format);
-if (id > 0)
-st->codecpar->codec_type = AVMEDIA_TYPE_SUBTITLE;
+else {
+if (st->codecpar->codec_type == AVMEDIA_TYPE_DATA ||
+(st->codecpar->codec_type == AVMEDIA_TYPE_SUBTITLE &&
+ st->codecpar->codec_id == AV_CODEC_ID_NONE)) {
+id = ff_codec_get_id(ff_codec_movsubtitle_tags, format);
+if (id > 0)
+st->codecpar->codec_type = AVMEDIA_TYPE_SUBTITLE;
+}
+if (id <= 0 &&
+st->codecpar->codec_type == AVMEDIA_TYPE_DATA) {
+id = ff_codec_get_id(ff_codec_metadata_tags, format);
+}
 }
 }
 
-- 
2.7.4

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


[FFmpeg-devel] [PATCH v3 07/25] avformat/mov: mov_read_tkhd stores alternate group to AV_PKT_DATA_TRACK_ALTERNATE_GROUP

2016-09-19 Thread Erkki Seppälä
This is done only if the option read_alternate_group is set as to
not change the behavior when copying tracks.

FFmpeg automatically assigns track groups (when no
AV_PKT_DATA_TRACK_ALTERNATE_GROUP side data is not available) by the
track indices, so if the track indices would be changed, reusing the
original alternate group from the track would likely by unwanted,
because the reassignment of alternate group would be skipped.

Signed-off-by: Erkki Seppälä 
Signed-off-by: OZOPlayer 
---
 libavformat/isom.h |  1 +
 libavformat/mov.c  | 16 +++-
 2 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/libavformat/isom.h b/libavformat/isom.h
index 609b7b7..7b521d8 100644
--- a/libavformat/isom.h
+++ b/libavformat/isom.h
@@ -242,6 +242,7 @@ typedef struct MOVContext {
 uint8_t *decryption_key;
 int decryption_key_len;
 int enable_drefs;
+int read_alternate_group;
 } MOVContext;
 
 int ff_mp4_read_descr_len(AVIOContext *pb);
diff --git a/libavformat/mov.c b/libavformat/mov.c
index ff4c91c..82450e9 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -3539,6 +3539,7 @@ static int mov_read_tkhd(MOVContext *c, AVIOContext *pb, 
MOVAtom atom)
 MOVStreamContext *sc;
 int version;
 int flags;
+int alternate_group;
 
 if (c->fc->nb_streams < 1)
 return 0;
@@ -3565,7 +3566,7 @@ static int mov_read_tkhd(MOVContext *c, AVIOContext *pb, 
MOVAtom atom)
 avio_rb32(pb); /* reserved */
 
 avio_rb16(pb); /* layer */
-avio_rb16(pb); /* alternate group */
+alternate_group = avio_rb16(pb);
 avio_rb16(pb); /* volume */
 avio_rb16(pb); /* reserved */
 
@@ -3630,6 +3631,17 @@ static int mov_read_tkhd(MOVContext *c, AVIOContext *pb, 
MOVAtom atom)
 disp_transform[0] / disp_transform[1],
 INT_MAX);
 }
+
+if (c->read_alternate_group) {
+int *alternate_group_side =
+(int*) av_stream_new_side_data(st, 
AV_PKT_DATA_TRACK_ALTERNATE_GROUP,
+   sizeof(int));
+if (!alternate_group_side)
+return AVERROR(ENOMEM);
+
+*alternate_group_side = alternate_group;
+}
+
 return 0;
 }
 
@@ -5682,6 +5694,8 @@ static const AVOption mov_options[] = {
 { "decryption_key", "The media decryption key (hex)", 
OFFSET(decryption_key), AV_OPT_TYPE_BINARY, .flags = AV_OPT_FLAG_DECODING_PARAM 
},
 { "enable_drefs", "Enable external track support.", OFFSET(enable_drefs), 
AV_OPT_TYPE_BOOL,
 {.i64 = 0}, 0, 1, FLAGS },
+{"read_alternate_group", "", OFFSET(read_alternate_group), 
AV_OPT_TYPE_BOOL, {.i64 = 0},
+0, 1, FLAGS},
 
 { NULL },
 };
-- 
2.7.4

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


[FFmpeg-devel] [PATCH v3 18/25] Updated Changelog

2016-09-19 Thread Erkki Seppälä
---
 Changelog | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/Changelog b/Changelog
index 3712172..c642d08 100644
--- a/Changelog
+++ b/Changelog
@@ -28,7 +28,9 @@ version :
 - Added side data AV_PKT_DATA_TRACK_ALTERNATE_GROUP for explicitly
   setting the alternate track groups (supported by isom)
 
+- Added support for muxing and demuxing timed metadata tracks
+  (AV_CODEC_ID_META of type AMEDIA_TYPE_DATA).
+
 version 3.1:
 - DXVA2-accelerated HEVC Main10 decoding
 - fieldhint filter
-- 
2.7.4

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


[FFmpeg-devel] [PATCH v3 13/25] avcodec/utils: do_decode now supports AVMEDIA_TYPE_DATA

2016-09-19 Thread Erkki Seppälä
This allows using avcodec_send_packet with data frames (ie. timed
metadata)

Signed-off-by: Erkki Seppälä 
Signed-off-by: OZOPlayer 
---
 libavcodec/utils.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index 138125a..8b55464 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -2737,6 +2737,10 @@ static int do_decode(AVCodecContext *avctx, AVPacket 
*pkt)
 } else if (avctx->codec_type == AVMEDIA_TYPE_AUDIO) {
 ret = avcodec_decode_audio4(avctx, avctx->internal->buffer_frame,
 _frame, pkt);
+} else if (avctx->codec_type == AVMEDIA_TYPE_DATA) {
+ret = avctx->codec->decode(avctx, avctx->internal->buffer_frame, 
_frame, pkt);
+if (ret == 0 && got_frame)
+ret = pkt->size;
 } else {
 ret = AVERROR(EINVAL);
 }
-- 
2.7.4

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


[FFmpeg-devel] [PATCH v3 14/25] avcodec/utils: do_encode now supports AVMEDIA_TYPE_DATA

2016-09-19 Thread Erkki Seppälä
Signed-off-by: Erkki Seppälä 
Signed-off-by: OZOPlayer 
---
 libavcodec/utils.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index 8b55464..f0e22b9 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -2880,6 +2880,8 @@ static int do_encode(AVCodecContext *avctx, const AVFrame 
*frame, int *got_packe
 } else if (avctx->codec_type == AVMEDIA_TYPE_AUDIO) {
 ret = avcodec_encode_audio2(avctx, avctx->internal->buffer_pkt,
 frame, got_packet);
+} else if (avctx->codec_type == AVMEDIA_TYPE_DATA) {
+ret = avctx->codec->encode2(avctx, avctx->internal->buffer_pkt, frame, 
got_packet);
 } else {
 ret = AVERROR(EINVAL);
 }
-- 
2.7.4

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


[FFmpeg-devel] [PATCH v3 11/25] avformat/movenc: add the urim sample descriptor

2016-09-19 Thread Erkki Seppälä
This also adds libavformat/movmeta that contains the meta data
information. Actually the sample configuration data is performed with
side packet data AV_PKT_DATA_TIMED_METADATA_INFO where the value is
stored inside AVTimedMetadataInfo.

Signed-off-by: Erkki Seppälä 
Signed-off-by: OZOPlayer 
---
 libavcodec/avcodec.h  | 16 ++
 libavformat/isom.c|  1 +
 libavformat/movenc.c  | 83 ---
 libavformat/movenc.h  |  1 +
 libavformat/movmeta.h | 46 
 5 files changed, 143 insertions(+), 4 deletions(-)
 create mode 100644 libavformat/movmeta.h

diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index 4219a9f..0079d22 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -1350,6 +1350,16 @@ typedef struct AVCPBProperties {
  * @{
  */
 
+typedef struct AVTimedMetadataInfo {
+charmeta_tag[4];/**< 4cc describing this metadata box type */
+int meta_length;/**< length of data for the metadata type 
information */
+
+charconf_tag[4];/**< configurationg box type 4cc, ie. 'conf' */
+int conf_length;/**< length of the data for the configuration 
box */
+
+/** followed by meta_length bytes of meta data followed by conf_length 
bytes of conf data */
+} AVTimedMetadataInfo;
+
 typedef struct AVTrackReferences {
 int next_tref_ofs;  /**< offset in bytes to the next 
AVTrackReferences or 0 if this is the last one*/
 chartag[4]; /**< 4cc used for describing this  */
@@ -1546,6 +1556,12 @@ enum AVPacketSideDataType {
 AV_PKT_DATA_TRACK_REFERENCES,
 
 /**
+ * Configured the timed metadata parameters, such as the uri and
+ * meta data configuration. The value is of type AVTimedMetadataInfo.
+ */
+AV_PKT_DATA_TIMED_METADATA_INFO,
+
+/**
  * Assign alternate groups for tracks. An example of alternate
  * groups would be audio tracks (or video tracks) that are
  * alternative to each other. Each alternative track shares the
diff --git a/libavformat/isom.c b/libavformat/isom.c
index 1a90d00..473700f 100644
--- a/libavformat/isom.c
+++ b/libavformat/isom.c
@@ -357,6 +357,7 @@ const AVCodecTag ff_codec_movsubtitle_tags[] = {
 
 const AVCodecTag ff_codec_metadata_tags[] = {
 { AV_CODEC_ID_META, MKTAG('m', 'e', 't', 'a') },
+{ AV_CODEC_ID_META, MKTAG('u', 'r', 'i', 'm') },
 { AV_CODEC_ID_NONE, 0 },
 };
 
diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index a6f234e..84a6940 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -1552,6 +1552,69 @@ static int mov_write_fiel_tag(AVIOContext *pb, MOVTrack 
*track, int field_order)
 return 10;
 }
 
+static int mov_write_urim_uri_box(AVIOContext *pb, const char *uri, int length)
+{
+int64_t pos = avio_tell(pb);
+avio_wb32(pb, 0);   /* size */
+ffio_wfourcc(pb, "uri ");
+avio_w8(pb, 0); /* version */
+avio_wb24(pb, 0);   /* flags */
+
+avio_write(pb, uri, length); /* uri */
+avio_w8(pb, 0);  /* null-terminated */
+
+return update_size(pb, pos);
+}
+
+static int mov_write_conf_box(AVIOContext *pb, const uint8_t *data, int 
length, char* tag)
+{
+int64_t pos = avio_tell(pb);
+avio_wb32(pb, 0);   /* size */
+ffio_wfourcc(pb, tag);
+
+avio_w8(pb, 0); /* version */
+avio_wb24(pb, 0);   /* flags */
+
+avio_write(pb, data, length); /* data */
+
+return update_size(pb, pos);
+}
+
+static int mov_write_meta_codec(AVIOContext *pb, MOVTrack *track)
+{
+int64_t pos = avio_tell(pb);
+
+char *data;
+char *tag;
+
+AVTimedMetadataInfo *meta =
+(void*) av_stream_get_side_data(track->st, 
AV_PKT_DATA_TIMED_METADATA_INFO,
+NULL);
+
+av_assert0(meta);
+
+avio_wb32(pb, 0);/* size */
+ffio_wfourcc(pb, meta->meta_tag);
+
+avio_wb32(pb, 0);/* Reserved */
+avio_wb16(pb, 0);/* Reserved */
+avio_wb16(pb, 1);/* Data-reference index */
+
+data = (char*) (meta + 1);
+tag = meta->meta_tag;
+if (tag[0] == 'u' && tag[1] == 'r' && tag[2] == 'i' && tag[3] == 'm') {
+mov_write_urim_uri_box(pb, data, meta->meta_length);
+data += meta->meta_length;
+}
+
+if (meta->conf_length) {
+mov_write_conf_box(pb, data, meta->conf_length, meta->conf_tag);
+data += meta->conf_length;
+}
+
+return update_size(pb, pos);
+}
+
 static int mov_write_subtitle_tag(AVIOContext *pb, MOVTrack *track)
 {
 int64_t pos = avio_tell(pb);
@@ -1951,6 +2014,18 @@ static int mov_write_tmcd_tag(AVIOContext *pb, MOVTrack 
*track)
 return update_size(pb, pos);
 }
 
+static int mov_write_data_tag(AVIOContext *pb, MOVTrack *track)
+{
+if (track->par->codec_id == AV_CODEC_ID_META)
+return mov_write_meta_codec(pb, track);
+else if 

[FFmpeg-devel] [PATCH v3 08/25] Updated Changelog

2016-09-19 Thread Erkki Seppälä
---
 Changelog | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/Changelog b/Changelog
index f95a1f5..3712172 100644
--- a/Changelog
+++ b/Changelog
@@ -25,6 +25,9 @@ version :
   multiple tracks references by such track references (supported
   by isom for both reading and writing)
 
+- Added side data AV_PKT_DATA_TRACK_ALTERNATE_GROUP for explicitly
+  setting the alternate track groups (supported by isom)
+
 version 3.1:
 - DXVA2-accelerated HEVC Main10 decoding
 - fieldhint filter
-- 
2.7.4

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


[FFmpeg-devel] [PATCH v3 05/25] Updated Changelog

2016-09-19 Thread Erkki Seppälä
---
 Changelog | 4 
 1 file changed, 4 insertions(+)

diff --git a/Changelog b/Changelog
index e1c8010..f95a1f5 100644
--- a/Changelog
+++ b/Changelog
@@ -21,6 +21,10 @@ version :
 - Custom major brand (the "brand" option) of MPEG4 is written
   as a compatible brand as well.
 
+- Added support for multiple track reference types as well as
+  multiple tracks references by such track references (supported
+  by isom for both reading and writing)
+
 version 3.1:
 - DXVA2-accelerated HEVC Main10 decoding
 - fieldhint filter
-- 
2.7.4

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


[FFmpeg-devel] [PATCH v3 06/25] avcodec/avcodec, avformat/movenc: introduced AV_PKT_DATA_TRACK_ALTERNATE_GROUP side data for expressing alternate groups

2016-09-19 Thread Erkki Seppälä
Alternate groups previously always generated for ISO media files. With
this addition client code can define track groups arbitrarily.

Signed-off-by: Erkki Seppälä 
Signed-off-by: OZOPlayer 
---
 libavcodec/avcodec.h | 11 +++
 libavformat/movenc.c |  9 +
 2 files changed, 20 insertions(+)

diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index 56bb9b0..3be54d4 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -1543,6 +1543,17 @@ enum AVPacketSideDataType {
  * indicated by the key's length.
  */
 AV_PKT_DATA_TRACK_REFERENCES,
+
+/**
+ * Assign alternate groups for tracks. An example of alternate
+ * groups would be audio tracks (or video tracks) that are
+ * alternative to each other. Each alternative track shares the
+ * same non-zero alternate group.
+ *
+ * The content is:
+ * uint: The alternate group of this track
+ */
+AV_PKT_DATA_TRACK_ALTERNATE_GROUP,
 };
 
 #define AV_PKT_DATA_QUALITY_FACTOR AV_PKT_DATA_QUALITY_STATS //DEPRECATED
diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index aed30dc..b2e87ed 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -2407,6 +2407,8 @@ static int mov_write_tkhd_tag(AVIOContext *pb, 
MOVMuxContext *mov,
 int flags   = MOV_TKHD_FLAG_IN_MOVIE;
 int rotation = 0;
 int group   = 0;
+int *alternate_group = NULL;
+int alternate_group_size;
 
 uint32_t *display_matrix = NULL;
 int  display_matrix_size, i;
@@ -2423,6 +2425,13 @@ static int mov_write_tkhd_tag(AVIOContext *pb, 
MOVMuxContext *mov,
 display_matrix = NULL;
 }
 
+if (st) {
+alternate_group = (int*) av_stream_get_side_data(st, 
AV_PKT_DATA_TRACK_ALTERNATE_GROUP,
+ 
_group_size);
+if (alternate_group && alternate_group_size >= sizeof(int))
+group = *alternate_group;
+}
+
 if (track->flags & MOV_TRACK_ENABLED)
 flags |= MOV_TKHD_FLAG_ENABLED;
 
-- 
2.7.4

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


[FFmpeg-devel] [PATCH v3 10/25] avformat/movenc: deal with AVMEDIA_TYPE_DATA by using AV_CODEC_ID_META

2016-09-19 Thread Erkki Seppälä
This includes creating an AVCodecTag table ff_codec_metadata_tags as
there are for video, audio and subtitles. The tag table is used for
mov-compatiblity.

Signed-off-by: Erkki Seppälä 
Signed-off-by: OZOPlayer 
---
 libavformat/isom.c   | 5 +
 libavformat/isom.h   | 1 +
 libavformat/movenc.c | 6 ++
 3 files changed, 12 insertions(+)

diff --git a/libavformat/isom.c b/libavformat/isom.c
index cb457dd..1a90d00 100644
--- a/libavformat/isom.c
+++ b/libavformat/isom.c
@@ -355,6 +355,11 @@ const AVCodecTag ff_codec_movsubtitle_tags[] = {
 { AV_CODEC_ID_NONE, 0 },
 };
 
+const AVCodecTag ff_codec_metadata_tags[] = {
+{ AV_CODEC_ID_META, MKTAG('m', 'e', 't', 'a') },
+{ AV_CODEC_ID_NONE, 0 },
+};
+
 /* map numeric codes from mdhd atom to ISO 639 */
 /* cf. QTFileFormat.pdf p253, qtff.pdf p205 */
 /* http://developer.apple.com/documentation/mac/Text/Text-368.html */
diff --git a/libavformat/isom.h b/libavformat/isom.h
index 7b521d8..89b15ea 100644
--- a/libavformat/isom.h
+++ b/libavformat/isom.h
@@ -35,6 +35,7 @@ extern const AVCodecTag ff_mp4_obj_type[];
 extern const AVCodecTag ff_codec_movvideo_tags[];
 extern const AVCodecTag ff_codec_movaudio_tags[];
 extern const AVCodecTag ff_codec_movsubtitle_tags[];
+extern const AVCodecTag ff_codec_metadata_tags[];
 
 int ff_mov_iso639_to_lang(const char lang[4], int mp4);
 int ff_mov_lang_to_iso639(unsigned code, char to[4]);
diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index b2e87ed..a6f234e 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -1470,6 +1470,8 @@ static int mov_get_codec_tag(AVFormatContext *s, MOVTrack 
*track)
 }
 } else if (track->par->codec_type == AVMEDIA_TYPE_SUBTITLE)
 tag = ff_codec_get_tag(ff_codec_movsubtitle_tags, 
track->par->codec_id);
+else if (track->par->codec_type == AVMEDIA_TYPE_DATA)
+tag = ff_codec_get_tag(ff_codec_metadata_tags, 
track->par->codec_id);
 }
 
 return tag;
@@ -2242,6 +2244,9 @@ static int mov_write_hdlr_tag(AVFormatContext *s, 
AVIOContext *pb, MOVTrack *tra
 } else if (track->par->codec_tag == MKTAG('t','m','c','d')) {
 hdlr_type = "tmcd";
 descr = "TimeCodeHandler";
+} else if (track->par->codec_type == AVMEDIA_TYPE_DATA) {
+hdlr_type = "meta";
+descr = "DataHandler";
 } else {
 char tag_buf[32];
 av_get_codec_tag_string(tag_buf, sizeof(tag_buf),
@@ -5425,6 +5430,7 @@ static void enable_tracks(AVFormatContext *s)
 case AVMEDIA_TYPE_VIDEO:
 case AVMEDIA_TYPE_AUDIO:
 case AVMEDIA_TYPE_SUBTITLE:
+case AVMEDIA_TYPE_DATA:
 if (enabled[i] > 1)
 mov->per_stream_grouping = 1;
 if (!enabled[i] && first[i] >= 0)
-- 
2.7.4

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


[FFmpeg-devel] [PATCH v3 02/25] Updated Changelog

2016-09-19 Thread Erkki Seppälä
---
 Changelog | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/Changelog b/Changelog
index 71abe8c..e1c8010 100644
--- a/Changelog
+++ b/Changelog
@@ -18,6 +18,8 @@ version :
 - bitplanenoise video filter
 - floating point support in als decoder
 
+- Custom major brand (the "brand" option) of MPEG4 is written
+  as a compatible brand as well.
 
 version 3.1:
 - DXVA2-accelerated HEVC Main10 decoding
-- 
2.7.4

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


[FFmpeg-devel] [PATCH v3 09/25] avcodec/metaenc, metadec: added an encoder/decoder for timed metadata

2016-09-19 Thread Erkki Seppälä
It has the codec id AV_CODEC_ID_META and type of AVMEDIA_TYPE_DATA.

This codec basically passes the data forward and is used for referring
timed meta data tracks by a codec. It is useful for dealing with the
metadata in a similar way as other kinds of codecs.

Signed-off-by: Erkki Seppälä 
Signed-off-by: OZOPlayer 
---
 configure   |  4 ++--
 libavcodec/Makefile |  2 ++
 libavcodec/allcodecs.c  |  3 +++
 libavcodec/avcodec.h|  1 +
 libavcodec/codec_desc.c |  8 +++
 libavcodec/metadec.c| 59 +
 libavcodec/metaenc.c| 58 
 7 files changed, 133 insertions(+), 2 deletions(-)
 create mode 100644 libavcodec/metadec.c
 create mode 100644 libavcodec/metaenc.c

diff --git a/configure b/configure
index 9b92426..ded5452 100755
--- a/configure
+++ b/configure
@@ -2848,11 +2848,11 @@ matroska_demuxer_select="iso_media riffdec"
 matroska_demuxer_suggest="bzlib lzo zlib"
 matroska_muxer_select="iso_media riffenc"
 mmf_muxer_select="riffenc"
-mov_demuxer_select="iso_media riffdec"
+mov_demuxer_select="iso_media riffdec meta_decoder"
 mov_demuxer_suggest="zlib"
 mov_muxer_select="iso_media riffenc rtpenc_chain"
 mp3_demuxer_select="mpegaudio_parser"
-mp4_muxer_select="mov_muxer"
+mp4_muxer_select="mov_muxer meta_encoder"
 mpegts_demuxer_select="iso_media"
 mpegts_muxer_select="adts_muxer latm_muxer"
 mpegtsraw_demuxer_select="mpegts_demuxer"
diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index a6e79ce..534f201 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -757,6 +757,8 @@ OBJS-$(CONFIG_ADPCM_VIMA_DECODER) += vima.o 
adpcm_data.o
 OBJS-$(CONFIG_ADPCM_XA_DECODER)   += adpcm.o adpcm_data.o
 OBJS-$(CONFIG_ADPCM_YAMAHA_DECODER)   += adpcm.o adpcm_data.o
 OBJS-$(CONFIG_ADPCM_YAMAHA_ENCODER)   += adpcmenc.o adpcm_data.o
+OBJS-$(CONFIG_META_ENCODER)   += metaenc.o
+OBJS-$(CONFIG_META_DECODER)   += metadec.o
 
 # hardware accelerators
 OBJS-$(CONFIG_D3D11VA)+= dxva2.o
diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
index 4c6b94e..30d0243 100644
--- a/libavcodec/allcodecs.c
+++ b/libavcodec/allcodecs.c
@@ -687,4 +687,7 @@ void avcodec_register_all(void)
 REGISTER_PARSER(VP3,vp3);
 REGISTER_PARSER(VP8,vp8);
 REGISTER_PARSER(VP9,vp9);
+
+/* data, meta data */
+REGISTER_ENCDEC(META,   meta);
 }
diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index 3be54d4..4219a9f 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -639,6 +639,7 @@ enum AVCodecID {
 AV_CODEC_ID_DVD_NAV,
 AV_CODEC_ID_TIMED_ID3,
 AV_CODEC_ID_BIN_DATA,
+AV_CODEC_ID_META,
 
 
 AV_CODEC_ID_PROBE = 0x19000, ///< codec_id is not known (like 
AV_CODEC_ID_NONE) but lavf should attempt to identify it
diff --git a/libavcodec/codec_desc.c b/libavcodec/codec_desc.c
index 24948ca..e85b51d 100644
--- a/libavcodec/codec_desc.c
+++ b/libavcodec/codec_desc.c
@@ -2965,6 +2965,14 @@ static const AVCodecDescriptor codec_descriptors[] = {
 .mime_types= MT("application/octet-stream"),
 },
 
+{
+.id= AV_CODEC_ID_META,
+.type  = AVMEDIA_TYPE_DATA,
+.name  = "meta_data",
+.long_name = NULL_IF_CONFIG_SMALL("binary data"),
+.mime_types= MT("application/octet-stream"),
+},
+
 /* deprecated codec ids */
 };
 
diff --git a/libavcodec/metadec.c b/libavcodec/metadec.c
new file mode 100644
index 000..2c1d461
--- /dev/null
+++ b/libavcodec/metadec.c
@@ -0,0 +1,59 @@
+/*
+ * Copyright (c) 2015-2016 Erkki Seppälä 
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "internal.h"
+#include "libavformat/avio.h"
+
+static int meta_decode(AVCodecContext *avctx, void *data, int *got_packet_ptr, 
AVPacket *avpkt)
+{
+AVFrame *metadata = data;
+
+*got_packet_ptr = 0;
+
+av_frame_unref(metadata);
+if (avpkt->buf) {
+metadata->buf[0] = av_buffer_ref(avpkt->buf);
+if (!metadata->buf[0])
+return AVERROR(ENOMEM);
+metadata->buf[0]->size = 

[FFmpeg-devel] [PATCH v3 00/25] Add timed metadata tracks, track references, channel layout

2016-09-19 Thread Erkki Seppälä
Hello again!

Here is the patch set version 3 with the goal of adding the following
features to the ISO base media file format support of FFmpeg (also
available at
https://github.com/nokiatech/FFmpeg/tree/timed-metadata-v3):

- This patchset is still against the same version of FFmepg as before,
  but it merges cleanly over current master.
- Reordered patches so that distinct features are not interleaved at
  all, with Changelog entries separating them. (The side data
  enumeration is still matches the original order.)

  This was done to encourage merging this patch piece-wise :). (In
  particular my personal projects might benefit from the timed
  metadata changes..)

- Hardened code dealing with side data (mov_tref_copy_from_side_data,
  mov_write_chnl_tag). This includes replacing some av_assert0 with
  return AVERROR(EINVAL).  Movenc.c however does not yes pass errors
  forward.
- Read the ISO tkhd's alternate_group into AV_PKT_DATA_TRACK_ALTERNATE_GROUP
  This is done only with mov.c option "read_alternate_group" as to not
  affect default FFmpeg functionality.
- Fixed memory bug in meta_encode
- Fixed comment style to match the used style (doxygen)
- Fixed messing up with the amount of whitespace
- Renamed AVTimedMetadata to AVTimedMetadataInfo to match the enumeration name
- Split meta_encode/meta_decode to separate files
- Renamed long_name "Metadata Decoder" to "Timed Metadata Decoder"
  (and Encoder correspondingly)
- Removed references to AV_CODEC_ID_META from ff_*_muxer as to not
  change the default ffmpeg tool functionality
- Updated configure-script to include references to the two examples
- Added parsing for ISO23001-8 chnl boxes (to side data) as
  mov_read_chnl. This means the 'chnl' box can be copied along the
  rest of the track with ffmpeg
- Fixed crash introduced by channel side data handling when there was
  no side data for chnl..

Erkki Seppälä (25):
  avformat/movenc: mov_write_ftyp_tag: write the major brand as a
compatible brand
  Updated Changelog
  avformat/movenc: support for multiple and client-provided track
references
  avformat/mov, isom: read (multiple) track references (tag and multiple
ids)
  Updated Changelog
  avcodec/avcodec, avformat/movenc: introduced
AV_PKT_DATA_TRACK_ALTERNATE_GROUP side data for expressing alternate
groups
  avformat/mov: mov_read_tkhd stores alternate group to
AV_PKT_DATA_TRACK_ALTERNATE_GROUP
  Updated Changelog
  avcodec/metaenc, metadec: added an encoder/decoder for timed metadata
  avformat/movenc: deal with AVMEDIA_TYPE_DATA by using AV_CODEC_ID_META
  avformat/movenc: add the urim sample descriptor
  avformat/movenc, isom: support metadata in mp4 files
  avcodec/utils: do_decode now supports AVMEDIA_TYPE_DATA
  avcodec/utils: do_encode now supports AVMEDIA_TYPE_DATA
  avformat/mov: basic support for identifying (and reading) timed
metadata
  avformat/mov: ff_mov_read_stsd_entries now deals with
AVMEDIA_TYPE_DATA
  avformat/mov: read urim metadata from meta
  Updated Changelog
  avcodec/avcodec, avformat/movenc: support embedding channel layout to
stream side data
  avformat/movenc: mov_write_audio_tag can write the proper number of
channels, not the hardcoded 2
  avformat/mov: read the chnl box as side data
AV_PKT_DATA_AUDIO_TRACK_CHANNEL_LAYOUT
  avutil: added channel_layout_isoiec23001_8.h to HEADERS
  Updated Changelog
  doc/examples/extract_timed_metadata: added a bare-bones metadata
extractor; find only the frames
  doc/examples/muxing_with_metadata: example for dealing with timed meta
data

 Changelog|  15 +
 configure|   8 +-
 doc/examples/Makefile|   3 +
 doc/examples/extract_timed_metadata.c| 230 
 doc/examples/muxing_with_metadata.c  | 885 +++
 libavcodec/Makefile  |   2 +
 libavcodec/allcodecs.c   |   3 +
 libavcodec/avcodec.h | 118 -
 libavcodec/codec_desc.c  |   8 +
 libavcodec/metadec.c |  59 +++
 libavcodec/metaenc.c |  58 ++
 libavcodec/utils.c   |   6 +
 libavformat/Makefile |   4 +-
 libavformat/isom.c   |   7 +
 libavformat/isom.h   |   5 +
 libavformat/mov.c| 399 +-
 libavformat/movenc.c | 349 +++-
 libavformat/movenc.h |   6 +-
 libavformat/movmeta.h|  46 ++
 libavformat/movtref.c| 115 
 libavformat/movtref.h|  75 +++
 libavutil/Makefile   |   1 +
 libavutil/channel_layout_isoiec23001_8.h |  97 
 23 files changed, 2454 insertions(+), 45 deletions(-)
 create mode 100644 doc/examples/extract_timed_metadata.c
 create mode 100644 doc/examples/muxing_with_metadata.c
 create mode 

[FFmpeg-devel] [PATCH v3 04/25] avformat/mov, isom: read (multiple) track references (tag and multiple ids)

2016-09-19 Thread Erkki Seppälä
This can be useful in particular with timed meta data tracks related
to multiple tracks.

Signed-off-by: Erkki Seppälä 
Signed-off-by: OZOPlayer 
---
 libavformat/isom.h |   3 ++
 libavformat/mov.c  | 119 -
 2 files changed, 121 insertions(+), 1 deletion(-)

diff --git a/libavformat/isom.h b/libavformat/isom.h
index df6c15a..609b7b7 100644
--- a/libavformat/isom.h
+++ b/libavformat/isom.h
@@ -27,6 +27,8 @@
 #include "avio.h"
 #include "internal.h"
 #include "dv.h"
+#include "movmeta.h"
+#include "movtref.h"
 
 /* isom.c */
 extern const AVCodecTag ff_mp4_obj_type[];
@@ -167,6 +169,7 @@ typedef struct MOVStreamContext {
 int start_pad;///< amount of samples to skip due to enc-dec delay
 unsigned int rap_group_count;
 MOVSbgp *rap_group;
+MOVTRefs trefs;
 
 int nb_frames_for_fps;
 int64_t duration_for_fps;
diff --git a/libavformat/mov.c b/libavformat/mov.c
index 1bc3800..ff4c91c 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -3157,6 +3157,121 @@ static void fix_timescale(MOVContext *c, 
MOVStreamContext *sc)
 }
 }
 
+static int mov_read_tref_subatom(MOVContext *c, AVIOContext *pb, MOVTRefs 
*trefs)
+{
+uint32_t tref_tag;
+MOVTRef *tref;
+int tref_ids_size;
+int *tref_ids;
+int ret;
+
+tref_ids_size = avio_rb32(pb);
+if (tref_ids_size % 4 != 0)
+return AVERROR_INVALIDDATA;
+tref_ids_size -= 4;
+
+tref_tag = avio_rl32(pb);
+tref_ids_size -= 4;
+if (tref_ids_size < 4)
+return AVERROR_INVALIDDATA;
+
+ret = ff_mov_tref_find_or_add(trefs, tref_tag, );
+if (ret != 0)
+return ret;
+
+ff_mov_tref_alloc(tref, tref_ids_size / 4, _ids);
+if (ret != 0)
+return ret;
+
+while (tref_ids_size) {
+*tref_ids = avio_rb32(pb);
+++tref_ids;
+tref_ids_size -= 4;
+}
+
+return ret;
+}
+
+static int mov_tref_copy_to_side_data(AVStream *st, MOVTRefs *trefs)
+{
+if (trefs->nb_trefs) {
+int i;
+char *trefs_side_ptr;
+int end_offset = 0;
+int offset = 0;
+AVTrackReferences *trefs_side_prev = NULL;
+
+for (i = 0; i < trefs->nb_trefs; ++i) {
+MOVTRef *tref = >trefs[i];
+if (tref->nb_track_ids > 0)
+// Ensure the returned data is easy to access without
+// worrying about alignment, even if it wastes some memory
+end_offset = FFALIGN(end_offset + sizeof(AVTrackReferences) +
+ sizeof(int) * (tref->nb_track_ids - 1),
+ sizeof(AVTrackReferences));
+}
+
+trefs_side_ptr = (void*) av_stream_new_side_data(st,
+ 
AV_PKT_DATA_TRACK_REFERENCES,
+ end_offset);
+if (!trefs_side_ptr)
+return AVERROR(ENOMEM);
+
+for (i = 0; i < trefs->nb_trefs; ++i) {
+MOVTRef *tref = >trefs[i];
+if (tref->nb_track_ids > 0) {
+AVTrackReferences *trefs_side = (AVTrackReferences*) 
(trefs_side_ptr + offset);
+int *trefs_tracks;
+
+trefs_side->nb_tracks = tref->nb_track_ids;
+trefs_side->tag[0] = (tref->tag >>  0) & 0xff;
+trefs_side->tag[1] = (tref->tag >>  8) & 0xff;
+trefs_side->tag[2] = (tref->tag >> 16) & 0xff;
+trefs_side->tag[3] = (tref->tag >> 24) & 0xff;
+trefs_tracks = trefs_side->tracks;
+for (i = 0; i < tref->nb_track_ids; ++i) {
+trefs_tracks[i] = tref->track_ids[i];
+}
+
+if (trefs_side_prev)
+trefs_side_prev->next_tref_ofs = (char*) trefs_side - 
(char*) trefs_side_prev;
+trefs_side_prev = trefs_side;
+offset = FFALIGN(end_offset + sizeof(AVTrackReferences) +
+ sizeof(int) * (tref->nb_track_ids - 1),
+ sizeof(AVTrackReferences));
+}
+}
+}
+
+return 0;
+}
+
+static int mov_read_tref(MOVContext *c, AVIOContext *pb, MOVAtom atom)
+{
+AVStream *st;
+MOVStreamContext *sc;
+int64_t end = avio_tell(pb) + atom.size;
+
+if (c->fc->nb_streams < 1)
+return 0;
+
+st = c->fc->streams[c->fc->nb_streams-1];
+sc = st->priv_data;
+
+if (atom.size < 12) {
+return mov_read_default(c, pb, atom);
+} else {
+int ret = 0;
+while (end - avio_tell(pb) > 0 && ret == 0) {
+ret = mov_read_tref_subatom(c, pb, >trefs);
+}
+mov_tref_copy_to_side_data(st, >trefs);
+avio_seek(pb, end, SEEK_SET);
+}
+
+return 0;
+}
+
 static int mov_read_trak(MOVContext *c, AVIOContext *pb, MOVAtom atom)
 {
 AVStream *st;
@@ 

[FFmpeg-devel] [PATCH v3 03/25] avformat/movenc: support for multiple and client-provided track references

2016-09-19 Thread Erkki Seppälä
Instead of one track reference, allow many, and instead of
of track reference type (ie. 'cdsc'), allow many.

In addition this patch allows client to explicitly add track references
with side packet AV_PKT_DATA_TRACK_REFERENCES containing
AVTrackReferences (which of there can many many).

Internally MOVTrack's track references can be manipulated with helper
functions ff_mov_tref* (and is used by a later patch for reading
MOVTRefs).

Multiple track references can be useful in particular with timed meta
data tracks, indicating the track is related to multiple other tracks.

This information ends up in ISO media file box 'tref' as specified by
ISO/IEC 14496-12.

Signed-off-by: Erkki Seppälä 
Signed-off-by: OZOPlayer 
---
 libavcodec/avcodec.h  |  19 ++-
 libavformat/Makefile  |   4 +-
 libavformat/movenc.c  | 153 ++
 libavformat/movenc.h  |   5 +-
 libavformat/movtref.c | 115 +
 libavformat/movtref.h |  75 +
 6 files changed, 344 insertions(+), 27 deletions(-)
 create mode 100644 libavformat/movtref.c
 create mode 100644 libavformat/movtref.h

diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index 6ac6646..56bb9b0 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -1348,6 +1348,15 @@ typedef struct AVCPBProperties {
  * Types and functions for working with AVPacket.
  * @{
  */
+
+typedef struct AVTrackReferences {
+int next_tref_ofs;  /**< offset in bytes to the next 
AVTrackReferences or 0 if this is the last one*/
+chartag[4]; /**< 4cc used for describing this  */
+int nb_tracks;  /**< number of tracks */
+int tracks[1];  /**< tracks this track refers to (contains 
nb_tracks entries) */
+/** followed by an optional gap for alignment purposes and another 
AVTrackReferences is applicaple */
+} AVTrackReferences;
+
 enum AVPacketSideDataType {
 AV_PKT_DATA_PALETTE,
 
@@ -1525,7 +1534,15 @@ enum AVPacketSideDataType {
  * should be associated with a video stream and containts data in the form
  * of the AVMasteringDisplayMetadata struct.
  */
-AV_PKT_DATA_MASTERING_DISPLAY_METADATA
+AV_PKT_DATA_MASTERING_DISPLAY_METADATA,
+
+/**
+ * Define track references (in particular applicaple for ISO MP4
+ * files). The data is a sequence of type AVTrackReferences
+ * (including the track list that follows it), for as long as
+ * indicated by the key's length.
+ */
+AV_PKT_DATA_TRACK_REFERENCES,
 };
 
 #define AV_PKT_DATA_QUALITY_FACTOR AV_PKT_DATA_QUALITY_STATS //DEPRECATED
diff --git a/libavformat/Makefile b/libavformat/Makefile
index fda1e17..6a393ed 100644
--- a/libavformat/Makefile
+++ b/libavformat/Makefile
@@ -280,10 +280,10 @@ OBJS-$(CONFIG_MLV_DEMUXER)   += mlvdec.o 
riffdec.o
 OBJS-$(CONFIG_MM_DEMUXER)+= mm.o
 OBJS-$(CONFIG_MMF_DEMUXER)   += mmf.o
 OBJS-$(CONFIG_MMF_MUXER) += mmf.o rawenc.o
-OBJS-$(CONFIG_MOV_DEMUXER)   += mov.o mov_chan.o replaygain.o
+OBJS-$(CONFIG_MOV_DEMUXER)   += mov.o mov_chan.o replaygain.o 
movtref.o
 OBJS-$(CONFIG_MOV_MUXER) += movenc.o avc.o hevc.o vpcc.o \
 movenchint.o mov_chan.o rtp.o \
-movenccenc.o rawutils.o
+movenccenc.o rawutils.o movtref.o
 OBJS-$(CONFIG_MP2_MUXER) += mp3enc.o rawenc.o id3v2enc.o
 OBJS-$(CONFIG_MP3_DEMUXER)   += mp3dec.o replaygain.o
 OBJS-$(CONFIG_MP3_MUXER) += mp3enc.o rawenc.o id3v2enc.o
diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index 571c2a7..aed30dc 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -2626,14 +2626,22 @@ static int mov_write_edts_tag(AVIOContext *pb, 
MOVMuxContext *mov,
 return size;
 }
 
-static int mov_write_tref_tag(AVIOContext *pb, MOVTrack *track)
+static int mov_write_tref_tag(AVIOContext *pb, MOVMuxContext *mov, MOVTrack 
*track)
 {
-avio_wb32(pb, 20);   // size
+int64_t pos = avio_tell(pb);
+int i, j;
+avio_wb32(pb, 0);   // size
 ffio_wfourcc(pb, "tref");
-avio_wb32(pb, 12);   // size (subatom)
-avio_wl32(pb, track->tref_tag);
-avio_wb32(pb, track->tref_id);
-return 20;
+for (j = 0; j < track->trefs.nb_trefs; ++j) {
+int64_t pos_sub = avio_tell(pb);
+MOVTRef* tref = >trefs.trefs[j];
+avio_wb32(pb, 0);   // size (subatom)
+avio_wl32(pb, tref->tag);
+for (i = 0; i < tref->nb_track_ids; i++)
+avio_wb32(pb, tref->track_ids[i]);
+update_size(pb, pos_sub);
+}
+return update_size(pb, pos);
 }
 
 // goes at the end of each track!  ... Critical for PSP playback 
("Incompatible data" without it)
@@ -2744,8 +2752,8 @@ static int 

[FFmpeg-devel] [PATCH v3 01/25] avformat/movenc: mov_write_ftyp_tag: write the major brand as a compatible brand

2016-09-19 Thread Erkki Seppälä
when the option "brand" is used. This allows custom brands to end up in
the compatible brands as well.

Signed-off-by: Erkki Seppälä 
Signed-off-by: OZOPlayer 
---
 libavformat/movenc.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index 525d103..571c2a7 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -4210,6 +4210,8 @@ static int mov_write_ftyp_tag(AVIOContext *pb, 
AVFormatContext *s)
 
 avio_wb32(pb, minor);
 
+if (mov->mode == MODE_MP4 && mov->major_brand)
+ffio_wfourcc(pb, mov->major_brand); /* write major brand as a 
compatible brand */
 if (mov->mode == MODE_MOV)
 ffio_wfourcc(pb, "qt  ");
 else if (mov->mode == MODE_ISM) {
-- 
2.7.4

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


Re: [FFmpeg-devel] [PATCH]lavf/mov: Read aspect ratio from ares atom for dnxhd

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

> title should mentioned what kind of aspect ratio this is about.
> As I thought it is about sar.

I don't understand: FFmpeg only knows about sample aspect
ratio (also known as pixel aspect ratio), display aspect ratio is
only shown on the console for convenience.
Without this patch, sar is 1:1 and (I suspect) the sample is not
decoded correctly, with my patch sar is 4:3 and the sample
looks better.

What do I miss?

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


Re: [FFmpeg-devel] [PATCH]lavf/mov: Read aspect ratio from ares atom for dnxhd

2016-09-19 Thread Paul B Mahol
On 9/19/16, Paul B Mahol  wrote:
> On 9/19/16, Paul B Mahol  wrote:
>> On 9/19/16, Carl Eugen Hoyos  wrote:
>>> 2016-09-19 14:02 GMT+02:00 Clement Boesch :
 On Mon, Sep 19, 2016 at 01:32:54PM +0200, Carl Eugen Hoyos wrote:
> Hi!
>
> Attached patch fixes the aspect ratio for the sample from
> ticket #5325 / #2125.
>
> The fate test changes because the fate sample  was written
> by FFmpeg with an incorrect aspect ratio.
>
> Please comment, Carl Eugen

> From 0553b0adfee87401854f0313dbcf386f2fb7ae68 Mon Sep 17 00:00:00 2001
> From: Carl Eugen Hoyos 
> Date: Mon, 19 Sep 2016 13:30:06 +0200
> Subject: [PATCH] lavf/mov: Read aspect ratio from ares atom for dnxhd.
>

> Fixes ticket #2125.
> Fixes ticket #5325.

 It fixes aspect ratio from samples from these tickets, it looks
 unrelated
 to the original issue.
>>>
>>> We seem to have very different interpretations of "unrelated" but
>>> changed
>>> locally to "Fixes aspect ratio of sample in ticket "
>>
>> Maybe this patch with above locally changed text is correct.
>>
>> But it does change nothing with sample from ticket #5325. As that sample
>> have same sar as before this patch.
>>
>> So it is another lie.
>>
>
> Ignore that one above, patck with corrected text is ok.
>

title should mentioned what kind of aspect ratio this is about. As I
thought it is about sar.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH]lavf/mov: Read aspect ratio from ares atom for dnxhd

2016-09-19 Thread Paul B Mahol
On 9/19/16, Paul B Mahol  wrote:
> On 9/19/16, Carl Eugen Hoyos  wrote:
>> 2016-09-19 14:02 GMT+02:00 Clement Boesch :
>>> On Mon, Sep 19, 2016 at 01:32:54PM +0200, Carl Eugen Hoyos wrote:
 Hi!

 Attached patch fixes the aspect ratio for the sample from
 ticket #5325 / #2125.

 The fate test changes because the fate sample  was written
 by FFmpeg with an incorrect aspect ratio.

 Please comment, Carl Eugen
>>>
 From 0553b0adfee87401854f0313dbcf386f2fb7ae68 Mon Sep 17 00:00:00 2001
 From: Carl Eugen Hoyos 
 Date: Mon, 19 Sep 2016 13:30:06 +0200
 Subject: [PATCH] lavf/mov: Read aspect ratio from ares atom for dnxhd.

>>>
 Fixes ticket #2125.
 Fixes ticket #5325.
>>>
>>> It fixes aspect ratio from samples from these tickets, it looks
>>> unrelated
>>> to the original issue.
>>
>> We seem to have very different interpretations of "unrelated" but changed
>> locally to "Fixes aspect ratio of sample in ticket "
>
> Maybe this patch with above locally changed text is correct.
>
> But it does change nothing with sample from ticket #5325. As that sample
> have same sar as before this patch.
>
> So it is another lie.
>

Ignore that one above, patck with corrected text is ok.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCHv2] vf_colorspace: Interpret unspecified color range as limited range

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

On Fri, Sep 16, 2016 at 9:27 AM, Clément Bœsch  wrote:

> On Fri, Sep 16, 2016 at 03:20:49PM +0200, Vittorio Giovara wrote:
> > This is the assumption that is made in pixel format conversion do
> > throughout the code (in particular swscale), and BT-specifications
> > mandate.
> >
> > Add a warning to inform the user that an automatic selection is being
> > made.
> >
> > Signed-off-by: Vittorio Giovara 
> > ---
> >  libavfilter/vf_colorspace.c | 9 ++---
> >  1 file changed, 6 insertions(+), 3 deletions(-)
> >
> > diff --git a/libavfilter/vf_colorspace.c b/libavfilter/vf_colorspace.c
> > index e69be50..41d1692 100644
> > --- a/libavfilter/vf_colorspace.c
> > +++ b/libavfilter/vf_colorspace.c
> > @@ -518,10 +518,13 @@ static int convert(AVFilterContext *ctx, void
> *data, int job_nr, int n_jobs)
> >  return 0;
> >  }
> >
> > -static int get_range_off(int *off, int *y_rng, int *uv_rng,
> > +static int get_range_off(AVFilterContext *ctx, int *off,
> > + int *y_rng, int *uv_rng,
> >   enum AVColorRange rng, int depth)
> >  {
> >  switch (rng) {
> > +case AVCOL_RANGE_UNSPECIFIED:
> > +av_log(ctx, AV_LOG_WARNING, "Input range not set, assuming
> tv/mpeg\n");
>
> nit: I think coverity likes a "// Fall-through" below this line in these
> cases.


Pushed with comment.

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


Re: [FFmpeg-devel] [PATCH]lavf/mov: Read aspect ratio from ares atom for dnxhd

2016-09-19 Thread Paul B Mahol
On 9/19/16, Carl Eugen Hoyos  wrote:
> 2016-09-19 14:02 GMT+02:00 Clement Boesch :
>> On Mon, Sep 19, 2016 at 01:32:54PM +0200, Carl Eugen Hoyos wrote:
>>> Hi!
>>>
>>> Attached patch fixes the aspect ratio for the sample from
>>> ticket #5325 / #2125.
>>>
>>> The fate test changes because the fate sample  was written
>>> by FFmpeg with an incorrect aspect ratio.
>>>
>>> Please comment, Carl Eugen
>>
>>> From 0553b0adfee87401854f0313dbcf386f2fb7ae68 Mon Sep 17 00:00:00 2001
>>> From: Carl Eugen Hoyos 
>>> Date: Mon, 19 Sep 2016 13:30:06 +0200
>>> Subject: [PATCH] lavf/mov: Read aspect ratio from ares atom for dnxhd.
>>>
>>
>>> Fixes ticket #2125.
>>> Fixes ticket #5325.
>>
>> It fixes aspect ratio from samples from these tickets, it looks unrelated
>> to the original issue.
>
> We seem to have very different interpretations of "unrelated" but changed
> locally to "Fixes aspect ratio of sample in ticket "

Maybe this patch with above locally changed text is correct.

But it does change nothing with sample from ticket #5325. As that sample
have same sar as before this patch.

So it is another lie.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH]lavf/mov: Read aspect ratio from ares atom for dnxhd

2016-09-19 Thread Clément Bœsch
On Mon, Sep 19, 2016 at 02:04:43PM +0200, Carl Eugen Hoyos wrote:
> 2016-09-19 14:03 GMT+02:00 Clément Bœsch :
> 
> >> > From the code of conduct: "Do not assume malice for things that can be
> >> > attributed to incompetence. Even if it is malice, it’s rarely good to
> >> > start with that as initial assumption."
> >>
> >> I thought this is not relevant anymore?
> >
> > Why do you believe that?
> 
> Last week a long-time contributor was attacked repeatedly
> and no steps were taken so I was hoping that these days
> of political correctness are over.
> 
> Was I wrong?
> 

I missed that so I have no idea what you are referring to, I'm sorry.
Also, I'm not a police officer, I just happened to read that thread that
just popped in my mailbox and wanted to avoid any escalation.

Regards,

-- 
Clément B.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH]lavf/mov: Read aspect ratio from ares atom for dnxhd

2016-09-19 Thread Clément Bœsch
On Mon, Sep 19, 2016 at 02:03:22PM +0200, Carl Eugen Hoyos wrote:
> 2016-09-19 14:02 GMT+02:00 Clément Bœsch :
> > On Mon, Sep 19, 2016 at 01:32:54PM +0200, Carl Eugen Hoyos wrote:
> >> Hi!
> >>
> >> Attached patch fixes the aspect ratio for the sample from
> >> ticket #5325 / #2125.
> >>
> >> The fate test changes because the fate sample  was written
> >> by FFmpeg with an incorrect aspect ratio.
> >>
> >> Please comment, Carl Eugen
> >
> >> From 0553b0adfee87401854f0313dbcf386f2fb7ae68 Mon Sep 17 00:00:00 2001
> >> From: Carl Eugen Hoyos 
> >> Date: Mon, 19 Sep 2016 13:30:06 +0200
> >> Subject: [PATCH] lavf/mov: Read aspect ratio from ares atom for dnxhd.
> >>
> >
> >> Fixes ticket #2125.
> >> Fixes ticket #5325.
> >
> > It fixes aspect ratio from samples from these tickets, it looks unrelated
> > to the original issue.
> 
> We seem to have very different interpretations of "unrelated" but changed
> locally to "Fixes aspect ratio of sample in ticket "
> 

Thanks

-- 
Clément B.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH]lavf/mov: Read aspect ratio from ares atom for dnxhd

2016-09-19 Thread Carl Eugen Hoyos
2016-09-19 14:03 GMT+02:00 Clément Bœsch :

>> > From the code of conduct: "Do not assume malice for things that can be
>> > attributed to incompetence. Even if it is malice, it’s rarely good to
>> > start with that as initial assumption."
>>
>> I thought this is not relevant anymore?
>
> Why do you believe that?

Last week a long-time contributor was attacked repeatedly
and no steps were taken so I was hoping that these days
of political correctness are over.

Was I wrong?

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


Re: [FFmpeg-devel] [PATCH]lavf/mov: Read aspect ratio from ares atom for dnxhd

2016-09-19 Thread Carl Eugen Hoyos
2016-09-19 14:02 GMT+02:00 Clément Bœsch :
> On Mon, Sep 19, 2016 at 01:32:54PM +0200, Carl Eugen Hoyos wrote:
>> Hi!
>>
>> Attached patch fixes the aspect ratio for the sample from
>> ticket #5325 / #2125.
>>
>> The fate test changes because the fate sample  was written
>> by FFmpeg with an incorrect aspect ratio.
>>
>> Please comment, Carl Eugen
>
>> From 0553b0adfee87401854f0313dbcf386f2fb7ae68 Mon Sep 17 00:00:00 2001
>> From: Carl Eugen Hoyos 
>> Date: Mon, 19 Sep 2016 13:30:06 +0200
>> Subject: [PATCH] lavf/mov: Read aspect ratio from ares atom for dnxhd.
>>
>
>> Fixes ticket #2125.
>> Fixes ticket #5325.
>
> It fixes aspect ratio from samples from these tickets, it looks unrelated
> to the original issue.

We seem to have very different interpretations of "unrelated" but changed
locally to "Fixes aspect ratio of sample in ticket "

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


Re: [FFmpeg-devel] [PATCH]lavf/mov: Read aspect ratio from ares atom for dnxhd

2016-09-19 Thread Clément Bœsch
On Mon, Sep 19, 2016 at 02:01:17PM +0200, Carl Eugen Hoyos wrote:
> 2016-09-19 14:00 GMT+02:00 Clément Bœsch :
> > On Mon, Sep 19, 2016 at 01:37:10PM +0200, Paul B Mahol wrote:
> >> On 9/19/16, Carl Eugen Hoyos  wrote:
> >> > Hi!
> >> >
> >> > Attached patch fixes the aspect ratio for the sample from
> >> > ticket #5325 / #2125.
> >> >
> >> > The fate test changes because the fate sample  was written
> >> > by FFmpeg with an incorrect aspect ratio.
> >> >
> >> > Please comment, Carl Eugen
> >> >
> >>
> >> > From 0553b0adfee87401854f0313dbcf386f2fb7ae68 Mon Sep 17 00:00:00 2001
> >> > From: Carl Eugen Hoyos 
> >> > Date: Mon, 19 Sep 2016 13:30:06 +0200
> >> > Subject: [PATCH] lavf/mov: Read aspect ratio from ares atom for dnxhd.
> >> >
> >> > Fixes ticket #2125.
> >> > Fixes ticket #5325.
> >>
> >> Feel free to spread lies to logs, it that helps your ego.
> >
> > Please don't use such aggressive statements. It might just be a ticket
> > number error here.
> 
> Why do you believe that there is an error?
> 

Because I'm assuming you made a mistake some way or another. It does look
like wording instead of ticket number.

> > From the code of conduct: "Do not assume malice for things that can be
> > attributed to incompetence. Even if it is malice, it’s rarely good to
> > start with that as initial assumption."
> 
> I thought this is not relevant anymore?
> 

Why do you believe that?

-- 
Clément B.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH]lavf/mov: Read aspect ratio from ares atom for dnxhd

2016-09-19 Thread Carl Eugen Hoyos
2016-09-19 14:00 GMT+02:00 Clément Bœsch :
> On Mon, Sep 19, 2016 at 01:37:10PM +0200, Paul B Mahol wrote:
>> On 9/19/16, Carl Eugen Hoyos  wrote:
>> > Hi!
>> >
>> > Attached patch fixes the aspect ratio for the sample from
>> > ticket #5325 / #2125.
>> >
>> > The fate test changes because the fate sample  was written
>> > by FFmpeg with an incorrect aspect ratio.
>> >
>> > Please comment, Carl Eugen
>> >
>>
>> > From 0553b0adfee87401854f0313dbcf386f2fb7ae68 Mon Sep 17 00:00:00 2001
>> > From: Carl Eugen Hoyos 
>> > Date: Mon, 19 Sep 2016 13:30:06 +0200
>> > Subject: [PATCH] lavf/mov: Read aspect ratio from ares atom for dnxhd.
>> >
>> > Fixes ticket #2125.
>> > Fixes ticket #5325.
>>
>> Feel free to spread lies to logs, it that helps your ego.
>
> Please don't use such aggressive statements. It might just be a ticket
> number error here.

Why do you believe that there is an error?

> From the code of conduct: "Do not assume malice for things that can be
> attributed to incompetence. Even if it is malice, it’s rarely good to
> start with that as initial assumption."

I thought this is not relevant anymore?

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


Re: [FFmpeg-devel] [PATCH]lavf/mov: Read aspect ratio from ares atom for dnxhd

2016-09-19 Thread Clément Bœsch
On Mon, Sep 19, 2016 at 01:32:54PM +0200, Carl Eugen Hoyos wrote:
> Hi!
> 
> Attached patch fixes the aspect ratio for the sample from 
> ticket #5325 / #2125.
> 
> The fate test changes because the fate sample  was written 
> by FFmpeg with an incorrect aspect ratio.
> 
> Please comment, Carl Eugen

> From 0553b0adfee87401854f0313dbcf386f2fb7ae68 Mon Sep 17 00:00:00 2001
> From: Carl Eugen Hoyos 
> Date: Mon, 19 Sep 2016 13:30:06 +0200
> Subject: [PATCH] lavf/mov: Read aspect ratio from ares atom for dnxhd.
> 

> Fixes ticket #2125.
> Fixes ticket #5325.

It fixes aspect ratio from samples from these tickets, it looks unrelated
to the original issue.

Regards,

-- 
Clément B.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH]lavf/mov: Read aspect ratio from ares atom for dnxhd

2016-09-19 Thread Clément Bœsch
On Mon, Sep 19, 2016 at 01:37:10PM +0200, Paul B Mahol wrote:
> On 9/19/16, Carl Eugen Hoyos  wrote:
> > Hi!
> >
> > Attached patch fixes the aspect ratio for the sample from
> > ticket #5325 / #2125.
> >
> > The fate test changes because the fate sample  was written
> > by FFmpeg with an incorrect aspect ratio.
> >
> > Please comment, Carl Eugen
> >
> 
> > From 0553b0adfee87401854f0313dbcf386f2fb7ae68 Mon Sep 17 00:00:00 2001
> > From: Carl Eugen Hoyos 
> > Date: Mon, 19 Sep 2016 13:30:06 +0200
> > Subject: [PATCH] lavf/mov: Read aspect ratio from ares atom for dnxhd.
> >
> > Fixes ticket #2125.
> > Fixes ticket #5325.
> 
> Feel free to spread lies to logs, it that helps your ego.

Please don't use such aggressive statements. It might just be a ticket
number error here.

From the code of conduct: "Do not assume malice for things that can be
attributed to incompetence. Even if it is malice, it’s rarely good to
start with that as initial assumption."

Regards,

-- 
Clément B.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH]lavf/mov: Read aspect ratio from ares atom for dnxhd

2016-09-19 Thread Carl Eugen Hoyos
2016-09-19 13:57 GMT+02:00 Paul B Mahol :
> On 9/19/16, Carl Eugen Hoyos  wrote:
>> 2016-09-19 13:37 GMT+02:00 Paul B Mahol :
>>> On 9/19/16, Carl Eugen Hoyos  wrote:
 Hi!

 Attached patch fixes the aspect ratio for the sample from
 ticket #5325 / #2125.

 The fate test changes because the fate sample  was written
 by FFmpeg with an incorrect aspect ratio.

 Please comment, Carl Eugen

>>>
 From 0553b0adfee87401854f0313dbcf386f2fb7ae68 Mon Sep 17 00:00:00 2001
 From: Carl Eugen Hoyos 
 Date: Mon, 19 Sep 2016 13:30:06 +0200
 Subject: [PATCH] lavf/mov: Read aspect ratio from ares atom for dnxhd.

 Fixes ticket #2125.
 Fixes ticket #5325.
>>>
>>> Feel free to spread lies to logs, it that helps your ego.
>>
>> I don't think I can follow you, sorry.
>
> How you can claim that you fixed those two tickets?

Afaict, the file is not decoded correctly by current FFmpeg.
It looks better with the patch in this thread.
Do you disagree?

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


Re: [FFmpeg-devel] [PATCH]lavf/mov: Read aspect ratio from ares atom for dnxhd

2016-09-19 Thread Paul B Mahol
On 9/19/16, Carl Eugen Hoyos  wrote:
> 2016-09-19 13:37 GMT+02:00 Paul B Mahol :
>> On 9/19/16, Carl Eugen Hoyos  wrote:
>>> Hi!
>>>
>>> Attached patch fixes the aspect ratio for the sample from
>>> ticket #5325 / #2125.
>>>
>>> The fate test changes because the fate sample  was written
>>> by FFmpeg with an incorrect aspect ratio.
>>>
>>> Please comment, Carl Eugen
>>>
>>
>>> From 0553b0adfee87401854f0313dbcf386f2fb7ae68 Mon Sep 17 00:00:00 2001
>>> From: Carl Eugen Hoyos 
>>> Date: Mon, 19 Sep 2016 13:30:06 +0200
>>> Subject: [PATCH] lavf/mov: Read aspect ratio from ares atom for dnxhd.
>>>
>>> Fixes ticket #2125.
>>> Fixes ticket #5325.
>>
>> Feel free to spread lies to logs, it that helps your ego.
>
> I don't think I can follow you, sorry.

How you can claim that you fixed those two tickets?
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


Re: [FFmpeg-devel] [PATCH]lavf/mov: Read aspect ratio from ares atom for dnxhd

2016-09-19 Thread Carl Eugen Hoyos
2016-09-19 13:37 GMT+02:00 Paul B Mahol :
> On 9/19/16, Carl Eugen Hoyos  wrote:
>> Hi!
>>
>> Attached patch fixes the aspect ratio for the sample from
>> ticket #5325 / #2125.
>>
>> The fate test changes because the fate sample  was written
>> by FFmpeg with an incorrect aspect ratio.
>>
>> Please comment, Carl Eugen
>>
>
>> From 0553b0adfee87401854f0313dbcf386f2fb7ae68 Mon Sep 17 00:00:00 2001
>> From: Carl Eugen Hoyos 
>> Date: Mon, 19 Sep 2016 13:30:06 +0200
>> Subject: [PATCH] lavf/mov: Read aspect ratio from ares atom for dnxhd.
>>
>> Fixes ticket #2125.
>> Fixes ticket #5325.
>
> Feel free to spread lies to logs, it that helps your ego.

I don't think I can follow you, sorry.

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


Re: [FFmpeg-devel] [PATCH]lavf/mov: Read aspect ratio from ares atom for dnxhd

2016-09-19 Thread Paul B Mahol
On 9/19/16, Carl Eugen Hoyos  wrote:
> Hi!
>
> Attached patch fixes the aspect ratio for the sample from
> ticket #5325 / #2125.
>
> The fate test changes because the fate sample  was written
> by FFmpeg with an incorrect aspect ratio.
>
> Please comment, Carl Eugen
>

> From 0553b0adfee87401854f0313dbcf386f2fb7ae68 Mon Sep 17 00:00:00 2001
> From: Carl Eugen Hoyos 
> Date: Mon, 19 Sep 2016 13:30:06 +0200
> Subject: [PATCH] lavf/mov: Read aspect ratio from ares atom for dnxhd.
>
> Fixes ticket #2125.
> Fixes ticket #5325.

Feel free to spread lies to logs, it that helps your ego.
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH]lavf/mov: Read aspect ratio from ares atom for dnxhd

2016-09-19 Thread Carl Eugen Hoyos
Hi!

Attached patch fixes the aspect ratio for the sample from 
ticket #5325 / #2125.

The fate test changes because the fate sample  was written 
by FFmpeg with an incorrect aspect ratio.

Please comment, Carl Eugen
From 0553b0adfee87401854f0313dbcf386f2fb7ae68 Mon Sep 17 00:00:00 2001
From: Carl Eugen Hoyos 
Date: Mon, 19 Sep 2016 13:30:06 +0200
Subject: [PATCH] lavf/mov: Read aspect ratio from ares atom for dnxhd.

Fixes ticket #2125.
Fixes ticket #5325.
---
 libavformat/mov.c  |3 ++-
 tests/ref/fate/dnxhd-mbaff |2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/libavformat/mov.c b/libavformat/mov.c
index 6e80b93..ce24e2e 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -1486,7 +1486,8 @@ static int mov_read_ares(MOVContext *c, AVIOContext *pb, 
MOVAtom atom)
 if (cid == 0xd4d || cid == 0xd4e)
 par->width = 1440;
 return 0;
-} else if (par->codec_tag == MKTAG('A', 'V', 'd', '1') &&
+} else if ((par->codec_tag == MKTAG('A', 'V', 'd', '1') ||
+par->codec_tag == MKTAG('A', 'V', 'd', 'n')) &&
atom.size >= 24) {
 int num, den;
 avio_skip(pb, 12);
diff --git a/tests/ref/fate/dnxhd-mbaff b/tests/ref/fate/dnxhd-mbaff
index d694cfe..8e95227 100644
--- a/tests/ref/fate/dnxhd-mbaff
+++ b/tests/ref/fate/dnxhd-mbaff
@@ -2,5 +2,5 @@
 #media_type 0: video
 #codec_id 0: rawvideo
 #dimensions 0: 1440x1080
-#sar 0: 4/3
+#sar 0: 1/1
 0,  0,  0,1,  6220800, 0xe78198c0
-- 
1.7.10.4

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


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

2016-09-19 Thread Carl Eugen Hoyos
Hi!

We read a display aspect ratio from ARES atom because of several 
user-provided samples, I believe it makes sense to also write the 
width value into the ares atom depending on the aspect ratio.

Please review, Carl Eugen
From ba2a97d8ff012895e39389dee65c075fe7a20f5c Mon Sep 17 00:00:00 2001
From: Carl Eugen Hoyos 
Date: Mon, 19 Sep 2016 13:24:44 +0200
Subject: [PATCH] lavf/movenc: Put correct display aspect ratio in ARES atom.

---
 libavformat/movenc.c   |6 +-
 tests/ref/vsynth/vsynth1-dnxhd-1080i   |2 +-
 tests/ref/vsynth/vsynth1-dnxhd-1080i-10bit |2 +-
 tests/ref/vsynth/vsynth1-dnxhd-1080i-colr  |2 +-
 tests/ref/vsynth/vsynth2-dnxhd-1080i   |2 +-
 tests/ref/vsynth/vsynth2-dnxhd-1080i-10bit |2 +-
 tests/ref/vsynth/vsynth2-dnxhd-1080i-colr  |2 +-
 tests/ref/vsynth/vsynth3-dnxhd-1080i-10bit |2 +-
 tests/ref/vsynth/vsynth3-dnxhd-1080i-colr  |2 +-
 tests/ref/vsynth/vsynth_lena-dnxhd-1080i   |2 +-
 tests/ref/vsynth/vsynth_lena-dnxhd-1080i-10bit |2 +-
 tests/ref/vsynth/vsynth_lena-dnxhd-1080i-colr  |2 +-
 12 files changed, 16 insertions(+), 12 deletions(-)

diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index aa4a076..fef884d 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -1070,6 +1070,7 @@ static int mov_write_avid_tag(AVIOContext *pb, MOVTrack 
*track)
 int i;
 int interlaced;
 int cid;
+int display_width = track->par->width;
 
 if (track->vos_data && track->vos_len > 0x29) {
 if (ff_dnxhd_parse_header_prefix(track->vos_data) != 0) {
@@ -1121,7 +1122,10 @@ static int mov_write_avid_tag(AVIOContext *pb, MOVTrack 
*track)
 ffio_wfourcc(pb, "ARES");
 ffio_wfourcc(pb, "0001");
 avio_wb32(pb, cid); /* dnxhd cid, some id ? */
-avio_wb32(pb, track->par->width);
+if (   track->par->sample_aspect_ratio.num >= 0
+&& track->par->sample_aspect_ratio.den >= 0)
+display_width = display_width * track->par->sample_aspect_ratio.num / 
track->par->sample_aspect_ratio.den;
+avio_wb32(pb, display_width);
 /* values below are based on samples created with quicktime and avid 
codecs */
 if (interlaced) {
 avio_wb32(pb, track->par->height / 2);
diff --git a/tests/ref/vsynth/vsynth1-dnxhd-1080i 
b/tests/ref/vsynth/vsynth1-dnxhd-1080i
index 02f989f..8db0548 100644
--- a/tests/ref/vsynth/vsynth1-dnxhd-1080i
+++ b/tests/ref/vsynth/vsynth1-dnxhd-1080i
@@ -1,4 +1,4 @@
-a0234e0a8516d958f423b119aa9e35c4 *tests/data/fate/vsynth1-dnxhd-1080i.mov
+a6ffa1127be4d24536d5a131e0bd9f9b *tests/data/fate/vsynth1-dnxhd-1080i.mov
 3031911 tests/data/fate/vsynth1-dnxhd-1080i.mov
 fed9ed2a5179c9df0ef58772b025e303 
*tests/data/fate/vsynth1-dnxhd-1080i.out.rawvideo
 stddev:6.18 PSNR: 32.31 MAXDIFF:   64 bytes:  7603200/   760320
diff --git a/tests/ref/vsynth/vsynth1-dnxhd-1080i-10bit 
b/tests/ref/vsynth/vsynth1-dnxhd-1080i-10bit
index dd96e14..ece6e9e 100644
--- a/tests/ref/vsynth/vsynth1-dnxhd-1080i-10bit
+++ b/tests/ref/vsynth/vsynth1-dnxhd-1080i-10bit
@@ -1,4 +1,4 @@
-f562845d1848bf5d3e524b418b742e01 *tests/data/fate/vsynth1-dnxhd-1080i-10bit.mov
+0b813077a8e61e2b776c25e028a25646 *tests/data/fate/vsynth1-dnxhd-1080i-10bit.mov
 4588391 tests/data/fate/vsynth1-dnxhd-1080i-10bit.mov
 31032fcb7e6af79daaac02288254c6d6 
*tests/data/fate/vsynth1-dnxhd-1080i-10bit.out.rawvideo
 stddev:5.69 PSNR: 33.02 MAXDIFF:   55 bytes:  7603200/   760320
diff --git a/tests/ref/vsynth/vsynth1-dnxhd-1080i-colr 
b/tests/ref/vsynth/vsynth1-dnxhd-1080i-colr
index ac42966..8ca97ae 100644
--- a/tests/ref/vsynth/vsynth1-dnxhd-1080i-colr
+++ b/tests/ref/vsynth/vsynth1-dnxhd-1080i-colr
@@ -1,4 +1,4 @@
-5fccdb16c0f14dea1b6b603bac90b97e *tests/data/fate/vsynth1-dnxhd-1080i-colr.mov
+a83febe7beb965a2d7df1b277ed55f33 *tests/data/fate/vsynth1-dnxhd-1080i-colr.mov
 3031929 tests/data/fate/vsynth1-dnxhd-1080i-colr.mov
 6f2d5429ffc4529a76acfeb28b560542 
*tests/data/fate/vsynth1-dnxhd-1080i-colr.out.rawvideo
 stddev:5.65 PSNR: 33.09 MAXDIFF:   55 bytes:  7603200/   760320
diff --git a/tests/ref/vsynth/vsynth2-dnxhd-1080i 
b/tests/ref/vsynth/vsynth2-dnxhd-1080i
index eabb6a2..e446d65 100644
--- a/tests/ref/vsynth/vsynth2-dnxhd-1080i
+++ b/tests/ref/vsynth/vsynth2-dnxhd-1080i
@@ -1,4 +1,4 @@
-2b75889122f8d918e1b068d128b618ca *tests/data/fate/vsynth2-dnxhd-1080i.mov
+3765c7d562250a83a26f4cafaad49325 *tests/data/fate/vsynth2-dnxhd-1080i.mov
 3031911 tests/data/fate/vsynth2-dnxhd-1080i.mov
 e941d2587cfeccddc450da7f41f7f911 
*tests/data/fate/vsynth2-dnxhd-1080i.out.rawvideo
 stddev:1.50 PSNR: 44.56 MAXDIFF:   31 bytes:  7603200/   760320
diff --git a/tests/ref/vsynth/vsynth2-dnxhd-1080i-10bit 
b/tests/ref/vsynth/vsynth2-dnxhd-1080i-10bit
index 3361c93..e811e38 100644
--- a/tests/ref/vsynth/vsynth2-dnxhd-1080i-10bit
+++ b/tests/ref/vsynth/vsynth2-dnxhd-1080i-10bit
@@ -1,4 +1,4 @@
-514607eecfd9004aa4da1d216f7620ce