[FFmpeg-devel] [PATCH] BFI demuxer
Michael Niedermayer
michaelni
Sat Apr 12 14:41:09 CEST 2008
On Sat, Apr 12, 2008 at 12:27:08PM +0530, Sisir Koppaka wrote:
> Updated patch attached.
[...]
> + int fps, width, height, sample_rate, chunk_header;
3 of these are unneeded at least
[...]
> + /* Setting total number of frames. */
> + url_fskip(pb, 8);
> + chunk_header = get_le32(pb);
> + bfi->nframes = get_le32(pb);
> + bfi->audio_frame = 0;
> + bfi->video_frame = 0;
> + get_le32(pb);
> + get_le32(pb);
> + get_le32(pb);
> + fps = get_le32(pb);
> + url_fseek(pb, 12, SEEK_CUR);
url_fskip() :)
[...]
> + /* Setting up the video codec... */
> + av_set_pts_info(vstream, 32, 1, fps);
> + vstream->codec->codec_type = CODEC_TYPE_VIDEO;
> + vstream->codec->codec_id = CODEC_ID_BFI;
> + vstream->codec->width = width;
> + vstream->codec->height = height;
> + vstream->codec->pix_fmt = PIX_FMT_PAL8;
> +
> + /* Setting up the audio codec now... */
> + astream->codec->codec_type = CODEC_TYPE_AUDIO;
> + astream->codec->codec_id = CODEC_ID_PCM_U8;
> + astream->codec->sample_rate = sample_rate;
> + av_log(NULL, AV_LOG_DEBUG, "\n sample_rate = %d",
> + astream->codec->sample_rate);
> + astream->codec->channels = 1;
> + astream->codec->bits_per_sample =
> + av_get_bits_per_sample(astream->codec->codec_id);
This still can be simplified
[...]
> + /* Trying to confirm the chunk by matching the header... */
> + while (1) {
> + c = get_byte(pb);
> + if (url_feof(pb))
> + return AVERROR(EIO);
> + if (c == 'I') {
> + if (get_byte(pb) == 'V' && get_byte(pb) == 'A'
> + && get_byte(pb) == 'S')
> + break;
> + }
> + }
uint32_t state=0;
while(state != MKTAG('I','V','A','S')){
if (url_feof(pb))
return AVERROR(EIO);
state= 256*state + get_byte(pb);
}
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
Everything should be made as simple as possible, but not simpler.
-- Albert Einstein
-------------- 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/20080412/afe5ca76/attachment.pgp>
More information about the ffmpeg-devel
mailing list