mirror of
https://github.com/mpv-player/mpv
synced 2025-01-02 13:02:24 +00:00
rv10 cleanup
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@7574 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
parent
690bccca99
commit
021c753321
@ -172,8 +172,6 @@ static int init(sh_video_t *sh){
|
||||
#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 @@ static int init(sh_video_t *sh){
|
||||
|| 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 @@ static void uninit(sh_video_t *sh){
|
||||
#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 @@ else
|
||||
}
|
||||
#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 @@ static mp_image_t* decode(sh_video_t *sh,void* data,int len,int flags){
|
||||
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");
|
||||
|
@ -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 @@ loop:
|
||||
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 @@ loop:
|
||||
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
|
||||
|
Loading…
Reference in New Issue
Block a user