validate:tools: Return an exit code != 0 if pipeline can't go to playing

And give some information to the user about why the return code is !=0
everywhere it happens
This commit is contained in:
Thibault Saunier 2014-01-10 18:00:27 +01:00
parent 1c614b9ed9
commit d485180074
2 changed files with 9 additions and 3 deletions

View file

@ -837,8 +837,11 @@ main (int argc, gchar ** argv)
g_print ("Starting pipeline\n"); g_print ("Starting pipeline\n");
if (gst_element_set_state (pipeline, if (gst_element_set_state (pipeline,
GST_STATE_PLAYING) == GST_STATE_CHANGE_FAILURE) GST_STATE_PLAYING) == GST_STATE_CHANGE_FAILURE) {
g_print ("Pipeline failed to go to PLAYING state\n");
ret = -1;
goto exit; goto exit;
}
g_timeout_add (50, (GSourceFunc) print_position, NULL); g_timeout_add (50, (GSourceFunc) print_position, NULL);
g_main_loop_run (mainloop); g_main_loop_run (mainloop);

View file

@ -94,7 +94,7 @@ bus_callback (GstBus * bus, GstMessage * message, gpointer data)
gchar *debug; gchar *debug;
ret = -1; ret = -1;
gst_message_parse_error (message, &err, &debug); gst_message_parse_error (message, &err, &debug);
g_print ("Error: %s\n", err->message); g_print ("Error: %s -- Setting returncode to -1\n", err->message);
g_error_free (err); g_error_free (err);
g_free (debug); g_free (debug);
g_main_loop_quit (loop); g_main_loop_quit (loop);
@ -243,6 +243,7 @@ main (int argc, gchar ** argv)
if (gst_element_set_state (pipeline, if (gst_element_set_state (pipeline,
GST_STATE_PLAYING) == GST_STATE_CHANGE_FAILURE) { GST_STATE_PLAYING) == GST_STATE_CHANGE_FAILURE) {
g_print ("Pipeline failed to go to PLAYING state\n"); g_print ("Pipeline failed to go to PLAYING state\n");
ret = -1;
goto exit; goto exit;
} }
@ -251,8 +252,10 @@ main (int argc, gchar ** argv)
g_main_loop_run (mainloop); g_main_loop_run (mainloop);
rep_err = gst_validate_runner_printf (runner); rep_err = gst_validate_runner_printf (runner);
if (ret == 0) if (ret == 0) {
ret = rep_err; ret = rep_err;
g_print ("Returning %d as error where found", rep_err);
}
exit: exit:
gst_element_set_state (pipeline, GST_STATE_NULL); gst_element_set_state (pipeline, GST_STATE_NULL);