mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-18 06:16:36 +00:00
autovideosink: add sync property
https://bugzilla.gnome.org/show_bug.cgi?id=706955
This commit is contained in:
parent
2fa68fce07
commit
f7528d274b
2 changed files with 18 additions and 0 deletions
|
@ -45,6 +45,7 @@
|
||||||
#include "gstautodetect.h"
|
#include "gstautodetect.h"
|
||||||
|
|
||||||
#define DEFAULT_TS_OFFSET 0
|
#define DEFAULT_TS_OFFSET 0
|
||||||
|
#define DEFAULT_SYNC TRUE
|
||||||
|
|
||||||
/* Properties */
|
/* Properties */
|
||||||
enum
|
enum
|
||||||
|
@ -52,6 +53,7 @@ enum
|
||||||
PROP_0,
|
PROP_0,
|
||||||
PROP_CAPS,
|
PROP_CAPS,
|
||||||
PROP_TS_OFFSET,
|
PROP_TS_OFFSET,
|
||||||
|
PROP_SYNC,
|
||||||
};
|
};
|
||||||
|
|
||||||
static GstStateChangeReturn
|
static GstStateChangeReturn
|
||||||
|
@ -106,6 +108,11 @@ gst_auto_video_sink_class_init (GstAutoVideoSinkClass * klass)
|
||||||
"Timestamp offset in nanoseconds", G_MININT64, G_MAXINT64,
|
"Timestamp offset in nanoseconds", G_MININT64, G_MAXINT64,
|
||||||
DEFAULT_TS_OFFSET, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
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_element_class_add_pad_template (eklass,
|
||||||
gst_static_pad_template_get (&sink_template));
|
gst_static_pad_template_get (&sink_template));
|
||||||
gst_element_class_set_static_metadata (eklass, "Auto video sink",
|
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 */
|
/* set the default raw video caps */
|
||||||
sink->filter_caps = gst_static_caps_get (&raw_caps);
|
sink->filter_caps = gst_static_caps_get (&raw_caps);
|
||||||
sink->ts_offset = DEFAULT_TS_OFFSET;
|
sink->ts_offset = DEFAULT_TS_OFFSET;
|
||||||
|
sink->sync = DEFAULT_SYNC;
|
||||||
|
|
||||||
/* mark as sink */
|
/* mark as sink */
|
||||||
GST_OBJECT_FLAG_SET (sink, GST_ELEMENT_FLAG_SINK);
|
GST_OBJECT_FLAG_SET (sink, GST_ELEMENT_FLAG_SINK);
|
||||||
|
@ -332,6 +340,7 @@ gst_auto_video_sink_detect (GstAutoVideoSink * sink)
|
||||||
goto no_sink;
|
goto no_sink;
|
||||||
|
|
||||||
g_object_set (G_OBJECT (esink), "ts-offset", sink->ts_offset, NULL);
|
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;
|
sink->kid = esink;
|
||||||
gst_bin_add (GST_BIN (sink), 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)
|
if (sink->kid)
|
||||||
g_object_set_property (G_OBJECT (sink->kid), pspec->name, value);
|
g_object_set_property (G_OBJECT (sink->kid), pspec->name, value);
|
||||||
break;
|
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:
|
default:
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||||
break;
|
break;
|
||||||
|
@ -429,6 +443,9 @@ gst_auto_video_sink_get_property (GObject * object, guint prop_id,
|
||||||
case PROP_TS_OFFSET:
|
case PROP_TS_OFFSET:
|
||||||
g_value_set_int64 (value, sink->ts_offset);
|
g_value_set_int64 (value, sink->ts_offset);
|
||||||
break;
|
break;
|
||||||
|
case PROP_SYNC:
|
||||||
|
g_value_set_boolean (value, sink->sync);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -45,6 +45,7 @@ typedef struct _GstAutoVideoSink {
|
||||||
GstElement *kid;
|
GstElement *kid;
|
||||||
GstCaps *filter_caps;
|
GstCaps *filter_caps;
|
||||||
GstClockTimeDiff ts_offset;
|
GstClockTimeDiff ts_offset;
|
||||||
|
gboolean sync;
|
||||||
} GstAutoVideoSink;
|
} GstAutoVideoSink;
|
||||||
|
|
||||||
typedef struct _GstAutoVideoSinkClass {
|
typedef struct _GstAutoVideoSinkClass {
|
||||||
|
|
Loading…
Reference in a new issue