Mercurial > mplayer.hg
view tremor/synthesis.c @ 16718:044260623695
makes demux_lavf (-demuxer 35) use the framerate specified in the container
if it's set and only fall back to the codec framerate if the former is not
set.
This solves the issue of some avi's playing at 30000/1 fps instead of the
correct framerate.
Patch by Ivo < ivop AH euronet POIS nl >
Original thread:
Date: Sep 25, 2005 12:34 AM
Subject: [MPlayer-dev-eng] [PATCH] make demux_lavf use container framerate
author | gpoirier |
---|---|
date | Mon, 10 Oct 2005 05:45:38 +0000 |
parents | 8631a3803289 |
children | cd6b211be811 |
line wrap: on
line source
/******************************************************************** * * * THIS FILE IS PART OF THE OggVorbis 'TREMOR' CODEC SOURCE CODE. * * * * THE OggVorbis 'TREMOR' SOURCE CODE IS (C) COPYRIGHT 1994-2002 * * BY THE Xiph.Org FOUNDATION http://www.xiph.org/ * * ALL REDISTRIBUTION RIGHTS RESERVED. * * * ******************************************************************** function: single-block PCM synthesis last mod: $Id$ ********************************************************************/ #include <stdio.h> #include "ogg.h" #include "ivorbiscodec.h" #include "codec_internal.h" #include "registry.h" #include "misc.h" #include "os.h" int vorbis_synthesis(vorbis_block *vb,ogg_packet *op){ vorbis_dsp_state *vd=vb->vd; backend_lookup_state *b=(backend_lookup_state *)vd->backend_state; vorbis_info *vi=vd->vi; codec_setup_info *ci=(codec_setup_info *)vi->codec_setup; oggpack_buffer *opb=&vb->opb; int type,mode,i; /* first things first. Make sure decode is ready */ _vorbis_block_ripcord(vb); oggpack_readinit(opb,op->packet,op->bytes); /* Check the packet type */ if(oggpack_read(opb,1)!=0){ /* Oops. This is not an audio data packet */ return(OV_ENOTAUDIO); } /* read our mode and pre/post windowsize */ mode=oggpack_read(opb,b->modebits); if(mode==-1)return(OV_EBADPACKET); vb->mode=mode; vb->W=ci->mode_param[mode]->blockflag; if(vb->W){ vb->lW=oggpack_read(opb,1); vb->nW=oggpack_read(opb,1); if(vb->nW==-1) return(OV_EBADPACKET); }else{ vb->lW=0; vb->nW=0; } /* more setup */ vb->granulepos=op->granulepos; vb->sequence=op->packetno-3; /* first block is third packet */ vb->eofflag=op->e_o_s; /* alloc pcm passback storage */ vb->pcmend=ci->blocksizes[vb->W]; vb->pcm=(ogg_int32_t **)_vorbis_block_alloc(vb,sizeof(*vb->pcm)*vi->channels); for(i=0;i<vi->channels;i++) vb->pcm[i]=(ogg_int32_t *)_vorbis_block_alloc(vb,vb->pcmend*sizeof(*vb->pcm[i])); /* unpack_header enforces range checking */ type=ci->map_type[ci->mode_param[mode]->mapping]; return(_mapping_P[type]->inverse(vb,b->mode[mode])); } long vorbis_packet_blocksize(vorbis_info *vi,ogg_packet *op){ codec_setup_info *ci=(codec_setup_info *)vi->codec_setup; oggpack_buffer opb; int mode; oggpack_readinit(&opb,op->packet,op->bytes); /* Check the packet type */ if(oggpack_read(&opb,1)!=0){ /* Oops. This is not an audio data packet */ return(OV_ENOTAUDIO); } { int modebits=0; int v=ci->modes; while(v>1){ modebits++; v>>=1; } /* read our mode and pre/post windowsize */ mode=oggpack_read(&opb,modebits); } if(mode==-1)return(OV_EBADPACKET); return(ci->blocksizes[ci->mode_param[mode]->blockflag]); }