autovideosink: add sync property

https://bugzilla.gnome.org/show_bug.cgi?id=706955
This commit is contained in:
Bernhard Miller 2013-08-28 10:51:32 +02:00 committed by Sebastian Dröge
parent 2fa68fce07
commit f7528d274b
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
@ -106,6 +108,11 @@ gst_auto_video_sink_class_init (GstAutoVideoSinkClass * 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));
gst_element_class_set_static_metadata (eklass, "Auto video sink",
@ -174,6 +181,7 @@ gst_auto_video_sink_init (GstAutoVideoSink * sink)
/* set the default raw video 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);
@ -332,6 +340,7 @@ gst_auto_video_sink_detect (GstAutoVideoSink * 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;
gst_bin_add (GST_BIN (sink), esink);
@ -409,6 +418,11 @@ gst_auto_video_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;
@ -429,6 +443,9 @@ gst_auto_video_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 _GstAutoVideoSink {
GstElement *kid;
GstCaps *filter_caps;
GstClockTimeDiff ts_offset;
gboolean sync;
} GstAutoVideoSink;
typedef struct _GstAutoVideoSinkClass {