[gegl] ff-save: hide fine grained codec config behind ifdef



commit 21c5e5979c30b6ddb8cea6f8597066edd8d8fcdb
Author: Øyvind Kolås <pippin gimp org>
Date:   Mon Nov 30 14:32:06 2015 +0100

    ff-save: hide fine grained codec config behind ifdef

 examples/frame-counter.c      |   16 +++++++++-------
 operations/external/ff-save.c |   15 +++++++++++----
 2 files changed, 20 insertions(+), 11 deletions(-)
---
diff --git a/examples/frame-counter.c b/examples/frame-counter.c
index ff628fd..3d36ff0 100644
--- a/examples/frame-counter.c
+++ b/examples/frame-counter.c
@@ -9,7 +9,7 @@ const char *video_codec = NULL;
 int video_bit_rate = 0;
 int video_bit_rate_min = 0;
 int video_bit_rate_max = 0;
-int bufsize = 0;
+int video_bufsize = 0;
 float frame_rate = 0.0;
 
 gint
@@ -19,11 +19,11 @@ main (gint    argc,
   int c;
   for (c = 1; argv[c]; c++)
   {
-    if (!strcmp (argv[c], "--bufsize"))
-      bufsize = atoi(argv[++c]);
-    else if (!strcmp (argv[c], "--video_bit_rate_max"))
+    if (!strcmp (argv[c], "--video-bufsize"))
+      video_bufsize = atoi(argv[++c]);
+    else if (!strcmp (argv[c], "--video-bit-rate-max"))
       video_bit_rate_max = atoi(argv[++c]);
-    else if (!strcmp (argv[c], "--video_bit_rate_min"))
+    else if (!strcmp (argv[c], "--video-bit-rate-min"))
       video_bit_rate_min = atoi(argv[++c]);
     else if (!strcmp (argv[c], "--video-bit-rate"))
       video_bit_rate = atoi(argv[++c]);
@@ -62,14 +62,16 @@ main (gint    argc,
 
     if (frame_rate)
       gegl_node_set (store, "frame-rate", frame_rate, NULL);
-    if (bufsize)
-      gegl_node_set (store, "bufsize", bufsize, NULL);
+    if (video_bufsize)
+      gegl_node_set (store, "video-bufsize", video_bufsize, NULL);
     if (video_bit_rate)
       gegl_node_set (store, "video-bit-rate", video_bit_rate, NULL);
+#if 0
     if (video_bit_rate_min)
       gegl_node_set (store, "video-bit-rate-min", video_bit_rate_min, NULL);
     if (video_bit_rate_max)
       gegl_node_set (store, "video-bit-rate-max", video_bit_rate_max, NULL);
+#endif
 
     gegl_node_link_many (bg, over, crop, store, NULL);
     gegl_node_connect_to (text, "output",  over, "aux");
diff --git a/operations/external/ff-save.c b/operations/external/ff-save.c
index eb857bd..3e196c4 100644
--- a/operations/external/ff-save.c
+++ b/operations/external/ff-save.c
@@ -22,6 +22,8 @@
 
 #include <glib/gi18n-lib.h>
 
+//#define USE_FINE_GRAINDED_FFMPEG 1
+
 #ifdef GEGL_PROPERTIES
 
 property_string (path, _("File"), "/tmp/fnord.ogv")
@@ -41,7 +43,9 @@ property_double (frame_rate, _("Frames/second"), 25.0)
 property_string (video_codec, _("Video codec"), "auto")
 property_int (video_bit_rate, _("video bitrate in kb/s"), 128)
     description (_("Target encoded video bitrate in kb/s"))
+property_int (video_bufsize, _("Video bufsize"), 0)
 
+#ifdef USE_FINE_GRAINED_FFMPEG
 property_int (global_quality, _("global quality"), 0)
 property_int (noise_reduction, _("noise reduction"), 0)
 property_int (scenechange_threshold, _("scenechange threshold"), 0)
@@ -51,7 +55,6 @@ property_int (video_bit_rate_tolerance, _("video bitrate tolerance"), -1)
 
 property_int (keyint_min, _("keyint-min"), 0)
 property_int (trellis, _("trellis"), 0)
-property_int (bufsize, _("bufsize"), 0)
 property_int (qmin, _("qmin"), 0)
 property_int (qmax, _("qmax"), 0)
 property_int (max_qdiff, _("max_qdiff"), 0)
@@ -63,7 +66,7 @@ property_double (qblur, _("qblur"), 0.0)
 property_double (i_quant_factor, _("i-quant-factor"), 0.0)
 property_double (i_quant_offset, _("i-quant-offset"), 0.0)
 property_int (me_subpel_quality, _("me-subpel-quality"), 0)
-
+#endif
 
 
 #else
@@ -539,10 +542,12 @@ add_video_stream (GeglProperties *o, AVFormatContext * oc, int codec_id)
   c->codec_type = AVMEDIA_TYPE_VIDEO;
   /* put sample propeters */
   c->bit_rate = o->video_bit_rate * 1000;
+#ifdef USE_FINE_GRAINED_FFMPEG
   c->rc_min_rate = o->video_bit_rate_min * 1000;
   c->rc_max_rate = o->video_bit_rate_max * 1000;
   if (o->video_bit_rate_tolerance >= 0)
     c->bit_rate_tolerance = o->video_bit_rate_tolerance * 1000;
+#endif
   /* resolution must be a multiple of two */
   c->width = p->width;
   c->height = p->height;
@@ -566,8 +571,9 @@ add_video_stream (GeglProperties *o, AVFormatContext * oc, int codec_id)
      c->max_b_frames = 3; // bf=3
    }
 
-  if (o->bufsize)
-    c->rc_buffer_size = o->bufsize * 1000;
+  if (o->video_bufsize)
+    c->rc_buffer_size = o->video_bufsize * 1000;
+#if USE_FINE_GRAINED_FFMPEG
   if (o->global_quality)
      c->global_quality = o->global_quality;
   if (o->qcompress != 0.0)
@@ -600,6 +606,7 @@ add_video_stream (GeglProperties *o, AVFormatContext * oc, int codec_id)
     c->gop_size = o->gop_size;
   if (o->keyint_min)
     c->keyint_min = o->keyint_min;
+#endif
 
    if (oc->oformat->flags & AVFMT_GLOBALHEADER)
      c->flags |= CODEC_FLAG_GLOBAL_HEADER;


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