さきゅばす/いんきゅばす用ffmpeg
Revision | f9e083a156f19094cb6fcd134c1ca4ca899a1a6d (tree) |
---|---|
Zeit | 2011-09-12 11:39:12 |
Autor | Joakim Plate <elupus@ecce...> |
Commiter | Michael Niedermayer |
avidec: Check return value of more avio_seek calls
The move of avio_seek in avi_read_seek is to avoiding modifying
state if the seek would fail.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
@@ -222,13 +222,18 @@ static int read_braindead_odml_indx(AVFormatContext *s, int frame_num){ | ||
222 | 222 | return -1; |
223 | 223 | } |
224 | 224 | |
225 | - avio_seek(pb, offset+8, SEEK_SET); | |
225 | + if(avio_seek(pb, offset+8, SEEK_SET) < 0) | |
226 | + return -1; | |
226 | 227 | avi->odml_depth++; |
227 | 228 | read_braindead_odml_indx(s, frame_num); |
228 | 229 | avi->odml_depth--; |
229 | 230 | frame_num += duration; |
230 | 231 | |
231 | - avio_seek(pb, pos, SEEK_SET); | |
232 | + if(avio_seek(pb, pos, SEEK_SET) < 0) { | |
233 | + av_log(s, AV_LOG_ERROR, "Failed to restore position after reading index"); | |
234 | + return -1; | |
235 | + } | |
236 | + | |
232 | 237 | } |
233 | 238 | } |
234 | 239 | avi->index_loaded=1; |
@@ -1365,11 +1370,13 @@ static int avi_read_seek(AVFormatContext *s, int stream_index, int64_t timestamp | ||
1365 | 1370 | /* the av_index_search_timestamp call above. */ |
1366 | 1371 | assert(stream_index == 0); |
1367 | 1372 | |
1373 | + if(avio_seek(s->pb, pos, SEEK_SET) < 0) | |
1374 | + return -1; | |
1375 | + | |
1368 | 1376 | /* Feed the DV video stream version of the timestamp to the */ |
1369 | 1377 | /* DV demux so it can synthesize correct timestamps. */ |
1370 | 1378 | dv_offset_reset(avi->dv_demux, timestamp); |
1371 | 1379 | |
1372 | - avio_seek(s->pb, pos, SEEK_SET); | |
1373 | 1380 | avi->stream_index= -1; |
1374 | 1381 | return 0; |
1375 | 1382 | } |
@@ -1420,7 +1427,8 @@ static int avi_read_seek(AVFormatContext *s, int stream_index, int64_t timestamp | ||
1420 | 1427 | } |
1421 | 1428 | |
1422 | 1429 | /* do the seek */ |
1423 | - avio_seek(s->pb, pos_min, SEEK_SET); | |
1430 | + if (avio_seek(s->pb, pos_min, SEEK_SET) < 0) | |
1431 | + return -1; | |
1424 | 1432 | avi->stream_index= -1; |
1425 | 1433 | avi->dts_max= INT_MIN; |
1426 | 1434 | return 0; |