Mercurial > libavformat.hg
comparison matroskadec.c @ 3913:253050919116 libavformat
matroskadec: move timecode calculation a little earlier
so as to be able to use it in other part of the code
author | aurel |
---|---|
date | Tue, 09 Sep 2008 11:54:35 +0000 |
parents | 32652a9c2624 |
children | f7a20cf5438f |
comparison
equal
deleted
inserted
replaced
3912:32652a9c2624 | 3913:253050919116 |
---|---|
1421 static int matroska_parse_block(MatroskaDemuxContext *matroska, uint8_t *data, | 1421 static int matroska_parse_block(MatroskaDemuxContext *matroska, uint8_t *data, |
1422 int size, int64_t pos, uint64_t cluster_time, | 1422 int size, int64_t pos, uint64_t cluster_time, |
1423 uint64_t duration, int is_keyframe, | 1423 uint64_t duration, int is_keyframe, |
1424 int64_t cluster_pos) | 1424 int64_t cluster_pos) |
1425 { | 1425 { |
1426 uint64_t timecode = AV_NOPTS_VALUE; | |
1426 MatroskaTrack *track; | 1427 MatroskaTrack *track; |
1427 int res = 0; | 1428 int res = 0; |
1428 AVStream *st; | 1429 AVStream *st; |
1429 AVPacket *pkt; | 1430 AVPacket *pkt; |
1430 int16_t block_time; | 1431 int16_t block_time; |
1455 data += 2; | 1456 data += 2; |
1456 flags = *data++; | 1457 flags = *data++; |
1457 size -= 3; | 1458 size -= 3; |
1458 if (is_keyframe == -1) | 1459 if (is_keyframe == -1) |
1459 is_keyframe = flags & 0x80 ? PKT_FLAG_KEY : 0; | 1460 is_keyframe = flags & 0x80 ? PKT_FLAG_KEY : 0; |
1461 | |
1462 if (cluster_time != (uint64_t)-1 | |
1463 && (block_time >= 0 || cluster_time >= -block_time)) { | |
1464 timecode = cluster_time + block_time; | |
1465 if (is_keyframe) | |
1466 av_add_index_entry(st, cluster_pos, timecode, 0,0,AVINDEX_KEYFRAME); | |
1467 } | |
1460 | 1468 |
1461 if (matroska->skip_to_keyframe) { | 1469 if (matroska->skip_to_keyframe) { |
1462 if (!is_keyframe || st != matroska->skip_to_stream) | 1470 if (!is_keyframe || st != matroska->skip_to_stream) |
1463 return res; | 1471 return res; |
1464 matroska->skip_to_keyframe = 0; | 1472 matroska->skip_to_keyframe = 0; |
1539 } | 1547 } |
1540 break; | 1548 break; |
1541 } | 1549 } |
1542 | 1550 |
1543 if (res == 0) { | 1551 if (res == 0) { |
1544 uint64_t timecode = AV_NOPTS_VALUE; | |
1545 | |
1546 if (cluster_time != (uint64_t)-1 | |
1547 && (block_time >= 0 || cluster_time >= -block_time)) { | |
1548 timecode = cluster_time + block_time; | |
1549 if (is_keyframe) | |
1550 av_add_index_entry(st, cluster_pos, timecode, | |
1551 0, 0, AVINDEX_KEYFRAME); | |
1552 } | |
1553 | |
1554 for (n = 0; n < laces; n++) { | 1552 for (n = 0; n < laces; n++) { |
1555 if (st->codec->codec_id == CODEC_ID_RA_288 || | 1553 if (st->codec->codec_id == CODEC_ID_RA_288 || |
1556 st->codec->codec_id == CODEC_ID_COOK || | 1554 st->codec->codec_id == CODEC_ID_COOK || |
1557 st->codec->codec_id == CODEC_ID_ATRAC3) { | 1555 st->codec->codec_id == CODEC_ID_ATRAC3) { |
1558 int a = st->codec->block_align; | 1556 int a = st->codec->block_align; |