From: Rob Clark Date: Sat, 13 Feb 2010 21:29:13 +0000 (-0600) Subject: gst-launch: add --loop argument X-Git-Tag: glsdk-6_00_00_07~14 X-Git-Url: https://git.ti.com/gitweb?p=glsdk%2Fgstreamer0-10.git;a=commitdiff_plain;h=5187a43a25fbb1663fe12cf6f35bb945226d2108 gst-launch: add --loop argument if --loop is specified, automatically seek to beginning of clip when EOS is received --- diff --git a/tools/gst-launch.c b/tools/gst-launch.c index b801d033d..a468c69ab 100644 --- a/tools/gst-launch.c +++ b/tools/gst-launch.c @@ -923,6 +923,7 @@ main (int argc, char *argv[]) gboolean trace = FALSE; gboolean eos_on_shutdown = FALSE; gboolean check_index = FALSE; + gboolean loop = FALSE; gchar *savefile = NULL; gchar *exclude_args = NULL; #ifndef GST_DISABLE_OPTION_PARSING @@ -951,6 +952,8 @@ main (int argc, char *argv[]) N_("Force EOS on sources before shutting the pipeline down"), NULL}, {"index", 'i', 0, G_OPTION_ARG_NONE, &check_index, N_("Gather and print index statistics"), NULL}, + {"loop", 'l', 0, G_OPTION_ARG_NONE, &loop, + N_("Repeat clip in loop without rebuilding pipeline"), NULL}, GST_TOOLS_GOPTION_VERSION, {NULL} }; @@ -1154,7 +1157,18 @@ main (int argc, char *argv[]) } tfthen = gst_util_get_timestamp (); - caught_error = event_loop (pipeline, TRUE, GST_STATE_PLAYING); + do { + caught_error = event_loop (pipeline, TRUE, GST_STATE_PLAYING); + if (loop && (caught_error == ELR_NO_ERROR)) { + PRINT (_("Looping ...\n")); + gst_element_seek (pipeline, 1.0, + GST_FORMAT_TIME, + GST_SEEK_FLAG_FLUSH | GST_SEEK_FLAG_KEY_UNIT, + GST_SEEK_TYPE_SET, 0, GST_SEEK_TYPE_NONE, GST_CLOCK_TIME_NONE); + } else { + break; + } + } while (TRUE); if (eos_on_shutdown && caught_error == ELR_INTERRUPT) { PRINT (_("EOS on shutdown enabled -- Forcing EOS on the pipeline\n")); waiting_eos = TRUE;