[MPlayer-dev-eng] Re: [PATCH] OpenDML AVI2.0 read support
Tobias Diedrich
ranma at gmx.at
Tue Feb 24 19:30:51 CET 2004
Tilmann Bitterberg wrote:
> + // find first non keyframe
> + if (!((idx->dwFlags&0xffff) & AVIIF_KEYFRAME) && idx->ckid == db) break;
[...]
> + if (!((idx->dwFlags&0xffff) & AVIIF_KEYFRAME) && idx->ckid == db)
[...]
> - if(!(idx->dwFlags&AVIIF_KEYFRAME)) flags=0;
> + if(!((idx->dwFlags&0xffff)&AVIIF_KEYFRAME)) flags=0;
[...]
> - if(!(idx->dwFlags&AVIIF_KEYFRAME)) flags=0;
> + if(!((idx->dwFlags&0xffff)&AVIIF_KEYFRAME)) flags=0;
AVIIF_KEYFRAME is defined as 0x00000010L, so masking with 0xffff is
not necessary.
Also, please apply the following patch on top of yours, it fixes some
"Broken chunk" messages, when running mplayer -v -v.
--- aviheader.c 2004-02-24 19:08:34.000000000 +0100
+++ ../../main-test/libmpdemux/aviheader.c 2004-02-24 17:42:14.000000000 +0100
@@ -205,6 +205,7 @@
priv->suidx = realloc(priv->suidx, priv->suidx_size * sizeof (avisuperindex_chunk));
s = &priv->suidx[priv->suidx_size-1];
+ chunksize-=24;
memcpy(s->fcc, "indx", 4);
s->dwSize = size2;
s->wLongsPerEntry = stream_read_word_le(demuxer->stream);
@@ -225,6 +226,7 @@
// now the real index of indices
for (i=0; i<s->nEntriesInUse; i++) {
+ chunksize-=16;
s->aIndex[i].qwOffset = stream_read_dword_le(demuxer->stream) & 0xffffffff;
s->aIndex[i].qwOffset |= ((uint64_t)stream_read_dword_le(demuxer->stream) & 0xffffffff)<<32;
s->aIndex[i].dwSize = stream_read_dword_le(demuxer->stream);
@@ -308,6 +310,7 @@
unsigned total_frames = stream_read_dword_le(demuxer->stream);
mp_msg(MSGT_HEADER,MSGL_V,"AVI: dmlh found (size=%d) (total_frames=%d)\n", chunksize, total_frames);
stream_skip(demuxer->stream, chunksize-4);
+ chunksize = 0;
}
break;
case ckidAVINEWINDEX:
@@ -325,8 +328,8 @@
le2me_AVIINDEXENTRY((AVIINDEXENTRY*)priv->idx + i);
chunksize-=priv->idx_size<<4;
if(verbose>=2) print_index(priv->idx,priv->idx_size);
- break;
}
+ break;
/* added May 2002 */
case mmioFOURCC('R','I','F','F'): {
char riff_type[4];
@@ -339,6 +342,10 @@
chunksize = 0;
list_end = 0; /* a new list will follow */
break; }
+ case ckidAVIPADDING:
+ stream_skip(demuxer->stream, chunksize);
+ chunksize = 0;
+ break;
}
if(hdr){
mp_msg(MSGT_HEADER,MSGL_V,"hdr=%s size=%u\n",hdr,size2);
@@ -357,6 +364,8 @@
mp_msg(MSGT_HEADER,MSGL_DBG2,"list_end=0x%X pos=0x%X chunksize=0x%X next=0x%X\n",
(int)list_end, (int)stream_tell(demuxer->stream),
chunksize, (int)chunksize+stream_tell(demuxer->stream));
+ if(list_end>0 &&
+ chunksize+stream_tell(demuxer->stream) == list_end) list_end=0;
if(list_end>0 && chunksize+stream_tell(demuxer->stream)>list_end){
mp_msg(MSGT_HEADER,MSGL_V,"Broken chunk? chunksize=%d (id=%.4s)\n",chunksize,(char *) &id);
stream_seek(demuxer->stream,list_end);
--
Tobias PGP: http://9ac7e0bc.2ya.com
This mail is made of 100% recycled bits.
More information about the MPlayer-dev-eng
mailing list