Skip to content

Instantly share code, notes, and snippets.

@AlexBolotsin
Last active December 11, 2015 16:35
Show Gist options
  • Save AlexBolotsin/f3ae7d785f16b47bccf6 to your computer and use it in GitHub Desktop.
Save AlexBolotsin/f3ae7d785f16b47bccf6 to your computer and use it in GitHub Desktop.
Patch for gstreamer multifilesink that allows you to pass bigger values to max_file_duration
diff --git a/gst/multifile/gstmultifilesink.c b/gst/multifile/gstmultifilesink.c
index c74c20b..646d544 100644
--- a/gst/multifile/gstmultifilesink.c
+++ b/gst/multifile/gstmultifilesink.c
@@ -138,6 +138,7 @@ GST_DEBUG_CATEGORY_STATIC (gst_multi_file_sink_debug);
#define DEFAULT_MAX_FILE_SIZE G_GUINT64_CONSTANT(2*1024*1024*1024)
#define DEFAULT_MAX_FILE_DURATION GST_CLOCK_TIME_NONE
#define DEFAULT_AGGREGATE_GOPS FALSE
+#define GST_MFS_SECOND 1e9
enum
{
@@ -149,6 +150,7 @@ enum
PROP_MAX_FILES,
PROP_MAX_FILE_SIZE,
PROP_MAX_FILE_DURATION,
+ PROP_MAX_FILE_DURATION_SECS,
PROP_AGGREGATE_GOPS
};
@@ -279,15 +281,26 @@ gst_multi_file_sink_class_init (GstMultiFileSinkClass * klass)
/**
* GstMultiFileSink:max-file-duration:
*
- * Maximum file size before starting a new file in max-size mode.
+ * Maximum video duration before starting a new file in max-size mode.
*/
g_object_class_install_property (gobject_class, PROP_MAX_FILE_DURATION,
- g_param_spec_uint64 ("max-file-duration", "Maximum File Duration",
- "Maximum file duration before starting a new file in max-size mode",
+ g_param_spec_uint64 ("max-file-duration", "Maximum Video Duration",
+ "Maximum video duration before starting a new file in max-duration mode",
0, G_MAXUINT64, DEFAULT_MAX_FILE_DURATION,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
/**
+ * GstMultiFileSink:max-file-duration:
+ *
+ * Maximum video duration before starting a new file in max-size mode.
+ */
+ g_object_class_install_property (gobject_class, PROP_MAX_FILE_DURATION_SECS,
+ g_param_spec_uint64 ("max-file-duration-secs", "Maximum Video Duration",
+ "Maximum video duration before starting a new file in max-duration mode",
+ 0, G_MAXINT, 0xFFFF,
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+
+ /**
* GstMultiFileSink:aggregate-gops:
*
* Whether to aggregate complete GOPs before doing any processing. Set this
@@ -398,6 +411,9 @@ gst_multi_file_sink_set_property (GObject * object, guint prop_id,
case PROP_MAX_FILE_DURATION:
sink->max_file_duration = g_value_get_uint64 (value);
break;
+ case PROP_MAX_FILE_DURATION_SECS:
+ sink->max_file_duration = g_value_get_uint64 (value) * GST_MFS_SECOND;
+ break;
case PROP_AGGREGATE_GOPS:
sink->aggregate_gops = g_value_get_boolean (value);
break;
@@ -435,6 +451,9 @@ gst_multi_file_sink_get_property (GObject * object, guint prop_id,
case PROP_MAX_FILE_DURATION:
g_value_set_uint64 (value, sink->max_file_duration);
break;
+ case PROP_MAX_FILE_DURATION_SECS:
+ g_value_set_uint64 (value, sink->max_file_duration / GST_MFS_SECOND);
+ break;
case PROP_AGGREGATE_GOPS:
g_value_set_boolean (value, sink->aggregate_gops);
break;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment