splitmuxsrc: Pass seek flags when activating.

Pass all seek flags when activating a part
based on a seek, so that SNAP flags are preserved.
This commit is contained in:
Jan Schmidt 2016-12-28 22:49:27 +11:00
parent 6a16f8ef2e
commit 389dd4e3d0
3 changed files with 12 additions and 10 deletions

View file

@ -815,12 +815,12 @@ gst_splitmux_part_reader_seek_to_time_locked (GstSplitMuxPartReader * reader,
/* Map the passed segment to 'internal' time from 0 to length of this piece and seek. Lock cannot be held */ /* Map the passed segment to 'internal' time from 0 to length of this piece and seek. Lock cannot be held */
static gboolean static gboolean
gst_splitmux_part_reader_seek_to_segment (GstSplitMuxPartReader * reader, gst_splitmux_part_reader_seek_to_segment (GstSplitMuxPartReader * reader,
GstSegment * target_seg) GstSegment * target_seg, GstSeekFlags extra_flags)
{ {
GstSeekFlags flags; GstSeekFlags flags;
GstClockTime start = 0, stop = GST_CLOCK_TIME_NONE; GstClockTime start = 0, stop = GST_CLOCK_TIME_NONE;
flags = target_seg->flags | GST_SEEK_FLAG_FLUSH; flags = target_seg->flags | GST_SEEK_FLAG_FLUSH | extra_flags;
SPLITMUX_PART_LOCK (reader); SPLITMUX_PART_LOCK (reader);
if (target_seg->start >= reader->start_offset) if (target_seg->start >= reader->start_offset)
@ -1167,11 +1167,11 @@ gst_splitmux_part_reader_set_location (GstSplitMuxPartReader * reader,
gboolean gboolean
gst_splitmux_part_reader_activate (GstSplitMuxPartReader * reader, gst_splitmux_part_reader_activate (GstSplitMuxPartReader * reader,
GstSegment * seg) GstSegment * seg, GstSeekFlags extra_flags)
{ {
GST_DEBUG_OBJECT (reader, "Activating part reader"); GST_DEBUG_OBJECT (reader, "Activating part reader");
if (!gst_splitmux_part_reader_seek_to_segment (reader, seg)) { if (!gst_splitmux_part_reader_seek_to_segment (reader, seg, extra_flags)) {
GST_ERROR_OBJECT (reader, "Failed to seek part to %" GST_SEGMENT_FORMAT, GST_ERROR_OBJECT (reader, "Failed to seek part to %" GST_SEGMENT_FORMAT,
seg); seg);
return FALSE; return FALSE;

View file

@ -101,7 +101,7 @@ void gst_splitmux_part_reader_set_location (GstSplitMuxPartReader *reader,
const gchar *path); const gchar *path);
gboolean gst_splitmux_part_is_eos (GstSplitMuxPartReader *reader); gboolean gst_splitmux_part_is_eos (GstSplitMuxPartReader *reader);
gboolean gst_splitmux_part_reader_activate (GstSplitMuxPartReader *part, GstSegment *seg); gboolean gst_splitmux_part_reader_activate (GstSplitMuxPartReader *part, GstSegment *seg, GstSeekFlags extra_flags);
void gst_splitmux_part_reader_deactivate (GstSplitMuxPartReader *part); void gst_splitmux_part_reader_deactivate (GstSplitMuxPartReader *part);
gboolean gst_splitmux_part_reader_is_active (GstSplitMuxPartReader *part); gboolean gst_splitmux_part_reader_is_active (GstSplitMuxPartReader *part);

View file

@ -575,7 +575,8 @@ flushing:
} }
static gboolean static gboolean
gst_splitmux_src_activate_part (GstSplitMuxSrc * splitmux, guint part) gst_splitmux_src_activate_part (GstSplitMuxSrc * splitmux, guint part,
GstSeekFlags extra_flags)
{ {
GList *cur; GList *cur;
@ -583,7 +584,7 @@ gst_splitmux_src_activate_part (GstSplitMuxSrc * splitmux, guint part)
splitmux->cur_part = part; splitmux->cur_part = part;
if (!gst_splitmux_part_reader_activate (splitmux->parts[part], if (!gst_splitmux_part_reader_activate (splitmux->parts[part],
&splitmux->play_segment)) &splitmux->play_segment, extra_flags))
return FALSE; return FALSE;
SPLITMUX_SRC_PADS_LOCK (splitmux); SPLITMUX_SRC_PADS_LOCK (splitmux);
@ -693,7 +694,7 @@ gst_splitmux_src_start (GstSplitMuxSrc * splitmux)
GST_INFO_OBJECT (splitmux, GST_INFO_OBJECT (splitmux,
"All parts prepared. Total duration %" GST_TIME_FORMAT "All parts prepared. Total duration %" GST_TIME_FORMAT
" Activating first part", GST_TIME_ARGS (total_duration)); " Activating first part", GST_TIME_ARGS (total_duration));
ret = gst_splitmux_src_activate_part (splitmux, 0); ret = gst_splitmux_src_activate_part (splitmux, 0, GST_SEEK_FLAG_NONE);
if (ret == FALSE) if (ret == FALSE)
goto failed_first_part; goto failed_first_part;
done: done:
@ -996,7 +997,8 @@ gst_splitmux_end_of_part (GstSplitMuxSrc * splitmux, SplitMuxSrcPad * splitpad)
GST_DEBUG_OBJECT (splitpad, GST_DEBUG_OBJECT (splitpad,
"First pad to change part. Activating part %d with seg %" "First pad to change part. Activating part %d with seg %"
GST_SEGMENT_FORMAT, next_part, &tmp); GST_SEGMENT_FORMAT, next_part, &tmp);
if (!gst_splitmux_part_reader_activate (splitpad->reader, &tmp)) if (!gst_splitmux_part_reader_activate (splitpad->reader, &tmp,
GST_SEEK_FLAG_NONE))
goto error; goto error;
} }
splitmux->cur_part = next_part; splitmux->cur_part = next_part;
@ -1168,7 +1170,7 @@ splitmux_src_pad_event (GstPad * pad, GstObject * parent, GstEvent * event)
GST_TIME_FORMAT, GST_TIME_ARGS (position), GST_TIME_FORMAT, GST_TIME_ARGS (position),
i, GST_TIME_ARGS (position - part_start)); i, GST_TIME_ARGS (position - part_start));
ret = gst_splitmux_src_activate_part (splitmux, i); ret = gst_splitmux_src_activate_part (splitmux, i, flags);
SPLITMUX_SRC_UNLOCK (splitmux); SPLITMUX_SRC_UNLOCK (splitmux);
} }
default: default: