[FFmpeg-devel] [PATCH]Autodetect raw flac files
Michael Niedermayer
michaelni at gmx.at
Fri Apr 10 12:18:16 CEST 2015
On Fri, Apr 10, 2015 at 07:43:23AM +0200, Carl Eugen Hoyos wrote:
> On Friday 10 April 2015 02:24:12 am Michael Niedermayer wrote:
> > On Fri, Apr 10, 2015 at 12:13:28AM +0200, Carl Eugen Hoyos wrote:
> > > static int flac_probe(AVProbeData *p)
> > > {
> > > + if ( (AV_RB16(p->buf) & 0xFFFE) == 0xFFF8
> > > + && p->buf[2] & 0xF0 // blocksize code != 0
> > > + && p->buf[2] & 0x0F ^ 0x0F // sample rate code < 15
> > > + && (p->buf[3] & 0xF0) < FLAC_MAX_CHANNELS + FLAC_CHMODE_MID_SIDE
> > > << 4 + // channel mode < 11
> > > + && p->buf[3] & 0x06 ^ 0x06 // bits per sample code valid
> > >
> > > + && p->buf[3] ^ 1) // reserved bit not set
> >
> > is this missing a "& 1" ?
>
> Definitely.
>
> > just guessing from "bit" in the comment
> >
> > also maybe write it as seperate function
> > so that it can be written as a series of if() instead of a long
> > chain of &&, should be looking cleaner
>
> New patch attached.
>
> Thank you, Carl Eugen
> flacdec.c | 18 ++++++++++++++++++
> 1 file changed, 18 insertions(+)
> d86d6c346843e7b98735a1ae5c29d11e14cc8d18 patchflac3.diff
> diff --git a/libavformat/flacdec.c b/libavformat/flacdec.c
> index 1a8dc19..4207fd2 100644
> --- a/libavformat/flacdec.c
> +++ b/libavformat/flacdec.c
LGTM
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
I have never wished to cater to the crowd; for what I know they do not
approve, and what they approve I do not know. -- Epicurus
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20150410/7e24c24b/attachment.asc>
More information about the ffmpeg-devel
mailing list