return proper values for state change failures

Original commit message from CVS:
return proper values for state change failures
This commit is contained in:
Thomas Vander Stichele 2004-03-29 17:19:38 +00:00
parent 4dc3806b1f
commit c6571b5c17
2 changed files with 23 additions and 6 deletions

View file

@ -1,3 +1,13 @@
2004-03-29 Thomas Vander Stichele <thomas at apestaart dot org>
* examples/gstplay/player.c: (main):
* gst-libs/gst/play/play.c: (gst_play_class_init),
(gst_play_set_location), (gst_play_set_data_src),
(gst_play_set_video_sink), (gst_play_set_audio_sink),
(gst_play_set_visualization), (gst_play_connect_visualization):
check return values of element_set_state and return FALSE where
failed
2004-03-29 Benjamin Otte <otte@gnome.org>
* ext/mad/gstid3tag.c: (gst_id3_tag_handle_event):

View file

@ -127,13 +127,18 @@ main (int argc, char *argv[])
data_src = gst_element_factory_make ("gnomevfssrc", "source");
/* Let's send them to GstPlay object */
gst_play_set_audio_sink (play, audio_sink);
gst_play_set_video_sink (play, video_sink);
gst_play_set_data_src (play, data_src);
gst_play_set_visualization (play, vis_element);
if (!gst_play_set_audio_sink (play, audio_sink))
g_warning ("Could not set audio sink");
if (!gst_play_set_video_sink (play, video_sink))
g_warning ("Could not set video sink");
if (!gst_play_set_data_src (play, data_src))
g_warning ("Could not set data src");
if (!gst_play_set_visualization (play, vis_element))
g_warning ("Could not set visualisation");
/* Setting location we want to play */
gst_play_set_location (play, argv[1]);
if (!gst_play_set_location (play, argv[1]))
g_warning ("Could not set location");
/* Uncomment that line to get an XML dump of the pipeline */
/* gst_xml_write_file (GST_ELEMENT (play), stdout); */
@ -151,7 +156,9 @@ main (int argc, char *argv[])
g_signal_connect (G_OBJECT (play), "eos", G_CALLBACK (got_eos), NULL);
/* Change state to PLAYING */
gst_element_set_state (GST_ELEMENT (play), GST_STATE_PLAYING);
if (gst_element_set_state (GST_ELEMENT (play),
GST_STATE_PLAYING) == GST_STATE_FAILURE)
g_warning ("Could not set state to PLAYING");
g_idle_add ((GSourceFunc) idle_iterate, play);
g_timeout_add (20000, (GSourceFunc) seek_timer, play);