aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAurelien Jacobs <aurel@gnuage.org>2007-03-11 23:05:01 +0000
committerAurelien Jacobs <aurel@gnuage.org>2007-03-11 23:05:01 +0000
commit6bed20f45a484f5709fec4c97a238240161b1797 (patch)
treee5af8eeb5850215118a8257ba2f3577c2e9410bc
parent4d41f3eea069a418139b2d2ef74dfc48a3e01aaf (diff)
downloadffmpeg-6bed20f45a484f5709fec4c97a238240161b1797.tar.gz
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
-rw-r--r--libavformat/matroska.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/libavformat/matroska.c b/libavformat/matroska.c
index 3d6d975690..7b86bc670a 100644
--- a/libavformat/matroska.c
+++ b/libavformat/matroska.c
@@ -2377,7 +2377,8 @@ rv_offset(uint8_t *data, int slice, int slices)
static int
matroska_parse_block(MatroskaDemuxContext *matroska, uint8_t *data, int size,
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 track;
@@ -2558,6 +2559,7 @@ matroska_parse_blockgroup (MatroskaDemuxContext *matroska,
int res = 0;
uint32_t id;
AVPacket *pkt = NULL;
+ int is_bframe = 0;
int is_keyframe = PKT_FLAG_KEY, last_num_packets = matroska->num_packets;
uint64_t duration = AV_NOPTS_VALUE;
int track = -1;
@@ -2592,14 +2594,19 @@ matroska_parse_blockgroup (MatroskaDemuxContext *matroska,
break;
}
- case MATROSKA_ID_BLOCKREFERENCE:
+ case MATROSKA_ID_BLOCKREFERENCE: {
+ int64_t num;
/* We've found a reference, so not even the first frame in
* the lace is a key frame. */
is_keyframe = 0;
if (last_num_packets != matroska->num_packets)
matroska->packets[last_num_packets]->flags = 0;
- res = ebml_read_skip(matroska);
+ if ((res = ebml_read_sint(matroska, &id, &num)) < 0)
+ break;
+ if (num > 0)
+ is_bframe = 1;
break;
+ }
default:
av_log(matroska->ctx, AV_LOG_INFO,
@@ -2622,7 +2629,7 @@ matroska_parse_blockgroup (MatroskaDemuxContext *matroska,
if (size > 0)
res = matroska_parse_block(matroska, data, size, pos, cluster_time,
- is_keyframe, &track, &pkt);
+ is_keyframe, is_bframe, &track, &pkt);
if (pkt)
{
@@ -2679,7 +2686,7 @@ matroska_parse_cluster (MatroskaDemuxContext *matroska)
res = ebml_read_binary(matroska, &id, &data, &size);
if (res == 0)
res = matroska_parse_block(matroska, data, size, pos,
- cluster_time, -1, NULL, NULL);
+ cluster_time, -1,0, NULL, NULL);
break;
default: