gst/matroska/: Handle EBML elements like Void or CRC32 in the EbmlRead base class already. They're not useful in the ...

Original commit message from CVS:
* gst/matroska/ebml-read.c: (gst_ebml_peek_id),
(gst_ebml_read_header):
* gst/matroska/matroska-demux.c: (gst_matroska_demux_add_stream),
(gst_matroska_demux_parse_tracks),
(gst_matroska_demux_parse_index_cuetrack),
(gst_matroska_demux_parse_index_pointentry),
(gst_matroska_demux_parse_index), (gst_matroska_demux_parse_info),
(gst_matroska_demux_parse_metadata_id_simple_tag),
(gst_matroska_demux_parse_metadata_id_tag),
(gst_matroska_demux_parse_metadata),
(gst_matroska_demux_parse_attachments),
(gst_matroska_demux_parse_chapters),
(gst_matroska_demux_parse_blockgroup_or_simpleblock),
(gst_matroska_demux_parse_cluster),
(gst_matroska_demux_parse_contents_seekentry),
(gst_matroska_demux_parse_contents),
(gst_matroska_demux_loop_stream_parse_id):
Handle EBML elements like Void or CRC32 in the EbmlRead base class
already. They're not useful in the matroska parser and only cause
additional code.
This commit is contained in:
Sebastian Dröge 2008-06-15 09:43:25 +00:00
parent 1051e57b36
commit 3a99102c49
3 changed files with 49 additions and 45 deletions

View file

@ -1,3 +1,26 @@
2008-06-15 Sebastian Dröge <slomo@circular-chaos.org>
* gst/matroska/ebml-read.c: (gst_ebml_peek_id),
(gst_ebml_read_header):
* gst/matroska/matroska-demux.c: (gst_matroska_demux_add_stream),
(gst_matroska_demux_parse_tracks),
(gst_matroska_demux_parse_index_cuetrack),
(gst_matroska_demux_parse_index_pointentry),
(gst_matroska_demux_parse_index), (gst_matroska_demux_parse_info),
(gst_matroska_demux_parse_metadata_id_simple_tag),
(gst_matroska_demux_parse_metadata_id_tag),
(gst_matroska_demux_parse_metadata),
(gst_matroska_demux_parse_attachments),
(gst_matroska_demux_parse_chapters),
(gst_matroska_demux_parse_blockgroup_or_simpleblock),
(gst_matroska_demux_parse_cluster),
(gst_matroska_demux_parse_contents_seekentry),
(gst_matroska_demux_parse_contents),
(gst_matroska_demux_loop_stream_parse_id):
Handle EBML elements like Void or CRC32 in the EbmlRead base class
already. They're not useful in the matroska parser and only cause
additional code.
2008-06-14 Sebastian Dröge <slomo@circular-chaos.org> 2008-06-14 Sebastian Dröge <slomo@circular-chaos.org>
* gst/matroska/ebml-read.c: (gst_ebml_level_free), * gst/matroska/ebml-read.c: (gst_ebml_level_free),

View file

