From 72707c69ef01903db0a62ca2fad1c233876066a3 Mon Sep 17 00:00:00 2001 From: michael Date: Fri, 7 Mar 2003 02:05:59 +0000 Subject: [PATCH] rv40 pict_type parser git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@9544 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libmpdemux/demux_real.c | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/libmpdemux/demux_real.c b/libmpdemux/demux_real.c index c3f2dd369a..482eb0d59b 100644 --- a/libmpdemux/demux_real.c +++ b/libmpdemux/demux_real.c @@ -313,17 +313,31 @@ int real_check_file(demuxer_t* demuxer) void hexdump(char *, unsigned long); +#define SKIP_BITS(n) buffer<<=n +#define SHOW_BITS(n) ((buffer)>>(32-(n))) + static float real_fix_timestamp(real_priv_t* priv, unsigned char* s, int timestamp, float frametime, unsigned int format){ float v_pts; + uint32_t buffer= (s[0]<<24) + (s[1]<<16) + (s[2]<<8) + s[3]; int kf=timestamp; - if(format==0x30335652){ // RV30 timestamps: - kf=2*(((s[1]&15)<<8)+s[2]); // 12-bit timestamp from frame header - //kf=((s[1]<<8)+s[2])>>3; // 12-bit timestamp from frame header - if(verbose>1) printf("\nTS: %08X (%04X) %02X %02X %02X %02X\n",timestamp,kf,s[0],s[1],s[2],s[3]); + int pict_type; + + if(format==mmioFOURCC('R','V','3','0') || format==mmioFOURCC('R','V','4','0')){ + if(format==mmioFOURCC('R','V','3','0')){ + SKIP_BITS(3); + pict_type= SHOW_BITS(2); + SKIP_BITS(2 + 7); + }else{ + SKIP_BITS(1); + pict_type= SHOW_BITS(2); + SKIP_BITS(2 + 7 + 1); + } + kf= 2*SHOW_BITS(12); + if(verbose>1) printf("\nTS: %08X (%04X) %d %02X %02X %02X %02X\n",timestamp,kf,pict_type,s[0],s[1],s[2],s[3]); kf|=timestamp&(~0x1fff); // combine with packet timestamp if(kftimestamp+4096) kf-=8192; - if(!(s[0]&0x8) || !(s[0]&0x10)){ // P || I frame -> swap timestamps + if(pict_type != 3){ // P || I frame -> swap timestamps int tmp=kf; kf=priv->kf_pts; priv->kf_pts=tmp;