matroska: refactor code common to matroskademux and matroskaparse
Move the following function to matroska-read-common.[ch] from matroska-demux.c and matroska-parse.c: - gst_matroska_{demux,parse}_parse_metadata_id_tag https://bugzilla.gnome.org/show_bug.cgi?id=650877
This commit is contained in:
parent
febfcce0fd
commit
493e197588
@ -2387,45 +2387,6 @@ gst_matroska_demux_parse_info (GstMatroskaDemux * demux, GstEbmlRead * ebml)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static GstFlowReturn
|
|
||||||
gst_matroska_demux_parse_metadata_id_tag (GstMatroskaDemux * demux,
|
|
||||||
GstEbmlRead * ebml, GstTagList ** p_taglist)
|
|
||||||
{
|
|
||||||
guint32 id;
|
|
||||||
GstFlowReturn ret;
|
|
||||||
|
|
||||||
DEBUG_ELEMENT_START (demux, ebml, "Tag");
|
|
||||||
|
|
||||||
if ((ret = gst_ebml_read_master (ebml, &id)) != GST_FLOW_OK) {
|
|
||||||
DEBUG_ELEMENT_STOP (demux, ebml, "Tag", ret);
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
while (ret == GST_FLOW_OK && gst_ebml_read_has_remaining (ebml, 1, TRUE)) {
|
|
||||||
/* read all sub-entries */
|
|
||||||
|
|
||||||
if ((ret = gst_ebml_peek_id (ebml, &id)) != GST_FLOW_OK)
|
|
||||||
break;
|
|
||||||
|
|
||||||
switch (id) {
|
|
||||||
case GST_MATROSKA_ID_SIMPLETAG:
|
|
||||||
ret =
|
|
||||||
gst_matroska_read_common_parse_metadata_id_simple_tag
|
|
||||||
(&demux->common, ebml, p_taglist);
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
ret = gst_matroska_read_common_parse_skip (&demux->common, ebml,
|
|
||||||
"Tag", id);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
DEBUG_ELEMENT_STOP (demux, ebml, "Tag", ret);
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
static GstFlowReturn
|
static GstFlowReturn
|
||||||
gst_matroska_demux_parse_metadata (GstMatroskaDemux * demux, GstEbmlRead * ebml)
|
gst_matroska_demux_parse_metadata (GstMatroskaDemux * demux, GstEbmlRead * ebml)
|
||||||
{
|
{
|
||||||
@ -2468,7 +2429,8 @@ gst_matroska_demux_parse_metadata (GstMatroskaDemux * demux, GstEbmlRead * ebml)
|
|||||||
|
|
||||||
switch (id) {
|
switch (id) {
|
||||||
case GST_MATROSKA_ID_TAG:
|
case GST_MATROSKA_ID_TAG:
|
||||||
ret = gst_matroska_demux_parse_metadata_id_tag (demux, ebml, &taglist);
|
ret = gst_matroska_read_common_parse_metadata_id_tag (&demux->common,
|
||||||
|
ebml, &taglist);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -1689,45 +1689,6 @@ gst_matroska_parse_parse_info (GstMatroskaParse * parse, GstEbmlRead * ebml)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static GstFlowReturn
|
|
||||||
gst_matroska_parse_parse_metadata_id_tag (GstMatroskaParse * parse,
|
|
||||||
GstEbmlRead * ebml, GstTagList ** p_taglist)
|
|
||||||
{
|
|
||||||
guint32 id;
|
|
||||||
GstFlowReturn ret;
|
|
||||||
|
|
||||||
DEBUG_ELEMENT_START (parse, ebml, "Tag");
|
|
||||||
|
|
||||||
if ((ret = gst_ebml_read_master (ebml, &id)) != GST_FLOW_OK) {
|
|
||||||
DEBUG_ELEMENT_STOP (parse, ebml, "Tag", ret);
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
while (ret == GST_FLOW_OK && gst_ebml_read_has_remaining (ebml, 1, TRUE)) {
|
|
||||||
/* read all sub-entries */
|
|
||||||
|
|
||||||
if ((ret = gst_ebml_peek_id (ebml, &id)) != GST_FLOW_OK)
|
|
||||||
break;
|
|
||||||
|
|
||||||
switch (id) {
|
|
||||||
case GST_MATROSKA_ID_SIMPLETAG:
|
|
||||||
ret =
|
|
||||||
gst_matroska_read_common_parse_metadata_id_simple_tag
|
|
||||||
(&parse->common, ebml, p_taglist);
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
ret = gst_matroska_read_common_parse_skip (&parse->common, ebml,
|
|
||||||
"Tag", id);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
DEBUG_ELEMENT_STOP (parse, ebml, "Tag", ret);
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
static GstFlowReturn
|
static GstFlowReturn
|
||||||
gst_matroska_parse_parse_metadata (GstMatroskaParse * parse, GstEbmlRead * ebml)
|
gst_matroska_parse_parse_metadata (GstMatroskaParse * parse, GstEbmlRead * ebml)
|
||||||
{
|
{
|
||||||
@ -1770,7 +1731,8 @@ gst_matroska_parse_parse_metadata (GstMatroskaParse * parse, GstEbmlRead * ebml)
|
|||||||
|
|
||||||
switch (id) {
|
switch (id) {
|
||||||
case GST_MATROSKA_ID_TAG:
|
case GST_MATROSKA_ID_TAG:
|
||||||
ret = gst_matroska_parse_parse_metadata_id_tag (parse, ebml, &taglist);
|
ret = gst_matroska_read_common_parse_metadata_id_tag (&parse->common,
|
||||||
|
ebml, &taglist);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -953,7 +953,7 @@ gst_matroska_read_common_parse_index (GstMatroskaReadCommon * common,
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
GstFlowReturn
|
static GstFlowReturn
|
||||||
gst_matroska_read_common_parse_metadata_id_simple_tag (GstMatroskaReadCommon *
|
gst_matroska_read_common_parse_metadata_id_simple_tag (GstMatroskaReadCommon *
|
||||||
common, GstEbmlRead * ebml, GstTagList ** p_taglist)
|
common, GstEbmlRead * ebml, GstTagList ** p_taglist)
|
||||||
{
|
{
|
||||||
@ -1076,6 +1076,43 @@ gst_matroska_read_common_parse_metadata_id_simple_tag (GstMatroskaReadCommon *
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GstFlowReturn
|
||||||
|
gst_matroska_read_common_parse_metadata_id_tag (GstMatroskaReadCommon * common,
|
||||||
|
GstEbmlRead * ebml, GstTagList ** p_taglist)
|
||||||
|
{
|
||||||
|
guint32 id;
|
||||||
|
GstFlowReturn ret;
|
||||||
|
|
||||||
|
DEBUG_ELEMENT_START (common, ebml, "Tag");
|
||||||
|
|
||||||
|
if ((ret = gst_ebml_read_master (ebml, &id)) != GST_FLOW_OK) {
|
||||||
|
DEBUG_ELEMENT_STOP (common, ebml, "Tag", ret);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
while (ret == GST_FLOW_OK && gst_ebml_read_has_remaining (ebml, 1, TRUE)) {
|
||||||
|
/* read all sub-entries */
|
||||||
|
|
||||||
|
if ((ret = gst_ebml_peek_id (ebml, &id)) != GST_FLOW_OK)
|
||||||
|
break;
|
||||||
|
|
||||||
|
switch (id) {
|
||||||
|
case GST_MATROSKA_ID_SIMPLETAG:
|
||||||
|
ret = gst_matroska_read_common_parse_metadata_id_simple_tag (common,
|
||||||
|
ebml, p_taglist);
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
ret = gst_matroska_read_common_parse_skip (common, ebml, "Tag", id);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
DEBUG_ELEMENT_STOP (common, ebml, "Tag", ret);
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
static const guint8 *
|
static const guint8 *
|
||||||
gst_matroska_read_common_peek_adapter (GstMatroskaReadCommon * common, guint
|
gst_matroska_read_common_peek_adapter (GstMatroskaReadCommon * common, guint
|
||||||
peek)
|
peek)
|
||||||
|
@ -93,7 +93,7 @@ GstFlowReturn gst_matroska_read_common_parse_index (GstMatroskaReadCommon *
|
|||||||
common, GstEbmlRead * ebml);
|
common, GstEbmlRead * ebml);
|
||||||
GstFlowReturn gst_matroska_read_common_parse_header (GstMatroskaReadCommon *
|
GstFlowReturn gst_matroska_read_common_parse_header (GstMatroskaReadCommon *
|
||||||
common, GstEbmlRead * ebml);
|
common, GstEbmlRead * ebml);
|
||||||
GstFlowReturn gst_matroska_read_common_parse_metadata_id_simple_tag (
|
GstFlowReturn gst_matroska_read_common_parse_metadata_id_tag (
|
||||||
GstMatroskaReadCommon * common, GstEbmlRead * ebml, GstTagList **
|
GstMatroskaReadCommon * common, GstEbmlRead * ebml, GstTagList **
|
||||||
p_taglist);
|
p_taglist);
|
||||||
GstFlowReturn gst_matroska_read_common_parse_skip (GstMatroskaReadCommon *
|
GstFlowReturn gst_matroska_read_common_parse_skip (GstMatroskaReadCommon *
|
||||||
|
Loading…
x
Reference in New Issue
Block a user