@ -432,16 +432,41 @@ gst_ebml_peek_id (GstEbmlRead * ebml, guint * level_up, guint32 * id)
{ {
guint64 off; guint64 off;
guint level_up_tmp = 0;
GstFlowReturn ret; GstFlowReturn ret;
g_assert (level_up); g_assert (level_up);
g_assert (id);
*level_up = 0;
next:
off = ebml->offset; /* save offset */ off = ebml->offset; /* save offset */
if ((ret = gst_ebml_read_element_id (ebml, id, level_up)) != GST_FLOW_OK) if ((ret = gst_ebml_read_element_id (ebml, id, &level_up_tmp)) != GST_FLOW_OK)
return ret; return ret;
ebml->offset = off; /* restore offset */ ebml->offset = off; /* restore offset */
*level_up += level_up_tmp;
level_up_tmp = 0;
switch (*id) {
case GST_EBML_ID_VOID:
GST_DEBUG_OBJECT (ebml, "Skipping EBML Void element");
if ((ret = gst_ebml_read_skip (ebml)) != GST_FLOW_OK)
return ret;
goto next;
break;
case GST_EBML_ID_CRC32:
GST_DEBUG_OBJECT (ebml, "Skipping EBML CRC32 element");
if ((ret = gst_ebml_read_skip (ebml)) != GST_FLOW_OK)
return ret;
goto next;
break;
}
return ret; return ret;
} }
@ -990,7 +1015,6 @@ gst_ebml_read_header (GstEbmlRead * ebml, gchar ** doctype, guint * version)
/* pass-through */ /* pass-through */
/* we ignore these two, as they don't tell us anything we care about */ /* we ignore these two, as they don't tell us anything we care about */
case GST_EBML_ID_VOID:
case GST_EBML_ID_EBMLVERSION: case GST_EBML_ID_EBMLVERSION:
case GST_EBML_ID_DOCTYPEVERSION: case GST_EBML_ID_DOCTYPEVERSION:
ret = gst_ebml_read_skip (ebml); ret = gst_ebml_read_skip (ebml);

View file

