[FFmpeg-devel] [RFC] dts and ac3 autodetection in wav
Michael Niedermayer
michaelni
Sat Apr 19 12:34:40 CEST 2008
On Sat, Apr 19, 2008 at 12:14:43PM +0200, Benjamin Larsson wrote:
> Michael Niedermayer wrote:
[...]
> > next comes the parser it seems out dts parser does not
> > set the channels,
>
> Correct.
>
> > and last is the decoder,
>
> ffmpeg -i dtsinwav.wav does not execute the decoder, so even if I set
> the channels to 0 it doesn't work. Do I need to NULL the samplerate and
> other parameters to make it call the decoder ?
you could probably change has_codec_parameters() to check for channels
Or make the parser override the channels, add support for midstream change
in channel number, ...
>
> > it does a
> > if (!avctx->channels)
> > before setting the channels
> >
> >
> >
> >
> > [...]
> >> Index: libavformat/wav.c
> >> ===================================================================
> >> --- libavformat/wav.c (revision 12892)
> >> +++ libavformat/wav.c (working copy)
> >> @@ -139,7 +139,7 @@
> >> static int wav_probe(AVProbeData *p)
> >> {
> >> /* check file header */
> >> - if (p->buf_size <= 32)
> >> + if (p->buf_size < PROBESIZE)
> >> return 0;
> >> if (p->buf[0] == 'R' && p->buf[1] == 'I' &&
> >> p->buf[2] == 'F' && p->buf[3] == 'F' &&
> >
> > i do not understand this check, the code uses the wav demuxer anyway
> > so this shouldnt be needed
>
> Well the size needs to be >32 otherwise there wont be enough data to
> parse through to find the dts syncword. I found it at position 3070
> something in one file. So I set it to 4096. I think this has to do with
> the streamability of the file.
but you dont search for the syncword in probe() but read_header().
>
>
> >
> >
> > [...]
> >> @@ -186,6 +242,10 @@
> >> size = find_tag(pb, MKTAG('d', 'a', 't', 'a'));
> >> if (size < 0)
> >> return -1;
> >> +
> >> + /* check if it's really PCM or hidden DTS */
> >> + if (codec_get_id (codec_wav_tags, st->codec->codec_tag) == CODEC_ID_PCM_S16LE)
> >> + find_dts_ac3_header (pb, st->codec);
> >
> > analyzing stream content to set the codec could be done in
> > set_codec_from_probe_data()
> > its not without issues but its better to keep such code together i think
> >
>
> I don't understand how that should be done.
First you should implement read_probe() for dts_demuxer()
Second you can then either just use the dts demuxer or set
codec_id to CODEC_ID_NONE in wav if it could be dts and add 2 lines to
set_codec_from_probe_data() to handle DTS / PCM_S16_LE as welll
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
Those who are too smart to engage in politics are punished by being
governed by those who are dumber. -- Plato
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20080419/5ab22f9e/attachment.pgp>
More information about the ffmpeg-devel
mailing list