Browse Source

Merge remote-tracking branch 'cehoyos/master'

* cehoyos/master:
  Fix condition for transparency warning in xsub encoder.
  Allow hiding the banner.

Merged-by: Michael Niedermayer <michaelni@gmx.at>
Michael Niedermayer 11 years ago
parent
commit
4aa9c91508
5 changed files with 15 additions and 2 deletions
  1. 5 1
      cmdutils.c
  2. 1 0
      cmdutils.h
  3. 1 0
      cmdutils_common_opts.h
  4. 7 0
      doc/fftools-common-opts.texi
  5. 1 1
      libavcodec/xsubenc.c

+ 5 - 1
cmdutils.c

@@ -66,6 +66,7 @@ AVDictionary *swr_opts;
 AVDictionary *format_opts, *codec_opts, *resample_opts;
 AVDictionary *format_opts, *codec_opts, *resample_opts;
 
 
 static FILE *report_file;
 static FILE *report_file;
+int hide_banner = 0;
 
 
 void init_opts(void)
 void init_opts(void)
 {
 {
@@ -491,6 +492,9 @@ void parse_loglevel(int argc, char **argv, const OptionDef *options)
             fflush(report_file);
             fflush(report_file);
         }
         }
     }
     }
+    idx = locate_option(argc, argv, options, "hide_banner");
+    if (idx)
+        hide_banner = 1;
 }
 }
 
 
 static const AVOption *opt_find(void *obj, const char *name, const char *unit,
 static const AVOption *opt_find(void *obj, const char *name, const char *unit,
@@ -1083,7 +1087,7 @@ static void print_buildconf(int flags, int level)
 void show_banner(int argc, char **argv, const OptionDef *options)
 void show_banner(int argc, char **argv, const OptionDef *options)
 {
 {
     int idx = locate_option(argc, argv, options, "version");
     int idx = locate_option(argc, argv, options, "version");
-    if (idx)
+    if (hide_banner || idx)
         return;
         return;
 
 
     print_program_info (INDENT|SHOW_COPYRIGHT, AV_LOG_INFO);
     print_program_info (INDENT|SHOW_COPYRIGHT, AV_LOG_INFO);

+ 1 - 0
cmdutils.h

@@ -48,6 +48,7 @@ extern AVFormatContext *avformat_opts;
 extern struct SwsContext *sws_opts;
 extern struct SwsContext *sws_opts;
 extern AVDictionary *swr_opts;
 extern AVDictionary *swr_opts;
 extern AVDictionary *format_opts, *codec_opts, *resample_opts;
 extern AVDictionary *format_opts, *codec_opts, *resample_opts;
+extern int hide_banner;
 
 
 /**
 /**
  * Register a program-specific cleanup routine.
  * Register a program-specific cleanup routine.

+ 1 - 0
cmdutils_common_opts.h

@@ -21,6 +21,7 @@
     { "report"     , 0,        {(void*)opt_report}, "generate a report" },
     { "report"     , 0,        {(void*)opt_report}, "generate a report" },
     { "max_alloc"  , HAS_ARG,  {.func_arg = opt_max_alloc},     "set maximum size of a single allocated block", "bytes" },
     { "max_alloc"  , HAS_ARG,  {.func_arg = opt_max_alloc},     "set maximum size of a single allocated block", "bytes" },
     { "cpuflags"   , HAS_ARG | OPT_EXPERT, { .func_arg = opt_cpuflags }, "force specific cpu flags", "flags" },
     { "cpuflags"   , HAS_ARG | OPT_EXPERT, { .func_arg = opt_cpuflags }, "force specific cpu flags", "flags" },
+    { "hide_banner", OPT_BOOL | OPT_EXPERT, {&hide_banner},     "do not show program banner", "hide_banner" },
 #if CONFIG_OPENCL
 #if CONFIG_OPENCL
     { "opencl_bench", OPT_EXIT, {.func_arg = opt_opencl_bench}, "run benchmark on all OpenCL devices and show results" },
     { "opencl_bench", OPT_EXIT, {.func_arg = opt_opencl_bench}, "run benchmark on all OpenCL devices and show results" },
     { "opencl_options", HAS_ARG, {.func_arg = opt_opencl},      "set OpenCL environment options" },
     { "opencl_options", HAS_ARG, {.func_arg = opt_opencl},      "set OpenCL environment options" },

+ 7 - 0
doc/fftools-common-opts.texi

@@ -194,6 +194,13 @@ to a plain @code{%}
 Errors in parsing the environment variable are not fatal, and will not
 Errors in parsing the environment variable are not fatal, and will not
 appear in the report.
 appear in the report.
 
 
+@item -hide_banner
+Suppress printing banner.
+
+All FFmpeg tools will normally show a copyright notice, build options
+and library versions. This option can be used to suppress printing
+this information.
+
 @item -cpuflags flags (@emph{global})
 @item -cpuflags flags (@emph{global})
 Allows setting and clearing cpu flags. This option is intended
 Allows setting and clearing cpu flags. This option is intended
 for testing. Do not use it unless you know what you're doing.
 for testing. Do not use it unless you know what you're doing.

+ 1 - 1
libavcodec/xsubenc.c

@@ -142,7 +142,7 @@ static int xsub_encode(AVCodecContext *avctx, unsigned char *buf,
         av_log(avctx, AV_LOG_WARNING, "No more than 4 subtitle colors supported (%d found.)\n", h->rects[0]->nb_colors);
         av_log(avctx, AV_LOG_WARNING, "No more than 4 subtitle colors supported (%d found.)\n", h->rects[0]->nb_colors);
 
 
     // TODO: Palette swapping if color zero is not transparent
     // TODO: Palette swapping if color zero is not transparent
-    if (((uint32_t *)h->rects[0]->pict.data[1])[0] & 0xff)
+    if (((uint32_t *)h->rects[0]->pict.data[1])[0] & 0xff000000)
         av_log(avctx, AV_LOG_WARNING, "Color index 0 is not transparent. Transparency will be messed up.\n");
         av_log(avctx, AV_LOG_WARNING, "Color index 0 is not transparent. Transparency will be messed up.\n");
 
 
     if (make_tc(startTime, start_tc) || make_tc(endTime, end_tc)) {
     if (make_tc(startTime, start_tc) || make_tc(endTime, end_tc)) {