• R/O
  • HTTP
  • SSH
  • HTTPS

libav_saccubus: Commit

さきゅばす/いんきゅばす用libav(実験的)


Commit MetaInfo

Revision495ecfd139ac9bf8e467086e17efd7f1970972bc (tree)
Zeit2011-09-12 00:30:04
AutorAnton Khirnov <anton@khir...>
CommiterAnton Khirnov

Log Message

avconv: move streamid_map to options context.

Ändern Zusammenfassung

Diff

--- a/avconv.c
+++ b/avconv.c
@@ -97,10 +97,6 @@ typedef struct MetadataMap {
9797
9898 static const OptionDef options[];
9999
100-/* indexed by output file stream index */
101-static int *streamid_map = NULL;
102-static int nb_streamid_map = 0;
103-
104100 static int video_discard = 0;
105101 static int same_quant = 0;
106102 static int do_deinterlace = 0;
@@ -299,6 +295,10 @@ typedef struct OptionsContext {
299295 int subtitle_disable;
300296 int data_disable;
301297
298+ /* indexed by output file stream index */
299+ int *streamid_map;
300+ int nb_streamid_map;
301+
302302 SpecifierOpt *metadata;
303303 int nb_metadata;
304304 SpecifierOpt *max_frames;
@@ -368,6 +368,7 @@ static void reset_options(OptionsContext *o)
368368
369369 av_freep(&o->stream_maps);
370370 av_freep(&o->meta_data_maps);
371+ av_freep(&o->streamid_map);
371372
372373 memset(o, 0, sizeof(*o));
373374
@@ -2934,7 +2935,7 @@ static void parse_forced_key_frames(char *kf, OutputStream *ost,
29342935 static OutputStream *new_output_stream(OptionsContext *o, AVFormatContext *oc, enum AVMediaType type)
29352936 {
29362937 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);
29382939 int idx = oc->nb_streams - 1;
29392940 int64_t max_frames = INT64_MAX;
29402941 char *bsf = NULL, *next, *codec_tag = NULL;
@@ -3209,7 +3210,7 @@ static OutputStream *new_subtitle_stream(OptionsContext *o, AVFormatContext *oc)
32093210 }
32103211
32113212 /* 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)
32133214 {
32143215 int idx;
32153216 char *p;
@@ -3225,8 +3226,8 @@ static int opt_streamid(const char *opt, const char *arg)
32253226 }
32263227 *p++ = '\0';
32273228 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);
32303231 return 0;
32313232 }
32323233
@@ -3587,9 +3588,6 @@ static void opt_output_file(void *optctx, const char *filename)
35873588 av_dict_set(m, o->metadata[i].u.str, *val ? val : NULL, 0);
35883589 }
35893590
3590- av_freep(&streamid_map);
3591- nb_streamid_map = 0;
3592-
35933591 reset_options(o);
35943592 }
35953593
@@ -3982,7 +3980,7 @@ static const OptionDef options[] = {
39823980 { "vtag", HAS_ARG | OPT_EXPERT | OPT_VIDEO | OPT_FUNC2, {(void*)opt_video_tag}, "force video tag/fourcc", "fourcc/tag" },
39833981 { "qphist", OPT_BOOL | OPT_EXPERT | OPT_VIDEO, { (void *)&qp_hist }, "show QP histogram" },
39843982 { "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" },
39863984 { "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" },
39873985
39883986 /* audio options */
Show on old repository browser