[gegl] ff-save: make encoding work with more different pixel formats



commit 971fd88ae8cd40a096e3cb933805830d0217e7d4
Author: Øyvind Kolås <pippin gimp org>
Date:   Fri Nov 27 03:51:07 2015 +0100

    ff-save: make encoding work with more different pixel formats

 operations/external/ff-save.c |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)
---
diff --git a/operations/external/ff-save.c b/operations/external/ff-save.c
index 7b48f24..781e602 100644
--- a/operations/external/ff-save.c
+++ b/operations/external/ff-save.c
@@ -501,7 +501,9 @@ add_video_stream (GeglProperties *o, AVFormatContext * oc, int codec_id)
   /* frames per second */
   st->time_base =(AVRational){1, o->frame_rate};
   c->time_base = st->time_base;
+
   c->pix_fmt = AV_PIX_FMT_YUV420P;
+  
 
   if (c->codec_id == AV_CODEC_ID_MPEG2VIDEO)
     {
@@ -595,6 +597,17 @@ open_video (Priv * p, AVFormatContext * oc, AVStream * st)
       exit (1);
     }
 
+  if (codec->pix_fmts){
+    int i = 0;
+    c->pix_fmt = codec->pix_fmts[0];
+    while (codec->pix_fmts[i] !=-1)
+    {
+      if (codec->pix_fmts[i] ==  AV_PIX_FMT_RGB24)
+         c->pix_fmt = AV_PIX_FMT_RGB24;
+      i++;
+    }
+  }
+
   /* open the codec */
   if (avcodec_open2 (c, codec, NULL) < 0)
     {


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