summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDamien Lespiau <damien.lespiau@intel.com>2011-09-01 00:20:12 +0100
committerDamien Lespiau <damien.lespiau@intel.com>2011-09-01 00:20:12 +0100
commit354b1958b765bad02093b7af47759860c144855b (patch)
treeb34bd8fb466ad999abf04a3c5c8d9976912859e9
parent93429994b2fafbf0142ef41d34148503e5774907 (diff)
downloadclutter-gst-354b1958b765bad02093b7af47759860c144855b.tar.gz
player: Add an option to loop the video
-rw-r--r--examples/video-player.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/examples/video-player.c b/examples/video-player.c
index de8108b..c749c1d 100644
--- a/examples/video-player.c
+++ b/examples/video-player.c
@@ -53,6 +53,7 @@ typedef struct _VideoApp
static void show_controls (VideoApp *app, gboolean vis);
static gboolean opt_fullscreen = FALSE;
+static gboolean opt_loop = FALSE;
static GOptionEntry options[] =
{
@@ -63,6 +64,13 @@ static GOptionEntry options[] =
"Start the player in fullscreen",
NULL },
+ { "loop",
+ 'l', 0,
+ G_OPTION_ARG_NONE,
+ &opt_loop,
+ "Start the video again once reached the EOS",
+ NULL },
+
{ NULL }
};
@@ -311,6 +319,17 @@ tick (GObject *object,
SEEK_H);
}
+static void
+on_video_texture_eos (ClutterMedia *media,
+ VideoApp *app)
+{
+ if (opt_loop)
+ {
+ clutter_media_set_progress (media, 0.0);
+ clutter_media_set_playing (media, TRUE);
+ }
+}
+
int
main (int argc, char *argv[])
{
@@ -364,6 +383,11 @@ main (int argc, char *argv[])
CLUTTER_GST_VIDEO_TEXTURE (app->vtexture),
CLUTTER_GST_SEEK_FLAG_ACCURATE);
+ g_signal_connect (app->vtexture,
+ "eos",
+ G_CALLBACK (on_video_texture_eos),
+ app);
+
g_signal_connect (stage,
"allocation-changed",
G_CALLBACK (on_stage_allocation_changed),