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}_peek_pull

https://bugzilla.gnome.org/show_bug.cgi?id=650877
This commit is contained in:
Debarshi Ray 2011-05-23 18:06:44 +03:00 committed by Sebastian Dröge
parent 72d969b360
commit 5384308c99
4 changed files with 18 additions and 24 deletions

View file

@ -461,23 +461,14 @@ gst_matroska_demux_reset (GstElement * element)
}
}
static const guint8 *
gst_matroska_demux_peek_pull (GstMatroskaDemux * demux, guint peek)
{
guint8 *data = NULL;
gst_matroska_read_common_peek_bytes (&demux->common, demux->common.offset,
peek, NULL, &data);
return data;
}
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_demux_peek_pull, (gpointer) demux,
GST_ELEMENT_CAST (demux), demux->common.offset);
(GstPeekData) gst_matroska_read_common_peek_pull,
(gpointer) (&demux->common), GST_ELEMENT_CAST (demux),
demux->common.offset);
}
static gint64

View file

@ -384,23 +384,14 @@ gst_matroska_parse_reset (GstElement * element)
}
}
static const guint8 *
gst_matroska_parse_peek_pull (GstMatroskaParse * parse, guint peek)
{
guint8 *data = NULL;
gst_matroska_read_common_peek_bytes (&parse->common, parse->common.offset,
peek, NULL, &data);
return data;
}
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_parse_peek_pull, (gpointer) parse,
GST_ELEMENT_CAST (parse), parse->common.offset);
(GstPeekData) gst_matroska_read_common_peek_pull,
(gpointer) (&parse->common), GST_ELEMENT_CAST (parse),
parse->common.offset);
}
static gint64

View file

@ -709,6 +709,16 @@ gst_matroska_read_common_peek_bytes (GstMatroskaReadCommon * common, guint64
return GST_FLOW_OK;
}
const guint8 *
gst_matroska_read_common_peek_pull (GstMatroskaReadCommon * common, guint peek)
{
guint8 *data = NULL;
gst_matroska_read_common_peek_bytes (common, common->offset, peek, NULL,
&data);
return data;
}
GstFlowReturn
gst_matroska_read_common_read_track_encoding (GstMatroskaReadCommon * common,
GstEbmlRead * ebml, GstMatroskaTrackContext * context)

View file

@ -80,6 +80,8 @@ GstFlowReturn gst_matroska_read_common_parse_skip (GstMatroskaReadCommon *
common, GstEbmlRead * ebml, const gchar * parent_name, guint id);
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);
gint gst_matroska_read_common_stream_from_num (GstMatroskaReadCommon * common,
guint track_num);
GstFlowReturn gst_matroska_read_common_read_track_encoding (