[FFmpeg-devel] [PATCH] Lego Mindstorms RSO de/muxer (copied from au.c)
Michael Niedermayer
michaelni
Sun Jul 18 19:13:26 CEST 2010
On Sun, Jul 18, 2010 at 05:37:13PM +0200, Rafa?l Carr? wrote:
[...]
> +static int rso_read_header(AVFormatContext *s, AVFormatParameters *ap)
> +{
> + ByteIOContext *pb = s->pb;
> + int id, rate, bps;
> + unsigned int size;
> + enum CodecID codec;
> + AVStream *st;
> +
> + id = get_be16(pb);
> + size = get_be16(pb);
> + rate = get_be16(pb);
> + get_be16(pb); /* play mode ? (0x0000 = don't loop) */
> +
> + codec = ff_codec_get_id(ff_codec_rso_tags, id);
> +
> + if (codec == CODEC_ID_ADPCM_IMA_WAV) {
> + av_log(s, AV_LOG_ERROR, "ADPCM in RSO not implemented\n");
> + return AVERROR_PATCHWELCOME;
> + }
> +
> + bps = av_get_bits_per_sample(codec);
> + if (!bps) {
> + av_log_ask_for_sample(s, "could not determine bits per sample\n");
> + return AVERROR_INVALIDDATA;
> + }
> +
> + /* now we are ready: build format streams */
> + st = av_new_stream(s, 0);
> + if (!st)
> + return AVERROR(ENOMEM);
> +
> + st->duration = (size * 8) >> av_log2(bps);
why not
st->duration = (size * 8) / bps ?
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
Asymptotically faster algorithms should always be preferred if you have
asymptotical amounts of data
-------------- 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/20100718/4606b6bd/attachment.pgp>
More information about the ffmpeg-devel
mailing list