]> git.sesse.net Git - vlc/blobdiff - modules/codec/avcodec/encoder.c
Do not use types not existing in official dxva2api.h header.
[vlc] / modules / codec / avcodec / encoder.c
index 8c85a9fbacdf06fd70a79a278df0b7c1c10aca17..21a4b6a555ee1737c7c3f33b97a06873213eb9e0 100644 (file)
@@ -278,7 +278,7 @@ int OpenEncoder( vlc_object_t *p_this )
 
     p_sys->p_context = p_context = avcodec_alloc_context();
     p_sys->p_context->codec_id = p_sys->p_codec->id;
-    p_context->debug = config_GetInt( p_enc, "ffmpeg-debug" );
+    p_context->debug = var_InheritInteger( p_enc, "ffmpeg-debug" );
     p_context->opaque = (void *)p_this;
 
     /* Set CPU capabilities */
@@ -386,8 +386,6 @@ int OpenEncoder( vlc_object_t *p_this )
 
     if( p_enc->fmt_in.i_cat == VIDEO_ES )
     {
-        int i_aspect_num, i_aspect_den;
-
         if( !p_enc->fmt_in.video.i_width || !p_enc->fmt_in.video.i_height )
         {
             msg_Warn( p_enc, "invalid size %ix%i", p_enc->fmt_in.video.i_width,
@@ -430,15 +428,15 @@ int OpenEncoder( vlc_object_t *p_this )
                p_enc->fmt_out.i_codec == VLC_CODEC_MP1V ) )
             p_context->flags |= CODEC_FLAG_LOW_DELAY;
 
-        av_reduce( &i_aspect_num, &i_aspect_den,
-                   p_enc->fmt_in.video.i_aspect,
-                   VOUT_ASPECT_FACTOR, 1 << 30 /* something big */ );
         av_reduce( &p_context->sample_aspect_ratio.num,
                    &p_context->sample_aspect_ratio.den,
-                   i_aspect_num * (int64_t)p_context->height,
-                   i_aspect_den * (int64_t)p_context->width, 1 << 30 );
+                   p_enc->fmt_in.video.i_sar_num,
+                   p_enc->fmt_in.video.i_sar_den, 1 << 30 );
+
+        p_sys->i_buffer_out = p_context->height * p_context->width
+            * 3     /* Assume 24bpp maximum */
+            + 200;  /* some room for potential headers (such as BMP) */
 
-        p_sys->i_buffer_out = p_context->height * p_context->width * 3;
         if( p_sys->i_buffer_out < FF_MIN_BUFFER_SIZE )
             p_sys->i_buffer_out = FF_MIN_BUFFER_SIZE;
         p_sys->p_buffer_out = malloc( p_sys->i_buffer_out );