return ret;
}
-static gint
-gst_matroska_index_seek_find (GstMatroskaIndex * i1, GstClockTime * time,
- gpointer user_data)
-{
- if (i1->time < *time)
- return -1;
- else if (i1->time > *time)
- return 1;
- else
- return 0;
-}
-
-static GstMatroskaIndex *
-gst_matroskademux_do_index_seek (GstMatroskaDemux * demux,
- GstMatroskaTrackContext * track, gint64 seek_pos, GArray ** _index,
- gint * _entry_index)
-{
- GstMatroskaIndex *entry = NULL;
- GArray *index;
-
- if (!demux->common.index || !demux->common.index->len)
- return NULL;
-
- /* find entry just before or at the requested position */
- if (track && track->index_table)
- index = track->index_table;
- else
- index = demux->common.index;
-
- entry =
- gst_util_array_binary_search (index->data, index->len,
- sizeof (GstMatroskaIndex),
- (GCompareDataFunc) gst_matroska_index_seek_find, GST_SEARCH_MODE_BEFORE,
- &seek_pos, NULL);
-
- if (entry == NULL)
- entry = &g_array_index (index, GstMatroskaIndex, 0);
-
- if (_index)
- *_index = index;
- if (_entry_index)
- *_entry_index = entry - (GstMatroskaIndex *) index->data;
-
- return entry;
-}
-
/* takes ownership of taglist */
static void
gst_matroska_demux_found_global_tag (GstMatroskaDemux * demux,
/* check sanity before we start flushing and all that */
GST_OBJECT_LOCK (demux);
track = gst_matroska_demux_get_seek_track (demux, track);
- if ((entry = gst_matroskademux_do_index_seek (demux, track,
+ if ((entry = gst_matroska_read_common_do_index_seek (&demux->common, track,
seeksegment.last_stop, &demux->seek_index, &demux->seek_entry)) ==
NULL) {
/* pull mode without index can scan later on */
return ret;
}
-static gint
-gst_matroska_index_seek_find (GstMatroskaIndex * i1, GstClockTime * time,
- gpointer user_data)
-{
- if (i1->time < *time)
- return -1;
- else if (i1->time > *time)
- return 1;
- else
- return 0;
-}
-
-static GstMatroskaIndex *
-gst_matroskaparse_do_index_seek (GstMatroskaParse * parse,
- GstMatroskaTrackContext * track, gint64 seek_pos, GArray ** _index,
- gint * _entry_index)
-{
- GstMatroskaIndex *entry = NULL;
- GArray *index;
-
- if (!parse->common.index || !parse->common.index->len)
- return NULL;
-
- /* find entry just before or at the requested position */
- if (track && track->index_table)
- index = track->index_table;
- else
- index = parse->common.index;
-
- entry =
- gst_util_array_binary_search (index->data, index->len,
- sizeof (GstMatroskaIndex),
- (GCompareDataFunc) gst_matroska_index_seek_find, GST_SEARCH_MODE_BEFORE,
- &seek_pos, NULL);
-
- if (entry == NULL)
- entry = &g_array_index (index, GstMatroskaIndex, 0);
-
- if (_index)
- *_index = index;
- if (_entry_index)
- *_entry_index = entry - (GstMatroskaIndex *) index->data;
-
- return entry;
-}
-
/* takes ownership of taglist */
static void
gst_matroska_parse_found_global_tag (GstMatroskaParse * parse,
/* check sanity before we start flushing and all that */
GST_OBJECT_LOCK (parse);
- if ((entry = gst_matroskaparse_do_index_seek (parse, track,
+ if ((entry = gst_matroska_read_common_do_index_seek (&parse->common, track,
seeksegment.last_stop, &parse->seek_index, &parse->seek_entry)) ==
NULL) {
/* pull mode without index can scan later on */
return 0;
}
+gint
+gst_matroska_index_seek_find (GstMatroskaIndex * i1, GstClockTime * time,
+ gpointer user_data)
+{
+ if (i1->time < *time)
+ return -1;
+ else if (i1->time > *time)
+ return 1;
+ else
+ return 0;
+}
+
+GstMatroskaIndex *
+gst_matroska_read_common_do_index_seek (GstMatroskaReadCommon * common,
+ GstMatroskaTrackContext * track, gint64 seek_pos, GArray ** _index,
+ gint * _entry_index)
+{
+ GstMatroskaIndex *entry = NULL;
+ GArray *index;
+
+ if (!common->index || !common->index->len)
+ return NULL;
+
+ /* find entry just before or at the requested position */
+ if (track && track->index_table)
+ index = track->index_table;
+ else
+ index = common->index;
+
+ entry =
+ gst_util_array_binary_search (index->data, index->len,
+ sizeof (GstMatroskaIndex),
+ (GCompareDataFunc) gst_matroska_index_seek_find, GST_SEARCH_MODE_BEFORE,
+ &seek_pos, NULL);
+
+ if (entry == NULL)
+ entry = &g_array_index (index, GstMatroskaIndex, 0);
+
+ if (_index)
+ *_index = index;
+ if (_entry_index)
+ *_entry_index = entry - (GstMatroskaIndex *) index->data;
+
+ return entry;
+}
+
static gint
gst_matroska_read_common_encoding_cmp (GstMatroskaTrackEncoding * a,
GstMatroskaTrackEncoding * b)
GstFlowReturn gst_matroska_decode_content_encodings (GArray * encodings);
gboolean gst_matroska_decode_data (GArray * encodings, guint8 ** data_out,
guint * size_out, GstMatroskaTrackEncodingScope scope, gboolean free);
+gint gst_matroska_index_seek_find (GstMatroskaIndex * i1, GstClockTime * time,
+ gpointer user_data);
+GstMatroskaIndex * gst_matroska_read_common_do_index_seek (
+ GstMatroskaReadCommon * common, GstMatroskaTrackContext * track, gint64
+ seek_pos, GArray ** _index, gint * _entry_index);
gint64 gst_matroska_read_common_get_length (GstMatroskaReadCommon * common);
GstFlowReturn gst_matroska_read_common_parse_index (GstMatroskaReadCommon *
common, GstEbmlRead * ebml);