OSDN Git Service

rtpdec: Don't pass non-const pointers to fmtp attribute parsing functions
[android-x86/external-ffmpeg.git] / avconv_opt.c
index 434ba0b..1625429 100644 (file)
@@ -213,6 +213,8 @@ static int opt_map(void *optctx, const char *opt, const char *arg)
         arg++;
     }
     map = av_strdup(arg);
+    if (!map)
+        return AVERROR(ENOMEM);
 
     /* parse sync stream first, just pick first matching stream */
     if (sync = strchr(map, ',')) {
@@ -587,7 +589,7 @@ static void assert_file_overwrite(const char *filename)
     }
 
     if (!file_overwrite &&
-        (strchr(filename, ':') == NULL || filename[1] == ':' ||
+        (!strchr(filename, ':') || filename[1] == ':' ||
          av_strstart(filename, "file:", NULL))) {
         if (avio_check(filename, 0) == 0) {
             if (!using_stdin && !file_skip) {
@@ -1134,6 +1136,10 @@ static OutputStream *new_video_stream(OptionsContext *o, AVFormatContext *oc)
             video_enc->rc_override =
                 av_realloc(video_enc->rc_override,
                            sizeof(RcOverride) * (i + 1));
+            if (!video_enc->rc_override) {
+                av_log(NULL, AV_LOG_FATAL, "Could not (re)allocate memory for rc_override.\n");
+                exit_program(1);
+            }
             video_enc->rc_override[i].start_frame = start;
             video_enc->rc_override[i].end_frame   = end;
             if (q > 0) {
@@ -1803,7 +1809,7 @@ static int opt_target(void *optctx, const char *opt, const char *arg)
         parse_option(o, "ac", "2", options);
 
         opt_default(NULL, "packetsize", "2324");
-        opt_default(NULL, "muxrate", "1411200"); // 2352 * 75 * 8;
+        opt_default(NULL, "muxrate", "3528"); // 2352 * 75 / 50;
 
         /* 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
@@ -1825,7 +1831,7 @@ static int opt_target(void *optctx, const char *opt, const char *arg)
         opt_default(NULL, "maxrate", "2516000");
         opt_default(NULL, "minrate", "0"); // 1145000;
         opt_default(NULL, "bufsize", "1835008"); // 224*1024*8;
-        opt_default(NULL, "flags", "+scan_offset");
+        opt_default(NULL, "scan_offset", "1");
 
 
         opt_default(NULL, "b:a", "224000");
@@ -1849,7 +1855,7 @@ static int opt_target(void *optctx, const char *opt, const char *arg)
         opt_default(NULL, "bufsize", "1835008"); // 224*1024*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
+        opt_default(NULL, "muxrate", "25200"); // from mplex project: data_rate = 1260000. mux_rate = data_rate / 50
 
         opt_default(NULL, "b:a", "448000");
         parse_option(o, "ar", "48000", options);
@@ -1870,6 +1876,10 @@ static int opt_target(void *optctx, const char *opt, const char *arg)
         av_log(NULL, AV_LOG_ERROR, "Unknown target: %s\n", arg);
         return AVERROR(EINVAL);
     }
+
+    av_dict_copy(&o->g->codec_opts,  codec_opts, 0);
+    av_dict_copy(&o->g->format_opts, format_opts, 0);
+
     return 0;
 }