summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--docs/plugins/gst_plugins_cache.json14
-rw-r--r--gst/audiolatency/gstaudiolatency.c32
-rw-r--r--gst/audiolatency/gstaudiolatency.h1
3 files changed, 44 insertions, 3 deletions
diff --git a/docs/plugins/gst_plugins_cache.json b/docs/plugins/gst_plugins_cache.json
index bbfd18219..05af1ee5c 100644
--- a/docs/plugins/gst_plugins_cache.json
+++ b/docs/plugins/gst_plugins_cache.json
@@ -1261,6 +1261,20 @@
"readable": true,
"type": "gboolean",
"writable": true
+ },
+ "samplesperbuffer": {
+ "blurb": "Number of samples in each outgoing buffer",
+ "conditionally-available": false,
+ "construct": false,
+ "construct-only": false,
+ "controllable": false,
+ "default": "240",
+ "max": "2147483647",
+ "min": "1",
+ "mutable": "null",
+ "readable": true,
+ "type": "gint",
+ "writable": true
}
},
"rank": "primary"
diff --git a/gst/audiolatency/gstaudiolatency.c b/gst/audiolatency/gstaudiolatency.c
index 4ea491a0f..f3eae724d 100644
--- a/gst/audiolatency/gstaudiolatency.c
+++ b/gst/audiolatency/gstaudiolatency.c
@@ -86,12 +86,15 @@ GST_ELEMENT_REGISTER_DEFINE (audiolatency, "audiolatency", GST_RANK_PRIMARY,
GST_TYPE_AUDIOLATENCY);
#define DEFAULT_PRINT_LATENCY FALSE
+#define DEFAULT_SAMPLES_PER_BUFFER 240
+
enum
{
PROP_0,
PROP_PRINT_LATENCY,
PROP_LAST_LATENCY,
- PROP_AVERAGE_LATENCY
+ PROP_AVERAGE_LATENCY,
+ PROP_SAMPLES_PER_BUFFER,
};
static gint64 gst_audiolatency_get_latency (GstAudioLatency * self);
@@ -119,6 +122,9 @@ gst_audiolatency_get_property (GObject * object,
case PROP_AVERAGE_LATENCY:
g_value_set_int64 (value, gst_audiolatency_get_average_latency (self));
break;
+ case PROP_SAMPLES_PER_BUFFER:
+ g_value_set_int (value, self->samples_per_buffer);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@@ -135,6 +141,11 @@ gst_audiolatency_set_property (GObject * object,
case PROP_PRINT_LATENCY:
self->print_latency = g_value_get_boolean (value);
break;
+ case PROP_SAMPLES_PER_BUFFER:
+ self->samples_per_buffer = g_value_get_int (value);
+ g_object_set (self->audiosrc,
+ "samplesperbuffer", self->samples_per_buffer, NULL);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@@ -165,6 +176,20 @@ gst_audiolatency_class_init (GstAudioLatencyClass * klass)
"The running average latency, in microseconds", 0,
G_USEC_PER_SEC, 0, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
+ /**
+ * GstAudioLatency:samplesperbuffer:
+ *
+ * The number of audio samples in each outgoing buffer.
+ * See also #GstAudioTestSrc:samplesperbuffer
+ *
+ * Since: 1.20
+ */
+ g_object_class_install_property (gobject_class, PROP_SAMPLES_PER_BUFFER,
+ g_param_spec_int ("samplesperbuffer", "Samples per buffer",
+ "Number of samples in each outgoing buffer",
+ 1, G_MAXINT, DEFAULT_SAMPLES_PER_BUFFER,
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+
gst_element_class_add_static_pad_template (gstelement_class, &src_template);
gst_element_class_add_static_pad_template (gstelement_class, &sink_template);
@@ -183,6 +208,7 @@ gst_audiolatency_init (GstAudioLatency * self)
self->send_pts = 0;
self->recv_pts = 0;
self->print_latency = DEFAULT_PRINT_LATENCY;
+ self->samples_per_buffer = DEFAULT_SAMPLES_PER_BUFFER;
/* Setup sinkpad */
self->sinkpad = gst_pad_new_from_static_template (&sink_template, "sink");
@@ -195,8 +221,8 @@ gst_audiolatency_init (GstAudioLatency * self)
/* Setup srcpad */
self->audiosrc = gst_element_factory_make ("audiotestsrc", NULL);
- g_object_set (self->audiosrc, "wave", 8, "samplesperbuffer", 240,
- "is-live", TRUE, NULL);
+ g_object_set (self->audiosrc, "wave", 8, "samplesperbuffer",
+ DEFAULT_SAMPLES_PER_BUFFER, "is-live", TRUE, NULL);
gst_bin_add (GST_BIN (self), self->audiosrc);
templ = gst_static_pad_template_get (&src_template);
diff --git a/gst/audiolatency/gstaudiolatency.h b/gst/audiolatency/gstaudiolatency.h
index 414b833ac..a7c68cb40 100644
--- a/gst/audiolatency/gstaudiolatency.h
+++ b/gst/audiolatency/gstaudiolatency.h
@@ -56,6 +56,7 @@ struct _GstAudioLatency
/* properties */
gboolean print_latency;
+ gint samples_per_buffer;
};
struct _GstAudioLatencyClass