mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-27 09:38:17 +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
File diff suppressed because it is too large
Load diff
|
@ -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 ()
|
||||
|
||||
|
@ -84,21 +92,20 @@ typedef struct _GstPlay GstPlay;
|
|||
typedef struct _GstPlayClass GstPlayClass;
|
||||
typedef struct _GstPlayIdleData GstPlayIdleData;
|
||||
|
||||
typedef guint (*GstPlayTimeoutAdd) ( guint interval,
|
||||
GSourceFunc function,
|
||||
gpointer data);
|
||||
typedef guint (*GstPlayTimeoutAdd) (guint interval,
|
||||
GSourceFunc function, gpointer data);
|
||||
typedef guint (*GstPlayIdleAdd) (GSourceFunc function, gpointer data);
|
||||
|
||||
struct _GstPlay
|
||||
{
|
||||
GObject parent;
|
||||
|
||||
gboolean (*setup_pipeline) (GstPlay *play, GError **error);
|
||||
void (*teardown_pipeline) (GstPlay *play);
|
||||
gboolean (*set_data_src) (GstPlay *play, GstElement *datasrc);
|
||||
gboolean (*set_autoplugger) (GstPlay *play, GstElement *autoplugger);
|
||||
gboolean (*set_video_sink) (GstPlay *play, GstElement *videosink);
|
||||
gboolean (*set_audio_sink) (GstPlay *play, GstElement *audiosink);
|
||||
gboolean (*setup_pipeline) (GstPlay * play, GError ** error);
|
||||
void (*teardown_pipeline) (GstPlay * play);
|
||||
gboolean (*set_data_src) (GstPlay * play, GstElement * datasrc);
|
||||
gboolean (*set_autoplugger) (GstPlay * play, GstElement * autoplugger);
|
||||
gboolean (*set_video_sink) (GstPlay * play, GstElement * videosink);
|
||||
gboolean (*set_audio_sink) (GstPlay * play, GstElement * audiosink);
|
||||
|
||||
/* core elements */
|
||||
GstElement *pipeline;
|
||||
|
@ -136,27 +143,18 @@ struct _GstPlayClass
|
|||
GObjectClass parent_class;
|
||||
|
||||
/* signals */
|
||||
void (*information) (GstPlay* play,
|
||||
GstObject* element,
|
||||
GParamSpec *param);
|
||||
void (*pipeline_error) (GstPlay* play,
|
||||
GstElement* element,
|
||||
char *error);
|
||||
void (*state_changed) (GstPlay* play,
|
||||
void (*information) (GstPlay * play,
|
||||
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 (*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);
|
||||
};
|
||||
|
||||
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,
|
||||
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 *element,
|
||||
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);
|
||||
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_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__ */
|
||||
|
|
|
@ -23,29 +23,31 @@
|
|||
*/
|
||||
|
||||
static gboolean
|
||||
gst_play_default_set_data_src ( GstPlay *play,
|
||||
GstElement *datasrc,
|
||||
GstElement* parent)
|
||||
gst_play_default_set_data_src (GstPlay * play,
|
||||
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);
|
||||
gst_bin_remove (GST_BIN (parent), play->source);
|
||||
}
|
||||
|
||||
play->source = datasrc;
|
||||
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,10 +102,9 @@ 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);
|
||||
return gst_play_default_set_data_src (play, datasrc, play->pipeline);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -114,11 +113,10 @@ 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);
|
||||
g_return_val_if_fail (GST_IS_PLAY (play), FALSE);
|
||||
|
||||
/* creating gst_thread */
|
||||
play->pipeline = gst_thread_new ("main_pipeline");
|
||||
|
@ -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,12 +159,11 @@ 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);
|
||||
g_return_val_if_fail (GST_IS_PLAY(play), FALSE);
|
||||
g_return_val_if_fail (GST_IS_PLAY (play), FALSE);
|
||||
g_return_val_if_fail (GST_IS_ELEMENT (audio_sink), FALSE);
|
||||
|
||||
if (play->audio_sink)
|
||||
|
@ -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,13 +226,12 @@ 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;
|
||||
|
||||
g_return_val_if_fail (play != NULL, FALSE);
|
||||
g_return_val_if_fail (GST_IS_PLAY(play), FALSE);
|
||||
g_return_val_if_fail (GST_IS_PLAY (play), FALSE);
|
||||
|
||||
/*
|
||||
play->pipeline = gst_thread_new ("main_pipeline");
|
||||
|
@ -263,7 +257,7 @@ gst_play_audioht_setup ( GstPlay *play,
|
|||
audio_thread = gst_thread_new ("audio_thread");
|
||||
g_return_val_if_fail (GST_IS_THREAD (audio_thread), FALSE);
|
||||
|
||||
g_hash_table_insert(play->other_elements, "audio_thread", audio_thread);
|
||||
g_hash_table_insert (play->other_elements, "audio_thread", audio_thread);
|
||||
|
||||
/* create audio queue */
|
||||
audio_queue = gst_element_factory_make ("queue", "audio_queue");
|
||||
|
@ -273,7 +267,7 @@ gst_play_audioht_setup ( GstPlay *play,
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
g_hash_table_insert(play->other_elements, "audio_queue", audio_queue);
|
||||
g_hash_table_insert (play->other_elements, "audio_queue", audio_queue);
|
||||
|
||||
/* create source element */
|
||||
play->volume = gst_element_factory_make ("volume", "volume");
|
||||
|
@ -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,17 +301,16 @@ 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;
|
||||
|
||||
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_PLAY (play), FALSE);
|
||||
g_return_val_if_fail (GST_IS_ELEMENT (audio_sink), FALSE);
|
||||
|
||||
audio_thread = g_hash_table_lookup(play->other_elements, "audio_thread");
|
||||
audio_thread = g_hash_table_lookup (play->other_elements, "audio_thread");
|
||||
|
||||
if (play->audio_sink)
|
||||
{
|
||||
|
@ -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,19 +341,19 @@ 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;
|
||||
|
||||
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_PLAY (play), FALSE);
|
||||
g_return_val_if_fail (GST_IS_ELEMENT (autoplugger), FALSE);
|
||||
|
||||
audio_thread = g_hash_table_lookup(play->other_elements, "audio_thread");
|
||||
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,15 +377,14 @@ 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;
|
||||
GstElement *work_thread, *colorspace;
|
||||
|
||||
g_return_val_if_fail (play != NULL, FALSE);
|
||||
g_return_val_if_fail (GST_IS_PLAY(play), FALSE);
|
||||
g_return_val_if_fail (GST_IS_PLAY (play), FALSE);
|
||||
|
||||
/* creating pipeline */
|
||||
play->pipeline = gst_pipeline_new ("main_pipeline");
|
||||
|
@ -403,7 +393,7 @@ gst_play_video_setup ( GstPlay *play,
|
|||
/* creating work thread */
|
||||
work_thread = gst_thread_new ("work_thread");
|
||||
g_return_val_if_fail (GST_IS_THREAD (work_thread), FALSE);
|
||||
g_hash_table_insert(play->other_elements, "work_thread", work_thread);
|
||||
g_hash_table_insert (play->other_elements, "work_thread", work_thread);
|
||||
|
||||
gst_bin_add (GST_BIN (play->pipeline), work_thread);
|
||||
|
||||
|
@ -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,36 +501,35 @@ 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);
|
||||
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);
|
||||
g_return_val_if_fail (GST_IS_PLAY (play), FALSE);
|
||||
g_return_val_if_fail (GST_IS_ELEMENT (datasrc), FALSE);
|
||||
|
||||
work_thread = g_hash_table_lookup(play->other_elements, "work_thread");
|
||||
return gst_play_default_set_data_src(play, datasrc, work_thread);
|
||||
work_thread = g_hash_table_lookup (play->other_elements, "work_thread");
|
||||
return gst_play_default_set_data_src (play, datasrc, work_thread);
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
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_PLAY (play), FALSE);
|
||||
g_return_val_if_fail (GST_IS_ELEMENT (autoplugger), FALSE);
|
||||
|
||||
audio_bin = g_hash_table_lookup(play->other_elements, "audio_bin");
|
||||
video_bin = g_hash_table_lookup(play->other_elements, "video_bin");
|
||||
work_thread = g_hash_table_lookup(play->other_elements, "work_thread");
|
||||
audio_bin = g_hash_table_lookup (play->other_elements, "audio_bin");
|
||||
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,20 +552,20 @@ 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;
|
||||
|
||||
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_PLAY (play), FALSE);
|
||||
g_return_val_if_fail (GST_IS_ELEMENT (video_sink), FALSE);
|
||||
|
||||
video_bin = g_hash_table_lookup(play->other_elements, "video_bin");
|
||||
video_mate = g_hash_table_lookup(play->other_elements, "colorspace");
|
||||
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,42 +573,36 @@ 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) {
|
||||
g_signal_connect ( G_OBJECT (play->video_sink_element),
|
||||
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_signal_connect ( G_OBJECT (play->video_sink_element),
|
||||
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_object_set( G_OBJECT(play->video_sink_element),
|
||||
"need_new_window",
|
||||
TRUE,
|
||||
"toplevel",
|
||||
FALSE, NULL);
|
||||
G_CALLBACK (callback_video_have_size), play);
|
||||
g_object_set (G_OBJECT (play->video_sink_element),
|
||||
"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;
|
||||
|
||||
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_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");
|
||||
audio_bin = g_hash_table_lookup (play->other_elements, "audio_bin");
|
||||
|
||||
if (play->audio_sink)
|
||||
{
|
||||
|
@ -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;
|
||||
|
@ -673,7 +650,7 @@ gst_play_video_vis_setup ( GstPlay *play,
|
|||
GstElement *video_queue, *video_bin, *colorspace;
|
||||
|
||||
g_return_val_if_fail (play != NULL, FALSE);
|
||||
g_return_val_if_fail (GST_IS_PLAY(play), FALSE);
|
||||
g_return_val_if_fail (GST_IS_PLAY (play), FALSE);
|
||||
|
||||
/* creating pipeline */
|
||||
play->pipeline = gst_pipeline_new ("main_pipeline");
|
||||
|
@ -682,7 +659,7 @@ gst_play_video_vis_setup ( GstPlay *play,
|
|||
/* creating work thread */
|
||||
work_thread = gst_thread_new ("work_thread");
|
||||
g_return_val_if_fail (GST_IS_THREAD (work_thread), FALSE);
|
||||
g_hash_table_insert(play->other_elements, "work_thread", work_thread);
|
||||
g_hash_table_insert (play->other_elements, "work_thread", work_thread);
|
||||
|
||||
gst_bin_add (GST_BIN (play->pipeline), work_thread);
|
||||
|
||||
|
@ -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_return_val_if_fail (GST_IS_ELEMENT (tee_element), FALSE);
|
||||
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,27 +715,22 @@ 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);
|
||||
g_hash_table_insert (play->other_elements,
|
||||
"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);
|
||||
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);
|
||||
|
||||
gst_pad_link ( tee_audio_pad, audio_sink_pad);
|
||||
gst_pad_link (tee_audio_pad, audio_sink_pad);
|
||||
|
||||
gst_element_add_ghost_pad ( play->audio_sink,
|
||||
gst_element_add_ghost_pad (play->audio_sink,
|
||||
gst_element_get_pad (audio_queue, "sink"),
|
||||
"sink");
|
||||
|
||||
|
@ -784,9 +744,8 @@ 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,
|
||||
"vis_video_thread",
|
||||
vis_video_thread);
|
||||
g_hash_table_insert (play->other_elements,
|
||||
"vis_video_thread", vis_video_thread);
|
||||
|
||||
vis_video_queue = gst_element_factory_make ("queue", "vis_video_queue");
|
||||
if (!vis_video_queue)
|
||||
|
@ -794,9 +753,8 @@ 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,
|
||||
"vis_video_queue",
|
||||
vis_video_queue);
|
||||
g_hash_table_insert (play->other_elements,
|
||||
"vis_video_queue", vis_video_queue);
|
||||
|
||||
vis_colorspace = gst_element_factory_make ("colorspace", "vis_colorspace");
|
||||
if (!vis_colorspace)
|
||||
|
@ -804,9 +762,8 @@ gst_play_video_vis_setup ( GstPlay *play,
|
|||
gst_play_error_plugin (GST_PLAY_ERROR_COLORSPACE, error);
|
||||
return FALSE;
|
||||
}
|
||||
g_hash_table_insert ( play->other_elements,
|
||||
"vis_colorspace",
|
||||
vis_colorspace);
|
||||
g_hash_table_insert (play->other_elements,
|
||||
"vis_colorspace", vis_colorspace);
|
||||
|
||||
vis_video_sink = gst_element_factory_make ("fakesink", "vis_video_sink");
|
||||
if (!vis_video_sink)
|
||||
|
@ -814,25 +771,23 @@ 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,
|
||||
"vis_video_sink",
|
||||
vis_video_sink);
|
||||
g_hash_table_insert (play->other_elements,
|
||||
"vis_video_sink", vis_video_sink);
|
||||
play->video_sink_element = NULL;
|
||||
|
||||
gst_bin_add_many ( GST_BIN (vis_video_thread), vis_video_queue,
|
||||
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);
|
||||
g_hash_table_insert (play->other_elements,
|
||||
"vis_video_thread_pad", vis_video_thread_pad);
|
||||
|
||||
gst_bin_add (GST_BIN(play->audio_sink), vis_video_thread);
|
||||
gst_bin_add (GST_BIN (play->audio_sink), vis_video_thread);
|
||||
|
||||
/* END VIS STUFF */
|
||||
|
||||
|
@ -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,27 +842,23 @@ 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;
|
||||
|
||||
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_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_sink_pad = g_hash_table_lookup ( play->other_elements,
|
||||
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) )
|
||||
if ((vis_audio_sink) && GST_IS_ELEMENT (vis_audio_sink))
|
||||
{
|
||||
gst_pad_unlink (tee_audio_pad, audio_sink_pad);
|
||||
gst_bin_remove (GST_BIN (audio_bin), vis_audio_sink);
|
||||
|
@ -916,24 +866,21 @@ gst_play_video_vis_set_audio ( GstPlay *play,
|
|||
|
||||
gst_bin_add (GST_BIN (audio_bin), audio_sink);
|
||||
|
||||
audio_sink_pad = gst_element_get_pad (audio_sink,"sink");
|
||||
audio_sink_pad = gst_element_get_pad (audio_sink, "sink");
|
||||
|
||||
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);
|
||||
g_hash_table_replace (play->other_elements,
|
||||
"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,20 +889,20 @@ 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;
|
||||
|
||||
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_PLAY (play), FALSE);
|
||||
g_return_val_if_fail (GST_IS_ELEMENT (video_sink), FALSE);
|
||||
|
||||
video_bin = g_hash_table_lookup(play->other_elements, "video_bin");
|
||||
video_mate = g_hash_table_lookup(play->other_elements, "colorspace");
|
||||
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) {
|
||||
g_signal_connect ( G_OBJECT (play->video_sink_element),
|
||||
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_signal_connect ( G_OBJECT (play->video_sink_element),
|
||||
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_object_set( G_OBJECT(play->video_sink_element),
|
||||
"need_new_window",
|
||||
TRUE,
|
||||
"toplevel",
|
||||
FALSE, NULL);
|
||||
G_CALLBACK (callback_video_have_size), play);
|
||||
g_object_set (G_OBJECT (play->video_sink_element),
|
||||
"need_new_window", TRUE, "toplevel", FALSE, NULL);
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -996,22 +938,23 @@ gst_play_video_vis_set_video ( GstPlay *play,
|
|||
* Returns: TRUE if call succeeded.
|
||||
*/
|
||||
gboolean
|
||||
gst_play_set_visualisation_video_sink ( GstPlay *play,
|
||||
GstElement *video_sink)
|
||||
gst_play_set_visualisation_video_sink (GstPlay * play,
|
||||
GstElement * video_sink)
|
||||
{
|
||||
GstElement *video_mate, *video_bin, *vis_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_PLAY (play), FALSE);
|
||||
g_return_val_if_fail (GST_IS_ELEMENT (video_sink), FALSE);
|
||||
|
||||
video_bin = g_hash_table_lookup(play->other_elements, "vis_video_thread");
|
||||
video_mate = g_hash_table_lookup(play->other_elements, "vis_colorspace");
|
||||
vis_video_sink = g_hash_table_lookup( play->other_elements,
|
||||
video_bin = g_hash_table_lookup (play->other_elements, "vis_video_thread");
|
||||
video_mate = g_hash_table_lookup (play->other_elements, "vis_colorspace");
|
||||
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) {
|
||||
g_signal_connect ( G_OBJECT (play->visualisation_sink_element),
|
||||
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);
|
||||
play); */
|
||||
g_object_set (G_OBJECT (play->visualisation_sink_element),
|
||||
"need_new_window", TRUE, "toplevel", FALSE, NULL);
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -1056,26 +993,24 @@ 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;
|
||||
|
||||
g_return_val_if_fail (play != NULL, FALSE);
|
||||
g_return_val_if_fail (element != NULL, FALSE);
|
||||
g_return_val_if_fail (GST_IS_PLAY(play), FALSE);
|
||||
g_return_val_if_fail (GST_IS_PLAY (play), FALSE);
|
||||
g_return_val_if_fail (GST_IS_ELEMENT (element), FALSE);
|
||||
|
||||
vis_video_bin = g_hash_table_lookup ( play->other_elements,
|
||||
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_colorspace = g_hash_table_lookup ( play->other_elements,
|
||||
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,21 +1035,19 @@ 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;
|
||||
gboolean connected = FALSE;
|
||||
|
||||
g_return_val_if_fail (play != NULL, FALSE);
|
||||
g_return_val_if_fail (GST_IS_PLAY(play), FALSE);
|
||||
g_return_val_if_fail (GST_IS_PLAY (play), FALSE);
|
||||
|
||||
tee_vis_pad = g_hash_table_lookup( play->other_elements,
|
||||
"tee_vis_pad");
|
||||
vis_video_thread_pad = g_hash_table_lookup( play->other_elements,
|
||||
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,
|
||||
vis_video_thread = g_hash_table_lookup (play->other_elements,
|
||||
"vis_video_thread");
|
||||
|
||||
if (gst_pad_get_peer (vis_video_thread_pad) != NULL)
|
||||
|
@ -1124,15 +1055,18 @@ 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) ) {
|
||||
gst_element_set_state ( vis_video_thread,
|
||||
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