mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-22 00:06:36 +00:00
Adding a lot of sanity checks
Original commit message from CVS: Adding a lot of sanity checks Checking if vis pad is connected before linking/unlinking
This commit is contained in:
parent
646db378d5
commit
a9bd477470
2 changed files with 61 additions and 21 deletions
|
@ -152,8 +152,9 @@ gst_play_set_property ( GObject *object,
|
|||
const GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GstPlay *play = GST_PLAY (object);
|
||||
|
||||
GstPlay *play;
|
||||
g_return_if_fail (object != NULL);
|
||||
play = GST_PLAY (object);
|
||||
g_return_if_fail (GST_IS_PLAY (play));
|
||||
|
||||
switch (prop_id) {
|
||||
|
@ -178,8 +179,9 @@ gst_play_get_property ( GObject *object,
|
|||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GstPlay *play = GST_PLAY (object);
|
||||
|
||||
GstPlay *play;
|
||||
g_return_if_fail (object != NULL);
|
||||
play = GST_PLAY (object);
|
||||
g_return_if_fail (GST_IS_PLAY (play));
|
||||
|
||||
switch (prop_id) {
|
||||
|
@ -242,7 +244,8 @@ gst_play_tick_callback (GstPlay *play)
|
|||
{
|
||||
gint secs;
|
||||
|
||||
g_return_val_if_fail(GST_IS_PLAY(play), FALSE);
|
||||
g_return_val_if_fail (play != NULL, FALSE);
|
||||
g_return_val_if_fail (GST_IS_PLAY(play), FALSE);
|
||||
|
||||
play->clock = gst_bin_get_clock (GST_BIN (play->pipeline));
|
||||
play->time_nanos = gst_clock_get_time(play->clock);
|
||||
|
@ -293,7 +296,8 @@ gst_play_default_idle_add ( GSourceFunc function,
|
|||
static gboolean
|
||||
gst_play_idle_callback (GstPlay *play)
|
||||
{
|
||||
g_return_val_if_fail(GST_IS_PLAY(play), FALSE);
|
||||
g_return_val_if_fail (play != NULL, FALSE);
|
||||
g_return_val_if_fail (GST_IS_PLAY(play), FALSE);
|
||||
|
||||
return gst_bin_iterate (GST_BIN (play->pipeline));
|
||||
}
|
||||
|
@ -304,7 +308,8 @@ gst_play_idle_signal (GstPlay *play)
|
|||
GstPlaySignal *signal;
|
||||
gint queue_length;
|
||||
|
||||
g_return_val_if_fail(GST_IS_PLAY(play), FALSE);
|
||||
g_return_val_if_fail (play != NULL, FALSE);
|
||||
g_return_val_if_fail (GST_IS_PLAY(play), FALSE);
|
||||
|
||||
signal = g_async_queue_try_pop(play->signal_queue);
|
||||
if (signal == NULL){
|
||||
|
@ -457,6 +462,8 @@ callback_pipeline_state_change ( GstElement *element,
|
|||
{
|
||||
GstPlaySignal *signal;
|
||||
|
||||
g_return_if_fail (play != NULL);
|
||||
g_return_if_fail (element != NULL);
|
||||
g_return_if_fail (GST_IS_ELEMENT (element));
|
||||
g_return_if_fail (GST_IS_PLAY (play));
|
||||
g_return_if_fail (element == play->pipeline);
|
||||
|
@ -689,6 +696,7 @@ gst_play_seek_to_time ( GstPlay *play,
|
|||
gboolean video_seek_worked = FALSE;
|
||||
gboolean visualisation_seek_worked = FALSE;
|
||||
|
||||
g_return_if_fail (play != NULL);
|
||||
g_return_if_fail (GST_IS_PLAY (play));
|
||||
if (time_nanos < 0LL){
|
||||
play->seek_time = 0LL;
|
||||
|
@ -757,6 +765,7 @@ gst_play_set_idle_timeout_funcs ( GstPlay *play,
|
|||
GstPlayTimeoutAdd timeout_add_func,
|
||||
GstPlayIdleAdd idle_add_func)
|
||||
{
|
||||
g_return_if_fail (play != NULL);
|
||||
g_return_if_fail (GST_IS_PLAY (play));
|
||||
play->timeout_add_func = timeout_add_func;
|
||||
play->idle_add_func = idle_add_func;
|
||||
|
@ -782,6 +791,8 @@ gst_play_get_sink_element ( GstPlay *play,
|
|||
const GList *pads = NULL;
|
||||
gboolean has_src, has_correct_type;
|
||||
|
||||
g_return_val_if_fail (play != NULL, NULL);
|
||||
g_return_val_if_fail (element != NULL, NULL);
|
||||
g_return_val_if_fail (GST_IS_PLAY (play), NULL);
|
||||
g_return_val_if_fail (GST_IS_ELEMENT (element), NULL);
|
||||
|
||||
|
@ -885,9 +896,9 @@ GstElementStateReturn
|
|||
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);
|
||||
g_return_val_if_fail (GST_IS_ELEMENT(play->pipeline), GST_STATE_FAILURE);
|
||||
/*g_print("setting state to %d\n", state);*/
|
||||
|
||||
return gst_element_set_state(play->pipeline, state);
|
||||
}
|
||||
|
@ -903,6 +914,7 @@ gst_play_set_state ( GstPlay *play,
|
|||
GstElementState
|
||||
gst_play_get_state (GstPlay *play)
|
||||
{
|
||||
g_return_val_if_fail (play != NULL, GST_STATE_FAILURE);
|
||||
g_return_val_if_fail (GST_IS_PLAY (play), GST_STATE_FAILURE);
|
||||
g_return_val_if_fail (play->pipeline, GST_STATE_FAILURE);
|
||||
|
||||
|
@ -923,6 +935,7 @@ gst_play_set_location ( GstPlay *play,
|
|||
const gchar *location)
|
||||
{
|
||||
GstElementState current_state;
|
||||
g_return_val_if_fail (play != NULL, FALSE);
|
||||
g_return_val_if_fail (GST_IS_PLAY (play), FALSE);
|
||||
g_return_val_if_fail (location != NULL, FALSE);
|
||||
|
||||
|
@ -964,6 +977,7 @@ gchar*
|
|||
gst_play_get_location (GstPlay *play)
|
||||
{
|
||||
gchar* location;
|
||||
g_return_val_if_fail (play != NULL, NULL);
|
||||
g_return_val_if_fail (GST_IS_PLAY (play), NULL);
|
||||
g_return_val_if_fail (GST_IS_ELEMENT(play->source), NULL);
|
||||
g_object_get (G_OBJECT (play->source), "location", &location, NULL);
|
||||
|
@ -981,6 +995,7 @@ void
|
|||
gst_play_set_volume ( GstPlay *play,
|
||||
gfloat volume)
|
||||
{
|
||||
g_return_if_fail (play != NULL);
|
||||
g_return_if_fail (GST_IS_PLAY (play));
|
||||
|
||||
g_object_set(G_OBJECT(play->vol_dparam), "value_float", volume, NULL);
|
||||
|
@ -999,6 +1014,7 @@ gst_play_get_volume (GstPlay *play)
|
|||
{
|
||||
gfloat volume;
|
||||
|
||||
g_return_val_if_fail (play != NULL, 0);
|
||||
g_return_val_if_fail (GST_IS_PLAY (play), 0);
|
||||
|
||||
g_object_get(G_OBJECT(play->vol_dparam), "value_float", &volume, NULL);
|
||||
|
@ -1017,6 +1033,7 @@ void
|
|||
gst_play_set_mute ( GstPlay *play,
|
||||
gboolean mute)
|
||||
{
|
||||
g_return_if_fail (play != NULL);
|
||||
g_return_if_fail (GST_IS_PLAY (play));
|
||||
|
||||
g_object_set (G_OBJECT (play->volume), "mute", mute, NULL);
|
||||
|
@ -1035,6 +1052,7 @@ gst_play_get_mute (GstPlay *play)
|
|||
{
|
||||
gboolean mute;
|
||||
|
||||
g_return_val_if_fail (play != NULL, 0);
|
||||
g_return_val_if_fail (GST_IS_PLAY (play), 0);
|
||||
|
||||
g_object_get (G_OBJECT (play->volume), "mute", &mute, NULL);
|
||||
|
@ -1061,6 +1079,8 @@ gboolean
|
|||
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);
|
||||
|
||||
|
@ -1089,6 +1109,8 @@ gboolean
|
|||
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);
|
||||
|
||||
|
@ -1117,6 +1139,8 @@ gboolean
|
|||
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);
|
||||
|
||||
|
@ -1267,12 +1291,3 @@ gst_play_new ( GstPlayPipeType pipe_type,
|
|||
|
||||
return play;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -27,6 +27,8 @@ 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);
|
||||
|
||||
|
@ -125,7 +127,7 @@ static gboolean
|
|||
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);
|
||||
|
||||
/* creating gst_thread */
|
||||
|
@ -183,6 +185,8 @@ static gboolean
|
|||
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_ELEMENT (audio_sink), FALSE);
|
||||
|
||||
|
@ -219,7 +223,8 @@ static gboolean
|
|||
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);
|
||||
|
||||
|
@ -251,6 +256,7 @@ gst_play_audioht_setup ( GstPlay *play,
|
|||
{
|
||||
GstElement *audio_thread, *audio_queue;
|
||||
|
||||
g_return_val_if_fail (play != NULL, FALSE);
|
||||
g_return_val_if_fail (GST_IS_PLAY(play), FALSE);
|
||||
|
||||
/*
|
||||
|
@ -337,6 +343,8 @@ gst_play_audioht_set_audio ( GstPlay *play,
|
|||
{
|
||||
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_ELEMENT (audio_sink), FALSE);
|
||||
|
||||
|
@ -377,6 +385,8 @@ gst_play_audioht_set_auto ( GstPlay *play,
|
|||
{
|
||||
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_ELEMENT (autoplugger), FALSE);
|
||||
|
||||
|
@ -413,6 +423,7 @@ gst_play_video_setup ( GstPlay *play,
|
|||
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);
|
||||
|
||||
/* creating pipeline */
|
||||
|
@ -558,7 +569,10 @@ 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);
|
||||
|
||||
work_thread = g_hash_table_lookup(play->other_elements, "work_thread");
|
||||
return gst_play_default_set_data_src(play, datasrc, work_thread);
|
||||
|
@ -572,6 +586,7 @@ gst_play_video_set_auto ( GstPlay *play,
|
|||
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_ELEMENT (autoplugger), FALSE);
|
||||
|
||||
|
@ -607,6 +622,8 @@ gst_play_video_set_video ( GstPlay *play,
|
|||
{
|
||||
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_ELEMENT (video_sink), FALSE);
|
||||
|
||||
|
@ -651,6 +668,8 @@ gst_play_video_set_audio ( GstPlay *play,
|
|||
{
|
||||
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_ELEMENT (audio_sink), FALSE);
|
||||
|
||||
|
@ -1172,6 +1191,7 @@ gst_play_connect_visualisation ( GstPlay *play,
|
|||
gboolean connect)
|
||||
{
|
||||
GstPad *tee_vis_pad, *vis_video_thread_pad;
|
||||
gboolean connected = FALSE;
|
||||
|
||||
g_return_val_if_fail (play != NULL, FALSE);
|
||||
g_return_val_if_fail (GST_IS_PLAY(play), FALSE);
|
||||
|
@ -1181,10 +1201,15 @@ gst_play_connect_visualisation ( GstPlay *play,
|
|||
vis_video_thread_pad = g_hash_table_lookup( play->other_elements,
|
||||
"vis_video_thread_pad");
|
||||
|
||||
if (connect) {
|
||||
if (gst_pad_get_peer (vis_video_thread_pad) != NULL)
|
||||
connected = TRUE;
|
||||
else
|
||||
connected = FALSE;
|
||||
|
||||
if ( (connect) && (!connected) ) {
|
||||
gst_pad_link (tee_vis_pad, vis_video_thread_pad);
|
||||
}
|
||||
else {
|
||||
else if ( (!connect) && (connected) ){
|
||||
gst_pad_unlink (tee_vis_pad, vis_video_thread_pad);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue