]> git.sesse.net Git - ffmpeg/blobdiff - ffmpeg.c
misc spelling fixes
[ffmpeg] / ffmpeg.c
index 105e1134287013943bcc86de4fa19db0cb4d5961..8336ea9f2d3f311046f2e22e03bb72ac6453866a 100644 (file)
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -18,7 +18,7 @@
  * License along with FFmpeg; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
-#define HAVE_AV_CONFIG_H
+
 #include <signal.h>
 #include <limits.h>
 #include "avformat.h"
@@ -182,7 +182,7 @@ static FILE *fvstats;
 static int rate_emu = 0;
 
 static int  video_channel = 0;
-static char *video_standard = "ntsc";
+static char *video_standard;
 
 static int audio_volume = 256;
 
@@ -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,8 @@ static int av_encode(AVFormatContext **output_files,
                         fprintf(stderr, "Cannot allocate temp picture, check pix fmt\n");
                         exit(1);
                     }
+                    if (ENABLE_SWSCALER)
+                        sws_flags = av_get_int(sws_opts, "sws_flags", NULL);
                     ost->img_resample_ctx = sws_getContext(
                             icodec->width - (frame_leftBand + frame_rightBand),
                             icodec->height - (frame_topBand + frame_bottomBand),
@@ -2240,10 +2243,24 @@ static void opt_frame_pad_right(const char *arg)
     }
 }
 
+void list_pix_fmts(void)
+{
+    int i;
+    char pix_fmt_str[128];
+    for (i=-1; i < PIX_FMT_NB; i++) {
+        avcodec_pix_fmt_string (pix_fmt_str, sizeof(pix_fmt_str), i);
+        fprintf(stdout, "%s\n", pix_fmt_str);
+    }
+}
 
 static void opt_frame_pix_fmt(const char *arg)
 {
-    frame_pix_fmt = avcodec_get_pix_fmt(arg);
+    if (strcmp(arg, "list"))
+        frame_pix_fmt = avcodec_get_pix_fmt(arg);
+    else {
+        list_pix_fmts();
+        exit(0);
+    }
 }
 
 static void opt_frame_aspect_ratio(const char *arg)
@@ -3260,11 +3277,11 @@ static void show_formats(void)
     }
     printf("\n\n");
     printf(
-"Note, the names of encoders and decoders dont always match, so there are\n"
+"Note, the names of encoders and decoders do not always match, so there are\n"
 "several cases where the above table shows encoder only or decoder only entries\n"
-"even though both encoding and decoding are supported for example, the h263\n"
-"decoder corresponds to the h263 and h263p encoders, for file formats its even\n"
-"worse\n");
+"even though both encoding and decoding are supported. For example, the h263\n"
+"decoder corresponds to the h263 and h263p encoders, for file formats it is even\n"
+"worse.\n");
     exit(1);
 }
 
@@ -3517,6 +3534,8 @@ static int opt_default(const char *opt, const char *arg){
     }
     if(!o)
         o = av_set_string(avformat_opts, opt, arg);
+    if(ENABLE_SWSCALER && !o)
+        o = av_set_string(sws_opts, opt, arg);
     if(!o){
         if(opt[0] == 'a')
             o = av_set_string(avctx_opts[CODEC_TYPE_AUDIO], opt+1, arg);
@@ -3591,7 +3610,7 @@ const OptionDef options[] = {
     { "r", HAS_ARG | OPT_VIDEO, {(void*)opt_frame_rate}, "set frame rate (Hz value, fraction or abbreviation)", "rate" },
     { "s", HAS_ARG | OPT_VIDEO, {(void*)opt_frame_size}, "set frame size (WxH or abbreviation)", "size" },
     { "aspect", HAS_ARG | OPT_VIDEO, {(void*)opt_frame_aspect_ratio}, "set aspect ratio (4:3, 16:9 or 1.3333, 1.7777)", "aspect" },
-    { "pix_fmt", HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)opt_frame_pix_fmt}, "set pixel format", "format" },
+    { "pix_fmt", HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)opt_frame_pix_fmt}, "set pixel format, 'list' as argument shows all the pixel formats supported", "format" },
     { "croptop", HAS_ARG | OPT_VIDEO, {(void*)opt_frame_crop_top}, "set top crop band size (in pixels)", "size" },
     { "cropbottom", HAS_ARG | OPT_VIDEO, {(void*)opt_frame_crop_bottom}, "set bottom crop band size (in pixels)", "size" },
     { "cropleft", HAS_ARG | OPT_VIDEO, {(void*)opt_frame_crop_left}, "set left crop band size (in pixels)", "size" },
@@ -3718,8 +3737,18 @@ static void show_license(void)
     exit(1);
 }
 
+/**
+ * Trivial log callback.
+ * Only suitable for show_help and similar since it lacks prefix handling.
+ */
+static void log_callback_help(void* ptr, int level, const char* fmt, va_list vl)
+{
+    vfprintf(stdout, fmt, vl);
+}
+
 static void show_help(void)
 {
+    av_log_set_callback(log_callback_help);
     show_banner();
     printf("usage: ffmpeg [[infile options] -i infile]... {[outfile options] outfile}...\n"
            "Hyper fast Audio and Video encoder\n");
@@ -3749,6 +3778,8 @@ static void show_help(void)
                       OPT_EXPERT);
     av_opt_show(avctx_opts[0], NULL);
     av_opt_show(avformat_opts, NULL);
+    if (ENABLE_SWSCALER)
+        av_opt_show(sws_opts, NULL);
 
     exit(1);
 }
@@ -3769,6 +3800,8 @@ int main(int argc, char **argv)
         avctx_opts[i]= avcodec_alloc_context2(i);
     }
     avformat_opts = av_alloc_format_context();
+    if (ENABLE_SWSCALER)
+        sws_opts = sws_getContext(16,16,0, 16,16,0, sws_flags, NULL,NULL,NULL);
 
     if (argc <= 1)
         show_help();
@@ -3824,6 +3857,8 @@ int main(int argc, char **argv)
 
     av_free(opt_names);
 
+    av_free(video_standard);
+
 #ifdef CONFIG_POWERPC_PERF
     extern void powerpc_display_perf_report(void);
     powerpc_display_perf_report();