mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-17 12:55:53 +00:00
Merge branch '0.10'
This commit is contained in:
commit
6eee006e82
2 changed files with 91 additions and 21 deletions
|
@ -1291,7 +1291,8 @@ gst_play_bin_init (GstPlayBin * playbin)
|
||||||
|
|
||||||
/* add sink */
|
/* add sink */
|
||||||
playbin->playsink =
|
playbin->playsink =
|
||||||
g_object_new (GST_TYPE_PLAY_SINK, "name", "playsink", NULL);
|
g_object_new (GST_TYPE_PLAY_SINK, "name", "playsink", "send-event-mode",
|
||||||
|
1, NULL);
|
||||||
gst_bin_add (GST_BIN_CAST (playbin), GST_ELEMENT_CAST (playbin->playsink));
|
gst_bin_add (GST_BIN_CAST (playbin), GST_ELEMENT_CAST (playbin->playsink));
|
||||||
gst_play_sink_set_flags (playbin->playsink, DEFAULT_FLAGS);
|
gst_play_sink_set_flags (playbin->playsink, DEFAULT_FLAGS);
|
||||||
/* Connect to notify::volume and notify::mute signals for proxying */
|
/* Connect to notify::volume and notify::mute signals for proxying */
|
||||||
|
|
|
@ -48,6 +48,41 @@ GST_DEBUG_CATEGORY_STATIC (gst_play_sink_debug);
|
||||||
|
|
||||||
#define GST_PLAY_CHAIN(c) ((GstPlayChain *)(c))
|
#define GST_PLAY_CHAIN(c) ((GstPlayChain *)(c))
|
||||||
|
|
||||||
|
/* enum types */
|
||||||
|
/**
|
||||||
|
* GstPlaySinkSendEventMode:
|
||||||
|
* @MODE_DEFAULT: default GstBin's send_event handling
|
||||||
|
* @MODE_FIRST: send event only to the first sink that return true
|
||||||
|
*
|
||||||
|
* Send event handling to use
|
||||||
|
*/
|
||||||
|
typedef enum
|
||||||
|
{
|
||||||
|
MODE_DEFAULT = 0,
|
||||||
|
MODE_FIRST = 1
|
||||||
|
} GstPlaySinkSendEventMode;
|
||||||
|
|
||||||
|
|
||||||
|
#define GST_TYPE_PLAY_SINK_SEND_EVENT_MODE (gst_play_sink_send_event_mode_get_type ())
|
||||||
|
static GType
|
||||||
|
gst_play_sink_send_event_mode_get_type (void)
|
||||||
|
{
|
||||||
|
static GType gtype = 0;
|
||||||
|
|
||||||
|
if (gtype == 0) {
|
||||||
|
static const GEnumValue values[] = {
|
||||||
|
{MODE_DEFAULT, "Default GstBin's send_event handling (default)",
|
||||||
|
"default"},
|
||||||
|
{MODE_FIRST, "Sends the event to sinks until the first one handles it",
|
||||||
|
"first"},
|
||||||
|
{0, NULL, NULL}
|
||||||
|
};
|
||||||
|
|
||||||
|
gtype = g_enum_register_static ("GstPlaySinkSendEventMode", values);
|
||||||
|
}
|
||||||
|
return gtype;
|
||||||
|
}
|
||||||
|
|
||||||
/* holds the common data fields for the audio and video pipelines. We keep them
|
/* holds the common data fields for the audio and video pipelines. We keep them
|
||||||
* in a structure to more easily have all the info available. */
|
* in a structure to more easily have all the info available. */
|
||||||
typedef struct
|
typedef struct
|
||||||
|
@ -206,6 +241,7 @@ struct _GstPlaySink
|
||||||
gboolean volume_changed; /* volume/mute changed while no audiochain */
|
gboolean volume_changed; /* volume/mute changed while no audiochain */
|
||||||
gboolean mute_changed; /* ... has been created yet */
|
gboolean mute_changed; /* ... has been created yet */
|
||||||
gint64 av_offset;
|
gint64 av_offset;
|
||||||
|
GstPlaySinkSendEventMode send_event_mode;
|
||||||
|
|
||||||
/* videooverlay proxy interface */
|
/* videooverlay proxy interface */
|
||||||
GstVideoOverlay *overlay_element; /* protected with LOCK */
|
GstVideoOverlay *overlay_element; /* protected with LOCK */
|
||||||
|
@ -275,6 +311,7 @@ enum
|
||||||
PROP_VIDEO_SINK,
|
PROP_VIDEO_SINK,
|
||||||
PROP_AUDIO_SINK,
|
PROP_AUDIO_SINK,
|
||||||
PROP_TEXT_SINK,
|
PROP_TEXT_SINK,
|
||||||
|
PROP_SEND_EVENT_MODE,
|
||||||
PROP_LAST
|
PROP_LAST
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -468,6 +505,20 @@ gst_play_sink_class_init (GstPlaySinkClass * klass)
|
||||||
"the text output element to use (NULL = default textoverlay)",
|
"the text output element to use (NULL = default textoverlay)",
|
||||||
GST_TYPE_ELEMENT, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
GST_TYPE_ELEMENT, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GstPlaySink::send-event-mode:
|
||||||
|
*
|
||||||
|
* Sets the handling method used for events received from send_event
|
||||||
|
* function. The default is %MODE_DEFAULT, that uses %GstBin's default
|
||||||
|
* handling (push the event to all internal sinks).
|
||||||
|
*
|
||||||
|
* Since: 0.10.37
|
||||||
|
*/
|
||||||
|
g_object_class_install_property (gobject_klass, PROP_SEND_EVENT_MODE,
|
||||||
|
g_param_spec_enum ("send-event-mode", "Send event mode",
|
||||||
|
"How to send events received in send_event function",
|
||||||
|
GST_TYPE_PLAY_SINK_SEND_EVENT_MODE, MODE_DEFAULT,
|
||||||
|
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
||||||
|
|
||||||
g_signal_new ("reconfigure", G_TYPE_FROM_CLASS (klass),
|
g_signal_new ("reconfigure", G_TYPE_FROM_CLASS (klass),
|
||||||
G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION, G_STRUCT_OFFSET (GstPlaySinkClass,
|
G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION, G_STRUCT_OFFSET (GstPlaySinkClass,
|
||||||
|
@ -537,6 +588,7 @@ gst_play_sink_init (GstPlaySink * playsink)
|
||||||
playsink->font_desc = NULL;
|
playsink->font_desc = NULL;
|
||||||
playsink->subtitle_encoding = NULL;
|
playsink->subtitle_encoding = NULL;
|
||||||
playsink->flags = DEFAULT_FLAGS;
|
playsink->flags = DEFAULT_FLAGS;
|
||||||
|
playsink->send_event_mode = MODE_DEFAULT;
|
||||||
|
|
||||||
playsink->stream_synchronizer =
|
playsink->stream_synchronizer =
|
||||||
g_object_new (GST_TYPE_STREAM_SYNCHRONIZER, NULL);
|
g_object_new (GST_TYPE_STREAM_SYNCHRONIZER, NULL);
|
||||||
|
@ -3755,9 +3807,11 @@ static gboolean
|
||||||
gst_play_sink_send_event_to_sink (GstPlaySink * playsink, GstEvent * event)
|
gst_play_sink_send_event_to_sink (GstPlaySink * playsink, GstEvent * event)
|
||||||
{
|
{
|
||||||
gboolean res = TRUE;
|
gboolean res = TRUE;
|
||||||
|
if (playsink->send_event_mode == MODE_FIRST) {
|
||||||
if (playsink->textchain && playsink->textchain->sink) {
|
if (playsink->textchain && playsink->textchain->sink) {
|
||||||
gst_event_ref (event);
|
gst_event_ref (event);
|
||||||
if ((res = gst_element_send_event (playsink->textchain->chain.bin, event))) {
|
if ((res =
|
||||||
|
gst_element_send_event (playsink->textchain->chain.bin, event))) {
|
||||||
GST_DEBUG_OBJECT (playsink, "Sent event successfully to text sink");
|
GST_DEBUG_OBJECT (playsink, "Sent event successfully to text sink");
|
||||||
} else {
|
} else {
|
||||||
GST_DEBUG_OBJECT (playsink, "Event failed when sent to text sink");
|
GST_DEBUG_OBJECT (playsink, "Event failed when sent to text sink");
|
||||||
|
@ -3766,7 +3820,9 @@ gst_play_sink_send_event_to_sink (GstPlaySink * playsink, GstEvent * event)
|
||||||
|
|
||||||
if (playsink->videochain) {
|
if (playsink->videochain) {
|
||||||
gst_event_ref (event);
|
gst_event_ref (event);
|
||||||
if ((res = gst_element_send_event (playsink->videochain->chain.bin, event))) {
|
if ((res =
|
||||||
|
gst_element_send_event (playsink->videochain->chain.bin,
|
||||||
|
event))) {
|
||||||
GST_DEBUG_OBJECT (playsink, "Sent event successfully to video sink");
|
GST_DEBUG_OBJECT (playsink, "Sent event successfully to video sink");
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
@ -3774,12 +3830,19 @@ gst_play_sink_send_event_to_sink (GstPlaySink * playsink, GstEvent * event)
|
||||||
}
|
}
|
||||||
if (playsink->audiochain) {
|
if (playsink->audiochain) {
|
||||||
gst_event_ref (event);
|
gst_event_ref (event);
|
||||||
if ((res = gst_element_send_event (playsink->audiochain->chain.bin, event))) {
|
if ((res =
|
||||||
|
gst_element_send_event (playsink->audiochain->chain.bin,
|
||||||
|
event))) {
|
||||||
GST_DEBUG_OBJECT (playsink, "Sent event successfully to audio sink");
|
GST_DEBUG_OBJECT (playsink, "Sent event successfully to audio sink");
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
GST_DEBUG_OBJECT (playsink, "Event failed when sent to audio sink");
|
GST_DEBUG_OBJECT (playsink, "Event failed when sent to audio sink");
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
return
|
||||||
|
GST_ELEMENT_CLASS (gst_play_sink_parent_class)->send_event
|
||||||
|
(GST_ELEMENT_CAST (playsink), event);
|
||||||
|
}
|
||||||
|
|
||||||
done:
|
done:
|
||||||
gst_event_unref (event);
|
gst_event_unref (event);
|
||||||
|
@ -4066,6 +4129,9 @@ gst_play_sink_set_property (GObject * object, guint prop_id,
|
||||||
gst_play_sink_set_sink (playsink, GST_PLAY_SINK_TYPE_TEXT,
|
gst_play_sink_set_sink (playsink, GST_PLAY_SINK_TYPE_TEXT,
|
||||||
g_value_get_object (value));
|
g_value_get_object (value));
|
||||||
break;
|
break;
|
||||||
|
case PROP_SEND_EVENT_MODE:
|
||||||
|
playsink->send_event_mode = g_value_get_enum (value);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, spec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, spec);
|
||||||
break;
|
break;
|
||||||
|
@ -4115,6 +4181,9 @@ gst_play_sink_get_property (GObject * object, guint prop_id,
|
||||||
g_value_take_object (value, gst_play_sink_get_sink (playsink,
|
g_value_take_object (value, gst_play_sink_get_sink (playsink,
|
||||||
GST_PLAY_SINK_TYPE_TEXT));
|
GST_PLAY_SINK_TYPE_TEXT));
|
||||||
break;
|
break;
|
||||||
|
case PROP_SEND_EVENT_MODE:
|
||||||
|
g_value_set_enum (value, playsink->send_event_mode);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, spec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, spec);
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in a new issue