[longomatch/0.20] Add more option to the test-editor cli



commit 903d8bd86112e7c97feff526476cd5e739510ab0
Author: Andoni Morales Alastruey <ylatuya gmail com>
Date:   Sat Aug 16 00:15:24 2014 +0200

    Add more option to the test-editor cli

 libcesarplayer/test-editor.c |   36 +++++++++++++++++++++++-------------
 1 files changed, 23 insertions(+), 13 deletions(-)
---
diff --git a/libcesarplayer/test-editor.c b/libcesarplayer/test-editor.c
index 36dde19..fd0c026 100644
--- a/libcesarplayer/test-editor.c
+++ b/libcesarplayer/test-editor.c
@@ -55,45 +55,55 @@ main (int argc, char *argv[])
   VideoEncoderType video_encoder;
   VideoMuxerType video_muxer;
   AudioEncoderType audio_encoder;
-  gchar *input_file, *output_file;
+  gchar *input_file, *output_file, *format;
   gchar *err = NULL;
   guint64 start, stop;
-  gint i;
+  gboolean with_audio, with_title;
+  gint i, bitrate;
 
   gst_video_editor_init_backend (&argc, &argv);
 
-  if (argc < 6) {
-    g_print("Usage: test-remuxer input_file output_file format start stop\n");
+  if (argc < 9) {
+    g_print("Usage: test-remuxer output_file format bitrate with_audio with_title input_file start stop\n");
     return 1;
   }
-  input_file = argv[1];
-  output_file = argv[2];
+  output_file = argv[1];
+  format = argv[2];
+  bitrate = (gint) g_strtod (argv[3], NULL);
+  with_audio = (gboolean) g_strtod (argv[4], NULL);
+  with_title = (gboolean) g_strtod (argv[5], NULL);
 
-  if (!g_strcmp0(argv[3], "mp4")) {
+  if (!g_strcmp0(format, "mp4")) {
     video_encoder = VIDEO_ENCODER_H264;
     video_muxer = VIDEO_MUXER_MP4;
     audio_encoder = AUDIO_ENCODER_AAC;
-  } else if (!g_strcmp0(argv[3], "avi")) {
+  } else if (!g_strcmp0(format, "avi")) {
     video_encoder = VIDEO_ENCODER_MPEG4;
     video_muxer = VIDEO_MUXER_AVI;
     audio_encoder = AUDIO_ENCODER_MP3;
   } else {
-    err = g_strdup_printf ("Invalid format %s\n", argv[3]);
+    err = g_strdup_printf ("Invalid format %s\n", format);
     goto error;
   }
 
   editor = gst_video_editor_new (NULL);
   gst_video_editor_set_encoding_format (editor, output_file, video_encoder,
-      audio_encoder, video_muxer, 500, 128, 1280, 720, 25, 1, TRUE, TRUE);
+      audio_encoder, video_muxer, bitrate, 128, 1280, 720, 25, 1, with_audio, with_title);
 
-  for (i=5; i<=argc; i=i+2) {
+  for (i=8; i<=argc; i=i+3) {
     gchar *title;
     title = g_strdup_printf ("Title %d", i-4);
 
+    input_file = argv[i-2];
     start = (guint64) g_strtod (argv[i-1], NULL);
     stop = (guint64) g_strtod (argv[i], NULL);
-    gst_video_editor_add_segment (editor, input_file, start, stop-start,
-      (gfloat) 1, title, TRUE);
+    if (g_str_has_suffix (input_file, ".png")) {
+      gst_video_editor_add_image_segment (editor, input_file, start,
+          stop-start, title);
+    } else {
+      gst_video_editor_add_segment (editor, input_file, start, stop-start,
+        (gfloat) 1, title, TRUE);
+    }
     g_free (title);
   }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]