autoaudiosink: introduce sync property

https://bugzilla.gnome.org/show_bug.cgi?id=706955
This commit is contained in:
Bernhard Miller 2013-08-28 07:15:00 +02:00 committed by Sebastian Dröge
parent 9549289a18
commit 2fa68fce07
2 changed files with 18 additions and 0 deletions

View file

@ -45,6 +45,7 @@
#include "gstautodetect.h"
#define DEFAULT_TS_OFFSET 0
#define DEFAULT_SYNC TRUE
/* Properties */
enum
@ -52,6 +53,7 @@ enum
PROP_0,
PROP_CAPS,
PROP_TS_OFFSET,
PROP_SYNC,
};
static GstStateChangeReturn
@ -108,6 +110,11 @@ gst_auto_audio_sink_class_init (GstAutoAudioSinkClass * klass)
"Timestamp offset in nanoseconds", G_MININT64, G_MAXINT64,
DEFAULT_TS_OFFSET, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class, PROP_SYNC,
g_param_spec_boolean ("sync", "Sync",
"Sync on the clock", DEFAULT_SYNC,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
gst_element_class_add_pad_template (eklass,
gst_static_pad_template_get (&sink_template));
@ -175,6 +182,7 @@ gst_auto_audio_sink_init (GstAutoAudioSink * sink)
/* set the default raw audio caps */
sink->filter_caps = gst_static_caps_get (&raw_caps);
sink->ts_offset = DEFAULT_TS_OFFSET;
sink->sync = DEFAULT_SYNC;
/* mark as sink */
GST_OBJECT_FLAG_SET (sink, GST_ELEMENT_FLAG_SINK);
@ -336,6 +344,7 @@ gst_auto_audio_sink_detect (GstAutoAudioSink * sink)
goto no_sink;
g_object_set (G_OBJECT (esink), "ts-offset", sink->ts_offset, NULL);
g_object_set (G_OBJECT (esink), "sync", sink->sync, NULL);
sink->kid = esink;
/* Ensure the child is brought up to the right state to match the parent
@ -421,6 +430,11 @@ gst_auto_audio_sink_set_property (GObject * object, guint prop_id,
if (sink->kid)
g_object_set_property (G_OBJECT (sink->kid), pspec->name, value);
break;
case PROP_SYNC:
sink->sync = g_value_get_boolean (value);
if (sink->kid)
g_object_set_property (G_OBJECT (sink->kid), pspec->name, value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@ -441,6 +455,9 @@ gst_auto_audio_sink_get_property (GObject * object, guint prop_id,
case PROP_TS_OFFSET:
g_value_set_int64 (value, sink->ts_offset);
break;
case PROP_SYNC:
g_value_set_boolean (value, sink->sync);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;

View file

@ -45,6 +45,7 @@ typedef struct _GstAutoAudioSink {
GstElement *kid;
GstCaps *filter_caps;
GstClockTimeDiff ts_offset;
gboolean sync;
} GstAutoAudioSink;
typedef struct _GstAutoAudioSinkClass {