OSDN Git Service

avconv: remove me_threshold option.
[coroid/libav_saccubus.git] / avconv.c
index 217aaf4..28e171e 100644 (file)
--- a/avconv.c
+++ b/avconv.c
@@ -103,12 +103,10 @@ static int nb_streamid_map = 0;
 
 static uint16_t *intra_matrix = NULL;
 static uint16_t *inter_matrix = NULL;
-static const char *video_rc_override_string=NULL;
 static int video_discard = 0;
 static int same_quant = 0;
 static int do_deinterlace = 0;
 static int top_field_first = -1;
-static int me_threshold = 0;
 static int intra_dc_precision = 8;
 static int qp_hist = 0;
 #if CONFIG_AVFILTER
@@ -325,6 +323,8 @@ typedef struct OptionsContext {
     int        nb_force_fps;
     SpecifierOpt *frame_aspect_ratios;
     int        nb_frame_aspect_ratios;
+    SpecifierOpt *rc_overrides;
+    int        nb_rc_overrides;
 } OptionsContext;
 
 #define MATCH_PER_STREAM_OPT(name, type, outvar, fmtctx, st)\
@@ -1216,7 +1216,7 @@ static void do_video_out(AVFormatContext *s,
             /* handles same_quant here. This is not correct because it may
                not be a global option */
             big_picture.quality = quality;
-            if(!me_threshold)
+            if (!enc->me_threshold)
                 big_picture.pict_type = 0;
 //            big_picture.pts = AV_NOPTS_VALUE;
             big_picture.pts= ost->sync_opts;
@@ -2186,6 +2186,9 @@ static int transcode_init(OutputFile *output_files,
                 av_log(NULL, AV_LOG_WARNING, "The bitrate parameter is set too low."
                                              "It takes bits/s as argument, not kbits/s\n");
             extra_size += ost->st->codec->extradata_size;
+
+            if (ost->st->codec->me_threshold)
+                input_streams[ost->source_index].st->codec->debug |= FF_DEBUG_MV;
         }
     }
 
@@ -2501,18 +2504,6 @@ static int transcode(OutputFile *output_files,
     return ret;
 }
 
-static int opt_video_rc_override_string(const char *opt, const char *arg)
-{
-    video_rc_override_string = arg;
-    return 0;
-}
-
-static int opt_me_threshold(const char *opt, const char *arg)
-{
-    me_threshold = parse_number_or_die(opt, arg, OPT_INT64, INT_MIN, INT_MAX);
-    return 0;
-}
-
 static int opt_verbose(const char *opt, const char *arg)
 {
     verbose = parse_number_or_die(opt, arg, OPT_INT64, -10, 10);
@@ -2784,8 +2775,6 @@ static void add_input_streams(OptionsContext *o, AVFormatContext *ic)
                 dec->height >>= dec->lowres;
                 dec->width  >>= dec->lowres;
             }
-            if(me_threshold)
-                dec->debug |= FF_DEBUG_MV;
 
             if (dec->time_base.den != rfps*dec->ticks_per_frame || dec->time_base.num != rfps_base) {
 
@@ -3037,7 +3026,7 @@ static OutputStream *new_video_stream(OptionsContext *o, AVFormatContext *oc)
     }
 
     if (!st->stream_copy) {
-        const char *p;
+        const char *p = NULL;
         char *forced_key_frames = NULL, *frame_rate = NULL, *frame_size = NULL;
         char *frame_aspect_ratio = NULL, *frame_pix_fmt = NULL;
         int i, force_fps = 0;
@@ -3070,7 +3059,7 @@ static OutputStream *new_video_stream(OptionsContext *o, AVFormatContext *oc)
         if(inter_matrix)
             video_enc->inter_matrix = inter_matrix;
 
-        p= video_rc_override_string;
+        MATCH_PER_STREAM_OPT(rc_overrides, str, p, oc, st);
         for(i=0; p; i++){
             int start, end, q;
             int e=sscanf(p, "%d,%d,%d", &start, &end, &q);
@@ -3097,7 +3086,6 @@ static OutputStream *new_video_stream(OptionsContext *o, AVFormatContext *oc)
         video_enc->rc_override_count=i;
         if (!video_enc->rc_initial_buffer_occupancy)
             video_enc->rc_initial_buffer_occupancy = video_enc->rc_buffer_size*3/4;
-        video_enc->me_threshold= me_threshold;
         video_enc->intra_dc_precision= intra_dc_precision - 8;
 
         if (do_psnr)
@@ -3971,9 +3959,8 @@ static const OptionDef options[] = {
     { "pix_fmt", HAS_ARG | OPT_EXPERT | OPT_VIDEO | OPT_STRING | OPT_SPEC, {.off = OFFSET(frame_pix_fmts)}, "set pixel format", "format" },
     { "vn", OPT_BOOL | OPT_VIDEO | OPT_OFFSET, {.off = OFFSET(video_disable)}, "disable video" },
     { "vdt", OPT_INT | HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)&video_discard}, "discard threshold", "n" },
-    { "rc_override", HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)opt_video_rc_override_string}, "rate control override for specific intervals", "override" },
+    { "rc_override", HAS_ARG | OPT_EXPERT | OPT_VIDEO | OPT_STRING | OPT_SPEC, {.off = OFFSET(rc_overrides)}, "rate control override for specific intervals", "override" },
     { "vcodec", HAS_ARG | OPT_VIDEO | OPT_FUNC2, {(void*)opt_video_codec}, "force video codec ('copy' to copy stream)", "codec" },
-    { "me_threshold", HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)opt_me_threshold}, "motion estimation threshold",  "threshold" },
     { "same_quant", OPT_BOOL | OPT_VIDEO, {(void*)&same_quant},
       "use same quantizer as source (implies VBR)" },
     { "pass", HAS_ARG | OPT_VIDEO, {(void*)opt_pass}, "select the pass number (1 or 2)", "n" },