summaryrefslogtreecommitdiff
path: root/gst
diff options
context:
space:
mode:
authorSebastian Dröge <sebastian@centricular.com>2020-06-25 12:58:48 +0300
committerSebastian Dröge <sebastian@centricular.com>2020-06-25 17:53:00 +0300
commit13331e051fa9215f575ef1620ab437cb18d5bbf9 (patch)
tree3abfe90e73b1292b0f105ce6863dc57acb7f019b /gst
parent8d464c8361f47d32d7e5d7ce22b6c9c32bcb9605 (diff)
splitmuxsink: Add new properties for setting muxer/sink presets
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/644>
Diffstat (limited to 'gst')
-rw-r--r--gst/multifile/gstsplitmuxsink.c68
-rw-r--r--gst/multifile/gstsplitmuxsink.h2
2 files changed, 70 insertions, 0 deletions
diff --git a/gst/multifile/gstsplitmuxsink.c b/gst/multifile/gstsplitmuxsink.c
index 5637c433f..d2b27028f 100644
--- a/gst/multifile/gstsplitmuxsink.c
+++ b/gst/multifile/gstsplitmuxsink.c
@@ -111,8 +111,10 @@ enum
PROP_RESET_MUXER,
PROP_ASYNC_FINALIZE,
PROP_MUXER_FACTORY,
+ PROP_MUXER_PRESET,
PROP_MUXER_PROPERTIES,
PROP_SINK_FACTORY,
+ PROP_SINK_PRESET,
PROP_SINK_PROPERTIES,
PROP_MUXERPAD_MAP
};
@@ -386,6 +388,19 @@ gst_splitmux_sink_class_init (GstSplitMuxSinkClass * klass)
"The muxer element factory to use (default = mp4mux). "
"Valid only for async-finalize = TRUE",
"mp4mux", G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+ /**
+ * GstSplitMuxSink:muxer-preset
+ *
+ * An optional #GstPreset name to use for the muxer. This only has an effect
+ * in `async-finalize=TRUE` mode.
+ *
+ * Since: 1.18
+ */
+ g_object_class_install_property (gobject_class, PROP_MUXER_PRESET,
+ g_param_spec_string ("muxer-preset", "Muxer preset",
+ "The muxer preset to use. "
+ "Valid only for async-finalize = TRUE",
+ NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class, PROP_MUXER_PROPERTIES,
g_param_spec_boxed ("muxer-properties", "Muxer properties",
"The muxer element properties to use. "
@@ -397,6 +412,19 @@ gst_splitmux_sink_class_init (GstSplitMuxSinkClass * klass)
"The sink element factory to use (default = filesink). "
"Valid only for async-finalize = TRUE",
"filesink", G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+ /**
+ * GstSplitMuxSink:sink-preset
+ *
+ * An optional #GstPreset name to use for the sink. This only has an effect
+ * in `async-finalize=TRUE` mode.
+ *
+ * Since: 1.18
+ */
+ g_object_class_install_property (gobject_class, PROP_SINK_PRESET,
+ g_param_spec_string ("sink-preset", "Sink preset",
+ "The sink preset to use. "
+ "Valid only for async-finalize = TRUE",
+ NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class, PROP_SINK_PROPERTIES,
g_param_spec_boxed ("sink-properties", "Sink properties",
"The sink element properties to use. "
@@ -627,10 +655,14 @@ gst_splitmux_sink_finalize (GObject * object)
if (splitmux->muxer_factory)
g_free (splitmux->muxer_factory);
+ if (splitmux->muxer_preset)
+ g_free (splitmux->muxer_preset);
if (splitmux->muxer_properties)
gst_structure_free (splitmux->muxer_properties);
if (splitmux->sink_factory)
g_free (splitmux->sink_factory);
+ if (splitmux->sink_preset)
+ g_free (splitmux->sink_preset);
if (splitmux->sink_properties)
gst_structure_free (splitmux->sink_properties);
@@ -799,6 +831,13 @@ gst_splitmux_sink_set_property (GObject * object, guint prop_id,
splitmux->muxer_factory = g_value_dup_string (value);
GST_OBJECT_UNLOCK (splitmux);
break;
+ case PROP_MUXER_PRESET:
+ GST_OBJECT_LOCK (splitmux);
+ if (splitmux->muxer_preset)
+ g_free (splitmux->muxer_preset);
+ splitmux->muxer_preset = g_value_dup_string (value);
+ GST_OBJECT_UNLOCK (splitmux);
+ break;
case PROP_MUXER_PROPERTIES:
GST_OBJECT_LOCK (splitmux);
if (splitmux->muxer_properties)
@@ -817,6 +856,13 @@ gst_splitmux_sink_set_property (GObject * object, guint prop_id,
splitmux->sink_factory = g_value_dup_string (value);
GST_OBJECT_UNLOCK (splitmux);
break;
+ case PROP_SINK_PRESET:
+ GST_OBJECT_LOCK (splitmux);
+ if (splitmux->sink_preset)
+ g_free (splitmux->sink_preset);
+ splitmux->sink_preset = g_value_dup_string (value);
+ GST_OBJECT_UNLOCK (splitmux);
+ break;
case PROP_SINK_PROPERTIES:
GST_OBJECT_LOCK (splitmux);
if (splitmux->sink_properties)
@@ -930,6 +976,11 @@ gst_splitmux_sink_get_property (GObject * object, guint prop_id,
g_value_set_string (value, splitmux->muxer_factory);
GST_OBJECT_UNLOCK (splitmux);
break;
+ case PROP_MUXER_PRESET:
+ GST_OBJECT_LOCK (splitmux);
+ g_value_set_string (value, splitmux->muxer_preset);
+ GST_OBJECT_UNLOCK (splitmux);
+ break;
case PROP_MUXER_PROPERTIES:
GST_OBJECT_LOCK (splitmux);
gst_value_set_structure (value, splitmux->muxer_properties);
@@ -940,6 +991,11 @@ gst_splitmux_sink_get_property (GObject * object, guint prop_id,
g_value_set_string (value, splitmux->sink_factory);
GST_OBJECT_UNLOCK (splitmux);
break;
+ case PROP_SINK_PRESET:
+ GST_OBJECT_LOCK (splitmux);
+ g_value_set_string (value, splitmux->sink_preset);
+ GST_OBJECT_UNLOCK (splitmux);
+ break;
case PROP_SINK_PROPERTIES:
GST_OBJECT_LOCK (splitmux);
gst_value_set_structure (value, splitmux->sink_properties);
@@ -1851,6 +1907,9 @@ start_next_fragment (GstSplitMuxSink * splitmux, MqStreamCtx * ctx)
create_element (splitmux, splitmux->sink_factory, newname,
TRUE)) == NULL)
goto fail;
+ if (splitmux->sink_preset && GST_IS_PRESET (splitmux->sink))
+ gst_preset_load_preset (GST_PRESET (splitmux->sink),
+ splitmux->sink_preset);
if (splitmux->sink_properties)
gst_structure_foreach (splitmux->sink_properties,
_set_property_from_structure, splitmux->sink);
@@ -1868,6 +1927,9 @@ start_next_fragment (GstSplitMuxSink * splitmux, MqStreamCtx * ctx)
* failures, so let's try and turn that off */
g_object_set (splitmux->sink, "async", FALSE, NULL);
}
+ if (splitmux->muxer_preset && GST_IS_PRESET (splitmux->muxer))
+ gst_preset_load_preset (GST_PRESET (splitmux->muxer),
+ splitmux->muxer_preset);
if (splitmux->muxer_properties)
gst_structure_foreach (splitmux->muxer_properties,
_set_property_from_structure, splitmux->muxer);
@@ -3168,6 +3230,9 @@ create_muxer (GstSplitMuxSink * splitmux)
create_element (splitmux, splitmux->muxer_factory, "muxer",
FALSE)) == NULL)
goto fail;
+ if (splitmux->muxer_preset && GST_IS_PRESET (splitmux->muxer))
+ gst_preset_load_preset (GST_PRESET (splitmux->muxer),
+ splitmux->muxer_preset);
if (splitmux->muxer_properties)
gst_structure_foreach (splitmux->muxer_properties,
_set_property_from_structure, splitmux->muxer);
@@ -3262,6 +3327,9 @@ create_sink (GstSplitMuxSink * splitmux)
create_element (splitmux, splitmux->sink_factory, "sink",
TRUE)) == NULL)
goto fail;
+ if (splitmux->sink_preset && GST_IS_PRESET (splitmux->sink))
+ gst_preset_load_preset (GST_PRESET (splitmux->sink),
+ splitmux->sink_preset);
if (splitmux->sink_properties)
gst_structure_foreach (splitmux->sink_properties,
_set_property_from_structure, splitmux->sink);
diff --git a/gst/multifile/gstsplitmuxsink.h b/gst/multifile/gstsplitmuxsink.h
index 81e144d0f..67df4d4d4 100644
--- a/gst/multifile/gstsplitmuxsink.h
+++ b/gst/multifile/gstsplitmuxsink.h
@@ -188,8 +188,10 @@ struct _GstSplitMuxSink
/* Async finalize options */
gboolean async_finalize;
gchar *muxer_factory;
+ gchar *muxer_preset;
GstStructure *muxer_properties;
gchar *sink_factory;
+ gchar *sink_preset;
GstStructure *sink_properties;
GstStructure *muxerpad_map;