From c77a21b1fa02be25e4a6270041f237597a765367 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim-Philipp=20M=C3=BCller?= Date: Mon, 15 Dec 2014 12:12:44 +0000 Subject: [PATCH] examples: improve playback-test help text a little And allow pipeline type to be specified as string. --- tests/examples/playback/playback-test.c | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/tests/examples/playback/playback-test.c b/tests/examples/playback/playback-test.c index fca116e9ec..514d499d04 100644 --- a/tests/examples/playback/playback-test.c +++ b/tests/examples/playback/playback-test.c @@ -293,13 +293,14 @@ typedef struct { const gchar *name; void (*func) (PlaybackApp * app, const gchar * location); + const gchar *help; } Pipeline; static const Pipeline pipelines[] = { - {"playbin", make_playbin_pipeline}, + {"playbin", make_playbin_pipeline, "[URLS|FILENAMES]"}, #ifndef GST_DISABLE_PARSE - {"parse-launch", make_parselaunch_pipeline}, + {"parse-launch", make_parselaunch_pipeline, "[PARSE-LAUNCH-LINE]"}, #endif }; @@ -2519,11 +2520,11 @@ print_usage (int argc, char **argv) { gint i; - g_print ("usage: %s \n", argv[0]); + g_print ("Usage: %s \n", argv[0]); g_print (" possible types:\n"); for (i = 0; i < G_N_ELEMENTS (pipelines); i++) { - g_print (" %d = %s\n", i, pipelines[i].name); + g_print (" %d = %s %s\n", i, pipelines[i].name, pipelines[i].help); } } @@ -3311,7 +3312,19 @@ main (int argc, char **argv) exit (-1); } - app.pipeline_type = atoi (argv[1]); + app.pipeline_type = -1; + if (g_ascii_isdigit (argv[1][0])) { + app.pipeline_type = atoi (argv[1]); + } else { + gint i; + + for (i = 0; i < G_N_ELEMENTS (pipelines); ++i) { + if (strcmp (pipelines[i].name, argv[1]) == 0) { + app.pipeline_type = i; + break; + } + } + } if (app.pipeline_type < 0 || app.pipeline_type >= G_N_ELEMENTS (pipelines)) { print_usage (argc, argv);