}
}
-static GstFlowReturn
-gst_matroska_demux_peek_id_length_pull (GstMatroskaDemux * demux, guint32 * _id,
- guint64 * _length, guint * _needed)
-{
- return gst_ebml_peek_id_length (_id, _length, _needed,
- (GstPeekData) gst_matroska_read_common_peek_pull,
- (gpointer) (&demux->common), GST_ELEMENT_CAST (demux),
- demux->common.offset);
-}
-
static gint64
gst_matroska_demux_get_length (GstMatroskaDemux * demux)
{
GST_DEBUG_OBJECT (demux,
"cluster reported at offset %" G_GINT64_FORMAT, *cpos);
demux->common.offset = *cpos;
- ret =
- gst_matroska_demux_peek_id_length_pull (demux, &id, &length, &needed);
+ ret = gst_matroska_read_common_peek_id_length_pull (&demux->common,
+ GST_ELEMENT_CAST (demux), &id, &length, &needed);
if (ret == GST_FLOW_OK && id == GST_MATROSKA_ID_CLUSTER) {
newpos = *cpos;
goto exit;
break;
}
demux->common.offset = newpos;
- ret =
- gst_matroska_demux_peek_id_length_pull (demux, &id, &length, &needed);
+ ret = gst_matroska_read_common_peek_id_length_pull (&demux->common,
+ GST_ELEMENT_CAST (demux), &id, &length, &needed);
if (ret != GST_FLOW_OK)
goto resume;
g_assert (id == GST_MATROSKA_ID_CLUSTER);
}
/* skip cluster */
demux->common.offset += length + needed;
- ret =
- gst_matroska_demux_peek_id_length_pull (demux, &id, &length, &needed);
+ ret = gst_matroska_read_common_peek_id_length_pull (&demux->common,
+ GST_ELEMENT_CAST (demux), &id, &length, &needed);
if (ret != GST_FLOW_OK)
goto resume;
GST_DEBUG_OBJECT (demux, "next element is %scluster",
guint64 cluster_size = 0;
/* peek and parse some elements */
- ret = gst_matroska_demux_peek_id_length_pull (demux, &id, &length, &needed);
+ ret = gst_matroska_read_common_peek_id_length_pull (&demux->common,
+ GST_ELEMENT_CAST (demux), &id, &length, &needed);
if (ret != GST_FLOW_OK)
goto error;
GST_LOG_OBJECT (demux, "Offset %" G_GUINT64_FORMAT ", Element id 0x%x, "
demux->common.offset = seek_pos + demux->common.ebml_segment_start;
/* check ID */
- if ((ret = gst_matroska_demux_peek_id_length_pull (demux, &id, &length,
- &needed)) != GST_FLOW_OK)
+ if ((ret = gst_matroska_read_common_peek_id_length_pull (&demux->common,
+ GST_ELEMENT_CAST (demux), &id, &length, &needed)) !=
+ GST_FLOW_OK)
goto finish;
if (id != seek_id) {
/* Search Tracks element */
while (TRUE) {
- ret = gst_matroska_demux_peek_id_length_pull (demux, &id, &length, &needed);
+ ret = gst_matroska_read_common_peek_id_length_pull (&demux->common,
+ GST_ELEMENT_CAST (demux), &id, &length, &needed);
if (ret != GST_FLOW_OK)
break;
}
}
- ret = gst_matroska_demux_peek_id_length_pull (demux, &id, &length, &needed);
+ ret = gst_matroska_read_common_peek_id_length_pull (&demux->common,
+ GST_ELEMENT_CAST (demux), &id, &length, &needed);
if (ret == GST_FLOW_UNEXPECTED)
goto eos;
if (ret != GST_FLOW_OK) {
}
static GstFlowReturn
-gst_matroska_demux_peek_id_length_push (GstMatroskaDemux * demux, guint32 * _id,
- guint64 * _length, guint * _needed)
-{
- return gst_ebml_peek_id_length (_id, _length, _needed,
- (GstPeekData) gst_matroska_read_common_peek_adapter,
- (gpointer) (&demux->common), GST_ELEMENT_CAST (demux),
- demux->common.offset);
-}
-
-static GstFlowReturn
gst_matroska_demux_chain (GstPad * pad, GstBuffer * buffer)
{
GstMatroskaDemux *demux = GST_MATROSKA_DEMUX (GST_PAD_PARENT (pad));
next:
available = gst_adapter_available (demux->common.adapter);
- ret = gst_matroska_demux_peek_id_length_push (demux, &id, &length, &needed);
+ ret = gst_matroska_read_common_peek_id_length_push (&demux->common,
+ GST_ELEMENT_CAST (demux), &id, &length, &needed);
if (G_UNLIKELY (ret != GST_FLOW_OK && ret != GST_FLOW_UNEXPECTED))
return ret;
}
}
-static GstFlowReturn
-gst_matroska_parse_peek_id_length_pull (GstMatroskaParse * parse, guint32 * _id,
- guint64 * _length, guint * _needed)
-{
- return gst_ebml_peek_id_length (_id, _length, _needed,
- (GstPeekData) gst_matroska_read_common_peek_pull,
- (gpointer) (&parse->common), GST_ELEMENT_CAST (parse),
- parse->common.offset);
-}
-
static gint64
gst_matroska_parse_get_length (GstMatroskaParse * parse)
{
break;
}
parse->common.offset = newpos;
- ret =
- gst_matroska_parse_peek_id_length_pull (parse, &id, &length, &needed);
+ ret = gst_matroska_read_common_peek_id_length_pull (&parse->common,
+ GST_ELEMENT_CAST (parse), &id, &length, &needed);
if (ret != GST_FLOW_OK)
goto resume;
g_assert (id == GST_MATROSKA_ID_CLUSTER);
}
/* skip cluster */
parse->common.offset += length + needed;
- ret =
- gst_matroska_parse_peek_id_length_pull (parse, &id, &length, &needed);
+ ret = gst_matroska_read_common_peek_id_length_pull (&parse->common,
+ GST_ELEMENT_CAST (parse), &id, &length, &needed);
if (ret != GST_FLOW_OK)
goto resume;
GST_DEBUG_OBJECT (parse, "next element is %scluster",
/* Search Tracks element */
while (TRUE) {
- ret = gst_matroska_parse_peek_id_length_pull (parse, &id, &length, &needed);
+ ret = gst_matroska_read_common_peek_id_length_pull (&parse->common,
+ GST_ELEMENT_CAST (parse), &id, &length, &needed);
if (ret != GST_FLOW_OK)
break;
}
}
- ret = gst_matroska_parse_peek_id_length_pull (parse, &id, &length, &needed);
+ ret = gst_matroska_read_common_peek_id_length_pull (&parse->common,
+ GST_ELEMENT_CAST (parse), &id, &length, &needed);
if (ret == GST_FLOW_UNEXPECTED)
goto eos;
if (ret != GST_FLOW_OK) {
}
static GstFlowReturn
-gst_matroska_parse_peek_id_length_push (GstMatroskaParse * parse, guint32 * _id,
- guint64 * _length, guint * _needed)
-{
- return gst_ebml_peek_id_length (_id, _length, _needed,
- (GstPeekData) gst_matroska_read_common_peek_adapter,
- (gpointer) (&parse->common), GST_ELEMENT_CAST (parse),
- parse->common.offset);
-}
-
-static GstFlowReturn
gst_matroska_parse_chain (GstPad * pad, GstBuffer * buffer)
{
GstMatroskaParse *parse = GST_MATROSKA_PARSE (GST_PAD_PARENT (pad));
next:
available = gst_adapter_available (parse->common.adapter);
- ret = gst_matroska_parse_peek_id_length_push (parse, &id, &length, &needed);
+ ret = gst_matroska_read_common_peek_id_length_push (&parse->common,
+ GST_ELEMENT_CAST (parse), &id, &length, &needed);
if (G_UNLIKELY (ret != GST_FLOW_OK && ret != GST_FLOW_UNEXPECTED))
return ret;
return ret;
}
-const guint8 *
+static const guint8 *
gst_matroska_read_common_peek_adapter (GstMatroskaReadCommon * common, guint
peek)
{
return GST_FLOW_OK;
}
-const guint8 *
+static const guint8 *
gst_matroska_read_common_peek_pull (GstMatroskaReadCommon * common, guint peek)
{
guint8 *data = NULL;
}
GstFlowReturn
+gst_matroska_read_common_peek_id_length_pull (GstMatroskaReadCommon * common,
+ GstElement * el, guint32 * _id, guint64 * _length, guint * _needed)
+{
+ return gst_ebml_peek_id_length (_id, _length, _needed,
+ (GstPeekData) gst_matroska_read_common_peek_pull, (gpointer) common, el,
+ common->offset);
+}
+
+GstFlowReturn
+gst_matroska_read_common_peek_id_length_push (GstMatroskaReadCommon * common,
+ GstElement * el, guint32 * _id, guint64 * _length, guint * _needed)
+{
+ return gst_ebml_peek_id_length (_id, _length, _needed,
+ (GstPeekData) gst_matroska_read_common_peek_adapter, (gpointer) common,
+ el, common->offset);
+}
+
+GstFlowReturn
gst_matroska_read_common_read_track_encoding (GstMatroskaReadCommon * common,
GstEbmlRead * ebml, GstMatroskaTrackContext * context)
{
common, GstEbmlRead * ebml);
GstFlowReturn gst_matroska_read_common_parse_skip (GstMatroskaReadCommon *
common, GstEbmlRead * ebml, const gchar * parent_name, guint id);
-const guint8 * gst_matroska_read_common_peek_adapter (GstMatroskaReadCommon *
- common, guint peek);
GstFlowReturn gst_matroska_read_common_peek_bytes (GstMatroskaReadCommon *
common, guint64 offset, guint size, GstBuffer ** p_buf, guint8 ** bytes);
-const guint8 * gst_matroska_read_common_peek_pull (GstMatroskaReadCommon *
- common, guint peek);
+GstFlowReturn gst_matroska_read_common_peek_id_length_pull (GstMatroskaReadCommon *
+ common, GstElement * el, guint32 * _id, guint64 * _length, guint *
+ _needed);
+GstFlowReturn gst_matroska_read_common_peek_id_length_push (GstMatroskaReadCommon *
+ common, GstElement * el, guint32 * _id, guint64 * _length, guint *
+ _needed);
gint gst_matroska_read_common_stream_from_num (GstMatroskaReadCommon * common,
guint track_num);
GstFlowReturn gst_matroska_read_common_read_track_encoding (