さきゅばす/いんきゅばす用libav(実験的)
リビジョン | 828e0bcb869f0b97bc91105686d37ec855c62d6a (tree) |
---|---|
日時 | 2011-09-12 00:30:04 |
作者 | Anton Khirnov <anton@khir...> |
コミッター | Anton Khirnov |
avconv: move top_field_first to options context.
@@ -104,7 +104,6 @@ static int nb_streamid_map = 0; | ||
104 | 104 | static int video_discard = 0; |
105 | 105 | static int same_quant = 0; |
106 | 106 | static int do_deinterlace = 0; |
107 | -static int top_field_first = -1; | |
108 | 107 | static int intra_dc_precision = 8; |
109 | 108 | static int qp_hist = 0; |
110 | 109 | #if CONFIG_AVFILTER |
@@ -203,6 +202,7 @@ typedef struct OutputStream { | ||
203 | 202 | int resample_pix_fmt; |
204 | 203 | AVRational frame_rate; |
205 | 204 | int force_fps; |
205 | + int top_field_first; | |
206 | 206 | |
207 | 207 | float frame_aspect_ratio; |
208 | 208 |
@@ -326,6 +326,8 @@ typedef struct OptionsContext { | ||
326 | 326 | int nb_intra_matrices; |
327 | 327 | SpecifierOpt *inter_matrices; |
328 | 328 | int nb_inter_matrices; |
329 | + SpecifierOpt *top_field_first; | |
330 | + int nb_top_field_first; | |
329 | 331 | } OptionsContext; |
330 | 332 | |
331 | 333 | #define MATCH_PER_STREAM_OPT(name, type, outvar, fmtctx, st)\ |
@@ -1205,10 +1207,10 @@ static void do_video_out(AVFormatContext *s, | ||
1205 | 1207 | settings */ |
1206 | 1208 | big_picture.interlaced_frame = in_picture->interlaced_frame; |
1207 | 1209 | if (ost->st->codec->flags & (CODEC_FLAG_INTERLACED_DCT|CODEC_FLAG_INTERLACED_ME)) { |
1208 | - if(top_field_first == -1) | |
1210 | + if (ost->top_field_first == -1) | |
1209 | 1211 | big_picture.top_field_first = in_picture->top_field_first; |
1210 | 1212 | else |
1211 | - big_picture.top_field_first = top_field_first; | |
1213 | + big_picture.top_field_first = !!ost->top_field_first; | |
1212 | 1214 | } |
1213 | 1215 | |
1214 | 1216 | /* handles same_quant here. This is not correct because it may |
@@ -2532,12 +2534,6 @@ static double parse_frame_aspect_ratio(const char *arg) | ||
2532 | 2534 | return ar; |
2533 | 2535 | } |
2534 | 2536 | |
2535 | -static int opt_top_field_first(const char *opt, const char *arg) | |
2536 | -{ | |
2537 | - top_field_first = parse_number_or_die(opt, arg, OPT_INT, 0, 1); | |
2538 | - return 0; | |
2539 | -} | |
2540 | - | |
2541 | 2537 | static int opt_audio_codec(OptionsContext *o, const char *opt, const char *arg) |
2542 | 2538 | { |
2543 | 2539 | return parse_option(o, "codec:a", arg, options); |
@@ -3045,7 +3041,7 @@ static OutputStream *new_video_stream(OptionsContext *o, AVFormatContext *oc) | ||
3045 | 3041 | char *forced_key_frames = NULL, *frame_rate = NULL, *frame_size = NULL; |
3046 | 3042 | char *frame_aspect_ratio = NULL, *frame_pix_fmt = NULL; |
3047 | 3043 | char *intra_matrix = NULL, *inter_matrix = NULL; |
3048 | - int i, force_fps = 0; | |
3044 | + int i, force_fps = 0, top_field_first = -1; | |
3049 | 3045 | |
3050 | 3046 | MATCH_PER_STREAM_OPT(frame_rates, str, frame_rate, oc, st); |
3051 | 3047 | if (frame_rate && av_parse_video_rate(&ost->frame_rate, frame_rate) < 0) { |
@@ -3131,6 +3127,9 @@ static OutputStream *new_video_stream(OptionsContext *o, AVFormatContext *oc) | ||
3131 | 3127 | |
3132 | 3128 | MATCH_PER_STREAM_OPT(force_fps, i, force_fps, oc, st); |
3133 | 3129 | ost->force_fps = force_fps; |
3130 | + | |
3131 | + MATCH_PER_STREAM_OPT(top_field_first, i, top_field_first, oc, st); | |
3132 | + ost->top_field_first = top_field_first; | |
3134 | 3133 | } |
3135 | 3134 | |
3136 | 3135 | return ost; |
@@ -3970,7 +3969,7 @@ static const OptionDef options[] = { | ||
3970 | 3969 | #endif |
3971 | 3970 | { "intra_matrix", HAS_ARG | OPT_EXPERT | OPT_VIDEO | OPT_STRING | OPT_SPEC, {.off = OFFSET(intra_matrices)}, "specify intra matrix coeffs", "matrix" }, |
3972 | 3971 | { "inter_matrix", HAS_ARG | OPT_EXPERT | OPT_VIDEO | OPT_STRING | OPT_SPEC, {.off = OFFSET(inter_matrices)}, "specify inter matrix coeffs", "matrix" }, |
3973 | - { "top", HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)opt_top_field_first}, "top=1/bottom=0/auto=-1 field first", "" }, | |
3972 | + { "top", HAS_ARG | OPT_EXPERT | OPT_VIDEO | OPT_INT| OPT_SPEC, {.off = OFFSET(top_field_first)}, "top=1/bottom=0/auto=-1 field first", "" }, | |
3974 | 3973 | { "dc", OPT_INT | HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)&intra_dc_precision}, "intra_dc_precision", "precision" }, |
3975 | 3974 | { "vtag", HAS_ARG | OPT_EXPERT | OPT_VIDEO | OPT_FUNC2, {(void*)opt_video_tag}, "force video tag/fourcc", "fourcc/tag" }, |
3976 | 3975 | { "qphist", OPT_BOOL | OPT_EXPERT | OPT_VIDEO, { (void *)&qp_hist }, "show QP histogram" }, |