0c1a90fa3a
http://bugs.xine-project.org/show_bug.cgi?id=216 from Brad (maintainer).
67 lines
2.2 KiB
Plaintext
67 lines
2.2 KiB
Plaintext
$OpenBSD: patch-src_demuxers_demux_matroska_c,v 1.3 2009/07/14 09:10:05 sthen Exp $
|
|
--- src/demuxers/demux_matroska.c.orig Mon Jul 13 04:09:24 2009
|
|
+++ src/demuxers/demux_matroska.c Mon Jul 13 04:12:12 2009
|
|
@@ -2078,6 +2078,31 @@ static int parse_block (demux_matroska_t *this, size_t
|
|
return 1;
|
|
}
|
|
|
|
+static int parse_simpleblock(demux_matroska_t *this, size_t block_len, uint64_t cluster_timecode, uint64_t block_duration)
|
|
+{
|
|
+ int has_block = 0;
|
|
+ off_t block_pos = 0;
|
|
+ off_t file_len = 0;
|
|
+ int normpos = 0;
|
|
+ int is_key = 1;
|
|
+
|
|
+ lprintf("simpleblock\n");
|
|
+ block_pos = this->input->get_current_pos(this->input);
|
|
+ file_len = this->input->get_length(this->input);
|
|
+ if( file_len )
|
|
+ normpos = (int) ( (double) block_pos * 65535 / file_len );
|
|
+
|
|
+ if (!read_block_data(this, block_len))
|
|
+ return 0;
|
|
+
|
|
+ has_block = 1;
|
|
+ /* we have the duration, we can parse the block now */
|
|
+ if (!parse_block(this, block_len, cluster_timecode, block_duration,
|
|
+ normpos, is_key))
|
|
+ return 0;
|
|
+ return 1;
|
|
+}
|
|
+
|
|
static int parse_block_group(demux_matroska_t *this,
|
|
uint64_t cluster_timecode,
|
|
uint64_t cluster_duration) {
|
|
@@ -2142,7 +2167,8 @@ static int parse_block_group(demux_matroska_t *this,
|
|
|
|
static int parse_cluster(demux_matroska_t *this) {
|
|
ebml_parser_t *ebml = this->ebml;
|
|
- int next_level = 2;
|
|
+ int this_level = ebml->level;
|
|
+ int next_level = this_level;
|
|
uint64_t timecode = 0;
|
|
uint64_t duration = 0;
|
|
|
|
@@ -2159,7 +2185,7 @@ static int parse_cluster(demux_matroska_t *this) {
|
|
this->first_cluster_found = 1;
|
|
}
|
|
|
|
- while (next_level == 2) {
|
|
+ while (next_level == this_level) {
|
|
ebml_elem_t elem;
|
|
|
|
if (!ebml_read_elem_head(ebml, &elem))
|
|
@@ -2181,6 +2207,11 @@ static int parse_cluster(demux_matroska_t *this) {
|
|
if (!ebml_read_master (ebml, &elem))
|
|
return 0;
|
|
if ((elem.len > 0) && !parse_block_group(this, timecode, duration))
|
|
+ return 0;
|
|
+ break;
|
|
+ case MATROSKA_ID_CL_SIMPLEBLOCK:
|
|
+ lprintf("simpleblock\n");
|
|
+ if (!parse_simpleblock(this, elem.len, timecode, duration))
|
|
return 0;
|
|
break;
|
|
case MATROSKA_ID_CL_BLOCK:
|