Commit 0cc5ea2e authored by Aurelien Jacobs's avatar Aurelien Jacobs

add support for simple blocks (ie. matroska v2)

Originally committed as revision 8180 to svn://svn.ffmpeg.org/ffmpeg/trunk
parent de7779b5
...@@ -139,6 +139,7 @@ ...@@ -139,6 +139,7 @@
/* IDs in the cluster master */ /* IDs in the cluster master */
#define MATROSKA_ID_CLUSTERTIMECODE 0xE7 #define MATROSKA_ID_CLUSTERTIMECODE 0xE7
#define MATROSKA_ID_BLOCKGROUP 0xA0 #define MATROSKA_ID_BLOCKGROUP 0xA0
#define MATROSKA_ID_SIMPLEBLOCK 0xA3
/* IDs in the blockgroup master */ /* IDs in the blockgroup master */
#define MATROSKA_ID_BLOCK 0xA1 #define MATROSKA_ID_BLOCK 0xA1
...@@ -2076,9 +2077,9 @@ matroska_read_header (AVFormatContext *s, ...@@ -2076,9 +2077,9 @@ matroska_read_header (AVFormatContext *s,
return AVERROR_NOFMT; return AVERROR_NOFMT;
} }
av_free(doctype); av_free(doctype);
if (version != 1) { if (version > 2) {
av_log(matroska->ctx, AV_LOG_ERROR, av_log(matroska->ctx, AV_LOG_ERROR,
"Matroska demuxer version 1 too old for file version %d\n", "Matroska demuxer version 2 too old for file version %d\n",
version); version);
return AVERROR_NOFMT; return AVERROR_NOFMT;
} }
...@@ -2425,6 +2426,8 @@ matroska_parse_block(MatroskaDemuxContext *matroska, uint64_t cluster_time, ...@@ -2425,6 +2426,8 @@ matroska_parse_block(MatroskaDemuxContext *matroska, uint64_t cluster_time,
flags = *data; flags = *data;
data += 1; data += 1;
size -= 1; size -= 1;
if (is_keyframe == -1)
is_keyframe = flags & 1 ? PKT_FLAG_KEY : 0;
switch ((flags & 0x06) >> 1) { switch ((flags & 0x06) >> 1) {
case 0x0: /* no lacing */ case 0x0: /* no lacing */
laces = 1; laces = 1;
...@@ -2666,6 +2669,10 @@ matroska_parse_cluster (MatroskaDemuxContext *matroska) ...@@ -2666,6 +2669,10 @@ matroska_parse_cluster (MatroskaDemuxContext *matroska)
res = matroska_parse_blockgroup(matroska, cluster_time); res = matroska_parse_blockgroup(matroska, cluster_time);
break; break;
case MATROSKA_ID_SIMPLEBLOCK:
matroska_parse_block(matroska, cluster_time, -1, NULL, NULL);
break;
default: default:
av_log(matroska->ctx, AV_LOG_INFO, av_log(matroska->ctx, AV_LOG_INFO,
"Unknown entry 0x%x in cluster data\n", id); "Unknown entry 0x%x in cluster data\n", id);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment