From b752dab333041a6f9ef60b79af39282092f894e8 Mon Sep 17 00:00:00 2001 From: Edward Hervey Date: Wed, 19 May 2010 12:38:21 +0200 Subject: [PATCH] examples: Allow setting null duration on files This will make the timeline use GstDiscoverer to analyze the file. --- tests/examples/playlist.c | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/tests/examples/playlist.c b/tests/examples/playlist.c index 6c302ce..08f38da 100644 --- a/tests/examples/playlist.c +++ b/tests/examples/playlist.c @@ -27,7 +27,8 @@ #include static GstEncodingProfile * -make_encoding_profile (gchar * audio, gchar * video, gchar * video_restriction, gchar * container) +make_encoding_profile (gchar * audio, gchar * video, gchar * video_restriction, + gchar * container) { GstEncodingProfile *profile; GstStreamEncodingProfile *stream; @@ -38,8 +39,8 @@ make_encoding_profile (gchar * audio, gchar * video, gchar * video_restriction, gst_caps_from_string (audio), NULL, NULL, 0); gst_encoding_profile_add_stream (profile, stream); stream = gst_stream_encoding_profile_new (GST_ENCODING_PROFILE_VIDEO, - gst_caps_from_string (video), NULL, - gst_caps_from_string(video_restriction), 0); + gst_caps_from_string (video), NULL, + gst_caps_from_string (video_restriction), 0); gst_encoding_profile_add_stream (profile, stream); return profile; } @@ -73,13 +74,16 @@ create_timeline (int nbargs, gchar ** argv) for (i = 0; i < nbargs / 3; i++) { gchar *uri = g_strdup_printf ("file://%s", argv[i * 3]); GESTimelineFileSource *src = ges_timeline_filesource_new (uri); + guint64 inpoint = atoi (argv[i * 3 + 1]) * GST_SECOND; + guint64 duration = atoi (argv[i * 3 + 2]) * GST_SECOND; + + g_print ("Adding %s inpoint:%" GST_TIME_FORMAT " duration:%" GST_TIME_FORMAT + "\n", uri, GST_TIME_ARGS (inpoint), GST_TIME_ARGS (duration)); g_assert (src); g_free (uri); - g_object_set (src, - "in-point", atoi (argv[i * 3 + 1]) * GST_SECOND, - "duration", atoi (argv[i * 3 + 2]) * GST_SECOND, NULL); + g_object_set (src, "in-point", inpoint, "duration", duration, NULL); /* Since we're using a GESSimpleTimelineLayer, objects will be automatically * appended to the end of the layer */ ges_timeline_layer_add_object (layer, (GESTimelineObject *) src); @@ -136,9 +140,9 @@ main (int argc, gchar ** argv) {"vformat", 'v', 0, G_OPTION_ARG_STRING, &video, "Video format", ""}, {"aformat", 'a', 0, G_OPTION_ARG_STRING, &audio, - "Audio format", ""}, + "Audio format", ""}, {"vrestriction", 'x', 0, G_OPTION_ARG_STRING, &video_restriction, - "Video restriction", ""}, + "Video restriction", ""}, {NULL} }; GOptionContext *ctx; @@ -153,7 +157,8 @@ main (int argc, gchar ** argv) g_option_context_set_summary (ctx, "If not specified, this example will playback the files\n" "\n" "The files should be layed out in triplets of:\n" " * filename\n" - " * inpoint (in seconds)\n" " * duration (in seconds)"); + " * inpoint (in seconds)\n" + " * duration (in seconds) If 0, full file length"); g_option_context_add_main_entries (ctx, options, NULL); g_option_context_add_group (ctx, gst_init_get_option_group ()); -- 2.7.4