return res;
}
-/* determine track to seek in */
-static GstMatroskaTrackContext *
-gst_matroska_demux_get_seek_track (GstMatroskaDemux * demux,
- GstMatroskaTrackContext * track)
-{
- gint i;
-
- if (track && track->type == GST_MATROSKA_TRACK_TYPE_VIDEO)
- return track;
-
- for (i = 0; i < demux->common.src->len; i++) {
- GstMatroskaTrackContext *stream;
-
- stream = g_ptr_array_index (demux->common.src, i);
- if (stream->type == GST_MATROSKA_TRACK_TYPE_VIDEO && stream->index_table)
- track = stream;
- }
-
- return track;
-}
-
-/* call with object lock held */
-static void
-gst_matroska_demux_reset_streams (GstMatroskaDemux * demux, GstClockTime time,
- gboolean full)
-{
- gint i;
-
- GST_DEBUG_OBJECT (demux, "resetting stream state");
-
- g_assert (demux->common.src->len == demux->common.num_streams);
- for (i = 0; i < demux->common.src->len; i++) {
- GstMatroskaTrackContext *context = g_ptr_array_index (demux->common.src,
- i);
- context->pos = time;
- context->set_discont = TRUE;
- context->eos = FALSE;
- context->from_time = GST_CLOCK_TIME_NONE;
- if (full)
- context->last_flow = GST_FLOW_OK;
- if (context->type == GST_MATROSKA_TRACK_TYPE_VIDEO) {
- GstMatroskaTrackVideoContext *videocontext =
- (GstMatroskaTrackVideoContext *) context;
- /* demux object lock held by caller */
- videocontext->earliest_time = GST_CLOCK_TIME_NONE;
- }
- }
-}
-
static gboolean
gst_matroska_demux_move_to_entry (GstMatroskaDemux * demux,
GstMatroskaIndex * entry, gboolean reset)
entry->block, GST_TIME_ARGS (entry->time));
/* update the time */
- gst_matroska_demux_reset_streams (demux, entry->time, TRUE);
+ gst_matroska_read_common_reset_streams (&demux->common, entry->time, TRUE);
demux->segment.last_stop = entry->time;
demux->seek_block = entry->block;
demux->seek_first = TRUE;
/* check sanity before we start flushing and all that */
GST_OBJECT_LOCK (demux);
- track = gst_matroska_demux_get_seek_track (demux, track);
+ track = gst_matroska_read_common_get_seek_track (&demux->common, track);
if ((entry = gst_matroska_read_common_do_index_seek (&demux->common, track,
seeksegment.last_stop, &demux->seek_index, &demux->seek_entry)) ==
NULL) {
GST_DEBUG_OBJECT (demux, "got DISCONT");
gst_adapter_clear (demux->common.adapter);
GST_OBJECT_LOCK (demux);
- gst_matroska_demux_reset_streams (demux, GST_CLOCK_TIME_NONE, FALSE);
+ gst_matroska_read_common_reset_streams (&demux->common,
+ GST_CLOCK_TIME_NONE, FALSE);
GST_OBJECT_UNLOCK (demux);
}
{
gst_adapter_clear (demux->common.adapter);
GST_OBJECT_LOCK (demux);
- gst_matroska_demux_reset_streams (demux, GST_CLOCK_TIME_NONE, TRUE);
+ gst_matroska_read_common_reset_streams (&demux->common,
+ GST_CLOCK_TIME_NONE, TRUE);
demux->segment.last_stop = GST_CLOCK_TIME_NONE;
demux->cluster_time = GST_CLOCK_TIME_NONE;
demux->cluster_offset = 0;
return res;
}
-/* determine track to seek in */
-static GstMatroskaTrackContext *
-gst_matroska_parse_get_seek_track (GstMatroskaParse * parse,
- GstMatroskaTrackContext * track)
-{
- gint i;
-
- if (track && track->type == GST_MATROSKA_TRACK_TYPE_VIDEO)
- return track;
-
- for (i = 0; i < parse->common.src->len; i++) {
- GstMatroskaTrackContext *stream;
-
- stream = g_ptr_array_index (parse->common.src, i);
- if (stream->type == GST_MATROSKA_TRACK_TYPE_VIDEO && stream->index_table)
- track = stream;
- }
-
- return track;
-}
-
-static void
-gst_matroska_parse_reset_streams (GstMatroskaParse * parse, GstClockTime time,
- gboolean full)
-{
- gint i;
-
- GST_DEBUG_OBJECT (parse, "resetting stream state");
-
- g_assert (parse->common.src->len == parse->common.num_streams);
- for (i = 0; i < parse->common.src->len; i++) {
- GstMatroskaTrackContext *context = g_ptr_array_index (parse->common.src,
- i);
- context->pos = time;
- context->set_discont = TRUE;
- context->eos = FALSE;
- context->from_time = GST_CLOCK_TIME_NONE;
- if (full)
- context->last_flow = GST_FLOW_OK;
- if (context->type == GST_MATROSKA_TRACK_TYPE_VIDEO) {
- GstMatroskaTrackVideoContext *videocontext =
- (GstMatroskaTrackVideoContext *) context;
- /* parse object lock held by caller */
- videocontext->earliest_time = GST_CLOCK_TIME_NONE;
- }
- }
-}
-
/* searches for a cluster start from @pos,
* return GST_FLOW_OK and cluster position in @pos if found */
static GstFlowReturn
if (pad)
track = gst_pad_get_element_private (pad);
- track = gst_matroska_parse_get_seek_track (parse, track);
+ track = gst_matroska_read_common_get_seek_track (&parse->common, track);
gst_event_parse_seek (event, &rate, &format, &flags, &cur_type, &cur,
&stop_type, &stop);
GST_DEBUG_OBJECT (parse, "got DISCONT");
gst_adapter_clear (parse->common.adapter);
GST_OBJECT_LOCK (parse);
- gst_matroska_parse_reset_streams (parse, GST_CLOCK_TIME_NONE, FALSE);
+ gst_matroska_read_common_reset_streams (&parse->common,
+ GST_CLOCK_TIME_NONE, FALSE);
GST_OBJECT_UNLOCK (parse);
}
{
gst_adapter_clear (parse->common.adapter);
GST_OBJECT_LOCK (parse);
- gst_matroska_parse_reset_streams (parse, GST_CLOCK_TIME_NONE, TRUE);
+ gst_matroska_read_common_reset_streams (&parse->common,
+ GST_CLOCK_TIME_NONE, TRUE);
GST_OBJECT_UNLOCK (parse);
parse->segment.last_stop = GST_CLOCK_TIME_NONE;
parse->cluster_time = GST_CLOCK_TIME_NONE;
return end;
}
+/* determine track to seek in */
+GstMatroskaTrackContext *
+gst_matroska_read_common_get_seek_track (GstMatroskaReadCommon * common,
+ GstMatroskaTrackContext * track)
+{
+ gint i;
+
+ if (track && track->type == GST_MATROSKA_TRACK_TYPE_VIDEO)
+ return track;
+
+ for (i = 0; i < common->src->len; i++) {
+ GstMatroskaTrackContext *stream;
+
+ stream = g_ptr_array_index (common->src, i);
+ if (stream->type == GST_MATROSKA_TRACK_TYPE_VIDEO && stream->index_table)
+ track = stream;
+ }
+
+ return track;
+}
+
/* skip unknown or alike element */
GstFlowReturn
gst_matroska_read_common_parse_skip (GstMatroskaReadCommon * common,
return gst_matroska_decode_content_encodings (context->encodings);
}
+/* call with object lock held */
+void
+gst_matroska_read_common_reset_streams (GstMatroskaReadCommon * common,
+ GstClockTime time, gboolean full)
+{
+ gint i;
+
+ GST_DEBUG_OBJECT (common, "resetting stream state");
+
+ g_assert (common->src->len == common->num_streams);
+ for (i = 0; i < common->src->len; i++) {
+ GstMatroskaTrackContext *context = g_ptr_array_index (common->src, i);
+ context->pos = time;
+ context->set_discont = TRUE;
+ context->eos = FALSE;
+ context->from_time = GST_CLOCK_TIME_NONE;
+ if (full)
+ context->last_flow = GST_FLOW_OK;
+ if (context->type == GST_MATROSKA_TRACK_TYPE_VIDEO) {
+ GstMatroskaTrackVideoContext *videocontext =
+ (GstMatroskaTrackVideoContext *) context;
+ /* demux object lock held by caller */
+ videocontext->earliest_time = GST_CLOCK_TIME_NONE;
+ }
+ }
+}
+
gboolean
gst_matroska_read_common_tracknumber_unique (GstMatroskaReadCommon * common,
guint64 num)
void gst_matroska_read_common_found_global_tag (GstMatroskaReadCommon * common,
GstElement * el, GstTagList * taglist);
gint64 gst_matroska_read_common_get_length (GstMatroskaReadCommon * common);
+GstMatroskaTrackContext * gst_matroska_read_common_get_seek_track (
+ GstMatroskaReadCommon * common, GstMatroskaTrackContext * track);
GstFlowReturn gst_matroska_read_common_parse_index (GstMatroskaReadCommon *
common, GstEbmlRead * ebml);
GstFlowReturn gst_matroska_read_common_parse_skip (GstMatroskaReadCommon *
GstFlowReturn gst_matroska_read_common_read_track_encodings (
GstMatroskaReadCommon * common, GstEbmlRead * ebml,
GstMatroskaTrackContext * context);
+void gst_matroska_read_common_reset_streams (GstMatroskaReadCommon * common,
+ GstClockTime time, gboolean full);
gboolean gst_matroska_read_common_tracknumber_unique (GstMatroskaReadCommon *
common, guint64 num);