]> git.sesse.net Git - ffmpeg/blobdiff - ffmpeg.c
init has_b_frames for stream copy
[ffmpeg] / ffmpeg.c
index 98ba75a5f7aa0139722e6fd954732d45d2e39e6f..1a63076c62a6fddf4c28e78b7e60f7b13bcb46a0 100644 (file)
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -136,6 +136,7 @@ static int video_intra_quant_bias= FF_DEFAULT_QUANT_BIAS;
 static int video_inter_quant_bias= FF_DEFAULT_QUANT_BIAS;
 static int me_method = ME_EPZS;
 static int video_disable = 0;
+static int video_discard = 0;
 static int video_codec_id = CODEC_ID_NONE;
 static int video_codec_tag = 0;
 static int same_quality = 0;
@@ -661,15 +662,15 @@ static void fill_pad_region(AVPicture* img, int height, int width,
             optr = img->data[i] + (img->linesize[i] * (padtop >> shift)) +
                 (img->linesize[i] - (padright >> shift));
 
-            for (y = 0; y < ((height - (padtop + padbottom)) >> shift); y++) {
+            for (y = 0; y < ((height - (padtop + padbottom) - 1) >> shift); y++) {
                 memset(optr, color[i], (padleft + padright) >> shift);
                 optr += img->linesize[i];
             }
         }
       
-        if (padbottom) {
-            optr = img->data[i] + (img->linesize[i] * ((height - padbottom) >> shift));
-            memset(optr, color[i], ((img->linesize[i] * padbottom) >> shift));
+        if (padbottom || padright) {
+            optr = img->data[i] + (((img->linesize[i] * (height - padbottom)) - padright) >> shift);
+            memset(optr, color[i], (((img->linesize[i] * padbottom) + padright) >> shift));
         }
     }
 }
@@ -1532,6 +1533,7 @@ static int av_encode(AVFormatContext **output_files,
                 codec->frame_rate_base = icodec->frame_rate_base;
                 codec->width = icodec->width;
                 codec->height = icodec->height;
+                codec->has_b_frames = icodec->has_b_frames;
                 break;
             default:
                 av_abort();
@@ -2902,7 +2904,7 @@ static void opt_input_file(const char *filename)
             audio_channels = enc->channels;
             audio_sample_rate = enc->sample_rate;
             if(audio_disable)
-                ic->streams[i]->discard= 1;
+                ic->streams[i]->discard= AVDISCARD_ALL;
             break;
         case CODEC_TYPE_VIDEO:
             frame_height = enc->height;
@@ -2937,7 +2939,9 @@ static void opt_input_file(const char *filename)
 
             enc->rate_emu = rate_emu;
             if(video_disable)
-                ic->streams[i]->discard= 1;
+                ic->streams[i]->discard= AVDISCARD_ALL;
+            else if(video_discard)
+                ic->streams[i]->discard= video_discard;
             break;
         case CODEC_TYPE_DATA:
             break;
@@ -3130,6 +3134,7 @@ static void opt_output_file(const char *filename)
                     video_enc->gop_size = 0;
                 if (video_qscale || same_quality) {
                     video_enc->flags |= CODEC_FLAG_QSCALE;
+                    video_enc->global_quality= 
                     st->quality = FF_QP2LAMBDA * video_qscale;
                 }
 
@@ -3740,7 +3745,7 @@ void opt_intra_matrix(const char *arg)
 static void opt_target(const char *arg)
 {
     int norm = -1;
-    static const char const *frame_rates[] = {"25", "30000/1001", "24000/1001"};
+    static const char *const frame_rates[] = {"25", "30000/1001", "24000/1001"};
 
     if(!strncmp(arg, "pal-", 4)) {
         norm = 0;
@@ -3946,6 +3951,7 @@ const OptionDef options[] = {
     { "g", HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)opt_gop_size}, "set the group of picture size", "gop_size" },
     { "intra", OPT_BOOL | OPT_EXPERT | OPT_VIDEO, {(void*)&intra_only}, "use only intra frames"},
     { "vn", OPT_BOOL | OPT_VIDEO, {(void*)&video_disable}, "disable video" },
+    { "vdt", OPT_INT | HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)&video_discard}, "discard threshold", "n" },
     { "qscale", HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)opt_qscale}, "use fixed video quantiser scale (VBR)", "q" },
     { "qmin", HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)opt_qmin}, "min video quantiser scale (VBR)", "q" },
     { "qmax", HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)opt_qmax}, "max video quantiser scale (VBR)", "q" },