[FFmpeg-devel] [PATCH] S/PDIF demuxer (was:[PATCH] Detect?DTS?in wav (issue70) + about ac3-in-wav)

Michael Niedermayer michaelni
Wed Aug 4 14:53:04 CEST 2010


On Wed, Jul 28, 2010 at 05:12:21AM +0300, Anssi Hannula wrote:
> Michael Niedermayer kirjoitti tiistai, 27. hein?kuuta 2010 16:59:27:
> > On Tue, Jul 27, 2010 at 07:59:13AM +0300, Anssi Hannula wrote:
> > > Michael Niedermayer kirjoitti perjantai, 23. hein?kuuta 2010 16:32:50:
> > > > On Fri, Jul 23, 2010 at 08:00:21AM +0300, Anssi Hannula wrote:
> > > > [...]
> > > > 
> > > > >  }
> > > > > 
> > > > > +#if CONFIG_SPDIF_MUXER
> > > > > 
> > > > >  static int spdif_header_ac3(AVFormatContext *s, AVPacket *pkt)
> > > 
> > > [...]
> > > 
> > > > if it compiles without the ifdefs then please remove them
> > > > its the compilers job to remove unused static functions
> > > > (might needs a av_unused))
> > > 
> > > It compiles, but warnings are emitted about unused functions when one of
> > > spdif demuxer or muxer is disabled (and I assumed you didn't want me to
> > > add av_unused to every function).
> > 
> > you also could just put the demuxer in a seperate file if this is possible
> 
> Ok, will just do that then.
> 
> > > Attached is a new version with unnecessary ifdefs removed and a better
> > > probe function.
> > 
> > [...]
> > 
> > > +static int spdif_probe(AVProbeData *p)
> > > +{
> > > +    const uint8_t *buf = p->buf;
> > > +    /* probe for 64 bytes to find initial sync word */
> > > +    const uint8_t *probe_end = p->buf + FFMIN(64, p->buf_size - 1);
> > 
> > this looks like it wont work if the stream is randomly cut
> > it would be nice if that worked too though
> > 
> 
> Ah, will change it so that it works like that as well.
> 
> > [...]
> > 
> > > +    if (sync_codes == consecutive_codes + 1 &&
> > > +        !memcmp(p->buf + 8, "WAVE", 4) && !memcmp(p->buf, "RIFF", 4))
> > > +        /* all sync codes (except first one as it was only after WAV
> > > headers)
> > > +           were consecutive, but the buffer was too small;
> > > +           also, this looks like a WAV file, so we need to delay wav
> > > demuxer
> > > +           from grabbing this file until we get a big enough
> > > buffer to see if
> > > +           there are more consecutive codes (we want
> > > to be selected for
> > > +           (ac3-in-)spdif-in-wav as chained demuxers
> > > are not yet supported),
> > > +           therefore return the same score as
> > > wav demuxer to make it a tie */
> > > +        return AVPROBE_SCORE_MAX - 1;
> > 
> > or make the wav demuxer only return a low score for small probe sizes
> > above would for example behave oddly if the wav demuxer is disabled
> 
> How low?

 < AVPROBE_SCORE_MAX/4 so the code in utils.c doesnt stop early


> 
> I mean, if we change it to AVPROBE_SCORE_MAX / 8 or so, every wav file would 
> needlessy be probed 1MB, even while 2k would have been enough (if no spdif 
> sync codes were in first 2k).

we can return a larger score once the amount of data available becomes large
enough like 100k ?


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

Frequently ignored awnser#1 FFmpeg bugs should be sent to our bugtracker. User
questions about the command line tools should be sent to the ffmpeg-user ML.
And questions about how to use libav* should be sent to the libav-user ML.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 190 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100804/29bfee92/attachment.pgp>



More information about the ffmpeg-devel mailing list