[Ffmpeg-cvslog] r6091 - trunk/libavformat/avidec.c
michael
subversion
Fri Aug 25 22:50:19 CEST 2006
Author: michael
Date: Fri Aug 25 22:50:18 2006
New Revision: 6091
Modified:
trunk/libavformat/avidec.c
Log:
support some totally broken ODML variant
Modified: trunk/libavformat/avidec.c
==============================================================================
--- trunk/libavformat/avidec.c (original)
+++ trunk/libavformat/avidec.c Fri Aug 25 22:50:18 2006
@@ -100,9 +100,12 @@
AVIStream *ast;
int i;
int64_t last_pos= -1;
+ int64_t filesize= url_fsize(&s->pb);
-// av_log(s, AV_LOG_ERROR, "longs_pre_entry:%d index_type:%d entries_in_use:%d chunk_id:%X base:%Ld\n",
-// longs_pre_entry,index_type, entries_in_use, chunk_id, base);
+#ifdef DEBUG_SEEK
+ av_log(s, AV_LOG_ERROR, "longs_pre_entry:%d index_type:%d entries_in_use:%d chunk_id:%X base:%16LX\n",
+ longs_pre_entry,index_type, entries_in_use, chunk_id, base);
+#endif
if(stream_id > s->nb_streams || stream_id < 0)
return -1;
@@ -119,6 +122,14 @@
if(index_type>1)
return -1;
+ if(filesize > 0 && base >= filesize){
+ av_log(s, AV_LOG_ERROR, "ODML index invalid\n");
+ if(base>>32 == (base & 0xFFFFFFFF) && (base & 0xFFFFFFFF) < filesize && filesize <= 0xFFFFFFFF)
+ base &= 0xFFFFFFFF;
+ else
+ return -1;
+ }
+
for(i=0; i<entries_in_use; i++){
if(index_type){
int64_t pos= get_le32(pb) + base - 8;
@@ -126,7 +137,9 @@
int key= len >= 0;
len &= 0x7FFFFFFF;
-//av_log(s, AV_LOG_ERROR, "pos:%Ld, len:%X\n", pos, len);
+#ifdef DEBUG_SEEK
+ av_log(s, AV_LOG_ERROR, "pos:%Ld, len:%X\n", pos, len);
+#endif
if(last_pos == pos || pos == base - 8)
avi->non_interleaved= 1;
else
@@ -152,11 +165,13 @@
url_fseek(pb, pos, SEEK_SET);
}
}
+ avi->index_loaded=1;
return 0;
}
static void clean_index(AVFormatContext *s){
- int i, j;
+ int i;
+ int64_t j;
for(i=0; i<s->nb_streams; i++){
AVStream *st = s->streams[i];
@@ -443,7 +458,6 @@
i= url_ftell(pb);
if(!url_is_streamed(pb)){
read_braindead_odml_indx(s, 0);
- avi->index_loaded=1;
}
url_fseek(pb, i+size, SEEK_SET);
break;
@@ -771,7 +785,7 @@
ast = st->priv_data;
#if defined(DEBUG_SEEK)
- av_log(NULL, AV_LOG_DEBUG, "%d cum_len=%d\n", len, ast->cum_len);
+ av_log(NULL, AV_LOG_DEBUG, "%d cum_len=%Ld\n", len, ast->cum_len);
#endif
if(last_pos == pos)
avi->non_interleaved= 1;
More information about the ffmpeg-cvslog
mailing list