mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-20 00:31:13 +00:00
Fixing indentation
Original commit message from CVS: Fixing indentation
This commit is contained in:
parent
5ee54c03c0
commit
8860bd5ac5
3 changed files with 1889 additions and 1958 deletions
|
@ -24,7 +24,8 @@
|
|||
|
||||
#include "play.h"
|
||||
|
||||
enum {
|
||||
enum
|
||||
{
|
||||
STREAM_END,
|
||||
INFORMATION,
|
||||
STATE_CHANGE,
|
||||
|
@ -45,27 +46,39 @@ typedef struct _GstPlaySignal GstPlaySignal;
|
|||
struct _GstPlaySignal
|
||||
{
|
||||
gint signal_id;
|
||||
union {
|
||||
struct {
|
||||
union
|
||||
{
|
||||
struct
|
||||
{
|
||||
gint width;
|
||||
gint height;
|
||||
} video_size;
|
||||
struct {
|
||||
}
|
||||
video_size;
|
||||
struct
|
||||
{
|
||||
gint xid;
|
||||
} video_xid;
|
||||
struct {
|
||||
}
|
||||
video_xid;
|
||||
struct
|
||||
{
|
||||
GstElementState old_state;
|
||||
GstElementState new_state;
|
||||
} state;
|
||||
struct {
|
||||
}
|
||||
state;
|
||||
struct
|
||||
{
|
||||
GstObject *object;
|
||||
GParamSpec *param;
|
||||
} info;
|
||||
struct {
|
||||
}
|
||||
info;
|
||||
struct
|
||||
{
|
||||
GstElement *element;
|
||||
char *error;
|
||||
} error;
|
||||
} signal_data;
|
||||
}
|
||||
error;
|
||||
}
|
||||
signal_data;
|
||||
};
|
||||
|
||||
enum
|
||||
|
@ -97,7 +110,8 @@ static GQuark
|
|||
gst_play_error_quark (void)
|
||||
{
|
||||
static GQuark quark = 0;
|
||||
if (quark == 0) {
|
||||
if (quark == 0)
|
||||
{
|
||||
quark = g_quark_from_static_string ("gst-play-error-quark");
|
||||
}
|
||||
|
||||
|
@ -109,12 +123,12 @@ gst_play_error_quark (void)
|
|||
* generic and have more errors than only
|
||||
* plug-ins, move the message creation to the switch */
|
||||
static void
|
||||
gst_play_error_plugin ( GstPlayError type,
|
||||
GError **error)
|
||||
gst_play_error_plugin (GstPlayError type, GError ** error)
|
||||
{
|
||||
gchar *name;
|
||||
|
||||
if (error == NULL) return;
|
||||
if (error == NULL)
|
||||
return;
|
||||
|
||||
switch (type)
|
||||
{
|
||||
|
@ -146,8 +160,7 @@ gst_play_error_plugin ( GstPlayError type,
|
|||
"The %s plug-in could not be found. "
|
||||
"This plug-in is essential for libgstplay. "
|
||||
"Please install it and verify that it works "
|
||||
"by running 'gst-inspect %s'",
|
||||
name, name);
|
||||
"by running 'gst-inspect %s'", name, name);
|
||||
g_free (name);
|
||||
return;
|
||||
}
|
||||
|
@ -155,15 +168,15 @@ gst_play_error_plugin ( GstPlayError type,
|
|||
static void
|
||||
gst_play_set_property (GObject * object,
|
||||
guint prop_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec)
|
||||
const GValue * value, GParamSpec * pspec)
|
||||
{
|
||||
GstPlay *play;
|
||||
g_return_if_fail (object != NULL);
|
||||
g_return_if_fail (GST_IS_PLAY (object));
|
||||
play = GST_PLAY (object);
|
||||
|
||||
switch (prop_id) {
|
||||
switch (prop_id)
|
||||
{
|
||||
case ARG_LOCATION:
|
||||
gst_play_set_location (play, g_value_get_string (value));
|
||||
break;
|
||||
|
@ -181,16 +194,15 @@ gst_play_set_property ( GObject *object,
|
|||
|
||||
static void
|
||||
gst_play_get_property (GObject * object,
|
||||
guint prop_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
guint prop_id, GValue * value, GParamSpec * pspec)
|
||||
{
|
||||
GstPlay *play;
|
||||
g_return_if_fail (object != NULL);
|
||||
g_return_if_fail (GST_IS_PLAY (object));
|
||||
play = GST_PLAY (object);
|
||||
|
||||
switch (prop_id) {
|
||||
switch (prop_id)
|
||||
{
|
||||
case ARG_LOCATION:
|
||||
g_value_set_string (value, gst_play_get_location (play));
|
||||
break;
|
||||
|
@ -220,20 +232,30 @@ gst_play_get_length_callback (GstPlay *play)
|
|||
gboolean query_worked = FALSE;
|
||||
|
||||
if ((play->audio_sink_element != NULL) &&
|
||||
(GST_IS_ELEMENT (play->audio_sink_element)) ) {
|
||||
query_worked = gst_element_query (play->audio_sink_element, GST_QUERY_TOTAL, &format, &value);
|
||||
(GST_IS_ELEMENT (play->audio_sink_element)))
|
||||
{
|
||||
query_worked =
|
||||
gst_element_query (play->audio_sink_element, GST_QUERY_TOTAL, &format,
|
||||
&value);
|
||||
}
|
||||
else if ((play->video_sink_element != NULL) &&
|
||||
(GST_IS_ELEMENT (play->video_sink_element)) ) {
|
||||
query_worked = gst_element_query (play->video_sink_element, GST_QUERY_TOTAL, &format, &value);
|
||||
(GST_IS_ELEMENT (play->video_sink_element)))
|
||||
{
|
||||
query_worked =
|
||||
gst_element_query (play->video_sink_element, GST_QUERY_TOTAL, &format,
|
||||
&value);
|
||||
}
|
||||
if (query_worked){
|
||||
g_signal_emit (G_OBJECT (play), gst_play_signals [STREAM_LENGTH], 0, value);
|
||||
if (query_worked)
|
||||
{
|
||||
g_signal_emit (G_OBJECT (play), gst_play_signals[STREAM_LENGTH], 0,
|
||||
value);
|
||||
play->length_nanos = value;
|
||||
return FALSE;
|
||||
}
|
||||
else {
|
||||
if (play->get_length_attempt-- < 1){
|
||||
else
|
||||
{
|
||||
if (play->get_length_attempt-- < 1)
|
||||
{
|
||||
/* we've tried enough times, give up */
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -252,9 +274,11 @@ gst_play_tick_callback (GstPlay *play)
|
|||
play->clock = gst_bin_get_clock (GST_BIN (play->pipeline));
|
||||
play->time_nanos = gst_clock_get_time (play->clock);
|
||||
secs = (gint) (play->time_nanos / GST_SECOND);
|
||||
if (secs != play->time_seconds){
|
||||
if (secs != play->time_seconds)
|
||||
{
|
||||
play->time_seconds = secs;
|
||||
g_signal_emit (G_OBJECT (play), gst_play_signals [TIME_TICK], 0, play->time_nanos);
|
||||
g_signal_emit (G_OBJECT (play), gst_play_signals[TIME_TICK], 0,
|
||||
play->time_nanos);
|
||||
}
|
||||
|
||||
return (gst_element_get_state (play->pipeline) == GST_STATE_PLAYING);
|
||||
|
@ -263,7 +287,8 @@ gst_play_tick_callback (GstPlay *play)
|
|||
static gboolean
|
||||
gst_play_default_idle (GstPlayIdleData * idle_data)
|
||||
{
|
||||
if(idle_data->func(idle_data->data)){
|
||||
if (idle_data->func (idle_data->data))
|
||||
{
|
||||
/* call this function again in the future */
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -274,19 +299,18 @@ gst_play_default_idle (GstPlayIdleData *idle_data)
|
|||
|
||||
static guint
|
||||
gst_play_default_timeout_add (guint interval,
|
||||
GSourceFunc function,
|
||||
gpointer data)
|
||||
GSourceFunc function, gpointer data)
|
||||
{
|
||||
GstPlayIdleData *idle_data = g_new0 (GstPlayIdleData, 1);
|
||||
idle_data->func = function;
|
||||
idle_data->data = data;
|
||||
|
||||
return g_timeout_add (interval, (GSourceFunc)gst_play_default_idle, idle_data);
|
||||
return g_timeout_add (interval, (GSourceFunc) gst_play_default_idle,
|
||||
idle_data);
|
||||
}
|
||||
|
||||
static guint
|
||||
gst_play_default_idle_add ( GSourceFunc function,
|
||||
gpointer data)
|
||||
gst_play_default_idle_add (GSourceFunc function, gpointer data)
|
||||
{
|
||||
GstPlayIdleData *idle_data = g_new0 (GstPlayIdleData, 1);
|
||||
idle_data->func = function;
|
||||
|
@ -314,11 +338,13 @@ gst_play_idle_signal (GstPlay *play)
|
|||
g_return_val_if_fail (GST_IS_PLAY (play), FALSE);
|
||||
|
||||
signal = g_async_queue_try_pop (play->signal_queue);
|
||||
if (signal == NULL){
|
||||
if (signal == NULL)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
switch (signal->signal_id){
|
||||
switch (signal->signal_id)
|
||||
{
|
||||
case HAVE_XID:
|
||||
g_signal_emit (G_OBJECT (play), gst_play_signals[HAVE_XID], 0,
|
||||
signal->signal_data.video_xid.xid);
|
||||
|
@ -329,20 +355,24 @@ gst_play_idle_signal (GstPlay *play)
|
|||
break;
|
||||
case HAVE_VIDEO_SIZE:
|
||||
g_signal_emit (G_OBJECT (play), gst_play_signals[HAVE_VIDEO_SIZE], 0,
|
||||
signal->signal_data.video_size.width, signal->signal_data.video_size.height);
|
||||
signal->signal_data.video_size.width,
|
||||
signal->signal_data.video_size.height);
|
||||
break;
|
||||
case STATE_CHANGE:
|
||||
g_signal_emit (G_OBJECT (play), gst_play_signals[STATE_CHANGE], 0,
|
||||
signal->signal_data.state.old_state, signal->signal_data.state.new_state);
|
||||
signal->signal_data.state.old_state,
|
||||
signal->signal_data.state.new_state);
|
||||
break;
|
||||
case INFORMATION:
|
||||
g_signal_emit (G_OBJECT (play), gst_play_signals[INFORMATION], 0,
|
||||
signal->signal_data.info.object, signal->signal_data.info.param);
|
||||
signal->signal_data.info.object,
|
||||
signal->signal_data.info.param);
|
||||
gst_object_unref (signal->signal_data.info.object);
|
||||
break;
|
||||
case PIPELINE_ERROR:
|
||||
g_signal_emit (G_OBJECT (play), gst_play_signals[PIPELINE_ERROR], 0,
|
||||
signal->signal_data.error.element, signal->signal_data.error.error);
|
||||
signal->signal_data.error.element,
|
||||
signal->signal_data.error.error);
|
||||
if (signal->signal_data.error.error)
|
||||
g_free (signal->signal_data.error.error);
|
||||
gst_object_unref (GST_OBJECT (signal->signal_data.error.element));
|
||||
|
@ -365,16 +395,13 @@ gst_play_idle_eos (GstPlay* play)
|
|||
}
|
||||
|
||||
static void
|
||||
callback_audio_sink_eos ( GstElement *element,
|
||||
GstPlay *play)
|
||||
callback_audio_sink_eos (GstElement * element, GstPlay * play)
|
||||
{
|
||||
play->idle_add_func ((GSourceFunc) gst_play_idle_eos, play);
|
||||
}
|
||||
|
||||
static void
|
||||
callback_video_have_xid ( GstElement *element,
|
||||
gint xid,
|
||||
GstPlay *play)
|
||||
callback_video_have_xid (GstElement * element, gint xid, GstPlay * play)
|
||||
{
|
||||
GstPlaySignal *signal;
|
||||
|
||||
|
@ -388,9 +415,7 @@ callback_video_have_xid ( GstElement *element,
|
|||
}
|
||||
|
||||
static void
|
||||
callback_video_have_vis_xid ( GstElement *element,
|
||||
gint xid,
|
||||
GstPlay *play)
|
||||
callback_video_have_vis_xid (GstElement * element, gint xid, GstPlay * play)
|
||||
{
|
||||
GstPlaySignal *signal;
|
||||
|
||||
|
@ -405,9 +430,7 @@ callback_video_have_vis_xid ( GstElement *element,
|
|||
|
||||
static void
|
||||
callback_video_have_size (GstElement * element,
|
||||
gint width,
|
||||
gint height,
|
||||
GstPlay *play)
|
||||
gint width, gint height, GstPlay * play)
|
||||
{
|
||||
GstPlaySignal *signal;
|
||||
|
||||
|
@ -423,9 +446,7 @@ callback_video_have_size ( GstElement *element,
|
|||
|
||||
static void
|
||||
callback_pipeline_error (GstElement * object,
|
||||
GstElement *orig,
|
||||
char *error,
|
||||
GstPlay* play)
|
||||
GstElement * orig, char *error, GstPlay * play)
|
||||
{
|
||||
GstPlaySignal *signal;
|
||||
|
||||
|
@ -447,8 +468,7 @@ callback_pipeline_error ( GstElement *object,
|
|||
static void
|
||||
callback_pipeline_deep_notify (GstObject * element,
|
||||
GstObject * orig,
|
||||
GParamSpec *param,
|
||||
GstPlay* play)
|
||||
GParamSpec * param, GstPlay * play)
|
||||
{
|
||||
GstPlaySignal *signal;
|
||||
|
||||
|
@ -467,8 +487,7 @@ callback_pipeline_deep_notify ( GstObject *element,
|
|||
static void
|
||||
callback_pipeline_state_change (GstElement * element,
|
||||
GstElementState old,
|
||||
GstElementState state,
|
||||
GstPlay* play)
|
||||
GstElementState state, GstPlay * play)
|
||||
{
|
||||
GstPlaySignal *signal;
|
||||
|
||||
|
@ -479,18 +498,21 @@ callback_pipeline_state_change ( GstElement *element,
|
|||
g_return_if_fail (element == play->pipeline);
|
||||
|
||||
/* do additional stuff depending on state */
|
||||
if (GST_IS_PIPELINE (play->pipeline)){
|
||||
switch (state) {
|
||||
if (GST_IS_PIPELINE (play->pipeline))
|
||||
{
|
||||
switch (state)
|
||||
{
|
||||
case GST_STATE_PLAYING:
|
||||
play->idle_add_func ( (GSourceFunc) gst_play_idle_callback,
|
||||
play);
|
||||
play->idle_add_func ((GSourceFunc) gst_play_idle_callback, play);
|
||||
play->timeout_add_func (200,
|
||||
(GSourceFunc) gst_play_tick_callback,
|
||||
play);
|
||||
if (play->length_nanos == 0LL){
|
||||
(GSourceFunc) gst_play_tick_callback, play);
|
||||
if (play->length_nanos == 0LL)
|
||||
{
|
||||
/* try to get the length up to 16 times */
|
||||
play->get_length_attempt = 16;
|
||||
play->timeout_add_func (200, (GSourceFunc) gst_play_get_length_callback, play);
|
||||
play->timeout_add_func (200,
|
||||
(GSourceFunc)
|
||||
gst_play_get_length_callback, play);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
@ -546,32 +568,29 @@ gst_play_class_init (GstPlayClass *klass)
|
|||
gobject_class->set_property = GST_DEBUG_FUNCPTR (gst_play_set_property);
|
||||
gobject_class->get_property = GST_DEBUG_FUNCPTR (gst_play_get_property);
|
||||
|
||||
g_object_class_install_property (
|
||||
gobject_class,
|
||||
g_object_class_install_property (gobject_class,
|
||||
ARG_LOCATION,
|
||||
g_param_spec_string (
|
||||
"location",
|
||||
g_param_spec_string ("location",
|
||||
"location of file",
|
||||
"location of the file to play",
|
||||
NULL, G_PARAM_READWRITE));
|
||||
NULL,
|
||||
G_PARAM_READWRITE));
|
||||
|
||||
g_object_class_install_property (
|
||||
gobject_class,
|
||||
g_object_class_install_property (gobject_class,
|
||||
ARG_VOLUME,
|
||||
g_param_spec_float (
|
||||
"volume",
|
||||
g_param_spec_float ("volume",
|
||||
"Playing volume",
|
||||
"Playing volume",
|
||||
0, 1.0, 0, G_PARAM_READWRITE));
|
||||
0, 1.0, 0,
|
||||
G_PARAM_READWRITE));
|
||||
|
||||
g_object_class_install_property (
|
||||
gobject_class,
|
||||
g_object_class_install_property (gobject_class,
|
||||
ARG_MUTE,
|
||||
g_param_spec_boolean (
|
||||
"mute",
|
||||
g_param_spec_boolean ("mute",
|
||||
"Volume muted",
|
||||
"Playing volume muted",
|
||||
FALSE, G_PARAM_READWRITE));
|
||||
FALSE,
|
||||
G_PARAM_READWRITE));
|
||||
|
||||
gst_play_signals[INFORMATION] =
|
||||
g_signal_new ("information",
|
||||
|
@ -580,8 +599,7 @@ gst_play_class_init (GstPlayClass *klass)
|
|||
G_STRUCT_OFFSET (GstPlayClass, information),
|
||||
NULL, NULL,
|
||||
gst_marshal_VOID__OBJECT_PARAM,
|
||||
G_TYPE_NONE, 2,
|
||||
G_TYPE_OBJECT, G_TYPE_PARAM);
|
||||
G_TYPE_NONE, 2, G_TYPE_OBJECT, G_TYPE_PARAM);
|
||||
|
||||
gst_play_signals[PIPELINE_ERROR] =
|
||||
g_signal_new ("pipeline_error",
|
||||
|
@ -590,8 +608,7 @@ gst_play_class_init (GstPlayClass *klass)
|
|||
G_STRUCT_OFFSET (GstPlayClass, pipeline_error),
|
||||
NULL, NULL,
|
||||
gst_marshal_VOID__OBJECT_STRING,
|
||||
G_TYPE_NONE, 2,
|
||||
G_TYPE_OBJECT, G_TYPE_STRING);
|
||||
G_TYPE_NONE, 2, G_TYPE_OBJECT, G_TYPE_STRING);
|
||||
|
||||
gst_play_signals[STATE_CHANGE] =
|
||||
g_signal_new ("state_change",
|
||||
|
@ -600,17 +617,14 @@ gst_play_class_init (GstPlayClass *klass)
|
|||
G_STRUCT_OFFSET (GstPlayClass, state_changed),
|
||||
NULL, NULL,
|
||||
gst_marshal_VOID__INT_INT,
|
||||
G_TYPE_NONE, 2,
|
||||
G_TYPE_INT, G_TYPE_INT);
|
||||
G_TYPE_NONE, 2, G_TYPE_INT, G_TYPE_INT);
|
||||
|
||||
gst_play_signals[STREAM_END] =
|
||||
g_signal_new ("stream_end",
|
||||
G_TYPE_FROM_CLASS (klass),
|
||||
G_SIGNAL_RUN_FIRST,
|
||||
G_STRUCT_OFFSET (GstPlayClass, stream_end),
|
||||
NULL, NULL,
|
||||
gst_marshal_VOID__VOID,
|
||||
G_TYPE_NONE, 0);
|
||||
NULL, NULL, gst_marshal_VOID__VOID, G_TYPE_NONE, 0);
|
||||
|
||||
gst_play_signals[TIME_TICK] =
|
||||
g_signal_new ("time_tick",
|
||||
|
@ -618,9 +632,7 @@ gst_play_class_init (GstPlayClass *klass)
|
|||
G_SIGNAL_RUN_FIRST,
|
||||
G_STRUCT_OFFSET (GstPlayClass, time_tick),
|
||||
NULL, NULL,
|
||||
gst_marshal_VOID__INT64,
|
||||
G_TYPE_NONE, 1,
|
||||
G_TYPE_INT64);
|
||||
gst_marshal_VOID__INT64, G_TYPE_NONE, 1, G_TYPE_INT64);
|
||||
|
||||
gst_play_signals[STREAM_LENGTH] =
|
||||
g_signal_new ("stream_length",
|
||||
|
@ -628,9 +640,7 @@ gst_play_class_init (GstPlayClass *klass)
|
|||
G_SIGNAL_RUN_FIRST,
|
||||
G_STRUCT_OFFSET (GstPlayClass, stream_length),
|
||||
NULL, NULL,
|
||||
gst_marshal_VOID__INT64,
|
||||
G_TYPE_NONE, 1,
|
||||
G_TYPE_INT64);
|
||||
gst_marshal_VOID__INT64, G_TYPE_NONE, 1, G_TYPE_INT64);
|
||||
|
||||
gst_play_signals[HAVE_XID] =
|
||||
g_signal_new ("have_xid",
|
||||
|
@ -638,9 +648,7 @@ gst_play_class_init (GstPlayClass *klass)
|
|||
G_SIGNAL_RUN_FIRST,
|
||||
G_STRUCT_OFFSET (GstPlayClass, have_xid),
|
||||
NULL, NULL,
|
||||
gst_marshal_VOID__INT,
|
||||
G_TYPE_NONE, 1,
|
||||
G_TYPE_INT);
|
||||
gst_marshal_VOID__INT, G_TYPE_NONE, 1, G_TYPE_INT);
|
||||
|
||||
gst_play_signals[HAVE_VIS_XID] =
|
||||
g_signal_new ("have_vis_xid",
|
||||
|
@ -648,9 +656,7 @@ gst_play_class_init (GstPlayClass *klass)
|
|||
G_SIGNAL_RUN_FIRST,
|
||||
G_STRUCT_OFFSET (GstPlayClass, have_vis_xid),
|
||||
NULL, NULL,
|
||||
gst_marshal_VOID__INT,
|
||||
G_TYPE_NONE, 1,
|
||||
G_TYPE_INT);
|
||||
gst_marshal_VOID__INT, G_TYPE_NONE, 1, G_TYPE_INT);
|
||||
|
||||
gst_play_signals[HAVE_VIDEO_SIZE] =
|
||||
g_signal_new ("have_video_size",
|
||||
|
@ -659,8 +665,7 @@ gst_play_class_init (GstPlayClass *klass)
|
|||
G_STRUCT_OFFSET (GstPlayClass, have_video_size),
|
||||
NULL, NULL,
|
||||
gst_marshal_VOID__INT_INT,
|
||||
G_TYPE_NONE, 2,
|
||||
G_TYPE_INT, G_TYPE_INT);
|
||||
G_TYPE_NONE, 2, G_TYPE_INT, G_TYPE_INT);
|
||||
|
||||
gst_control_init (NULL, NULL);
|
||||
}
|
||||
|
@ -705,8 +710,7 @@ gst_play_init (GstPlay *play)
|
|||
* Performs a seek on @play until @time_nanos.
|
||||
*/
|
||||
void
|
||||
gst_play_seek_to_time ( GstPlay *play,
|
||||
gint64 time_nanos)
|
||||
gst_play_seek_to_time (GstPlay * play, gint64 time_nanos)
|
||||
{
|
||||
GstEvent *s_event;
|
||||
guint8 prev_state;
|
||||
|
@ -716,13 +720,16 @@ gst_play_seek_to_time ( GstPlay *play,
|
|||
|
||||
g_return_if_fail (play != NULL);
|
||||
g_return_if_fail (GST_IS_PLAY (play));
|
||||
if (time_nanos < 0LL){
|
||||
if (time_nanos < 0LL)
|
||||
{
|
||||
play->seek_time = 0LL;
|
||||
}
|
||||
else if (time_nanos < 0LL){
|
||||
else if (time_nanos < 0LL)
|
||||
{
|
||||
play->seek_time = play->length_nanos;
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
play->seek_time = time_nanos;
|
||||
}
|
||||
|
||||
|
@ -734,26 +741,31 @@ gst_play_seek_to_time ( GstPlay *play,
|
|||
s_event = gst_event_new_seek (GST_FORMAT_TIME |
|
||||
GST_SEEK_METHOD_SET |
|
||||
GST_SEEK_FLAG_FLUSH, play->seek_time);
|
||||
if (play->audio_sink_element != NULL){
|
||||
if (play->audio_sink_element != NULL)
|
||||
{
|
||||
gst_event_ref (s_event);
|
||||
audio_seek_worked = gst_element_send_event (
|
||||
play->audio_sink_element, s_event);
|
||||
audio_seek_worked =
|
||||
gst_element_send_event (play->audio_sink_element, s_event);
|
||||
}
|
||||
if (play->visualisation_sink_element != NULL){
|
||||
if (play->visualisation_sink_element != NULL)
|
||||
{
|
||||
gst_event_ref (s_event);
|
||||
visualisation_seek_worked = gst_element_send_event (
|
||||
play->visualisation_sink_element, s_event);
|
||||
visualisation_seek_worked =
|
||||
gst_element_send_event (play->visualisation_sink_element, s_event);
|
||||
}
|
||||
if (play->video_sink_element != NULL){
|
||||
if (play->video_sink_element != NULL)
|
||||
{
|
||||
gst_event_ref (s_event);
|
||||
video_seek_worked = gst_element_send_event (
|
||||
play->video_sink_element, s_event);
|
||||
video_seek_worked =
|
||||
gst_element_send_event (play->video_sink_element, s_event);
|
||||
}
|
||||
gst_event_unref (s_event);
|
||||
|
||||
if (audio_seek_worked || video_seek_worked){
|
||||
if (audio_seek_worked || video_seek_worked)
|
||||
{
|
||||
play->time_nanos = gst_clock_get_time (play->clock);
|
||||
g_signal_emit (G_OBJECT (play), gst_play_signals [TIME_TICK], 0, play->time_nanos);
|
||||
g_signal_emit (G_OBJECT (play), gst_play_signals[TIME_TICK], 0,
|
||||
play->time_nanos);
|
||||
}
|
||||
if (gst_element_set_state (play->pipeline, prev_state) != GST_STATE_SUCCESS)
|
||||
g_warning ("gst_play_seek_to_time: setting to READY failed\n");
|
||||
|
@ -770,11 +782,13 @@ gst_play_need_new_video_window (GstPlay *play)
|
|||
{
|
||||
g_return_if_fail (play != NULL);
|
||||
g_return_if_fail (GST_IS_PLAY (play));
|
||||
if (GST_IS_ELEMENT(play->video_sink_element)){
|
||||
if (GST_IS_ELEMENT (play->video_sink_element))
|
||||
{
|
||||
g_object_set (G_OBJECT (play->video_sink_element),
|
||||
"need_new_window", TRUE, NULL);
|
||||
}
|
||||
if (GST_IS_ELEMENT(play->visualisation_sink_element)){
|
||||
if (GST_IS_ELEMENT (play->visualisation_sink_element))
|
||||
{
|
||||
g_object_set (G_OBJECT (play->visualisation_sink_element),
|
||||
"need_new_window", TRUE, NULL);
|
||||
}
|
||||
|
@ -804,8 +818,7 @@ gst_play_set_idle_timeout_funcs ( GstPlay *play,
|
|||
*/
|
||||
GstElement *
|
||||
gst_play_get_sink_element (GstPlay * play,
|
||||
GstElement *element,
|
||||
GstPlaySinkType sink_type)
|
||||
GstElement * element, GstPlaySinkType sink_type)
|
||||
{
|
||||
GList *elements = NULL;
|
||||
const GList *pads = NULL;
|
||||
|
@ -816,7 +829,8 @@ gst_play_get_sink_element ( GstPlay *play,
|
|||
g_return_val_if_fail (GST_IS_PLAY (play), NULL);
|
||||
g_return_val_if_fail (GST_IS_ELEMENT (element), NULL);
|
||||
|
||||
if (!GST_IS_BIN(element)){
|
||||
if (!GST_IS_BIN (element))
|
||||
{
|
||||
/* since its not a bin, we'll presume this
|
||||
* element is a sink element */
|
||||
return element;
|
||||
|
@ -826,34 +840,42 @@ gst_play_get_sink_element ( GstPlay *play,
|
|||
|
||||
/* traverse all elements looking for a src pad */
|
||||
|
||||
while (elements) {
|
||||
while (elements)
|
||||
{
|
||||
|
||||
element = GST_ELEMENT (elements->data);
|
||||
|
||||
/* Recursivity :) */
|
||||
|
||||
if (GST_IS_BIN(element)) {
|
||||
if (GST_IS_BIN (element))
|
||||
{
|
||||
element = gst_play_get_sink_element (play, element, sink_type);
|
||||
if (GST_IS_ELEMENT (element)) {
|
||||
if (GST_IS_ELEMENT (element))
|
||||
{
|
||||
return element;
|
||||
}
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
|
||||
pads = gst_element_get_pad_list (element);
|
||||
has_src = FALSE;
|
||||
has_correct_type = FALSE;
|
||||
while (pads) {
|
||||
while (pads)
|
||||
{
|
||||
/* check for src pad */
|
||||
if (GST_PAD_DIRECTION (GST_PAD (pads->data)) == GST_PAD_SRC) {
|
||||
if (GST_PAD_DIRECTION (GST_PAD (pads->data)) == GST_PAD_SRC)
|
||||
{
|
||||
has_src = TRUE;
|
||||
break;
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
/* If not a src pad checking caps */
|
||||
GstCaps *caps;
|
||||
caps = gst_pad_get_caps (GST_PAD (pads->data));
|
||||
while (caps) {
|
||||
while (caps)
|
||||
{
|
||||
gboolean has_video_cap = FALSE, has_audio_cap = FALSE;
|
||||
if (g_ascii_strcasecmp (gst_caps_get_mime (caps),
|
||||
"audio/raw") == 0)
|
||||
|
@ -866,7 +888,8 @@ gst_play_get_sink_element ( GstPlay *play,
|
|||
has_video_cap = TRUE;
|
||||
}
|
||||
|
||||
switch (sink_type) {
|
||||
switch (sink_type)
|
||||
{
|
||||
case GST_PLAY_SINK_TYPE_AUDIO:
|
||||
if (has_audio_cap)
|
||||
has_correct_type = TRUE;
|
||||
|
@ -887,7 +910,8 @@ gst_play_get_sink_element ( GstPlay *play,
|
|||
}
|
||||
pads = g_list_next (pads);
|
||||
}
|
||||
if ( (!has_src) && (has_correct_type) ){
|
||||
if ((!has_src) && (has_correct_type))
|
||||
{
|
||||
return element;
|
||||
}
|
||||
}
|
||||
|
@ -913,8 +937,7 @@ gst_play_get_sink_element ( GstPlay *play,
|
|||
* Returns: a #GstElementStateReturn indicating if the operation succeeded.
|
||||
*/
|
||||
GstElementStateReturn
|
||||
gst_play_set_state ( GstPlay *play,
|
||||
GstElementState state)
|
||||
gst_play_set_state (GstPlay * play, GstElementState state)
|
||||
{
|
||||
g_return_val_if_fail (play != NULL, GST_STATE_FAILURE);
|
||||
g_return_val_if_fail (GST_IS_PLAY (play), GST_STATE_FAILURE);
|
||||
|
@ -951,8 +974,7 @@ gst_play_get_state (GstPlay *play)
|
|||
* Returns: TRUE if location was set successfully.
|
||||
*/
|
||||
gboolean
|
||||
gst_play_set_location ( GstPlay *play,
|
||||
const gchar *location)
|
||||
gst_play_set_location (GstPlay * play, const gchar * location)
|
||||
{
|
||||
GstElementState current_state;
|
||||
g_return_val_if_fail (play != NULL, FALSE);
|
||||
|
@ -960,13 +982,19 @@ gst_play_set_location ( GstPlay *play,
|
|||
g_return_val_if_fail (location != NULL, FALSE);
|
||||
|
||||
current_state = gst_play_get_state (play);
|
||||
if (current_state != GST_STATE_READY){
|
||||
if (current_state != GST_STATE_READY)
|
||||
{
|
||||
if (gst_play_set_state (play, GST_STATE_READY) != GST_STATE_SUCCESS)
|
||||
g_warning ("gst_play_set_location: setting to READY failed\n");
|
||||
}
|
||||
|
||||
if (play->set_autoplugger){
|
||||
if (! play->set_autoplugger(play, gst_element_factory_make ("spider", "autoplugger"))){
|
||||
if (play->set_autoplugger)
|
||||
{
|
||||
if (!play->
|
||||
set_autoplugger (play,
|
||||
gst_element_factory_make ("spider",
|
||||
"autoplugger")))
|
||||
{
|
||||
g_warning ("couldn't replace autoplugger\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -1013,8 +1041,7 @@ gst_play_get_location (GstPlay *play)
|
|||
* Set current volume of @play.
|
||||
*/
|
||||
void
|
||||
gst_play_set_volume ( GstPlay *play,
|
||||
gfloat volume)
|
||||
gst_play_set_volume (GstPlay * play, gfloat volume)
|
||||
{
|
||||
g_return_if_fail (play != NULL);
|
||||
g_return_if_fail (GST_IS_PLAY (play));
|
||||
|
@ -1051,8 +1078,7 @@ gst_play_get_volume (GstPlay *play)
|
|||
* Mutes/Unmutes audio playback of @play.
|
||||
*/
|
||||
void
|
||||
gst_play_set_mute ( GstPlay *play,
|
||||
gboolean mute)
|
||||
gst_play_set_mute (GstPlay * play, gboolean mute)
|
||||
{
|
||||
g_return_if_fail (play != NULL);
|
||||
g_return_if_fail (GST_IS_PLAY (play));
|
||||
|
@ -1097,20 +1123,21 @@ gst_play_get_mute (GstPlay *play)
|
|||
* Returns: TRUE if call succeeded.
|
||||
*/
|
||||
gboolean
|
||||
gst_play_set_data_src ( GstPlay *play,
|
||||
GstElement *data_src)
|
||||
gst_play_set_data_src (GstPlay * play, GstElement * data_src)
|
||||
{
|
||||
g_return_val_if_fail (play != NULL, FALSE);
|
||||
g_return_val_if_fail (data_src != NULL, FALSE);
|
||||
g_return_val_if_fail (GST_IS_PLAY (play), FALSE);
|
||||
g_return_val_if_fail (GST_IS_ELEMENT (data_src), FALSE);
|
||||
|
||||
if (gst_play_get_state (play) != GST_STATE_READY){
|
||||
if (gst_play_get_state (play) != GST_STATE_READY)
|
||||
{
|
||||
if (gst_play_set_state (play, GST_STATE_READY) != GST_STATE_SUCCESS)
|
||||
g_warning ("gst_play_set_data_src: setting to READY failed\n");
|
||||
}
|
||||
|
||||
if (play->set_data_src){
|
||||
if (play->set_data_src)
|
||||
{
|
||||
return play->set_data_src (play, data_src);
|
||||
}
|
||||
|
||||
|
@ -1128,20 +1155,21 @@ gst_play_set_data_src ( GstPlay *play,
|
|||
* Returns: TRUE if call succeeded.
|
||||
*/
|
||||
gboolean
|
||||
gst_play_set_video_sink ( GstPlay *play,
|
||||
GstElement *video_sink)
|
||||
gst_play_set_video_sink (GstPlay * play, GstElement * video_sink)
|
||||
{
|
||||
g_return_val_if_fail (play != NULL, FALSE);
|
||||
g_return_val_if_fail (video_sink != NULL, FALSE);
|
||||
g_return_val_if_fail (GST_IS_PLAY (play), FALSE);
|
||||
g_return_val_if_fail (GST_IS_ELEMENT (video_sink), FALSE);
|
||||
|
||||
if (gst_play_get_state (play) != GST_STATE_READY){
|
||||
if (gst_play_get_state (play) != GST_STATE_READY)
|
||||
{
|
||||
if (gst_play_set_state (play, GST_STATE_READY) != GST_STATE_SUCCESS)
|
||||
g_warning ("gst_play_set_video_sink: setting to READY failed\n");
|
||||
}
|
||||
|
||||
if (play->set_video_sink){
|
||||
if (play->set_video_sink)
|
||||
{
|
||||
return play->set_video_sink (play, video_sink);
|
||||
}
|
||||
|
||||
|
@ -1159,20 +1187,21 @@ gst_play_set_video_sink ( GstPlay *play,
|
|||
* Returns: TRUE if call succeeded.
|
||||
*/
|
||||
gboolean
|
||||
gst_play_set_audio_sink ( GstPlay *play,
|
||||
GstElement *audio_sink)
|
||||
gst_play_set_audio_sink (GstPlay * play, GstElement * audio_sink)
|
||||
{
|
||||
g_return_val_if_fail (play != NULL, FALSE);
|
||||
g_return_val_if_fail (audio_sink != NULL, FALSE);
|
||||
g_return_val_if_fail (GST_IS_PLAY (play), FALSE);
|
||||
g_return_val_if_fail (GST_IS_ELEMENT (audio_sink), FALSE);
|
||||
|
||||
if (gst_play_get_state (play) != GST_STATE_READY){
|
||||
if (gst_play_get_state (play) != GST_STATE_READY)
|
||||
{
|
||||
if (gst_play_set_state (play, GST_STATE_READY) != GST_STATE_SUCCESS)
|
||||
g_warning ("gst_play_set_audio_sink: setting to READY failed\n");
|
||||
}
|
||||
|
||||
if (play->set_audio_sink){
|
||||
if (play->set_audio_sink)
|
||||
{
|
||||
return play->set_audio_sink (play, audio_sink);
|
||||
}
|
||||
|
||||
|
@ -1203,7 +1232,8 @@ gst_play_get_type (void)
|
|||
NULL
|
||||
};
|
||||
|
||||
play_type = g_type_register_static (G_TYPE_OBJECT, "GstPlay", &play_info, 0);
|
||||
play_type =
|
||||
g_type_register_static (G_TYPE_OBJECT, "GstPlay", &play_info, 0);
|
||||
}
|
||||
|
||||
return play_type;
|
||||
|
@ -1211,15 +1241,15 @@ gst_play_get_type (void)
|
|||
|
||||
|
||||
GstPlay *
|
||||
gst_play_new ( GstPlayPipeType pipe_type,
|
||||
GError **error)
|
||||
gst_play_new (GstPlayPipeType pipe_type, GError ** error)
|
||||
{
|
||||
GstPlay *play;
|
||||
|
||||
play = g_object_new (GST_TYPE_PLAY, NULL);
|
||||
|
||||
/* FIXME: looks like only VIDEO ever gets used ! */
|
||||
switch (pipe_type){
|
||||
switch (pipe_type)
|
||||
{
|
||||
case GST_PLAY_PIPE_VIDEO:
|
||||
play->setup_pipeline = gst_play_video_setup;
|
||||
play->teardown_pipeline = NULL;
|
||||
|
@ -1266,31 +1296,28 @@ gst_play_new ( GstPlayPipeType pipe_type,
|
|||
}
|
||||
|
||||
/* init pipeline */
|
||||
if ((play->setup_pipeline) &&
|
||||
(! play->setup_pipeline (play, error)))
|
||||
if ((play->setup_pipeline) && (!play->setup_pipeline (play, error)))
|
||||
{
|
||||
g_object_unref (play);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
if (play->pipeline) {
|
||||
if (play->pipeline)
|
||||
{
|
||||
/* connect to pipeline events */
|
||||
g_signal_connect (G_OBJECT (play->pipeline),
|
||||
"deep_notify",
|
||||
G_CALLBACK (callback_pipeline_deep_notify),
|
||||
play);
|
||||
G_CALLBACK (callback_pipeline_deep_notify), play);
|
||||
g_signal_connect (G_OBJECT (play->pipeline),
|
||||
"state_change",
|
||||
G_CALLBACK (callback_pipeline_state_change),
|
||||
play);
|
||||
G_CALLBACK (callback_pipeline_state_change), play);
|
||||
g_signal_connect (G_OBJECT (play->pipeline),
|
||||
"error",
|
||||
G_CALLBACK (callback_pipeline_error),
|
||||
play);
|
||||
"error", G_CALLBACK (callback_pipeline_error), play);
|
||||
}
|
||||
|
||||
if (play->volume) {
|
||||
if (play->volume)
|
||||
{
|
||||
play->vol_dpman = gst_dpman_get_manager (play->volume);
|
||||
play->vol_dparam = gst_dpsmooth_new (G_TYPE_FLOAT);
|
||||
|
||||
|
@ -1303,8 +1330,7 @@ gst_play_new ( GstPlayPipeType pipe_type,
|
|||
"slope_time", 10000000LL, NULL);
|
||||
|
||||
if (!gst_dpman_attach_dparam (play->vol_dpman,
|
||||
"volume",
|
||||
play->vol_dparam))
|
||||
"volume", play->vol_dparam))
|
||||
g_warning ("could not attach dparam to volume element\n");
|
||||
|
||||
gst_dpman_set_mode (play->vol_dpman, "asynchronous");
|
||||
|
|
|
@ -40,22 +40,27 @@
|
|||
* playing state.
|
||||
*/
|
||||
|
||||
typedef enum {
|
||||
typedef enum
|
||||
{
|
||||
GST_PLAY_OK,
|
||||
GST_PLAY_UNKNOWN_MEDIA,
|
||||
GST_PLAY_CANNOT_PLAY,
|
||||
GST_PLAY_ERROR,
|
||||
} GstPlayReturn;
|
||||
}
|
||||
GstPlayReturn;
|
||||
|
||||
typedef enum {
|
||||
typedef enum
|
||||
{
|
||||
GST_PLAY_PIPE_AUDIO,
|
||||
GST_PLAY_PIPE_AUDIO_THREADED,
|
||||
GST_PLAY_PIPE_AUDIO_HYPER_THREADED,
|
||||
GST_PLAY_PIPE_VIDEO,
|
||||
GST_PLAY_PIPE_VIDEO_VISUALISATION,
|
||||
} GstPlayPipeType;
|
||||
}
|
||||
GstPlayPipeType;
|
||||
|
||||
typedef enum {
|
||||
typedef enum
|
||||
{
|
||||
GST_PLAY_ERROR_FAKESINK,
|
||||
GST_PLAY_ERROR_THREAD,
|
||||
GST_PLAY_ERROR_QUEUE,
|
||||
|
@ -63,13 +68,16 @@ typedef enum {
|
|||
GST_PLAY_ERROR_VOLUME,
|
||||
GST_PLAY_ERROR_COLORSPACE,
|
||||
GST_PLAY_ERROR_LAST,
|
||||
} GstPlayError;
|
||||
}
|
||||
GstPlayError;
|
||||
|
||||
typedef enum {
|
||||
typedef enum
|
||||
{
|
||||
GST_PLAY_SINK_TYPE_AUDIO,
|
||||
GST_PLAY_SINK_TYPE_VIDEO,
|
||||
GST_PLAY_SINK_TYPE_ANY,
|
||||
} GstPlaySinkType;
|
||||
}
|
||||
GstPlaySinkType;
|
||||
|
||||
#define GST_PLAY_ERROR gst_play_error_quark ()
|
||||
|
||||
|
@ -85,8 +93,7 @@ typedef struct _GstPlayClass GstPlayClass;
|
|||
typedef struct _GstPlayIdleData GstPlayIdleData;
|
||||
|
||||
typedef guint (*GstPlayTimeoutAdd) (guint interval,
|
||||
GSourceFunc function,
|
||||
gpointer data);
|
||||
GSourceFunc function, gpointer data);
|
||||
typedef guint (*GstPlayIdleAdd) (GSourceFunc function, gpointer data);
|
||||
|
||||
struct _GstPlay
|
||||
|
@ -137,26 +144,17 @@ struct _GstPlayClass
|
|||
|
||||
/* signals */
|
||||
void (*information) (GstPlay * play,
|
||||
GstObject* element,
|
||||
GParamSpec *param);
|
||||
void (*pipeline_error) (GstPlay* play,
|
||||
GstElement* element,
|
||||
char *error);
|
||||
GstObject * element, GParamSpec * param);
|
||||
void (*pipeline_error) (GstPlay * play, GstElement * element, char *error);
|
||||
void (*state_changed) (GstPlay * play,
|
||||
GstElementState old_state,
|
||||
GstElementState new_state);
|
||||
void (*stream_end) (GstPlay * play);
|
||||
void (*time_tick) (GstPlay* play,
|
||||
gint64 time_nanos);
|
||||
void (*stream_length) (GstPlay* play,
|
||||
gint64 length_nanos);
|
||||
void (*have_xid) (GstPlay* play,
|
||||
gint xid);
|
||||
void (*have_vis_xid) (GstPlay* play,
|
||||
gint xid);
|
||||
void (*have_video_size) (GstPlay* play,
|
||||
gint width,
|
||||
gint height);
|
||||
void (*time_tick) (GstPlay * play, gint64 time_nanos);
|
||||
void (*stream_length) (GstPlay * play, gint64 length_nanos);
|
||||
void (*have_xid) (GstPlay * play, gint xid);
|
||||
void (*have_vis_xid) (GstPlay * play, gint xid);
|
||||
void (*have_video_size) (GstPlay * play, gint width, gint height);
|
||||
};
|
||||
|
||||
struct _GstPlayIdleData
|
||||
|
@ -166,82 +164,55 @@ struct _GstPlayIdleData
|
|||
};
|
||||
|
||||
|
||||
void
|
||||
gst_play_seek_to_time ( GstPlay *play,
|
||||
gint64 time_nanos);
|
||||
void gst_play_seek_to_time (GstPlay * play, gint64 time_nanos);
|
||||
|
||||
void
|
||||
gst_play_need_new_video_window (GstPlay *play);
|
||||
void gst_play_need_new_video_window (GstPlay * play);
|
||||
|
||||
void
|
||||
gst_play_set_idle_timeout_funcs (GstPlay * play,
|
||||
GstPlayTimeoutAdd timeout_add_func,
|
||||
GstPlayIdleAdd idle_add_func);
|
||||
GstElement*
|
||||
gst_play_get_sink_element ( GstPlay *play,
|
||||
GstElement *gst_play_get_sink_element (GstPlay * play,
|
||||
GstElement * element,
|
||||
GstPlaySinkType sink_type);
|
||||
|
||||
/* Set/Get state */
|
||||
|
||||
GstElementStateReturn
|
||||
gst_play_set_state ( GstPlay *play,
|
||||
GstElementState state);
|
||||
GstElementState
|
||||
gst_play_get_state (GstPlay *play);
|
||||
gst_play_set_state (GstPlay * play, GstElementState state);
|
||||
GstElementState gst_play_get_state (GstPlay * play);
|
||||
|
||||
/* Set/Get location */
|
||||
|
||||
gboolean
|
||||
gst_play_set_location ( GstPlay *play,
|
||||
const gchar *location);
|
||||
gchar*
|
||||
gst_play_get_location (GstPlay *play);
|
||||
gboolean gst_play_set_location (GstPlay * play, const gchar * location);
|
||||
gchar *gst_play_get_location (GstPlay * play);
|
||||
|
||||
/* Set/Get volume */
|
||||
|
||||
void
|
||||
gst_play_set_volume ( GstPlay *play,
|
||||
gfloat volume);
|
||||
gfloat
|
||||
gst_play_get_volume (GstPlay *play);
|
||||
void gst_play_set_volume (GstPlay * play, gfloat volume);
|
||||
gfloat gst_play_get_volume (GstPlay * play);
|
||||
|
||||
/* Set/Get mute */
|
||||
|
||||
void
|
||||
gst_play_set_mute ( GstPlay *play,
|
||||
gboolean mute);
|
||||
gboolean
|
||||
gst_play_get_mute (GstPlay *play);
|
||||
void gst_play_set_mute (GstPlay * play, gboolean mute);
|
||||
gboolean gst_play_get_mute (GstPlay * play);
|
||||
|
||||
/* Set sinks and data src */
|
||||
|
||||
gboolean
|
||||
gst_play_set_data_src ( GstPlay *play,
|
||||
GstElement *data_src);
|
||||
gboolean
|
||||
gst_play_set_video_sink ( GstPlay *play,
|
||||
GstElement *video_sink);
|
||||
gboolean gst_play_set_data_src (GstPlay * play, GstElement * data_src);
|
||||
gboolean gst_play_set_video_sink (GstPlay * play, GstElement * video_sink);
|
||||
gboolean
|
||||
gst_play_set_visualisation_video_sink (GstPlay * play,
|
||||
GstElement * video_sink);
|
||||
gboolean
|
||||
gst_play_set_audio_sink ( GstPlay *play,
|
||||
GstElement *audio_sink);
|
||||
gboolean gst_play_set_audio_sink (GstPlay * play, GstElement * audio_sink);
|
||||
|
||||
gboolean
|
||||
gst_play_set_visualisation_element ( GstPlay *play,
|
||||
GstElement *element);
|
||||
gst_play_set_visualisation_element (GstPlay * play, GstElement * element);
|
||||
|
||||
gboolean
|
||||
gst_play_connect_visualisation ( GstPlay *play,
|
||||
gboolean connect);
|
||||
gboolean gst_play_connect_visualisation (GstPlay * play, gboolean connect);
|
||||
|
||||
GType
|
||||
gst_play_get_type (void);
|
||||
GType gst_play_get_type (void);
|
||||
|
||||
GstPlay *
|
||||
gst_play_new ( GstPlayPipeType pipe_type,
|
||||
GError **error);
|
||||
GstPlay *gst_play_new (GstPlayPipeType pipe_type, GError ** error);
|
||||
|
||||
#endif /* __GSTPLAY_H__ */
|
||||
|
|
|
@ -24,18 +24,19 @@
|
|||
|
||||
static gboolean
|
||||
gst_play_default_set_data_src (GstPlay * play,
|
||||
GstElement *datasrc,
|
||||
GstElement* parent)
|
||||
GstElement * datasrc, GstElement * parent)
|
||||
{
|
||||
g_return_val_if_fail (play != NULL, FALSE);
|
||||
g_return_val_if_fail (datasrc != NULL, FALSE);
|
||||
g_return_val_if_fail (GST_IS_PLAY (play), FALSE);
|
||||
g_return_val_if_fail (GST_IS_ELEMENT (datasrc), FALSE);
|
||||
|
||||
if (GST_IS_ELEMENT(play->source)) {
|
||||
if (GST_IS_ELEMENT (play->source))
|
||||
{
|
||||
/* we need to remove the existing data
|
||||
source before creating a new one */
|
||||
if (GST_IS_ELEMENT(play->autoplugger)){
|
||||
if (GST_IS_ELEMENT (play->autoplugger))
|
||||
{
|
||||
gst_element_unlink (play->autoplugger, play->source);
|
||||
}
|
||||
gst_bin_remove (GST_BIN (parent), play->source);
|
||||
|
@ -45,7 +46,8 @@ gst_play_default_set_data_src ( GstPlay *play,
|
|||
g_return_val_if_fail (play->source != NULL, FALSE);
|
||||
|
||||
gst_bin_add (GST_BIN (parent), play->source);
|
||||
if (GST_IS_ELEMENT(play->autoplugger)){
|
||||
if (GST_IS_ELEMENT (play->autoplugger))
|
||||
{
|
||||
gst_element_link (play->autoplugger, play->source);
|
||||
}
|
||||
return TRUE;
|
||||
|
@ -57,8 +59,7 @@ gst_play_default_set_data_src ( GstPlay *play,
|
|||
*/
|
||||
|
||||
static gboolean
|
||||
gst_play_audio_setup ( GstPlay *play,
|
||||
GError **error)
|
||||
gst_play_audio_setup (GstPlay * play, GError ** error)
|
||||
{
|
||||
|
||||
/* creating gst_bin */
|
||||
|
@ -92,8 +93,7 @@ gst_play_audio_setup ( GstPlay *play,
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
gst_bin_add_many (
|
||||
GST_BIN (play->pipeline), play->volume,
|
||||
gst_bin_add_many (GST_BIN (play->pipeline), play->volume,
|
||||
play->audio_sink, NULL);
|
||||
|
||||
gst_element_link (play->volume, play->audio_sink);
|
||||
|
@ -102,8 +102,7 @@ gst_play_audio_setup ( GstPlay *play,
|
|||
}
|
||||
|
||||
static gboolean
|
||||
gst_play_simple_set_data_src ( GstPlay *play,
|
||||
GstElement *datasrc)
|
||||
gst_play_simple_set_data_src (GstPlay * play, GstElement * datasrc)
|
||||
{
|
||||
return gst_play_default_set_data_src (play, datasrc, play->pipeline);
|
||||
}
|
||||
|
@ -114,8 +113,7 @@ gst_play_simple_set_data_src ( GstPlay *play,
|
|||
*/
|
||||
|
||||
static gboolean
|
||||
gst_play_audiot_setup ( GstPlay *play,
|
||||
GError **error)
|
||||
gst_play_audiot_setup (GstPlay * play, GError ** error)
|
||||
{
|
||||
g_return_val_if_fail (play != NULL, FALSE);
|
||||
g_return_val_if_fail (GST_IS_PLAY (play), FALSE);
|
||||
|
@ -151,8 +149,7 @@ gst_play_audiot_setup ( GstPlay *play,
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
gst_bin_add_many (
|
||||
GST_BIN (play->pipeline), play->volume,
|
||||
gst_bin_add_many (GST_BIN (play->pipeline), play->volume,
|
||||
play->audio_sink, NULL);
|
||||
|
||||
gst_element_link (play->volume, play->audio_sink);
|
||||
|
@ -162,8 +159,7 @@ gst_play_audiot_setup ( GstPlay *play,
|
|||
|
||||
|
||||
static gboolean
|
||||
gst_play_audiot_set_audio ( GstPlay *play,
|
||||
GstElement *audio_sink)
|
||||
gst_play_audiot_set_audio (GstPlay * play, GstElement * audio_sink)
|
||||
{
|
||||
g_return_val_if_fail (play != NULL, FALSE);
|
||||
g_return_val_if_fail (audio_sink != NULL, FALSE);
|
||||
|
@ -180,17 +176,16 @@ gst_play_audiot_set_audio ( GstPlay *play,
|
|||
gst_bin_add (GST_BIN (play->pipeline), play->audio_sink);
|
||||
gst_element_link (play->volume, play->audio_sink);
|
||||
|
||||
play->audio_sink_element = gst_play_get_sink_element (
|
||||
play,
|
||||
play->audio_sink_element = gst_play_get_sink_element (play,
|
||||
audio_sink,
|
||||
GST_PLAY_SINK_TYPE_AUDIO);
|
||||
|
||||
play->visualisation_sink_element = gst_play_get_sink_element (
|
||||
play,
|
||||
play->visualisation_sink_element = gst_play_get_sink_element (play,
|
||||
audio_sink,
|
||||
GST_PLAY_SINK_TYPE_VIDEO);
|
||||
|
||||
if (play->audio_sink_element != NULL) {
|
||||
if (play->audio_sink_element != NULL)
|
||||
{
|
||||
g_signal_connect (G_OBJECT (play->audio_sink_element), "eos",
|
||||
G_CALLBACK (callback_audio_sink_eos), play);
|
||||
}
|
||||
|
@ -200,15 +195,15 @@ gst_play_audiot_set_audio ( GstPlay *play,
|
|||
|
||||
|
||||
static gboolean
|
||||
gst_play_audiot_set_auto ( GstPlay *play,
|
||||
GstElement *autoplugger)
|
||||
gst_play_audiot_set_auto (GstPlay * play, GstElement * autoplugger)
|
||||
{
|
||||
g_return_val_if_fail (play != NULL, FALSE);
|
||||
g_return_val_if_fail (autoplugger != NULL, FALSE);
|
||||
g_return_val_if_fail (GST_IS_PLAY (play), FALSE);
|
||||
g_return_val_if_fail (GST_IS_ELEMENT (autoplugger), FALSE);
|
||||
|
||||
if (play->autoplugger) {
|
||||
if (play->autoplugger)
|
||||
{
|
||||
/* we need to remove the existing autoplugger
|
||||
before creating a new one */
|
||||
gst_element_unlink (play->autoplugger, play->volume);
|
||||
|
@ -231,8 +226,7 @@ gst_play_audiot_set_auto ( GstPlay *play,
|
|||
*/
|
||||
|
||||
static gboolean
|
||||
gst_play_audioht_setup ( GstPlay *play,
|
||||
GError **error)
|
||||
gst_play_audioht_setup (GstPlay * play, GError ** error)
|
||||
{
|
||||
GstElement *audio_thread, *audio_queue;
|
||||
|
||||
|
@ -291,14 +285,13 @@ gst_play_audioht_setup ( GstPlay *play,
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
gst_bin_add_many (
|
||||
GST_BIN (audio_thread), audio_queue, play->volume,
|
||||
gst_bin_add_many (GST_BIN (audio_thread), audio_queue, play->volume,
|
||||
play->audio_sink, NULL);
|
||||
|
||||
gst_element_link_many (audio_queue, play->volume, play->audio_sink);
|
||||
|
||||
gst_element_add_ghost_pad (
|
||||
audio_thread, gst_element_get_pad (audio_queue, "sink"),
|
||||
gst_element_add_ghost_pad (audio_thread,
|
||||
gst_element_get_pad (audio_queue, "sink"),
|
||||
"sink");
|
||||
|
||||
gst_bin_add (GST_BIN (play->pipeline), audio_thread);
|
||||
|
@ -308,8 +301,7 @@ gst_play_audioht_setup ( GstPlay *play,
|
|||
|
||||
|
||||
static gboolean
|
||||
gst_play_audioht_set_audio ( GstPlay *play,
|
||||
GstElement *audio_sink)
|
||||
gst_play_audioht_set_audio (GstPlay * play, GstElement * audio_sink)
|
||||
{
|
||||
GstElement *audio_thread;
|
||||
|
||||
|
@ -330,17 +322,16 @@ gst_play_audioht_set_audio ( GstPlay *play,
|
|||
gst_bin_add (GST_BIN (audio_thread), play->audio_sink);
|
||||
gst_element_link (play->volume, play->audio_sink);
|
||||
|
||||
play->audio_sink_element = gst_play_get_sink_element (
|
||||
play,
|
||||
play->audio_sink_element = gst_play_get_sink_element (play,
|
||||
audio_sink,
|
||||
GST_PLAY_SINK_TYPE_AUDIO);
|
||||
|
||||
play->visualisation_sink_element = gst_play_get_sink_element (
|
||||
play,
|
||||
play->visualisation_sink_element = gst_play_get_sink_element (play,
|
||||
audio_sink,
|
||||
GST_PLAY_SINK_TYPE_VIDEO);
|
||||
|
||||
if (play->audio_sink_element != NULL) {
|
||||
if (play->audio_sink_element != NULL)
|
||||
{
|
||||
g_signal_connect (G_OBJECT (play->audio_sink_element), "eos",
|
||||
G_CALLBACK (callback_audio_sink_eos), play);
|
||||
}
|
||||
|
@ -350,8 +341,7 @@ gst_play_audioht_set_audio ( GstPlay *play,
|
|||
|
||||
|
||||
static gboolean
|
||||
gst_play_audioht_set_auto ( GstPlay *play,
|
||||
GstElement *autoplugger)
|
||||
gst_play_audioht_set_auto (GstPlay * play, GstElement * autoplugger)
|
||||
{
|
||||
GstElement *audio_thread;
|
||||
|
||||
|
@ -362,7 +352,8 @@ gst_play_audioht_set_auto ( GstPlay *play,
|
|||
|
||||
audio_thread = g_hash_table_lookup (play->other_elements, "audio_thread");
|
||||
|
||||
if (play->autoplugger) {
|
||||
if (play->autoplugger)
|
||||
{
|
||||
/* we need to remove the existing autoplugger
|
||||
before creating a new one */
|
||||
gst_element_unlink (play->autoplugger, audio_thread);
|
||||
|
@ -386,8 +377,7 @@ gst_play_audioht_set_auto ( GstPlay *play,
|
|||
*/
|
||||
|
||||
static gboolean
|
||||
gst_play_video_setup ( GstPlay *play,
|
||||
GError **error)
|
||||
gst_play_video_setup (GstPlay * play, GError ** error)
|
||||
{
|
||||
GstElement *audio_bin, *audio_queue;
|
||||
GstElement *video_queue, *video_bin;
|
||||
|
@ -452,14 +442,11 @@ gst_play_video_setup ( GstPlay *play,
|
|||
g_hash_table_insert (play->other_elements, "audio_bin", audio_bin);
|
||||
|
||||
/* adding all that stuff to bin */
|
||||
gst_bin_add_many (
|
||||
GST_BIN (audio_bin), audio_queue, play->volume,
|
||||
play->audio_sink, NULL);
|
||||
gst_element_link_many (audio_queue, play->volume,
|
||||
gst_bin_add_many (GST_BIN (audio_bin), audio_queue, play->volume,
|
||||
play->audio_sink, NULL);
|
||||
gst_element_link_many (audio_queue, play->volume, play->audio_sink, NULL);
|
||||
|
||||
gst_element_add_ghost_pad (
|
||||
audio_bin,
|
||||
gst_element_add_ghost_pad (audio_bin,
|
||||
gst_element_get_pad (audio_queue, "sink"),
|
||||
"sink");
|
||||
|
||||
|
@ -502,11 +489,10 @@ gst_play_video_setup ( GstPlay *play,
|
|||
gst_bin_add_many (GST_BIN (video_bin), video_queue, colorspace,
|
||||
play->video_sink, NULL);
|
||||
|
||||
gst_element_link_many (video_queue, colorspace,
|
||||
play->video_sink, NULL);
|
||||
gst_element_link_many (video_queue, colorspace, play->video_sink, NULL);
|
||||
|
||||
gst_element_add_ghost_pad (
|
||||
video_bin, gst_element_get_pad (video_queue, "sink"),
|
||||
gst_element_add_ghost_pad (video_bin,
|
||||
gst_element_get_pad (video_queue, "sink"),
|
||||
"sink");
|
||||
|
||||
gst_bin_add (GST_BIN (work_thread), video_bin);
|
||||
|
@ -515,8 +501,7 @@ gst_play_video_setup ( GstPlay *play,
|
|||
}
|
||||
|
||||
static gboolean
|
||||
gst_play_video_set_data_src ( GstPlay *play,
|
||||
GstElement *datasrc)
|
||||
gst_play_video_set_data_src (GstPlay * play, GstElement * datasrc)
|
||||
{
|
||||
GstElement *work_thread;
|
||||
g_return_val_if_fail (play != NULL, FALSE);
|
||||
|
@ -529,8 +514,7 @@ gst_play_video_set_data_src ( GstPlay *play,
|
|||
}
|
||||
|
||||
static gboolean
|
||||
gst_play_video_set_auto ( GstPlay *play,
|
||||
GstElement *autoplugger)
|
||||
gst_play_video_set_auto (GstPlay * play, GstElement * autoplugger)
|
||||
{
|
||||
|
||||
GstElement *audio_bin, *video_bin, *work_thread;
|
||||
|
@ -544,7 +528,8 @@ gst_play_video_set_auto ( GstPlay *play,
|
|||
video_bin = g_hash_table_lookup (play->other_elements, "video_bin");
|
||||
work_thread = g_hash_table_lookup (play->other_elements, "work_thread");
|
||||
|
||||
if (play->autoplugger) {
|
||||
if (play->autoplugger)
|
||||
{
|
||||
/* we need to remove the existing autoplugger
|
||||
before creating a new one */
|
||||
gst_element_unlink (play->autoplugger, audio_bin);
|
||||
|
@ -567,8 +552,7 @@ gst_play_video_set_auto ( GstPlay *play,
|
|||
|
||||
|
||||
static gboolean
|
||||
gst_play_video_set_video ( GstPlay *play,
|
||||
GstElement *video_sink)
|
||||
gst_play_video_set_video (GstPlay * play, GstElement * video_sink)
|
||||
{
|
||||
GstElement *video_mate, *video_bin;
|
||||
|
||||
|
@ -580,7 +564,8 @@ gst_play_video_set_video ( GstPlay *play,
|
|||
video_bin = g_hash_table_lookup (play->other_elements, "video_bin");
|
||||
video_mate = g_hash_table_lookup (play->other_elements, "colorspace");
|
||||
|
||||
if (play->video_sink) {
|
||||
if (play->video_sink)
|
||||
{
|
||||
gst_element_unlink (video_mate, play->video_sink);
|
||||
gst_bin_remove (GST_BIN (video_bin), play->video_sink);
|
||||
}
|
||||
|
@ -588,33 +573,27 @@ gst_play_video_set_video ( GstPlay *play,
|
|||
gst_bin_add (GST_BIN (video_bin), play->video_sink);
|
||||
gst_element_link (video_mate, play->video_sink);
|
||||
|
||||
play->video_sink_element = gst_play_get_sink_element (
|
||||
play,
|
||||
play->video_sink_element = gst_play_get_sink_element (play,
|
||||
video_sink,
|
||||
GST_PLAY_SINK_TYPE_VIDEO);
|
||||
|
||||
if (play->video_sink_element != NULL) {
|
||||
if (play->video_sink_element != NULL)
|
||||
{
|
||||
g_signal_connect (G_OBJECT (play->video_sink_element),
|
||||
"have_xid",
|
||||
G_CALLBACK (callback_video_have_xid),
|
||||
play);
|
||||
G_CALLBACK (callback_video_have_xid), play);
|
||||
g_signal_connect (G_OBJECT (play->video_sink_element),
|
||||
"have_size",
|
||||
G_CALLBACK (callback_video_have_size),
|
||||
play);
|
||||
G_CALLBACK (callback_video_have_size), play);
|
||||
g_object_set (G_OBJECT (play->video_sink_element),
|
||||
"need_new_window",
|
||||
TRUE,
|
||||
"toplevel",
|
||||
FALSE, NULL);
|
||||
"need_new_window", TRUE, "toplevel", FALSE, NULL);
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
static gboolean
|
||||
gst_play_video_set_audio ( GstPlay *play,
|
||||
GstElement *audio_sink)
|
||||
gst_play_video_set_audio (GstPlay * play, GstElement * audio_sink)
|
||||
{
|
||||
GstElement *audio_bin;
|
||||
|
||||
|
@ -635,17 +614,16 @@ gst_play_video_set_audio ( GstPlay *play,
|
|||
gst_bin_add (GST_BIN (audio_bin), play->audio_sink);
|
||||
gst_element_link (play->volume, play->audio_sink);
|
||||
|
||||
play->audio_sink_element = gst_play_get_sink_element (
|
||||
play,
|
||||
play->audio_sink_element = gst_play_get_sink_element (play,
|
||||
audio_sink,
|
||||
GST_PLAY_SINK_TYPE_AUDIO);
|
||||
|
||||
play->visualisation_sink_element = gst_play_get_sink_element (
|
||||
play,
|
||||
play->visualisation_sink_element = gst_play_get_sink_element (play,
|
||||
audio_sink,
|
||||
GST_PLAY_SINK_TYPE_VIDEO);
|
||||
|
||||
if (play->audio_sink_element != NULL) {
|
||||
if (play->audio_sink_element != NULL)
|
||||
{
|
||||
g_signal_connect (G_OBJECT (play->audio_sink_element), "eos",
|
||||
G_CALLBACK (callback_audio_sink_eos), play);
|
||||
}
|
||||
|
@ -660,8 +638,7 @@ gst_play_video_set_audio ( GstPlay *play,
|
|||
*/
|
||||
|
||||
static gboolean
|
||||
gst_play_video_vis_setup ( GstPlay *play,
|
||||
GError **error)
|
||||
gst_play_video_vis_setup (GstPlay * play, GError ** error)
|
||||
{
|
||||
|
||||
GstElement *work_thread, *tee_element;
|
||||
|
@ -705,9 +682,7 @@ gst_play_video_vis_setup ( GstPlay *play,
|
|||
gst_play_error_plugin (GST_PLAY_ERROR_THREAD, error);
|
||||
return FALSE;
|
||||
}
|
||||
g_hash_table_insert( play->other_elements,
|
||||
"audio_bin",
|
||||
play->audio_sink);
|
||||
g_hash_table_insert (play->other_elements, "audio_bin", play->audio_sink);
|
||||
|
||||
audio_queue = gst_element_factory_make ("queue", "audio_queue");
|
||||
if (!audio_queue)
|
||||
|
@ -715,9 +690,7 @@ gst_play_video_vis_setup ( GstPlay *play,
|
|||
gst_play_error_plugin (GST_PLAY_ERROR_QUEUE, error);
|
||||
return FALSE;
|
||||
}
|
||||
g_hash_table_insert ( play->other_elements,
|
||||
"audio_queue",
|
||||
audio_queue);
|
||||
g_hash_table_insert (play->other_elements, "audio_queue", audio_queue);
|
||||
|
||||
play->volume = gst_element_factory_make ("volume", "audio_volume");
|
||||
if (!play->volume)
|
||||
|
@ -725,24 +698,16 @@ gst_play_video_vis_setup ( GstPlay *play,
|
|||
gst_play_error_plugin (GST_PLAY_ERROR_VOLUME, error);
|
||||
return FALSE;
|
||||
}
|
||||
g_hash_table_insert ( play->other_elements,
|
||||
"audio_volume",
|
||||
play->volume);
|
||||
g_hash_table_insert (play->other_elements, "audio_volume", play->volume);
|
||||
|
||||
tee_element = gst_element_factory_make ("tee", "audio_tee");
|
||||
g_return_val_if_fail (GST_IS_ELEMENT (tee_element), FALSE);
|
||||
g_hash_table_insert( play->other_elements,
|
||||
"vis_tee",
|
||||
play->audio_sink);
|
||||
g_hash_table_insert (play->other_elements, "vis_tee", play->audio_sink);
|
||||
|
||||
tee_vis_pad = gst_element_get_request_pad (tee_element, "src%d");
|
||||
tee_audio_pad = gst_element_get_request_pad (tee_element, "src%d");
|
||||
g_hash_table_insert( play->other_elements,
|
||||
"tee_vis_pad",
|
||||
tee_vis_pad);
|
||||
g_hash_table_insert( play->other_elements,
|
||||
"tee_audio_pad",
|
||||
tee_audio_pad);
|
||||
g_hash_table_insert (play->other_elements, "tee_vis_pad", tee_vis_pad);
|
||||
g_hash_table_insert (play->other_elements, "tee_audio_pad", tee_audio_pad);
|
||||
|
||||
audio_sink = gst_element_factory_make ("fakesink", "audio_sink");
|
||||
if (!audio_sink)
|
||||
|
@ -750,23 +715,18 @@ gst_play_video_vis_setup ( GstPlay *play,
|
|||
gst_play_error_plugin (GST_PLAY_ERROR_FAKESINK, error);
|
||||
return FALSE;
|
||||
}
|
||||
g_hash_table_insert ( play->other_elements,
|
||||
"audio_sink",
|
||||
audio_sink);
|
||||
g_hash_table_insert (play->other_elements, "audio_sink", audio_sink);
|
||||
|
||||
audio_sink_pad = gst_element_get_pad (audio_sink, "sink");
|
||||
g_hash_table_insert (play->other_elements,
|
||||
"audio_sink_pad",
|
||||
audio_sink_pad);
|
||||
"audio_sink_pad", audio_sink_pad);
|
||||
|
||||
play->audio_sink_element = NULL;
|
||||
|
||||
|
||||
gst_bin_add_many (GST_BIN (play->audio_sink),
|
||||
audio_queue, play->volume,
|
||||
tee_element, audio_sink, NULL);
|
||||
gst_element_link_many ( audio_queue, play->volume,
|
||||
tee_element, NULL);
|
||||
audio_queue, play->volume, tee_element, audio_sink, NULL);
|
||||
gst_element_link_many (audio_queue, play->volume, tee_element, NULL);
|
||||
|
||||
gst_pad_link (tee_audio_pad, audio_sink_pad);
|
||||
|
||||
|
@ -785,8 +745,7 @@ gst_play_video_vis_setup ( GstPlay *play,
|
|||
return FALSE;
|
||||
}
|
||||
g_hash_table_insert (play->other_elements,
|
||||
"vis_video_thread",
|
||||
vis_video_thread);
|
||||
"vis_video_thread", vis_video_thread);
|
||||
|
||||
vis_video_queue = gst_element_factory_make ("queue", "vis_video_queue");
|
||||
if (!vis_video_queue)
|
||||
|
@ -795,8 +754,7 @@ gst_play_video_vis_setup ( GstPlay *play,
|
|||
return FALSE;
|
||||
}
|
||||
g_hash_table_insert (play->other_elements,
|
||||
"vis_video_queue",
|
||||
vis_video_queue);
|
||||
"vis_video_queue", vis_video_queue);
|
||||
|
||||
vis_colorspace = gst_element_factory_make ("colorspace", "vis_colorspace");
|
||||
if (!vis_colorspace)
|
||||
|
@ -805,8 +763,7 @@ gst_play_video_vis_setup ( GstPlay *play,
|
|||
return FALSE;
|
||||
}
|
||||
g_hash_table_insert (play->other_elements,
|
||||
"vis_colorspace",
|
||||
vis_colorspace);
|
||||
"vis_colorspace", vis_colorspace);
|
||||
|
||||
vis_video_sink = gst_element_factory_make ("fakesink", "vis_video_sink");
|
||||
if (!vis_video_sink)
|
||||
|
@ -815,22 +772,20 @@ gst_play_video_vis_setup ( GstPlay *play,
|
|||
return FALSE;
|
||||
}
|
||||
g_hash_table_insert (play->other_elements,
|
||||
"vis_video_sink",
|
||||
vis_video_sink);
|
||||
"vis_video_sink", vis_video_sink);
|
||||
play->video_sink_element = NULL;
|
||||
|
||||
gst_bin_add_many (GST_BIN (vis_video_thread), vis_video_queue,
|
||||
vis_colorspace, vis_video_sink, NULL);
|
||||
|
||||
|
||||
vis_video_thread_pad = gst_element_add_ghost_pad (
|
||||
vis_video_thread,
|
||||
gst_element_get_pad (vis_video_queue, "sink"),
|
||||
vis_video_thread_pad = gst_element_add_ghost_pad (vis_video_thread,
|
||||
gst_element_get_pad
|
||||
(vis_video_queue, "sink"),
|
||||
"sink");
|
||||
|
||||
g_hash_table_insert (play->other_elements,
|
||||
"vis_video_thread_pad",
|
||||
vis_video_thread_pad);
|
||||
"vis_video_thread_pad", vis_video_thread_pad);
|
||||
|
||||
gst_bin_add (GST_BIN (play->audio_sink), vis_video_thread);
|
||||
|
||||
|
@ -875,11 +830,10 @@ gst_play_video_vis_setup ( GstPlay *play,
|
|||
gst_bin_add_many (GST_BIN (video_bin), video_queue, colorspace,
|
||||
play->video_sink, NULL);
|
||||
|
||||
gst_element_link_many (video_queue, colorspace,
|
||||
play->video_sink, NULL);
|
||||
gst_element_link_many (video_queue, colorspace, play->video_sink, NULL);
|
||||
|
||||
gst_element_add_ghost_pad (
|
||||
video_bin, gst_element_get_pad (video_queue, "sink"),
|
||||
gst_element_add_ghost_pad (video_bin,
|
||||
gst_element_get_pad (video_queue, "sink"),
|
||||
"sink");
|
||||
|
||||
gst_bin_add (GST_BIN (work_thread), video_bin);
|
||||
|
@ -888,8 +842,7 @@ gst_play_video_vis_setup ( GstPlay *play,
|
|||
}
|
||||
|
||||
static gboolean
|
||||
gst_play_video_vis_set_audio ( GstPlay *play,
|
||||
GstElement *audio_sink)
|
||||
gst_play_video_vis_set_audio (GstPlay * play, GstElement * audio_sink)
|
||||
{
|
||||
GstElement *audio_bin, *vis_audio_sink;
|
||||
GstPad *audio_sink_pad, *tee_audio_pad;
|
||||
|
@ -899,14 +852,11 @@ gst_play_video_vis_set_audio ( GstPlay *play,
|
|||
g_return_val_if_fail (GST_IS_PLAY (play), FALSE);
|
||||
g_return_val_if_fail (GST_IS_ELEMENT (audio_sink), FALSE);
|
||||
|
||||
audio_bin = g_hash_table_lookup ( play->other_elements,
|
||||
"audio_bin");
|
||||
vis_audio_sink = g_hash_table_lookup ( play->other_elements,
|
||||
"audio_sink");
|
||||
audio_bin = g_hash_table_lookup (play->other_elements, "audio_bin");
|
||||
vis_audio_sink = g_hash_table_lookup (play->other_elements, "audio_sink");
|
||||
audio_sink_pad = g_hash_table_lookup (play->other_elements,
|
||||
"audio_sink_pad");
|
||||
tee_audio_pad = g_hash_table_lookup ( play->other_elements,
|
||||
"tee_audio_pad");
|
||||
tee_audio_pad = g_hash_table_lookup (play->other_elements, "tee_audio_pad");
|
||||
|
||||
if ((vis_audio_sink) && GST_IS_ELEMENT (vis_audio_sink))
|
||||
{
|
||||
|
@ -920,20 +870,17 @@ gst_play_video_vis_set_audio ( GstPlay *play,
|
|||
|
||||
gst_pad_link (tee_audio_pad, audio_sink_pad);
|
||||
|
||||
g_hash_table_replace( play->other_elements,
|
||||
"audio_sink",
|
||||
audio_sink);
|
||||
g_hash_table_replace (play->other_elements, "audio_sink", audio_sink);
|
||||
|
||||
g_hash_table_replace (play->other_elements,
|
||||
"audio_sink_pad",
|
||||
audio_sink_pad);
|
||||
"audio_sink_pad", audio_sink_pad);
|
||||
|
||||
play->audio_sink_element = gst_play_get_sink_element (
|
||||
play,
|
||||
play->audio_sink_element = gst_play_get_sink_element (play,
|
||||
audio_sink,
|
||||
GST_PLAY_SINK_TYPE_AUDIO);
|
||||
|
||||
if (play->audio_sink_element != NULL) {
|
||||
if (play->audio_sink_element != NULL)
|
||||
{
|
||||
g_signal_connect (G_OBJECT (play->audio_sink_element), "eos",
|
||||
G_CALLBACK (callback_audio_sink_eos), play);
|
||||
}
|
||||
|
@ -942,8 +889,7 @@ gst_play_video_vis_set_audio ( GstPlay *play,
|
|||
}
|
||||
|
||||
static gboolean
|
||||
gst_play_video_vis_set_video ( GstPlay *play,
|
||||
GstElement *video_sink)
|
||||
gst_play_video_vis_set_video (GstPlay * play, GstElement * video_sink)
|
||||
{
|
||||
GstElement *video_mate, *video_bin;
|
||||
|
||||
|
@ -955,7 +901,8 @@ gst_play_video_vis_set_video ( GstPlay *play,
|
|||
video_bin = g_hash_table_lookup (play->other_elements, "video_bin");
|
||||
video_mate = g_hash_table_lookup (play->other_elements, "colorspace");
|
||||
|
||||
if (play->video_sink) {
|
||||
if (play->video_sink)
|
||||
{
|
||||
gst_element_unlink (video_mate, play->video_sink);
|
||||
gst_bin_remove (GST_BIN (video_bin), play->video_sink);
|
||||
}
|
||||
|
@ -963,25 +910,20 @@ gst_play_video_vis_set_video ( GstPlay *play,
|
|||
gst_bin_add (GST_BIN (video_bin), play->video_sink);
|
||||
gst_element_link (video_mate, play->video_sink);
|
||||
|
||||
play->video_sink_element = gst_play_get_sink_element (
|
||||
play,
|
||||
play->video_sink_element = gst_play_get_sink_element (play,
|
||||
video_sink,
|
||||
GST_PLAY_SINK_TYPE_VIDEO);
|
||||
|
||||
if (play->video_sink_element != NULL) {
|
||||
if (play->video_sink_element != NULL)
|
||||
{
|
||||
g_signal_connect (G_OBJECT (play->video_sink_element),
|
||||
"have_xid",
|
||||
G_CALLBACK (callback_video_have_xid),
|
||||
play);
|
||||
G_CALLBACK (callback_video_have_xid), play);
|
||||
g_signal_connect (G_OBJECT (play->video_sink_element),
|
||||
"have_size",
|
||||
G_CALLBACK (callback_video_have_size),
|
||||
play);
|
||||
G_CALLBACK (callback_video_have_size), play);
|
||||
g_object_set (G_OBJECT (play->video_sink_element),
|
||||
"need_new_window",
|
||||
TRUE,
|
||||
"toplevel",
|
||||
FALSE, NULL);
|
||||
"need_new_window", TRUE, "toplevel", FALSE, NULL);
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -1011,7 +953,8 @@ gst_play_set_visualisation_video_sink ( GstPlay *play,
|
|||
vis_video_sink = g_hash_table_lookup (play->other_elements,
|
||||
"vis_video_sink");
|
||||
|
||||
if (vis_video_sink) {
|
||||
if (vis_video_sink)
|
||||
{
|
||||
gst_element_unlink (video_mate, vis_video_sink);
|
||||
gst_bin_remove (GST_BIN (video_bin), vis_video_sink);
|
||||
}
|
||||
|
@ -1019,29 +962,23 @@ gst_play_set_visualisation_video_sink ( GstPlay *play,
|
|||
gst_bin_add (GST_BIN (video_bin), video_sink);
|
||||
gst_element_link (video_mate, video_sink);
|
||||
|
||||
g_hash_table_replace( play->other_elements,
|
||||
"vis_video_sink",
|
||||
video_sink);
|
||||
g_hash_table_replace (play->other_elements, "vis_video_sink", video_sink);
|
||||
|
||||
play->visualisation_sink_element = gst_play_get_sink_element (
|
||||
play,
|
||||
play->visualisation_sink_element = gst_play_get_sink_element (play,
|
||||
video_sink,
|
||||
GST_PLAY_SINK_TYPE_VIDEO);
|
||||
|
||||
if (play->visualisation_sink_element != NULL) {
|
||||
if (play->visualisation_sink_element != NULL)
|
||||
{
|
||||
g_signal_connect (G_OBJECT (play->visualisation_sink_element),
|
||||
"have_xid",
|
||||
G_CALLBACK (callback_video_have_vis_xid),
|
||||
play);
|
||||
G_CALLBACK (callback_video_have_vis_xid), play);
|
||||
/*g_signal_connect ( G_OBJECT (play->visualisation_sink_element),
|
||||
"have_size",
|
||||
G_CALLBACK (callback_video_have_vis_size),
|
||||
play); */
|
||||
g_object_set (G_OBJECT (play->visualisation_sink_element),
|
||||
"need_new_window",
|
||||
TRUE,
|
||||
"toplevel",
|
||||
FALSE, NULL);
|
||||
"need_new_window", TRUE, "toplevel", FALSE, NULL);
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -1056,8 +993,7 @@ gst_play_set_visualisation_video_sink ( GstPlay *play,
|
|||
* Returns: TRUE if call succeeded.
|
||||
*/
|
||||
gboolean
|
||||
gst_play_set_visualisation_element ( GstPlay *play,
|
||||
GstElement *element)
|
||||
gst_play_set_visualisation_element (GstPlay * play, GstElement * element)
|
||||
{
|
||||
GstElement *video_queue, *video_colorspace;
|
||||
GstElement *vis_element, *vis_video_bin;
|
||||
|
@ -1069,13 +1005,12 @@ gst_play_set_visualisation_element ( GstPlay *play,
|
|||
|
||||
vis_video_bin = g_hash_table_lookup (play->other_elements,
|
||||
"vis_video_thread");
|
||||
video_queue = g_hash_table_lookup ( play->other_elements,
|
||||
"vis_video_queue");
|
||||
video_queue = g_hash_table_lookup (play->other_elements, "vis_video_queue");
|
||||
video_colorspace = g_hash_table_lookup (play->other_elements,
|
||||
"vis_colorspace");
|
||||
vis_element = g_hash_table_lookup ( play->other_elements,
|
||||
"vis_element");
|
||||
if (vis_element) {
|
||||
vis_element = g_hash_table_lookup (play->other_elements, "vis_element");
|
||||
if (vis_element)
|
||||
{
|
||||
gst_element_unlink (video_queue, vis_element);
|
||||
gst_element_unlink (vis_element, video_colorspace);
|
||||
gst_bin_remove (GST_BIN (vis_video_bin), vis_element);
|
||||
|
@ -1084,9 +1019,7 @@ gst_play_set_visualisation_element ( GstPlay *play,
|
|||
gst_bin_add (GST_BIN (vis_video_bin), element);
|
||||
gst_element_link_many (video_queue, element, video_colorspace, NULL);
|
||||
|
||||
g_hash_table_replace( play->other_elements,
|
||||
"vis_element",
|
||||
element);
|
||||
g_hash_table_replace (play->other_elements, "vis_element", element);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -1102,8 +1035,7 @@ gst_play_set_visualisation_element ( GstPlay *play,
|
|||
* Returns: TRUE if call succeeded.
|
||||
*/
|
||||
gboolean
|
||||
gst_play_connect_visualisation ( GstPlay *play,
|
||||
gboolean connect)
|
||||
gst_play_connect_visualisation (GstPlay * play, gboolean connect)
|
||||
{
|
||||
GstPad *tee_vis_pad, *vis_video_thread_pad;
|
||||
GstElement *vis_video_thread;
|
||||
|
@ -1112,8 +1044,7 @@ gst_play_connect_visualisation ( GstPlay *play,
|
|||
g_return_val_if_fail (play != NULL, FALSE);
|
||||
g_return_val_if_fail (GST_IS_PLAY (play), FALSE);
|
||||
|
||||
tee_vis_pad = g_hash_table_lookup( play->other_elements,
|
||||
"tee_vis_pad");
|
||||
tee_vis_pad = g_hash_table_lookup (play->other_elements, "tee_vis_pad");
|
||||
vis_video_thread_pad = g_hash_table_lookup (play->other_elements,
|
||||
"vis_video_thread_pad");
|
||||
vis_video_thread = g_hash_table_lookup (play->other_elements,
|
||||
|
@ -1124,14 +1055,17 @@ gst_play_connect_visualisation ( GstPlay *play,
|
|||
else
|
||||
connected = FALSE;
|
||||
|
||||
if ( (connect) && (!connected) ) {
|
||||
if ((connect) && (!connected))
|
||||
{
|
||||
gst_pad_link (tee_vis_pad, vis_video_thread_pad);
|
||||
}
|
||||
else if ( (!connect) && (connected) ){
|
||||
else if ((!connect) && (connected))
|
||||
{
|
||||
gst_pad_unlink (tee_vis_pad, vis_video_thread_pad);
|
||||
}
|
||||
|
||||
if ( GST_IS_ELEMENT(vis_video_thread) && GST_IS_ELEMENT(play->pipeline) ) {
|
||||
if (GST_IS_ELEMENT (vis_video_thread) && GST_IS_ELEMENT (play->pipeline))
|
||||
{
|
||||
gst_element_set_state (vis_video_thread,
|
||||
gst_element_get_state (play->pipeline));
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue