[FFmpeg-devel] [PATCH]Improce auto-detection for cdata files
pross at xvid.org
pross
Tue Jan 5 14:48:58 CET 2010
On Wed, Dec 30, 2009 at 01:54:39PM -0800, Mike Melanson wrote:
> Reimar D?ffinger wrote:
> >On Wed, Dec 30, 2009 at 08:14:49PM +0000, Carl Eugen Hoyos wrote:
> >>Reimar D?ffinger <Reimar.Doeffinger <at> gmx.de> writes:
> >>
> >>>>- if (b[0] == 0x04 && (b[1] == 0x00 || b[1] == 0x04 || b[1] == 0x0C))
> >>>>+ if (b[0] == 0x04 && (b[1] == 0x00 || b[1] == 0x04 || b[1] == 0x0C)
> >>>>&&
> >>>>+ ((uint32_t *)b)[1] == ((uint32_t *)b)[3] && ((uint32_t *)b)[1])
> >>>> return AVPROBE_SCORE_MAX/8;
> >>>You should check for a valid sample_rate
> >>I totally agree.
> >>What are valid sample rates?
quick analysis of my cdata samples shows 22k5, 44k1 & 48kHz values to be
commonplace.
> >
> >Well, at least != 0. And that check actually should be done in the
> >read_header as well since we can get a division by 0 otherwise I think.
> >Otherwise I'd suggest to consider < 4000 as valid (since it is only 16
> >bit, I wouldn't check for a maximum).
>
> Check out the idcin demuxer where I had to do something similar. I
> bounded the sample rate between 8000..48000 Hz. Sure, sample rates could
> theoretically go much higher in modern practice (96, 192 KHz), but in
> these old DOS games, unlikely.
since probing of the sample rate is used by many demuxers, why not have a
function that returns a confidence value.
e.g.
int ff_sample_rate_confidence(int r, int high, int low) {
if (r==8000||r==11025||r==16000||r==22050||r==32000||r==44100||r==48000||r==64000||r==88200||r==96000||r==128000||r==176400||r==192000) {
return high;
} else if (r>=8000 && r<=192000)
return low;
} else {
return -1;
}
}
-- Peter
(A907 E02F A6E5 0CD2 34CD 20D2 6760 79C5 AC40 DD6B)
-------------- 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/20100106/565fe11e/attachment.pgp>
More information about the ffmpeg-devel
mailing list