Browse Source

ffmpeg_opt: reduce diff to libav in opt_target() by 16 lines

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
tags/n2.4
Michael Niedermayer 11 years ago
parent
commit
7a67ab5cba
1 changed files with 26 additions and 26 deletions
  1. +26
    -26
      ffmpeg_opt.c

+ 26
- 26
ffmpeg_opt.c View File

@@ -2221,19 +2221,19 @@ static int opt_target(void *optctx, const char *opt, const char *arg)


parse_option(o, "s", norm == PAL ? "352x288" : "352x240", options); parse_option(o, "s", norm == PAL ? "352x288" : "352x240", options);
parse_option(o, "r", frame_rates[norm], options); parse_option(o, "r", frame_rates[norm], options);
av_dict_set(&o->g->codec_opts, "g", norm == PAL ? "15" : "18", AV_DICT_DONT_OVERWRITE);
opt_default(NULL, "g", norm == PAL ? "15" : "18");


av_dict_set(&o->g->codec_opts, "b:v", "1150000", AV_DICT_DONT_OVERWRITE);
av_dict_set(&o->g->codec_opts, "maxrate", "1150000", AV_DICT_DONT_OVERWRITE);
av_dict_set(&o->g->codec_opts, "minrate", "1150000", AV_DICT_DONT_OVERWRITE);
av_dict_set(&o->g->codec_opts, "bufsize", "327680", AV_DICT_DONT_OVERWRITE); // 40*1024*8;
opt_default(NULL, "b:v", "1150000");
opt_default(NULL, "maxrate", "1150000");
opt_default(NULL, "minrate", "1150000");
opt_default(NULL, "bufsize", "327680"); // 40*1024*8;


av_dict_set(&o->g->codec_opts, "b:a", "224000", AV_DICT_DONT_OVERWRITE);
opt_default(NULL, "b:a", "224000");
parse_option(o, "ar", "44100", options); parse_option(o, "ar", "44100", options);
parse_option(o, "ac", "2", options); parse_option(o, "ac", "2", options);


av_dict_set(&o->g->format_opts, "packetsize", "2324", AV_DICT_DONT_OVERWRITE);
av_dict_set(&o->g->format_opts, "muxrate", "1411200", AV_DICT_DONT_OVERWRITE); // 2352 * 75 * 8;
opt_default(NULL, "packetsize", "2324");
opt_default(NULL, "muxrate", "1411200"); // 2352 * 75 * 8;


/* We have to offset the PTS, so that it is consistent with the SCR. /* We have to offset the PTS, so that it is consistent with the SCR.
SCR starts at 36000, but the first two packs contain only padding SCR starts at 36000, but the first two packs contain only padding
@@ -2250,18 +2250,18 @@ static int opt_target(void *optctx, const char *opt, const char *arg)
parse_option(o, "s", norm == PAL ? "480x576" : "480x480", options); parse_option(o, "s", norm == PAL ? "480x576" : "480x480", options);
parse_option(o, "r", frame_rates[norm], options); parse_option(o, "r", frame_rates[norm], options);
parse_option(o, "pix_fmt", "yuv420p", options); parse_option(o, "pix_fmt", "yuv420p", options);
av_dict_set(&o->g->codec_opts, "g", norm == PAL ? "15" : "18", AV_DICT_DONT_OVERWRITE);
opt_default(NULL, "g", norm == PAL ? "15" : "18");


av_dict_set(&o->g->codec_opts, "b:v", "2040000", AV_DICT_DONT_OVERWRITE);
av_dict_set(&o->g->codec_opts, "maxrate", "2516000", AV_DICT_DONT_OVERWRITE);
av_dict_set(&o->g->codec_opts, "minrate", "0", AV_DICT_DONT_OVERWRITE); // 1145000;
av_dict_set(&o->g->codec_opts, "bufsize", "1835008", AV_DICT_DONT_OVERWRITE); // 224*1024*8;
av_dict_set(&o->g->codec_opts, "scan_offset", "1", AV_DICT_DONT_OVERWRITE);
opt_default(NULL, "b:v", "2040000");
opt_default(NULL, "maxrate", "2516000");
opt_default(NULL, "minrate", "0"); // 1145000;
opt_default(NULL, "bufsize", "1835008"); // 224*1024*8;
opt_default(NULL, "scan_offset", "1");


av_dict_set(&o->g->codec_opts, "b:a", "224000", AV_DICT_DONT_OVERWRITE);
opt_default(NULL, "b:a", "224000");
parse_option(o, "ar", "44100", options); parse_option(o, "ar", "44100", options);


av_dict_set(&o->g->format_opts, "packetsize", "2324", AV_DICT_DONT_OVERWRITE);
opt_default(NULL, "packetsize", "2324");


} else if (!strcmp(arg, "dvd")) { } else if (!strcmp(arg, "dvd")) {


@@ -2272,17 +2272,17 @@ static int opt_target(void *optctx, const char *opt, const char *arg)
parse_option(o, "s", norm == PAL ? "720x576" : "720x480", options); parse_option(o, "s", norm == PAL ? "720x576" : "720x480", options);
parse_option(o, "r", frame_rates[norm], options); parse_option(o, "r", frame_rates[norm], options);
parse_option(o, "pix_fmt", "yuv420p", options); parse_option(o, "pix_fmt", "yuv420p", options);
av_dict_set(&o->g->codec_opts, "g", norm == PAL ? "15" : "18", AV_DICT_DONT_OVERWRITE);
opt_default(NULL, "g", norm == PAL ? "15" : "18");


av_dict_set(&o->g->codec_opts, "b:v", "6000000", AV_DICT_DONT_OVERWRITE);
av_dict_set(&o->g->codec_opts, "maxrate", "9000000", AV_DICT_DONT_OVERWRITE);
av_dict_set(&o->g->codec_opts, "minrate", "0", AV_DICT_DONT_OVERWRITE); // 1500000;
av_dict_set(&o->g->codec_opts, "bufsize", "1835008", AV_DICT_DONT_OVERWRITE); // 224*1024*8;
opt_default(NULL, "b:v", "6000000");
opt_default(NULL, "maxrate", "9000000");
opt_default(NULL, "minrate", "0"); // 1500000;
opt_default(NULL, "bufsize", "1835008"); // 224*1024*8;


av_dict_set(&o->g->format_opts, "packetsize", "2048", AV_DICT_DONT_OVERWRITE); // from www.mpucoder.com: DVD sectors contain 2048 bytes of data, this is also the size of one pack.
av_dict_set(&o->g->format_opts, "muxrate", "10080000", AV_DICT_DONT_OVERWRITE); // from mplex project: data_rate = 1260000. mux_rate = data_rate * 8
opt_default(NULL, "packetsize", "2048"); // from www.mpucoder.com: DVD sectors contain 2048 bytes of data, this is also the size of one pack.
opt_default(NULL, "muxrate", "10080000"); // from mplex project: data_rate = 1260000. mux_rate = data_rate * 8


av_dict_set(&o->g->codec_opts, "b:a", "448000", AV_DICT_DONT_OVERWRITE);
opt_default(NULL, "b:a", "448000");
parse_option(o, "ar", "48000", options); parse_option(o, "ar", "48000", options);


} else if (!strncmp(arg, "dv", 2)) { } else if (!strncmp(arg, "dv", 2)) {
@@ -2302,8 +2302,8 @@ static int opt_target(void *optctx, const char *opt, const char *arg)
return AVERROR(EINVAL); return AVERROR(EINVAL);
} }


av_dict_copy(&o->g->codec_opts, codec_opts, 0);
av_dict_copy(&o->g->format_opts, format_opts, 0);
av_dict_copy(&o->g->codec_opts, codec_opts, AV_DICT_DONT_OVERWRITE);
av_dict_copy(&o->g->format_opts, format_opts, AV_DICT_DONT_OVERWRITE);


return 0; return 0;
} }


Loading…
Cancel
Save