@ -23,7 +23,6 @@
/* TODO: "Unkown track header" & "Unknown entry": implement if useful /* TODO: "Unkown track header" & "Unknown entry": implement if useful
* TODO: dynamic number of tracks without upper bound * TODO: dynamic number of tracks without upper bound
* FIXME: uint64 -> int64 overflows! * FIXME: uint64 -> int64 overflows!
* FIXME: ignore 0xBF aka. CRC32 elements without warning
* TODO: check CRC32 if present * TODO: check CRC32 if present
* FIXME: go out of loops, don't add Track or whatever if something goes wrong * FIXME: go out of loops, don't add Track or whatever if something goes wrong
* or required elements are not there * or required elements are not there
@ -888,9 +887,6 @@ gst_matroska_demux_add_stream (GstMatroskaDemux * demux)
default: default:
GST_WARNING ("Unknown video track header entry 0x%x - ignoring", GST_WARNING ("Unknown video track header entry 0x%x - ignoring",
id); id);
/* pass-through */
case GST_EBML_ID_VOID:
ret = gst_ebml_read_skip (ebml); ret = gst_ebml_read_skip (ebml);
break; break;
} }
@ -991,9 +987,6 @@ gst_matroska_demux_add_stream (GstMatroskaDemux * demux)
default: default:
GST_WARNING ("Unknown audio track header entry 0x%x - ignoring", GST_WARNING ("Unknown audio track header entry 0x%x - ignoring",
id); id);
/* pass-through */
case GST_EBML_ID_VOID:
ret = gst_ebml_read_skip (ebml); ret = gst_ebml_read_skip (ebml);
break; break;
} }
@ -1186,7 +1179,6 @@ gst_matroska_demux_add_stream (GstMatroskaDemux * demux)
case GST_MATROSKA_ID_CODECINFOURL: case GST_MATROSKA_ID_CODECINFOURL:
case GST_MATROSKA_ID_CODECDOWNLOADURL: case GST_MATROSKA_ID_CODECDOWNLOADURL:
case GST_MATROSKA_ID_CODECDECODEALL: case GST_MATROSKA_ID_CODECDECODEALL:
case GST_EBML_ID_VOID:
ret = gst_ebml_read_skip (ebml); ret = gst_ebml_read_skip (ebml);
break; break;
} }
@ -1798,9 +1790,6 @@ gst_matroska_demux_parse_tracks (GstMatroskaDemux * demux)
default: default:
GST_WARNING ("Unknown entry 0x%x in track header", id); GST_WARNING ("Unknown entry 0x%x in track header", id);
/* fall-through */
case GST_EBML_ID_VOID:
ret = gst_ebml_read_skip (ebml); ret = gst_ebml_read_skip (ebml);
break; break;
} }
@ -1881,7 +1870,6 @@ gst_matroska_demux_parse_index_cuetrack (GstMatroskaDemux * demux,
case GST_MATROSKA_ID_CUEBLOCKNUMBER: case GST_MATROSKA_ID_CUEBLOCKNUMBER:
case GST_MATROSKA_ID_CUECODECSTATE: case GST_MATROSKA_ID_CUECODECSTATE:
case GST_MATROSKA_ID_CUEREFERENCE: case GST_MATROSKA_ID_CUEREFERENCE:
case GST_EBML_ID_VOID:
if ((ret = gst_ebml_read_skip (ebml)) != GST_FLOW_OK) if ((ret = gst_ebml_read_skip (ebml)) != GST_FLOW_OK)
goto error; goto error;
break; break;
@ -1957,9 +1945,6 @@ gst_matroska_demux_parse_index_pointentry (GstMatroskaDemux * demux,
default: default:
GST_WARNING ("Unknown entry 0x%x in cuespoint index", id); GST_WARNING ("Unknown entry 0x%x in cuespoint index", id);
/* fall-through */
case GST_EBML_ID_VOID:
ret = gst_ebml_read_skip (ebml); ret = gst_ebml_read_skip (ebml);
break; break;
} }
@ -2029,9 +2014,6 @@ gst_matroska_demux_parse_index (GstMatroskaDemux * demux, gboolean prevent_eos)
default: default:
GST_WARNING ("Unknown entry 0x%x in cues header", id); GST_WARNING ("Unknown entry 0x%x in cues header", id);
/* fall-through */
case GST_EBML_ID_VOID:
ret = gst_ebml_read_skip (ebml); ret = gst_ebml_read_skip (ebml);
break; break;
} }
@ -2143,9 +2125,6 @@ gst_matroska_demux_parse_info (GstMatroskaDemux * demux)
default: default:
GST_WARNING ("Unknown entry 0x%x in info header", id); GST_WARNING ("Unknown entry 0x%x in info header", id);
/* fall-through */
case GST_EBML_ID_VOID:
ret = gst_ebml_read_skip (ebml); ret = gst_ebml_read_skip (ebml);
break; break;
} }
@ -2235,7 +2214,6 @@ gst_matroska_demux_parse_metadata_id_simple_tag (GstMatroskaDemux * demux,
case GST_MATROSKA_ID_TAGLANGUAGE: case GST_MATROSKA_ID_TAGLANGUAGE:
case GST_MATROSKA_ID_TAGDEFAULT: case GST_MATROSKA_ID_TAGDEFAULT:
case GST_MATROSKA_ID_TAGBINARY: case GST_MATROSKA_ID_TAGBINARY:
case GST_EBML_ID_VOID:
ret = gst_ebml_read_skip (ebml); ret = gst_ebml_read_skip (ebml);
break; break;
} }
@ -2313,9 +2291,6 @@ gst_matroska_demux_parse_metadata_id_tag (GstMatroskaDemux * demux,
default: default:
GST_WARNING ("Unknown entry 0x%x in metadata collection", id); GST_WARNING ("Unknown entry 0x%x in metadata collection", id);
/* fall-through */
case GST_EBML_ID_VOID:
ret = gst_ebml_read_skip (ebml); ret = gst_ebml_read_skip (ebml);
break; break;
} }
@ -2371,9 +2346,6 @@ gst_matroska_demux_parse_metadata (GstMatroskaDemux * demux,
default: default:
GST_WARNING ("Unknown entry 0x%x in metadata header", id); GST_WARNING ("Unknown entry 0x%x in metadata header", id);
/* fall-through */
case GST_EBML_ID_VOID:
/* FIXME: Use to limit the tags to specific pads */ /* FIXME: Use to limit the tags to specific pads */
case GST_MATROSKA_ID_TARGETS: case GST_MATROSKA_ID_TARGETS:
ret = gst_ebml_read_skip (ebml); ret = gst_ebml_read_skip (ebml);
@ -2432,7 +2404,6 @@ gst_matroska_demux_parse_attachments (GstMatroskaDemux * demux,
switch (id) { switch (id) {
default: default:
case GST_EBML_ID_VOID:
ret = gst_ebml_read_skip (ebml); ret = gst_ebml_read_skip (ebml);
break; break;
} }
@ -2482,7 +2453,6 @@ gst_matroska_demux_parse_chapters (GstMatroskaDemux * demux,
switch (id) { switch (id) {
default: default:
case GST_EBML_ID_VOID:
ret = gst_ebml_read_skip (ebml); ret = gst_ebml_read_skip (ebml);
break; break;
} }
@ -3264,7 +3234,6 @@ gst_matroska_demux_parse_blockgroup_or_simpleblock (GstMatroskaDemux * demux,
case GST_MATROSKA_ID_REFERENCEVIRTUAL: case GST_MATROSKA_ID_REFERENCEVIRTUAL:
case GST_MATROSKA_ID_CODECSTATE: case GST_MATROSKA_ID_CODECSTATE:
case GST_MATROSKA_ID_SLICES: case GST_MATROSKA_ID_SLICES:
case GST_EBML_ID_VOID:
ret = gst_ebml_read_skip (ebml); ret = gst_ebml_read_skip (ebml);
break; break;
} }
@ -3457,7 +3426,6 @@ gst_matroska_demux_parse_cluster (GstMatroskaDemux * demux)
case GST_MATROSKA_ID_PREVSIZE: case GST_MATROSKA_ID_PREVSIZE:
case GST_MATROSKA_ID_ENCRYPTEDBLOCK: case GST_MATROSKA_ID_ENCRYPTEDBLOCK:
case GST_MATROSKA_ID_SILENTTRACKS: case GST_MATROSKA_ID_SILENTTRACKS:
case GST_EBML_ID_VOID:
ret = gst_ebml_read_skip (ebml); ret = gst_ebml_read_skip (ebml);
break; break;
} }
@ -3520,9 +3488,6 @@ gst_matroska_demux_parse_contents_seekentry (GstMatroskaDemux * demux,
default: default:
GST_WARNING ("Unknown seekhead ID 0x%x", id); GST_WARNING ("Unknown seekhead ID 0x%x", id);
/* fall-through */
case GST_EBML_ID_VOID:
ret = gst_ebml_read_skip (ebml); ret = gst_ebml_read_skip (ebml);
break; break;
} }
@ -3745,9 +3710,6 @@ gst_matroska_demux_parse_contents (GstMatroskaDemux * demux,
default: default:
GST_WARNING ("Unknown seekhead ID 0x%x", id); GST_WARNING ("Unknown seekhead ID 0x%x", id);
/* fall-through */
case GST_EBML_ID_VOID:
ret = gst_ebml_read_skip (ebml); ret = gst_ebml_read_skip (ebml);
break; break;
} }
@ -3905,14 +3867,9 @@ gst_matroska_demux_loop_stream_parse_id (GstMatroskaDemux * demux,
default: default:
GST_WARNING ("Unknown matroska file header ID 0x%x at %" GST_WARNING ("Unknown matroska file header ID 0x%x at %"
G_GUINT64_FORMAT, id, GST_EBML_READ (demux)->offset); G_GUINT64_FORMAT, id, GST_EBML_READ (demux)->offset);
/* fall-through */
case GST_EBML_ID_VOID:
{
if ((ret = gst_ebml_read_skip (ebml)) != GST_FLOW_OK) if ((ret = gst_ebml_read_skip (ebml)) != GST_FLOW_OK)
return ret; return ret;
break; break;
}
} }
return GST_FLOW_OK; return GST_FLOW_OK;
} }