さきゅばす/いんきゅばす用libav(実験的)
Revision | 495ecfd139ac9bf8e467086e17efd7f1970972bc (tree) |
---|---|
Zeit | 2011-09-12 00:30:04 |
Autor | Anton Khirnov <anton@khir...> |
Commiter | Anton Khirnov |
avconv: move streamid_map to options context.
@@ -97,10 +97,6 @@ typedef struct MetadataMap { | ||
97 | 97 | |
98 | 98 | static const OptionDef options[]; |
99 | 99 | |
100 | -/* indexed by output file stream index */ | |
101 | -static int *streamid_map = NULL; | |
102 | -static int nb_streamid_map = 0; | |
103 | - | |
104 | 100 | static int video_discard = 0; |
105 | 101 | static int same_quant = 0; |
106 | 102 | static int do_deinterlace = 0; |
@@ -299,6 +295,10 @@ typedef struct OptionsContext { | ||
299 | 295 | int subtitle_disable; |
300 | 296 | int data_disable; |
301 | 297 | |
298 | + /* indexed by output file stream index */ | |
299 | + int *streamid_map; | |
300 | + int nb_streamid_map; | |
301 | + | |
302 | 302 | SpecifierOpt *metadata; |
303 | 303 | int nb_metadata; |
304 | 304 | SpecifierOpt *max_frames; |
@@ -368,6 +368,7 @@ static void reset_options(OptionsContext *o) | ||
368 | 368 | |
369 | 369 | av_freep(&o->stream_maps); |
370 | 370 | av_freep(&o->meta_data_maps); |
371 | + av_freep(&o->streamid_map); | |
371 | 372 | |
372 | 373 | memset(o, 0, sizeof(*o)); |
373 | 374 |
@@ -2934,7 +2935,7 @@ static void parse_forced_key_frames(char *kf, OutputStream *ost, | ||
2934 | 2935 | static OutputStream *new_output_stream(OptionsContext *o, AVFormatContext *oc, enum AVMediaType type) |
2935 | 2936 | { |
2936 | 2937 | OutputStream *ost; |
2937 | - AVStream *st = av_new_stream(oc, oc->nb_streams < nb_streamid_map ? streamid_map[oc->nb_streams] : 0); | |
2938 | + AVStream *st = av_new_stream(oc, oc->nb_streams < o->nb_streamid_map ? o->streamid_map[oc->nb_streams] : 0); | |
2938 | 2939 | int idx = oc->nb_streams - 1; |
2939 | 2940 | int64_t max_frames = INT64_MAX; |
2940 | 2941 | char *bsf = NULL, *next, *codec_tag = NULL; |
@@ -3209,7 +3210,7 @@ static OutputStream *new_subtitle_stream(OptionsContext *o, AVFormatContext *oc) | ||
3209 | 3210 | } |
3210 | 3211 | |
3211 | 3212 | /* arg format is "output-stream-index:streamid-value". */ |
3212 | -static int opt_streamid(const char *opt, const char *arg) | |
3213 | +static int opt_streamid(OptionsContext *o, const char *opt, const char *arg) | |
3213 | 3214 | { |
3214 | 3215 | int idx; |
3215 | 3216 | char *p; |
@@ -3225,8 +3226,8 @@ static int opt_streamid(const char *opt, const char *arg) | ||
3225 | 3226 | } |
3226 | 3227 | *p++ = '\0'; |
3227 | 3228 | idx = parse_number_or_die(opt, idx_str, OPT_INT, 0, INT_MAX); |
3228 | - streamid_map = grow_array(streamid_map, sizeof(*streamid_map), &nb_streamid_map, idx+1); | |
3229 | - streamid_map[idx] = parse_number_or_die(opt, p, OPT_INT, 0, INT_MAX); | |
3229 | + o->streamid_map = grow_array(o->streamid_map, sizeof(*o->streamid_map), &o->nb_streamid_map, idx+1); | |
3230 | + o->streamid_map[idx] = parse_number_or_die(opt, p, OPT_INT, 0, INT_MAX); | |
3230 | 3231 | return 0; |
3231 | 3232 | } |
3232 | 3233 |
@@ -3587,9 +3588,6 @@ static void opt_output_file(void *optctx, const char *filename) | ||
3587 | 3588 | av_dict_set(m, o->metadata[i].u.str, *val ? val : NULL, 0); |
3588 | 3589 | } |
3589 | 3590 | |
3590 | - av_freep(&streamid_map); | |
3591 | - nb_streamid_map = 0; | |
3592 | - | |
3593 | 3591 | reset_options(o); |
3594 | 3592 | } |
3595 | 3593 |
@@ -3982,7 +3980,7 @@ static const OptionDef options[] = { | ||
3982 | 3980 | { "vtag", HAS_ARG | OPT_EXPERT | OPT_VIDEO | OPT_FUNC2, {(void*)opt_video_tag}, "force video tag/fourcc", "fourcc/tag" }, |
3983 | 3981 | { "qphist", OPT_BOOL | OPT_EXPERT | OPT_VIDEO, { (void *)&qp_hist }, "show QP histogram" }, |
3984 | 3982 | { "force_fps", OPT_BOOL | OPT_EXPERT | OPT_VIDEO | OPT_SPEC, {.off = OFFSET(force_fps)}, "force the selected framerate, disable the best supported framerate selection" }, |
3985 | - { "streamid", HAS_ARG | OPT_EXPERT, {(void*)opt_streamid}, "set the value of an outfile streamid", "streamIndex:value" }, | |
3983 | + { "streamid", HAS_ARG | OPT_EXPERT | OPT_FUNC2, {(void*)opt_streamid}, "set the value of an outfile streamid", "streamIndex:value" }, | |
3986 | 3984 | { "force_key_frames", OPT_STRING | HAS_ARG | OPT_EXPERT | OPT_VIDEO | OPT_SPEC, {.off = OFFSET(forced_key_frames)}, "force key frames at specified timestamps", "timestamps" }, |
3987 | 3985 | |
3988 | 3986 | /* audio options */ |