Mercurial > mplayer.hg
changeset 7573:30e1c1f77737
rv10 cleanup
author | michael |
---|---|
date | Tue, 01 Oct 2002 20:01:04 +0000 |
parents | f46967928779 |
children | 87f57e23e301 |
files | libmpcodecs/vd_ffmpeg.c libmpdemux/demux_real.c |
diffstat | 2 files changed, 45 insertions(+), 28 deletions(-) [+] |
line wrap: on
line diff
--- a/libmpcodecs/vd_ffmpeg.c Tue Oct 01 14:37:01 2002 +0000 +++ b/libmpcodecs/vd_ffmpeg.c Tue Oct 01 20:01:04 2002 +0000 @@ -172,8 +172,6 @@ #endif mp_dbg(MSGT_DECVIDEO,MSGL_DBG2,"libavcodec.size: %d x %d\n",avctx->width,avctx->height); - if (sh->format == mmioFOURCC('R', 'V', '1', '3')) - avctx->sub_id = 3; #if LIBAVCODEC_BUILD >= 4605 /* AVRn stores huffman table in AVI header */ /* Pegasus MJPEG stores it also in AVI header, but it uses the common @@ -204,9 +202,18 @@ || sh->format == mmioFOURCC('R', 'V', '1', '3')){ unsigned int* extrahdr=(unsigned int*)(sh->bih+1); avctx->extradata_size= 8; - avctx->extradata = malloc(avctx->extradata_size); + avctx->extradata = malloc(avctx->extradata_size); + if(sh->ds->demuxer->type != DEMUXER_TYPE_REAL){ + /* not .rm container -> only 1 packet per frame & sub_id from fourcc */ + if (sh->format == mmioFOURCC('R', 'V', '1', '3')) + extrahdr[1] = 0x10003001; + else + extrahdr[1] = 0x10000000; + } ((uint32_t*)avctx->extradata)[0] = extrahdr[0]; ((uint32_t*)avctx->extradata)[1] = extrahdr[1]; + avctx->sub_id= extrahdr[1]; + // printf("%X %X %d %d\n", extrahdr[0], extrahdr[1]); } @@ -231,6 +238,12 @@ #if LIBAVCODEC_BUILD >= 4605 if (avctx->extradata_size) free(avctx->extradata); + avctx->extradata=NULL; +#endif +#if LIBAVCODEC_BUILD >= 4630 + if(avctx->slice_offset!=NULL) + free(avctx->slice_offset); + avctx->slice_offset=NULL; #endif if (avctx) @@ -422,6 +435,15 @@ } #endif +// copypaste from demux_real.c - it should match to get it working! +//FIXME put into some header +typedef struct dp_hdr_s { + uint32_t chunks; // number of chunks + uint32_t timestamp; // timestamp from packet header + uint32_t len; // length of actual data + uint32_t chunktab; // offset to chunk offset array +} dp_hdr_t; + // decode a frame static mp_image_t* decode(sh_video_t *sh,void* data,int len,int flags){ int got_picture=0; @@ -450,6 +472,23 @@ avctx->hurry_up=(flags&3)?((flags&2)?2:1):0; #endif +#if LIBAVCODEC_BUILD >= 4630 + if(sh->ds->demuxer->type == DEMUXER_TYPE_REAL){ + int i; + dp_hdr_t *hdr= (dp_hdr_t*)data; + + if(avctx->slice_offset==NULL) + avctx->slice_offset= malloc(sizeof(int)*1000); + +// for(i=0; i<25; i++) printf("%02X ", ((uint8_t*)data)[i]); + + avctx->slice_count= hdr->chunks+1; + for(i=0; i<avctx->slice_count; i++) + avctx->slice_offset[i]= ((uint32_t*)(data+hdr->chunktab))[2*i+1]; + data+= sizeof(dp_hdr_t); + } +#endif + ret = avcodec_decode_video(avctx, &lavc_picture, &got_picture, data, len); if(ret<0) mp_msg(MSGT_DECVIDEO,MSGL_WARN, "Error while decoding frame!\n");
--- a/libmpdemux/demux_real.c Tue Oct 01 14:37:01 2002 +0000 +++ b/libmpdemux/demux_real.c Tue Oct 01 20:01:04 2002 +0000 @@ -8,6 +8,9 @@ TODO: fix the whole syncing mechanism $Log$ + Revision 1.27 2002/10/01 20:01:04 michael + rv10 cleanup + Revision 1.26 2002/09/22 02:33:26 arpi tons of warning fixes, also some 10l bugfixes, including Dominik's PVA bug @@ -575,9 +578,6 @@ ds_add_packet(ds, dp); } else if (sh_video != NULL) { - if (sh_video->format==0x30345652 || - sh_video->format==0x30335652 || - sh_video->format==0x30325652 ) { // we need a more complicated demuxing // a block may contain multiple packets // as well as a packet may be contained in multiple blocks @@ -743,28 +743,6 @@ printf("\n******** !!!!!!!! BUG!! len=%d !!!!!!!!!!! ********\n",len); if(len>0) stream_skip(demuxer->stream, len); } - - } else { - // old video stream type - - dp = new_demux_packet(len); - stream_read(demuxer->stream, dp->buffer, len); -#if 0 - { unsigned char* p=dp->buffer; - int i; - printf("\n#HDR# %04X",len); - for(i=0;i<20;i++) printf(" %02X",p[i]); - printf("\n"); - if((p[0]&0x80)) printf("#HDR#\n"); - } -#endif - - dp->pts = timestamp/1000.0f; - dp->pos = demuxer->filepos; - dp->flags = (flags & 0x2) ? 0x10 : 0; - ds_add_packet(ds, dp); - } - } } #endif