mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-22 14:06:23 +00:00
splitmuxsrc: Rename some internal terminology
A part reader can be 'loaded' (prepared, but not currently outputting anything) or 'playing' (actively being used to output data) Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7053>
This commit is contained in:
parent
3121eeeb08
commit
93c04e7473
3 changed files with 30 additions and 25 deletions
|
@ -114,10 +114,10 @@ have_empty_queue (GstSplitMuxPartReader * reader)
|
||||||
static gboolean
|
static gboolean
|
||||||
block_until_can_push (GstSplitMuxPartReader * reader)
|
block_until_can_push (GstSplitMuxPartReader * reader)
|
||||||
{
|
{
|
||||||
while (reader->running) {
|
while (reader->loaded) {
|
||||||
if (reader->flushing)
|
if (reader->flushing)
|
||||||
goto out;
|
goto out;
|
||||||
if (reader->active && have_empty_queue (reader))
|
if (reader->playing && have_empty_queue (reader))
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
GST_LOG_OBJECT (reader,
|
GST_LOG_OBJECT (reader,
|
||||||
|
@ -125,10 +125,10 @@ block_until_can_push (GstSplitMuxPartReader * reader)
|
||||||
SPLITMUX_PART_WAIT (reader);
|
SPLITMUX_PART_WAIT (reader);
|
||||||
}
|
}
|
||||||
|
|
||||||
GST_LOG_OBJECT (reader, "Done waiting on reader %s active %d flushing %d",
|
GST_LOG_OBJECT (reader, "Done waiting on reader %s playing %d flushing %d",
|
||||||
reader->path, reader->active, reader->flushing);
|
reader->path, reader->playing, reader->flushing);
|
||||||
out:
|
out:
|
||||||
return reader->active && !reader->flushing;
|
return reader->playing && !reader->flushing;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -603,14 +603,14 @@ splitmux_part_pad_query (GstPad * pad, GstObject * parent, GstQuery * query)
|
||||||
GstSplitMuxPartReader *reader = part_pad->reader;
|
GstSplitMuxPartReader *reader = part_pad->reader;
|
||||||
GstPad *target;
|
GstPad *target;
|
||||||
gboolean ret = FALSE;
|
gboolean ret = FALSE;
|
||||||
gboolean active;
|
gboolean playing;
|
||||||
|
|
||||||
SPLITMUX_PART_LOCK (reader);
|
SPLITMUX_PART_LOCK (reader);
|
||||||
target = gst_object_ref (part_pad->target);
|
target = gst_object_ref (part_pad->target);
|
||||||
active = reader->active;
|
playing = reader->playing;
|
||||||
SPLITMUX_PART_UNLOCK (reader);
|
SPLITMUX_PART_UNLOCK (reader);
|
||||||
|
|
||||||
if (active) {
|
if (playing) {
|
||||||
GST_LOG_OBJECT (pad, "Forwarding query %" GST_PTR_FORMAT
|
GST_LOG_OBJECT (pad, "Forwarding query %" GST_PTR_FORMAT
|
||||||
" from %" GST_PTR_FORMAT " on %" GST_PTR_FORMAT, query, pad, target);
|
" from %" GST_PTR_FORMAT " on %" GST_PTR_FORMAT, query, pad, target);
|
||||||
|
|
||||||
|
@ -717,7 +717,8 @@ gst_splitmux_part_reader_init (GstSplitMuxPartReader * reader)
|
||||||
reader->prep_state = PART_STATE_NULL;
|
reader->prep_state = PART_STATE_NULL;
|
||||||
reader->need_duration_measuring = TRUE;
|
reader->need_duration_measuring = TRUE;
|
||||||
|
|
||||||
reader->active = FALSE;
|
reader->loaded = FALSE;
|
||||||
|
reader->playing = FALSE;
|
||||||
reader->smallest_ts_offset = GST_CLOCK_TIME_NONE;
|
reader->smallest_ts_offset = GST_CLOCK_TIME_NONE;
|
||||||
reader->info.start_offset = GST_CLOCK_TIME_NONE;
|
reader->info.start_offset = GST_CLOCK_TIME_NONE;
|
||||||
reader->info.duration = GST_CLOCK_TIME_NONE;
|
reader->info.duration = GST_CLOCK_TIME_NONE;
|
||||||
|
@ -1214,7 +1215,7 @@ gst_splitmux_part_reader_change_state (GstElement * element,
|
||||||
g_object_set (reader->src, "location", reader->path, NULL);
|
g_object_set (reader->src, "location", reader->path, NULL);
|
||||||
reader->prep_state = PART_STATE_PREPARING_COLLECT_STREAMS;
|
reader->prep_state = PART_STATE_PREPARING_COLLECT_STREAMS;
|
||||||
gst_splitmux_part_reader_set_flushing_locked (reader, FALSE);
|
gst_splitmux_part_reader_set_flushing_locked (reader, FALSE);
|
||||||
reader->running = TRUE;
|
reader->loaded = TRUE;
|
||||||
SPLITMUX_PART_UNLOCK (reader);
|
SPLITMUX_PART_UNLOCK (reader);
|
||||||
|
|
||||||
/* we go to PAUSED asynchronously once all streams have been collected
|
/* we go to PAUSED asynchronously once all streams have been collected
|
||||||
|
@ -1226,13 +1227,13 @@ gst_splitmux_part_reader_change_state (GstElement * element,
|
||||||
case GST_STATE_CHANGE_PAUSED_TO_READY:
|
case GST_STATE_CHANGE_PAUSED_TO_READY:
|
||||||
SPLITMUX_PART_LOCK (reader);
|
SPLITMUX_PART_LOCK (reader);
|
||||||
gst_splitmux_part_reader_set_flushing_locked (reader, TRUE);
|
gst_splitmux_part_reader_set_flushing_locked (reader, TRUE);
|
||||||
reader->running = FALSE;
|
reader->loaded = FALSE;
|
||||||
SPLITMUX_PART_BROADCAST (reader);
|
SPLITMUX_PART_BROADCAST (reader);
|
||||||
SPLITMUX_PART_UNLOCK (reader);
|
SPLITMUX_PART_UNLOCK (reader);
|
||||||
break;
|
break;
|
||||||
case GST_STATE_CHANGE_PLAYING_TO_PAUSED:
|
case GST_STATE_CHANGE_PLAYING_TO_PAUSED:
|
||||||
SPLITMUX_PART_LOCK (reader);
|
SPLITMUX_PART_LOCK (reader);
|
||||||
reader->active = FALSE;
|
reader->playing = FALSE;
|
||||||
gst_splitmux_part_reader_set_flushing_locked (reader, TRUE);
|
gst_splitmux_part_reader_set_flushing_locked (reader, TRUE);
|
||||||
SPLITMUX_PART_BROADCAST (reader);
|
SPLITMUX_PART_BROADCAST (reader);
|
||||||
SPLITMUX_PART_UNLOCK (reader);
|
SPLITMUX_PART_UNLOCK (reader);
|
||||||
|
@ -1258,7 +1259,7 @@ gst_splitmux_part_reader_change_state (GstElement * element,
|
||||||
case GST_STATE_CHANGE_PAUSED_TO_PLAYING:
|
case GST_STATE_CHANGE_PAUSED_TO_PLAYING:
|
||||||
SPLITMUX_PART_LOCK (reader);
|
SPLITMUX_PART_LOCK (reader);
|
||||||
gst_splitmux_part_reader_set_flushing_locked (reader, FALSE);
|
gst_splitmux_part_reader_set_flushing_locked (reader, FALSE);
|
||||||
reader->active = TRUE;
|
reader->playing = TRUE;
|
||||||
SPLITMUX_PART_BROADCAST (reader);
|
SPLITMUX_PART_BROADCAST (reader);
|
||||||
SPLITMUX_PART_UNLOCK (reader);
|
SPLITMUX_PART_UNLOCK (reader);
|
||||||
break;
|
break;
|
||||||
|
@ -1297,7 +1298,7 @@ gst_splitmux_part_reader_prepare_sync (GstSplitMuxPartReader * reader)
|
||||||
|
|
||||||
if (ret == GST_STATE_CHANGE_ASYNC) {
|
if (ret == GST_STATE_CHANGE_ASYNC) {
|
||||||
SPLITMUX_PART_LOCK (reader);
|
SPLITMUX_PART_LOCK (reader);
|
||||||
while (reader->running && reader->prep_state != PART_STATE_READY) {
|
while (reader->loaded && reader->prep_state != PART_STATE_READY) {
|
||||||
if (reader->prep_state == PART_STATE_FAILED) {
|
if (reader->prep_state == PART_STATE_FAILED) {
|
||||||
SPLITMUX_PART_UNLOCK (reader);
|
SPLITMUX_PART_UNLOCK (reader);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -1321,12 +1322,12 @@ gst_splitmux_part_reader_unprepare (GstSplitMuxPartReader * part)
|
||||||
}
|
}
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
gst_splitmux_part_reader_is_running (GstSplitMuxPartReader * part)
|
gst_splitmux_part_reader_is_loaded (GstSplitMuxPartReader * part)
|
||||||
{
|
{
|
||||||
gboolean ret;
|
gboolean ret;
|
||||||
|
|
||||||
SPLITMUX_PART_LOCK (part);
|
SPLITMUX_PART_LOCK (part);
|
||||||
ret = part->running;
|
ret = part->loaded;
|
||||||
SPLITMUX_PART_UNLOCK (part);
|
SPLITMUX_PART_UNLOCK (part);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -1364,12 +1365,12 @@ gst_splitmux_part_reader_activate (GstSplitMuxPartReader * reader,
|
||||||
}
|
}
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
gst_splitmux_part_reader_is_active (GstSplitMuxPartReader * part)
|
gst_splitmux_part_reader_is_playing (GstSplitMuxPartReader * part)
|
||||||
{
|
{
|
||||||
gboolean ret;
|
gboolean ret;
|
||||||
|
|
||||||
SPLITMUX_PART_LOCK (part);
|
SPLITMUX_PART_LOCK (part);
|
||||||
ret = part->active;
|
ret = part->playing;
|
||||||
SPLITMUX_PART_UNLOCK (part);
|
SPLITMUX_PART_UNLOCK (part);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
|
|
@ -74,8 +74,10 @@ struct _GstSplitMuxPartReader
|
||||||
GstElement *demux;
|
GstElement *demux;
|
||||||
|
|
||||||
gboolean async_pending;
|
gboolean async_pending;
|
||||||
gboolean active;
|
|
||||||
gboolean running;
|
gboolean loaded;
|
||||||
|
gboolean playing;
|
||||||
|
|
||||||
gboolean prepared;
|
gboolean prepared;
|
||||||
gboolean flushing;
|
gboolean flushing;
|
||||||
gboolean no_more_pads;
|
gboolean no_more_pads;
|
||||||
|
@ -108,11 +110,13 @@ struct _GstSplitMuxPartReaderClass
|
||||||
|
|
||||||
GType gst_splitmux_part_reader_get_type (void);
|
GType gst_splitmux_part_reader_get_type (void);
|
||||||
|
|
||||||
|
gboolean gst_splitmux_part_reader_is_loaded (GstSplitMuxPartReader *part);
|
||||||
|
gboolean gst_splitmux_part_reader_is_playing (GstSplitMuxPartReader *part);
|
||||||
|
|
||||||
void gst_splitmux_part_reader_set_callbacks (GstSplitMuxPartReader *reader,
|
void gst_splitmux_part_reader_set_callbacks (GstSplitMuxPartReader *reader,
|
||||||
gpointer cb_data, GstSplitMuxPartReaderPadCb get_pad_cb, GstSplitMuxPartReaderMeasuredCb measured_cb);
|
gpointer cb_data, GstSplitMuxPartReaderPadCb get_pad_cb, GstSplitMuxPartReaderMeasuredCb measured_cb);
|
||||||
gboolean gst_splitmux_part_reader_prepare (GstSplitMuxPartReader *part);
|
gboolean gst_splitmux_part_reader_prepare (GstSplitMuxPartReader *part);
|
||||||
void gst_splitmux_part_reader_unprepare (GstSplitMuxPartReader *part);
|
void gst_splitmux_part_reader_unprepare (GstSplitMuxPartReader *part);
|
||||||
gboolean gst_splitmux_part_reader_is_running (GstSplitMuxPartReader *part);
|
|
||||||
void gst_splitmux_part_reader_set_location (GstSplitMuxPartReader *reader,
|
void gst_splitmux_part_reader_set_location (GstSplitMuxPartReader *reader,
|
||||||
const gchar *path);
|
const gchar *path);
|
||||||
gboolean gst_splitmux_part_reader_needs_measuring (GstSplitMuxPartReader *reader);
|
gboolean gst_splitmux_part_reader_needs_measuring (GstSplitMuxPartReader *reader);
|
||||||
|
@ -120,7 +124,6 @@ gboolean gst_splitmux_part_is_eos (GstSplitMuxPartReader *reader);
|
||||||
|
|
||||||
gboolean gst_splitmux_part_reader_activate (GstSplitMuxPartReader *part, GstSegment *seg, GstSeekFlags extra_flags);
|
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);
|
|
||||||
|
|
||||||
void gst_splitmux_part_reader_stop (GstSplitMuxPartReader *part);
|
void gst_splitmux_part_reader_stop (GstSplitMuxPartReader *part);
|
||||||
|
|
||||||
|
|
|
@ -921,7 +921,8 @@ reduce_active_readers (GstSplitMuxSrc * splitmux)
|
||||||
splitmux->target_max_readers) {
|
splitmux->target_max_readers) {
|
||||||
GstSplitMuxPartReader *oldest_reader =
|
GstSplitMuxPartReader *oldest_reader =
|
||||||
g_queue_peek_head (splitmux->active_parts);
|
g_queue_peek_head (splitmux->active_parts);
|
||||||
if (gst_splitmux_part_reader_is_active (oldest_reader)) {
|
if (gst_splitmux_part_reader_is_playing (oldest_reader)) {
|
||||||
|
/* This part is still playing on some pad(s). Keep it active */
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -940,7 +941,7 @@ add_to_active_readers (GstSplitMuxSrc * splitmux,
|
||||||
if (splitmux->target_max_readers != 0) {
|
if (splitmux->target_max_readers != 0) {
|
||||||
/* Check if it's already in the active reader pool, and move this reader
|
/* Check if it's already in the active reader pool, and move this reader
|
||||||
* to the tail, or else add a ref and push it on the tail */
|
* to the tail, or else add a ref and push it on the tail */
|
||||||
if (gst_splitmux_part_reader_is_running (reader)) {
|
if (gst_splitmux_part_reader_is_loaded (reader)) {
|
||||||
/* Already in the queue, and reffed, move it to the end without
|
/* Already in the queue, and reffed, move it to the end without
|
||||||
* adding another ref */
|
* adding another ref */
|
||||||
gboolean in_queue = g_queue_remove (splitmux->active_parts, reader);
|
gboolean in_queue = g_queue_remove (splitmux->active_parts, reader);
|
||||||
|
@ -1446,7 +1447,7 @@ gst_splitmux_end_of_part (GstSplitMuxSrc * splitmux, SplitMuxSrcPad * splitpad)
|
||||||
splitpad->reader = splitmux->parts[splitpad->cur_part];
|
splitpad->reader = splitmux->parts[splitpad->cur_part];
|
||||||
|
|
||||||
if (splitmux->cur_part != next_part) {
|
if (splitmux->cur_part != next_part) {
|
||||||
if (!gst_splitmux_part_reader_is_active (splitpad->reader)) {
|
if (!gst_splitmux_part_reader_is_playing (splitpad->reader)) {
|
||||||
GstSegment tmp;
|
GstSegment tmp;
|
||||||
/* If moving backward into a new part, set stop
|
/* If moving backward into a new part, set stop
|
||||||
* to -1 to ensure we play the entire file - workaround
|
* to -1 to ensure we play the entire file - workaround
|
||||||
|
|
Loading…
Reference in a new issue