aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRob Clark2010-02-13 15:29:13 -0600
committerNikhil Devshatwar2013-05-15 06:20:48 -0500
commit5187a43a25fbb1663fe12cf6f35bb945226d2108 (patch)
tree3798c0cf24237ed1ef412c0293d7ef7ccd70bcc5
parent4296d16177a8f66b997a1d4bc78da44161b0b69b (diff)
downloadgstreamer0-10-5187a43a25fbb1663fe12cf6f35bb945226d2108.tar.gz
gstreamer0-10-5187a43a25fbb1663fe12cf6f35bb945226d2108.tar.xz
gstreamer0-10-5187a43a25fbb1663fe12cf6f35bb945226d2108.zip
gst-launch: add --loop argument
if --loop is specified, automatically seek to beginning of clip when EOS is received
-rw-r--r--tools/gst-launch.c16
1 files changed, 15 insertions, 1 deletions
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[])
923 gboolean trace = FALSE; 923 gboolean trace = FALSE;
924 gboolean eos_on_shutdown = FALSE; 924 gboolean eos_on_shutdown = FALSE;
925 gboolean check_index = FALSE; 925 gboolean check_index = FALSE;
926 gboolean loop = FALSE;
926 gchar *savefile = NULL; 927 gchar *savefile = NULL;
927 gchar *exclude_args = NULL; 928 gchar *exclude_args = NULL;
928#ifndef GST_DISABLE_OPTION_PARSING 929#ifndef GST_DISABLE_OPTION_PARSING
@@ -951,6 +952,8 @@ main (int argc, char *argv[])
951 N_("Force EOS on sources before shutting the pipeline down"), NULL}, 952 N_("Force EOS on sources before shutting the pipeline down"), NULL},
952 {"index", 'i', 0, G_OPTION_ARG_NONE, &check_index, 953 {"index", 'i', 0, G_OPTION_ARG_NONE, &check_index,
953 N_("Gather and print index statistics"), NULL}, 954 N_("Gather and print index statistics"), NULL},
955 {"loop", 'l', 0, G_OPTION_ARG_NONE, &loop,
956 N_("Repeat clip in loop without rebuilding pipeline"), NULL},
954 GST_TOOLS_GOPTION_VERSION, 957 GST_TOOLS_GOPTION_VERSION,
955 {NULL} 958 {NULL}
956 }; 959 };
@@ -1154,7 +1157,18 @@ main (int argc, char *argv[])
1154 } 1157 }
1155 1158
1156 tfthen = gst_util_get_timestamp (); 1159 tfthen = gst_util_get_timestamp ();
1157 caught_error = event_loop (pipeline, TRUE, GST_STATE_PLAYING); 1160 do {
1161 caught_error = event_loop (pipeline, TRUE, GST_STATE_PLAYING);
1162 if (loop && (caught_error == ELR_NO_ERROR)) {
1163 PRINT (_("Looping ...\n"));
1164 gst_element_seek (pipeline, 1.0,
1165 GST_FORMAT_TIME,
1166 GST_SEEK_FLAG_FLUSH | GST_SEEK_FLAG_KEY_UNIT,
1167 GST_SEEK_TYPE_SET, 0, GST_SEEK_TYPE_NONE, GST_CLOCK_TIME_NONE);
1168 } else {
1169 break;
1170 }
1171 } while (TRUE);
1158 if (eos_on_shutdown && caught_error == ELR_INTERRUPT) { 1172 if (eos_on_shutdown && caught_error == ELR_INTERRUPT) {
1159 PRINT (_("EOS on shutdown enabled -- Forcing EOS on the pipeline\n")); 1173 PRINT (_("EOS on shutdown enabled -- Forcing EOS on the pipeline\n"));
1160 waiting_eos = TRUE; 1174 waiting_eos = TRUE;