[FFmpeg-devel] [RFC] dts and ac3 autodetection in wav

Michael Niedermayer michaelni
Sat Apr 19 00:25:33 CEST 2008


On Fri, Apr 18, 2008 at 11:42:28PM +0200, Benjamin Larsson wrote:
> Hi, this is just a first try. For some reason ac3 detection works but
> the audio doesn't play 

try -acodec copy -f image2 frame%d.raw
and look at the result are these valid ac3 frames
also i assume the file does play with some other player


> and dts gets the channel count wrong. So what is
> wrong with this approach?

well where is the channel number set? wav.c likely does set it, is this
value correct? next comes the parser it seems out dts parser does not
set the channels, and last is the decoder, 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


[...]
> @@ -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

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

I hate to see young programmers poisoned by the kind of thinking
Ulrich Drepper puts forward since it is simply too narrow -- Roman Shaposhnik
-------------- 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/1bcef7aa/attachment.pgp>



More information about the ffmpeg-devel mailing list