1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-08-15 14:13:16 +02:00

check if current block contains a B frame and gives this info to parse_block()

Originally committed as revision 8332 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
Aurelien Jacobs
2007-03-11 23:05:01 +00:00
parent 4d41f3eea0
commit 6bed20f45a

View File

@@ -2377,7 +2377,8 @@ rv_offset(uint8_t *data, int slice, int slices)
static int static int
matroska_parse_block(MatroskaDemuxContext *matroska, uint8_t *data, int size, matroska_parse_block(MatroskaDemuxContext *matroska, uint8_t *data, int size,
int64_t pos, uint64_t cluster_time, int64_t pos, uint64_t cluster_time,
int is_keyframe, int *ptrack, AVPacket **ppkt) int is_keyframe, int is_bframe,
int *ptrack, AVPacket **ppkt)
{ {
int res = 0; int res = 0;
int track; int track;
@@ -2558,6 +2559,7 @@ matroska_parse_blockgroup (MatroskaDemuxContext *matroska,
int res = 0; int res = 0;
uint32_t id; uint32_t id;
AVPacket *pkt = NULL; AVPacket *pkt = NULL;
int is_bframe = 0;
int is_keyframe = PKT_FLAG_KEY, last_num_packets = matroska->num_packets; int is_keyframe = PKT_FLAG_KEY, last_num_packets = matroska->num_packets;
uint64_t duration = AV_NOPTS_VALUE; uint64_t duration = AV_NOPTS_VALUE;
int track = -1; int track = -1;
@@ -2592,14 +2594,19 @@ matroska_parse_blockgroup (MatroskaDemuxContext *matroska,
break; break;
} }
case MATROSKA_ID_BLOCKREFERENCE: case MATROSKA_ID_BLOCKREFERENCE: {
int64_t num;
/* We've found a reference, so not even the first frame in /* We've found a reference, so not even the first frame in
* the lace is a key frame. */ * the lace is a key frame. */
is_keyframe = 0; is_keyframe = 0;
if (last_num_packets != matroska->num_packets) if (last_num_packets != matroska->num_packets)
matroska->packets[last_num_packets]->flags = 0; matroska->packets[last_num_packets]->flags = 0;
res = ebml_read_skip(matroska); if ((res = ebml_read_sint(matroska, &id, &num)) < 0)
break; break;
if (num > 0)
is_bframe = 1;
break;
}
default: default:
av_log(matroska->ctx, AV_LOG_INFO, av_log(matroska->ctx, AV_LOG_INFO,
@@ -2622,7 +2629,7 @@ matroska_parse_blockgroup (MatroskaDemuxContext *matroska,
if (size > 0) if (size > 0)
res = matroska_parse_block(matroska, data, size, pos, cluster_time, res = matroska_parse_block(matroska, data, size, pos, cluster_time,
is_keyframe, &track, &pkt); is_keyframe, is_bframe, &track, &pkt);
if (pkt) if (pkt)
{ {
@@ -2679,7 +2686,7 @@ matroska_parse_cluster (MatroskaDemuxContext *matroska)
res = ebml_read_binary(matroska, &id, &data, &size); res = ebml_read_binary(matroska, &id, &data, &size);
if (res == 0) if (res == 0)
res = matroska_parse_block(matroska, data, size, pos, res = matroska_parse_block(matroska, data, size, pos,
cluster_time, -1, NULL, NULL); cluster_time, -1,0, NULL, NULL);
break; break;
default: default: