[SCM] libav/experimental: -sws_flags command line option to set swscaler flags

siretart at users.alioth.debian.org siretart at users.alioth.debian.org
Sun Jun 30 16:00:20 UTC 2013


The following commit has been merged in the experimental branch:
commit 3592648940a4bcca010e07edd6422a067f215019
Author: Ivo van Poorten <ivop at euronet.nl>
Date:   Wed May 23 18:35:45 2007 +0000

    -sws_flags command line option to set swscaler flags
    
    Originally committed as revision 9109 to svn://svn.ffmpeg.org/ffmpeg/trunk

diff --git a/doc/ffmpeg-doc.texi b/doc/ffmpeg-doc.texi
index f70b8b8..f606010 100644
--- a/doc/ffmpeg-doc.texi
+++ b/doc/ffmpeg-doc.texi
@@ -416,6 +416,8 @@ Add a new video stream to the current output stream.
 @table @option
 @item -pix_fmt format
 Set pixel format.
+ at item -sws_flags flags
+Set SwScaler flags (only available when compiled with SwScaler support).
 @item -g gop_size
 Set the group of pictures size.
 @item -intra
diff --git a/ffmpeg.c b/ffmpeg.c
index 46449ea..cd3fb22 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -208,6 +208,7 @@ const char **opt_names=NULL;
 int opt_name_count=0;
 AVCodecContext *avctx_opts[CODEC_TYPE_NB];
 AVFormatContext *avformat_opts;
+struct SwsContext *sws_opts;
 static int64_t timer_start = 0;
 
 static AVBitStreamFilterContext *video_bitstream_filters=NULL;
@@ -1609,6 +1610,9 @@ static int av_encode(AVFormatContext **output_files,
                         fprintf(stderr, "Cannot allocate temp picture, check pix fmt\n");
                         exit(1);
                     }
+#ifdef CONFIG_SWSCALER
+                    sws_flags = av_get_int(sws_opts, "sws_flags", NULL);
+#endif
                     ost->img_resample_ctx = sws_getContext(
                             icodec->width - (frame_leftBand + frame_rightBand),
                             icodec->height - (frame_topBand + frame_bottomBand),
@@ -3517,6 +3521,10 @@ static int opt_default(const char *opt, const char *arg){
     }
     if(!o)
         o = av_set_string(avformat_opts, opt, arg);
+#ifdef CONFIG_SWSCALER
+    if(!o)
+        o = av_set_string(sws_opts, opt, arg);
+#endif
     if(!o){
         if(opt[0] == 'a')
             o = av_set_string(avctx_opts[CODEC_TYPE_AUDIO], opt+1, arg);
@@ -3759,6 +3767,9 @@ static void show_help(void)
                       OPT_EXPERT);
     av_opt_show(avctx_opts[0], NULL);
     av_opt_show(avformat_opts, NULL);
+#ifdef CONFIG_SWSCALER
+    av_opt_show(sws_opts, NULL);
+#endif
 
     exit(1);
 }
@@ -3779,6 +3790,9 @@ int main(int argc, char **argv)
         avctx_opts[i]= avcodec_alloc_context2(i);
     }
     avformat_opts = av_alloc_format_context();
+#ifdef CONFIG_SWSCALER
+    sws_opts = sws_getContext(16, 16, 0, 16, 16, 0, sws_flags, NULL,NULL,NULL);
+#endif
 
     if (argc <= 1)
         show_help();

-- 
Libav/FFmpeg packaging



More information about the pkg-multimedia-commits mailing list