autodetect: proxy ts-offset properties

Proxy the ts-offset property in the audio*sink elements.

Fixes https://bugzilla.gnome.org/show_bug.cgi?id=679343
This commit is contained in:
Wim Taymans 2012-07-10 14:38:21 +02:00
parent 2052cabdc4
commit ab77c424be
4 changed files with 40 additions and 0 deletions

View file

@ -44,11 +44,14 @@
#include "gstautoaudiosink.h" #include "gstautoaudiosink.h"
#include "gstautodetect.h" #include "gstautodetect.h"
#define DEFAULT_TS_OFFSET 0
/* Properties */ /* Properties */
enum enum
{ {
PROP_0, PROP_0,
PROP_CAPS, PROP_CAPS,
PROP_TS_OFFSET,
}; };
static GstStateChangeReturn static GstStateChangeReturn
@ -100,6 +103,11 @@ gst_auto_audio_sink_class_init (GstAutoAudioSinkClass * klass)
"Filter sink candidates using these caps.", GST_TYPE_CAPS, "Filter sink candidates using these caps.", GST_TYPE_CAPS,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class, PROP_TS_OFFSET,
g_param_spec_int64 ("ts-offset", "TS Offset",
"Timestamp offset in nanoseconds", G_MININT64, G_MAXINT64,
DEFAULT_TS_OFFSET, 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));
@ -166,6 +174,7 @@ gst_auto_audio_sink_init (GstAutoAudioSink * sink)
/* set the default raw audio caps */ /* set the default raw audio 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;
/* mark as sink */ /* mark as sink */
GST_OBJECT_FLAG_SET (sink, GST_ELEMENT_FLAG_SINK); GST_OBJECT_FLAG_SET (sink, GST_ELEMENT_FLAG_SINK);
@ -336,6 +345,8 @@ gst_auto_audio_sink_detect (GstAutoAudioSink * sink)
if (!(esink = gst_auto_audio_sink_find_best (sink))) if (!(esink = gst_auto_audio_sink_find_best (sink)))
goto no_sink; goto no_sink;
g_object_set (G_OBJECT (esink), "ts-offset", sink->ts_offset, NULL);
sink->kid = esink; sink->kid = esink;
/* Ensure the child is brought up to the right state to match the parent /* Ensure the child is brought up to the right state to match the parent
* although it's currently always in READY and * although it's currently always in READY and
@ -415,6 +426,11 @@ gst_auto_audio_sink_set_property (GObject * object, guint prop_id,
gst_caps_unref (sink->filter_caps); gst_caps_unref (sink->filter_caps);
sink->filter_caps = gst_caps_copy (gst_value_get_caps (value)); sink->filter_caps = gst_caps_copy (gst_value_get_caps (value));
break; break;
case PROP_TS_OFFSET:
sink->ts_offset = g_value_get_int64 (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;
@ -432,6 +448,9 @@ gst_auto_audio_sink_get_property (GObject * object, guint prop_id,
gst_value_set_caps (value, sink->filter_caps); gst_value_set_caps (value, sink->filter_caps);
break; break;
} }
case PROP_TS_OFFSET:
g_value_set_int64 (value, sink->ts_offset);
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;

View file

@ -44,6 +44,7 @@ typedef struct _GstAutoAudioSink {
GstPad *pad; GstPad *pad;
GstElement *kid; GstElement *kid;
GstCaps *filter_caps; GstCaps *filter_caps;
GstClockTimeDiff ts_offset;
} GstAutoAudioSink; } GstAutoAudioSink;
typedef struct _GstAutoAudioSinkClass { typedef struct _GstAutoAudioSinkClass {

View file

@ -44,11 +44,14 @@
#include "gstautovideosink.h" #include "gstautovideosink.h"
#include "gstautodetect.h" #include "gstautodetect.h"
#define DEFAULT_TS_OFFSET 0
/* Properties */ /* Properties */
enum enum
{ {
PROP_0, PROP_0,
PROP_CAPS, PROP_CAPS,
PROP_TS_OFFSET,
}; };
static GstStateChangeReturn static GstStateChangeReturn
@ -98,6 +101,11 @@ gst_auto_video_sink_class_init (GstAutoVideoSinkClass * klass)
"Filter sink candidates using these caps.", GST_TYPE_CAPS, "Filter sink candidates using these caps.", GST_TYPE_CAPS,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class, PROP_TS_OFFSET,
g_param_spec_int64 ("ts-offset", "TS Offset",
"Timestamp offset in nanoseconds", G_MININT64, G_MAXINT64,
DEFAULT_TS_OFFSET, 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",
@ -165,6 +173,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;
/* 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 +341,8 @@ gst_auto_video_sink_detect (GstAutoVideoSink * sink)
if (!(esink = gst_auto_video_sink_find_best (sink))) if (!(esink = gst_auto_video_sink_find_best (sink)))
goto no_sink; goto no_sink;
g_object_set (G_OBJECT (esink), "ts-offset", sink->ts_offset, NULL);
sink->kid = esink; sink->kid = esink;
gst_bin_add (GST_BIN (sink), esink); gst_bin_add (GST_BIN (sink), esink);
@ -403,6 +414,11 @@ gst_auto_video_sink_set_property (GObject * object, guint prop_id,
gst_caps_unref (sink->filter_caps); gst_caps_unref (sink->filter_caps);
sink->filter_caps = gst_caps_copy (gst_value_get_caps (value)); sink->filter_caps = gst_caps_copy (gst_value_get_caps (value));
break; break;
case PROP_TS_OFFSET:
sink->ts_offset = g_value_get_int64 (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;
@ -420,6 +436,9 @@ gst_auto_video_sink_get_property (GObject * object, guint prop_id,
gst_value_set_caps (value, sink->filter_caps); gst_value_set_caps (value, sink->filter_caps);
break; break;
} }
case PROP_TS_OFFSET:
g_value_set_int64 (value, sink->ts_offset);
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;

View file

@ -44,6 +44,7 @@ typedef struct _GstAutoVideoSink {
GstPad *pad; GstPad *pad;
GstElement *kid; GstElement *kid;
GstCaps *filter_caps; GstCaps *filter_caps;
GstClockTimeDiff ts_offset;
} GstAutoVideoSink; } GstAutoVideoSink;
typedef struct _GstAutoVideoSinkClass { typedef struct _GstAutoVideoSinkClass {