Ticket #3000: ticket_3000.diff
File ticket_3000.diff, 7.0 KB (added by , 17 years ago) |
---|
-
libs/libavformat/mpeg.c
1440 1440 { 1441 1441 MpegDemuxContext *m = s->priv_data; 1442 1442 int len, size, startcode, c, flags, header_len; 1443 int64_t pts, dts, last_pos; 1443 int64_t pts, dts; 1444 int64_t last_sync= url_ftell(&s->pb); 1444 1445 1445 last_pos = -1; 1446 error_redo: 1447 url_fseek(&s->pb, last_sync, SEEK_SET); 1446 1448 redo: 1447 1449 /* next start code (should be immediately after) */ 1448 1450 m->header_state = 0xff; 1449 1451 size = MAX_SYNC_SIZE; 1450 1452 startcode = find_next_start_code(&s->pb, &size, &m->header_state); 1451 //printf("startcode=%x pos=0x%Lx\n", startcode, url_ftell(&s->pb)); 1453 last_sync = url_ftell(&s->pb); 1454 //printf("startcode=%x pos=0x%"PRIx64"\n", startcode, url_ftell(&s->pb)); 1452 1455 if (startcode < 0) 1453 1456 return AVERROR_IO; 1454 1457 if (startcode == PACK_START_CODE) … … 1481 1484 /* stuffing */ 1482 1485 for(;;) { 1483 1486 if (len < 1) 1484 goto redo;1487 goto error_redo; 1485 1488 c = get_byte(&s->pb); 1486 1489 len--; 1487 1490 /* XXX: for mpeg1, should test only bit 7 */ … … 1490 1493 } 1491 1494 if ((c & 0xc0) == 0x40) { 1492 1495 /* buffer scale & size */ 1493 if (len < 2)1494 goto redo;1495 1496 get_byte(&s->pb); 1496 1497 c = get_byte(&s->pb); 1497 1498 len -= 2; 1498 1499 } 1499 if ((c & 0xf0) == 0x20) { 1500 if (len < 4) 1501 goto redo; 1500 if ((c & 0xe0) == 0x20) { 1502 1501 dts = pts = get_pts(&s->pb, c); 1503 1502 len -= 4; 1504 } else if ((c & 0xf0) == 0x30) { 1505 if (len < 9) 1506 goto redo; 1507 pts = get_pts(&s->pb, c); 1508 dts = get_pts(&s->pb, -1); 1509 len -= 9; 1503 if (c & 0x10){ 1504 dts = get_pts(&s->pb, -1); 1505 len -= 5; 1506 } 1510 1507 } else if ((c & 0xc0) == 0x80) { 1511 1508 /* mpeg 2 PES */ 1512 1509 #if 0 /* some streams have this field set for no apparent reason */ … … 1519 1516 header_len = get_byte(&s->pb); 1520 1517 len -= 2; 1521 1518 if (header_len > len) 1522 goto redo; 1523 if ((flags & 0xc0) == 0x80) { 1519 goto error_redo; 1520 len -= header_len; 1521 if (flags & 0x80) { 1524 1522 dts = pts = get_pts(&s->pb, -1); 1525 if (header_len < 5)1526 goto redo;1527 1523 header_len -= 5; 1528 len -= 5; 1529 } if ((flags & 0xc0) == 0xc0) { 1530 pts = get_pts(&s->pb, -1); 1531 dts = get_pts(&s->pb, -1); 1532 if (header_len < 10) 1533 goto redo; 1534 header_len -= 10; 1535 len -= 10; 1524 if (flags & 0x40) { 1525 dts = get_pts(&s->pb, -1); 1526 header_len -= 5; 1527 } 1536 1528 } 1537 len -= header_len; 1538 while (header_len > 0) { 1539 get_byte(&s->pb); 1540 header_len--; 1541 } 1529 if(header_len < 0) 1530 goto error_redo; 1531 url_fskip(&s->pb, header_len); 1542 1532 } 1543 1533 else if( c!= 0xf ) 1544 1534 goto redo; 1545 1535 1546 1536 if (startcode == PRIVATE_STREAM_1 && !m->psm_es_type[startcode & 0xff]) { 1547 if (len < 1)1548 goto redo;1549 1537 startcode = get_byte(&s->pb); 1550 1538 len--; 1551 1539 if (startcode >= 0x80 && startcode <= 0xbf) { 1552 1540 /* audio: skip header */ 1553 if (len < 3)1554 goto redo;1555 1541 get_byte(&s->pb); 1556 1542 get_byte(&s->pb); 1557 1543 get_byte(&s->pb); 1558 1544 len -= 3; 1559 1545 } 1560 1546 } 1547 if(len<0) 1548 goto error_redo; 1561 1549 if(dts != AV_NOPTS_VALUE && ppos && s->build_index){ 1562 1550 int i; 1563 1551 for(i=0; i<s->nb_streams; i++){ -
libs/libmythtv/avformatdecoder.cpp
341 341 { 342 342 if (ic) 343 343 { 344 for ( int i = 0; i < ic->nb_streams; i++)344 for (unsigned int i = 0; i < ic->nb_streams; i++) 345 345 { 346 346 QMutexLocker locker(&avcodeclock); 347 347 AVStream *st = ic->streams[i]; … … 403 403 getrawframes = false; 404 404 405 405 AVStream *st = NULL; 406 int i;406 unsigned int i; 407 407 for (i = 0; i < ic->nb_streams; i++) 408 408 { 409 409 AVStream *st1 = ic->streams[i]; … … 508 508 509 509 // Flush the avcodec buffers 510 510 VERBOSE(VB_PLAYBACK, LOC + "SeekReset() flushing"); 511 for ( int i = 0; i < ic->nb_streams; i++)511 for (unsigned int i = 0; i < ic->nb_streams; i++) 512 512 { 513 513 AVCodecContext *enc = ic->streams[i]->codec; 514 514 if (enc->codec) … … 1276 1276 map<int,uint> lang_sub_cnt; 1277 1277 map<int,uint> lang_aud_cnt; 1278 1278 1279 for ( int i = 0; i < ic->nb_streams; i++)1279 for (unsigned int i = 0; i < ic->nb_streams; i++) 1280 1280 { 1281 1281 AVCodecContext *enc = ic->streams[i]->codec; 1282 1282 VERBOSE(VB_PLAYBACK, LOC + … … 1381 1381 selectedVideoIndex = i; 1382 1382 } 1383 1383 1384 InitVideoCodec(ic->streams[i], enc, selectedVideoIndex == i);1384 InitVideoCodec(ic->streams[i], enc, selectedVideoIndex == (int)i); 1385 1385 1386 1386 ScanATSCCaptionStreams(i); 1387 1387 … … 2396 2396 2397 2397 bool AvFormatDecoder::SetVideoByComponentTag(int tag) 2398 2398 { 2399 for ( int i = 0; i < ic->nb_streams; i++)2399 for (unsigned int i = 0; i < ic->nb_streams; i++) 2400 2400 { 2401 2401 AVStream *s = ic->streams[i]; 2402 2402 if (s) … … 2778 2778 delete pkt; 2779 2779 return false; 2780 2780 } 2781 2782 2781 if (waitingForChange && pkt->pos >= readAdjust) 2783 2782 FileChanged(); 2784 2783 … … 2786 2785 pkt->pos -= readAdjust; 2787 2786 } 2788 2787 2789 if (pkt->stream_index > ic->nb_streams)2788 if (pkt->stream_index > (int)ic->nb_streams) 2790 2789 { 2791 2790 VERBOSE(VB_IMPORTANT, LOC_ERR + "Bad stream"); 2792 2791 av_free_packet(pkt); … … 3419 3418 AudioInfo old_out = audioOut; 3420 3419 3421 3420 if ((currentTrack[kTrackTypeAudio] >= 0) && 3422 (selectedTrack[kTrackTypeAudio].av_stream_index <= ic->nb_streams) &&3421 (selectedTrack[kTrackTypeAudio].av_stream_index <= (int)ic->nb_streams) && 3423 3422 (curstream = ic->streams[selectedTrack[kTrackTypeAudio] 3424 3423 .av_stream_index])) 3425 3424 { -
libs/libmythtv/avfringbuffer.cpp
26 27 { 27 28 AVFRingBuffer *avfr = (AVFRingBuffer *)h->priv_data; 28 29 30 if (whence == AVSEEK_SIZE) 31 return -1; // not supported /*avfr->GetRingBuffer()->GetRealFileSize(); 32 29 33 if (whence == SEEK_END) 30 34 return avfr->GetRingBuffer()->GetRealFileSize() + offset; 31 35 32 return avfr->GetRingBuffer()->Seek(offset, whence); 36 if (!avfr->GetRingBuffer()->isDVD()) 37 return avfr->GetRingBuffer()->Seek(offset, whence); 33 38 } 34 39 35 40 int AVF_Close(URLContext *h)