Re: [FFmpeg-devel] [PATCH] libavformat/mov.c: Add parsing for DDTS atom for DTS audio
FYI I haven't forgotten about this. Just traveling these next few days. Thanks. On Wed, Sep 30, 2015 at 8:22 AM, Yusuke Nakamura < muken.the.vfrman...@gmail.com> wrote: > 2015-09-30 12:05 GMT+09:00 Michael Niedermayer : > > > On Tue, Sep 29, 2015 at 02:44:38PM -0700, Shawn Singh wrote: > > > The DDTS atom is defined in ETSI TS 102 114, v1.4.1, Annex E. > > > This is useful for DTS-HD formats, some of which cannot be > > > decoded by dcadec.c or libdcadec. > > > > > > Signed-off-by: Shawn Singh > > > --- > > > libavformat/mov.c | 56 > > +++ > > > 1 file changed, 56 insertions(+) > > > > applied > > > > btw do you have a sample that you can share ? > > > > > DASH-IF's test vectors contain DTS-in-ISOBMFF samples. > http://dashif.org/test-vectors/ > You can get them from URLs in MPD files. > > > > thanks > > > > [...] > > -- > > Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB > > > > The real ebay dictionary, page 1 > > "Used only once"- "Some unspecified defect prevented a second use" > > "In good condition" - "Can be repaird by experienced expert" > > "As is" - "You wouldnt want it even if you were payed for it, if you knew > > ..." > > > > ___ > > ffmpeg-devel mailing list > > ffmpeg-devel@ffmpeg.org > > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel > > > > > ___ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel > ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] libavformat/mov.c: Add parsing for DDTS atom for DTS audio
2015-09-30 12:05 GMT+09:00 Michael Niedermayer : > On Tue, Sep 29, 2015 at 02:44:38PM -0700, Shawn Singh wrote: > > The DDTS atom is defined in ETSI TS 102 114, v1.4.1, Annex E. > > This is useful for DTS-HD formats, some of which cannot be > > decoded by dcadec.c or libdcadec. > > > > Signed-off-by: Shawn Singh > > --- > > libavformat/mov.c | 56 > +++ > > 1 file changed, 56 insertions(+) > > applied > > btw do you have a sample that you can share ? > > DASH-IF's test vectors contain DTS-in-ISOBMFF samples. http://dashif.org/test-vectors/ You can get them from URLs in MPD files. > thanks > > [...] > -- > Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB > > The real ebay dictionary, page 1 > "Used only once"- "Some unspecified defect prevented a second use" > "In good condition" - "Can be repaird by experienced expert" > "As is" - "You wouldnt want it even if you were payed for it, if you knew > ..." > > ___ > 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] libavformat/mov.c: Add parsing for DDTS atom for DTS audio
On Wed, Sep 30, 2015 at 5:53 AM, Michael Niedermayer wrote: > On Wed, Sep 30, 2015 at 02:17:02PM +0900, Yusuke Nakamura wrote: > > 2015-09-30 6:44 GMT+09:00 Shawn Singh : > > > > > The DDTS atom is defined in ETSI TS 102 114, v1.4.1, Annex E. > > > This is useful for DTS-HD formats, some of which cannot be > > > decoded by dcadec.c or libdcadec. > > > > > > > How useful? > > DTS audio has scalability, and 'ddts' box indicates only one of > properties > > of the stream. > > > > > > > > > > Signed-off-by: Shawn Singh > > > --- > > > libavformat/mov.c | 56 > > > +++ > > > 1 file changed, 56 insertions(+) > > > > > > diff --git a/libavformat/mov.c b/libavformat/mov.c > > > index c57aaeb..da170a6 100644 > > > --- a/libavformat/mov.c > > > +++ b/libavformat/mov.c > > > @@ -744,6 +744,61 @@ static int mov_read_dec3(MOVContext *c, > AVIOContext > > > *pb, MOVAtom atom) > > > return 0; > > > } > > > > > > +static int mov_read_ddts(MOVContext *c, AVIOContext *pb, MOVAtom atom) > > > +{ > > > +const uint32_t ddts_size = 20; > > > +AVStream *st = NULL; > > > +uint8_t *buf = NULL; > > > +uint32_t frame_duration_code = 0; > > > +uint32_t channel_layout_code = 0; > > > +GetBitContext gb; > > > + > > > +buf = av_malloc(ddts_size + FF_INPUT_BUFFER_PADDING_SIZE); > > > +if (!buf) { > > > +return AVERROR(ENOMEM); > > > +} > > > +if (avio_read(pb, buf, ddts_size) < ddts_size) { > > > +av_free(buf); > > > +return AVERROR_INVALIDDATA; > > > +} > > > + > > > +init_get_bits(&gb, buf, 8*ddts_size); > > > + > > > +if (c->fc->nb_streams < 1) { > > > +return 0; > > > +} > > > +st = c->fc->streams[c->fc->nb_streams-1]; > > > + > > > +st->codec->sample_rate = get_bits_long(&gb, 32); > > > +skip_bits_long(&gb, 32); /* max bitrate */ > > > +st->codec->bit_rate = get_bits_long(&gb, 32); > > > +st->codec->bits_per_coded_sample = get_bits(&gb, 8); > > > > > > > This field is set to 0 as a reserved field if the file is compatible with > > Ultra Violet's Common File Format (CFF). > > I prefer that the reference about this is here. > > > > > > > +frame_duration_code = get_bits(&gb, 2); > > > +skip_bits(&gb, 30); /* various fields */ > > > +channel_layout_code = get_bits(&gb, 16); > > > + > > > +st->codec->frame_size = > > > +(frame_duration_code == 0) ? 512 : > > > +(frame_duration_code == 1) ? 1024 : > > > +(frame_duration_code == 2) ? 2048 : > > > +(frame_duration_code == 3) ? 4096 : 0; > > > > > > > Wrong if LBRDurationMod is set to 1. > > if you think its better to revert this patch, just say so and ill > revert > > [...] > -- > Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB > > The worst form of inequality is to try to make unequal things equal. > -- Aristotle > > ___ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel > > Michael and Yusuke, thanks for the feedback. If you do revert, that's no problem. Otherwise, I can submit a fix for the LBRDurationMod and for the CFF reserved field as Yusuke suggested. Also, unfortunately we do not have any samples that can be shared. I will try to remux one of the existing fate tests, but we have limited remuxing capability so it probably will not work. Yusuke has a good point that the DDTS atom can reflect only one configuration (e.g. core-substream only, or core + extension). The dcadec or libdcadec decoders will override any AVStream fields that are set here. Our use case was to facilitate probing DTS-HD files with avformat_find_stream_info without requiring to decode. Doing so also required disabling CODEC_CAP_CHANNEL_CONF capability in the decoder, but obviously that is not appropriate to contribute back to ffmpeg. We thought the atom parsing would be nice to contribute. Best Regards, ~Shawn ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] libavformat/mov.c: Add parsing for DDTS atom for DTS audio
On Wed, Sep 30, 2015 at 02:17:02PM +0900, Yusuke Nakamura wrote: > 2015-09-30 6:44 GMT+09:00 Shawn Singh : > > > The DDTS atom is defined in ETSI TS 102 114, v1.4.1, Annex E. > > This is useful for DTS-HD formats, some of which cannot be > > decoded by dcadec.c or libdcadec. > > > > How useful? > DTS audio has scalability, and 'ddts' box indicates only one of properties > of the stream. > > > > > > Signed-off-by: Shawn Singh > > --- > > libavformat/mov.c | 56 > > +++ > > 1 file changed, 56 insertions(+) > > > > diff --git a/libavformat/mov.c b/libavformat/mov.c > > index c57aaeb..da170a6 100644 > > --- a/libavformat/mov.c > > +++ b/libavformat/mov.c > > @@ -744,6 +744,61 @@ static int mov_read_dec3(MOVContext *c, AVIOContext > > *pb, MOVAtom atom) > > return 0; > > } > > > > +static int mov_read_ddts(MOVContext *c, AVIOContext *pb, MOVAtom atom) > > +{ > > +const uint32_t ddts_size = 20; > > +AVStream *st = NULL; > > +uint8_t *buf = NULL; > > +uint32_t frame_duration_code = 0; > > +uint32_t channel_layout_code = 0; > > +GetBitContext gb; > > + > > +buf = av_malloc(ddts_size + FF_INPUT_BUFFER_PADDING_SIZE); > > +if (!buf) { > > +return AVERROR(ENOMEM); > > +} > > +if (avio_read(pb, buf, ddts_size) < ddts_size) { > > +av_free(buf); > > +return AVERROR_INVALIDDATA; > > +} > > + > > +init_get_bits(&gb, buf, 8*ddts_size); > > + > > +if (c->fc->nb_streams < 1) { > > +return 0; > > +} > > +st = c->fc->streams[c->fc->nb_streams-1]; > > + > > +st->codec->sample_rate = get_bits_long(&gb, 32); > > +skip_bits_long(&gb, 32); /* max bitrate */ > > +st->codec->bit_rate = get_bits_long(&gb, 32); > > +st->codec->bits_per_coded_sample = get_bits(&gb, 8); > > > > This field is set to 0 as a reserved field if the file is compatible with > Ultra Violet's Common File Format (CFF). > I prefer that the reference about this is here. > > > > +frame_duration_code = get_bits(&gb, 2); > > +skip_bits(&gb, 30); /* various fields */ > > +channel_layout_code = get_bits(&gb, 16); > > + > > +st->codec->frame_size = > > +(frame_duration_code == 0) ? 512 : > > +(frame_duration_code == 1) ? 1024 : > > +(frame_duration_code == 2) ? 2048 : > > +(frame_duration_code == 3) ? 4096 : 0; > > > > Wrong if LBRDurationMod is set to 1. if you think its better to revert this patch, just say so and ill revert [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB The worst form of inequality is to try to make unequal things equal. -- Aristotle signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] libavformat/mov.c: Add parsing for DDTS atom for DTS audio
2015-09-30 6:44 GMT+09:00 Shawn Singh : > The DDTS atom is defined in ETSI TS 102 114, v1.4.1, Annex E. > This is useful for DTS-HD formats, some of which cannot be > decoded by dcadec.c or libdcadec. > How useful? DTS audio has scalability, and 'ddts' box indicates only one of properties of the stream. > > Signed-off-by: Shawn Singh > --- > libavformat/mov.c | 56 > +++ > 1 file changed, 56 insertions(+) > > diff --git a/libavformat/mov.c b/libavformat/mov.c > index c57aaeb..da170a6 100644 > --- a/libavformat/mov.c > +++ b/libavformat/mov.c > @@ -744,6 +744,61 @@ static int mov_read_dec3(MOVContext *c, AVIOContext > *pb, MOVAtom atom) > return 0; > } > > +static int mov_read_ddts(MOVContext *c, AVIOContext *pb, MOVAtom atom) > +{ > +const uint32_t ddts_size = 20; > +AVStream *st = NULL; > +uint8_t *buf = NULL; > +uint32_t frame_duration_code = 0; > +uint32_t channel_layout_code = 0; > +GetBitContext gb; > + > +buf = av_malloc(ddts_size + FF_INPUT_BUFFER_PADDING_SIZE); > +if (!buf) { > +return AVERROR(ENOMEM); > +} > +if (avio_read(pb, buf, ddts_size) < ddts_size) { > +av_free(buf); > +return AVERROR_INVALIDDATA; > +} > + > +init_get_bits(&gb, buf, 8*ddts_size); > + > +if (c->fc->nb_streams < 1) { > +return 0; > +} > +st = c->fc->streams[c->fc->nb_streams-1]; > + > +st->codec->sample_rate = get_bits_long(&gb, 32); > +skip_bits_long(&gb, 32); /* max bitrate */ > +st->codec->bit_rate = get_bits_long(&gb, 32); > +st->codec->bits_per_coded_sample = get_bits(&gb, 8); > This field is set to 0 as a reserved field if the file is compatible with Ultra Violet's Common File Format (CFF). I prefer that the reference about this is here. > +frame_duration_code = get_bits(&gb, 2); > +skip_bits(&gb, 30); /* various fields */ > +channel_layout_code = get_bits(&gb, 16); > + > +st->codec->frame_size = > +(frame_duration_code == 0) ? 512 : > +(frame_duration_code == 1) ? 1024 : > +(frame_duration_code == 2) ? 2048 : > +(frame_duration_code == 3) ? 4096 : 0; > Wrong if LBRDurationMod is set to 1. > + > +if (channel_layout_code > 0xff) { > +av_log(c->fc, AV_LOG_WARNING, "Unsupported DTS audio channel > layout"); > +} > +st->codec->channel_layout = > +((channel_layout_code & 0x1) ? AV_CH_FRONT_CENTER : 0) | > +((channel_layout_code & 0x2) ? AV_CH_FRONT_LEFT : 0) | > +((channel_layout_code & 0x2) ? AV_CH_FRONT_RIGHT : 0) | > +((channel_layout_code & 0x4) ? AV_CH_SIDE_LEFT : 0) | > +((channel_layout_code & 0x4) ? AV_CH_SIDE_RIGHT : 0) | > +((channel_layout_code & 0x8) ? AV_CH_LOW_FREQUENCY : 0); > + > +st->codec->channels = > av_get_channel_layout_nb_channels(st->codec->channel_layout); > + > +return 0; > +} > + > static int mov_read_chan(MOVContext *c, AVIOContext *pb, MOVAtom atom) > { > AVStream *st; > @@ -3824,6 +3879,7 @@ static const MOVParseTableEntry > mov_default_parse_table[] = { > { MKTAG('e','s','d','s'), mov_read_esds }, > { MKTAG('d','a','c','3'), mov_read_dac3 }, /* AC-3 info */ > { MKTAG('d','e','c','3'), mov_read_dec3 }, /* EAC-3 info */ > +{ MKTAG('d','d','t','s'), mov_read_ddts }, /* DTS audio descriptor */ > { MKTAG('w','i','d','e'), mov_read_wide }, /* place holder */ > { MKTAG('w','f','e','x'), mov_read_wfex }, > { MKTAG('c','m','o','v'), mov_read_cmov }, > -- > 2.6.0.rc2.230.g3dd15c0 > > ___ > 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] libavformat/mov.c: Add parsing for DDTS atom for DTS audio
On Tue, Sep 29, 2015 at 02:44:38PM -0700, Shawn Singh wrote: > The DDTS atom is defined in ETSI TS 102 114, v1.4.1, Annex E. > This is useful for DTS-HD formats, some of which cannot be > decoded by dcadec.c or libdcadec. > > Signed-off-by: Shawn Singh > --- > libavformat/mov.c | 56 > +++ > 1 file changed, 56 insertions(+) applied btw do you have a sample that you can share ? thanks [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB The real ebay dictionary, page 1 "Used only once"- "Some unspecified defect prevented a second use" "In good condition" - "Can be repaird by experienced expert" "As is" - "You wouldnt want it even if you were payed for it, if you knew ..." signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] libavformat/mov.c: Add parsing for DDTS atom for DTS audio
The DDTS atom is defined in ETSI TS 102 114, v1.4.1, Annex E. This is useful for DTS-HD formats, some of which cannot be decoded by dcadec.c or libdcadec. Signed-off-by: Shawn Singh --- libavformat/mov.c | 56 +++ 1 file changed, 56 insertions(+) diff --git a/libavformat/mov.c b/libavformat/mov.c index c57aaeb..da170a6 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -744,6 +744,61 @@ static int mov_read_dec3(MOVContext *c, AVIOContext *pb, MOVAtom atom) return 0; } +static int mov_read_ddts(MOVContext *c, AVIOContext *pb, MOVAtom atom) +{ +const uint32_t ddts_size = 20; +AVStream *st = NULL; +uint8_t *buf = NULL; +uint32_t frame_duration_code = 0; +uint32_t channel_layout_code = 0; +GetBitContext gb; + +buf = av_malloc(ddts_size + FF_INPUT_BUFFER_PADDING_SIZE); +if (!buf) { +return AVERROR(ENOMEM); +} +if (avio_read(pb, buf, ddts_size) < ddts_size) { +av_free(buf); +return AVERROR_INVALIDDATA; +} + +init_get_bits(&gb, buf, 8*ddts_size); + +if (c->fc->nb_streams < 1) { +return 0; +} +st = c->fc->streams[c->fc->nb_streams-1]; + +st->codec->sample_rate = get_bits_long(&gb, 32); +skip_bits_long(&gb, 32); /* max bitrate */ +st->codec->bit_rate = get_bits_long(&gb, 32); +st->codec->bits_per_coded_sample = get_bits(&gb, 8); +frame_duration_code = get_bits(&gb, 2); +skip_bits(&gb, 30); /* various fields */ +channel_layout_code = get_bits(&gb, 16); + +st->codec->frame_size = +(frame_duration_code == 0) ? 512 : +(frame_duration_code == 1) ? 1024 : +(frame_duration_code == 2) ? 2048 : +(frame_duration_code == 3) ? 4096 : 0; + +if (channel_layout_code > 0xff) { +av_log(c->fc, AV_LOG_WARNING, "Unsupported DTS audio channel layout"); +} +st->codec->channel_layout = +((channel_layout_code & 0x1) ? AV_CH_FRONT_CENTER : 0) | +((channel_layout_code & 0x2) ? AV_CH_FRONT_LEFT : 0) | +((channel_layout_code & 0x2) ? AV_CH_FRONT_RIGHT : 0) | +((channel_layout_code & 0x4) ? AV_CH_SIDE_LEFT : 0) | +((channel_layout_code & 0x4) ? AV_CH_SIDE_RIGHT : 0) | +((channel_layout_code & 0x8) ? AV_CH_LOW_FREQUENCY : 0); + +st->codec->channels = av_get_channel_layout_nb_channels(st->codec->channel_layout); + +return 0; +} + static int mov_read_chan(MOVContext *c, AVIOContext *pb, MOVAtom atom) { AVStream *st; @@ -3824,6 +3879,7 @@ static const MOVParseTableEntry mov_default_parse_table[] = { { MKTAG('e','s','d','s'), mov_read_esds }, { MKTAG('d','a','c','3'), mov_read_dac3 }, /* AC-3 info */ { MKTAG('d','e','c','3'), mov_read_dec3 }, /* EAC-3 info */ +{ MKTAG('d','d','t','s'), mov_read_ddts }, /* DTS audio descriptor */ { MKTAG('w','i','d','e'), mov_read_wide }, /* place holder */ { MKTAG('w','f','e','x'), mov_read_wfex }, { MKTAG('c','m','o','v'), mov_read_cmov }, -- 2.6.0.rc2.230.g3dd15c0 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel