]> git.sesse.net Git - vlc/blobdiff - modules/codec/avcodec/video.c
Avcodec: deactivate DR for Camtasia
[vlc] / modules / codec / avcodec / video.c
index 5b13a5ad8bf941251e1e219d6371614cbc22679b..6c9b865134cf3257412b5ed2e5a18de5050a7cca 100644 (file)
@@ -301,7 +301,7 @@ int InitVideoDec( decoder_t *p_dec, AVCodecContext *p_context,
     if( var_CreateGetBool( p_dec, "ffmpeg-dr" ) &&
        (p_sys->p_codec->capabilities & CODEC_CAP_DR1) &&
         /* No idea why ... but this fixes flickering on some TSCC streams */
-        p_sys->i_codec_id != CODEC_ID_TSCC &&
+        p_sys->i_codec_id != CODEC_ID_TSCC && p_sys->i_codec_id != CODEC_ID_CSCD &&
 #if (LIBAVCODEC_VERSION_INT >= AV_VERSION_INT( 52, 68, 2 ) ) && (LIBAVCODEC_VERSION_INT < AV_VERSION_INT( 52, 100, 1 ) )
         /* avcodec native vp8 decode doesn't handle EMU_EDGE flag, and I
            don't have idea howto implement fallback to libvpx decoder */
@@ -349,11 +349,13 @@ int InitVideoDec( decoder_t *p_dec, AVCodecContext *p_context,
          i_codec_id == CODEC_ID_H264 ||
          i_codec_id == CODEC_ID_VC1 || i_codec_id == CODEC_ID_WMV3) )
     {
+#ifdef HAVE_AVCODEC_MT
         if( p_sys->p_context->thread_type & FF_THREAD_FRAME )
         {
             msg_Warn( p_dec, "threaded frame decoding is not compatible with ffmpeg-hw, disabled" );
             p_sys->p_context->thread_type &= ~FF_THREAD_FRAME;
         }
+#endif
         p_sys->p_context->get_format = ffmpeg_GetFormat;
     }
 #endif
@@ -943,10 +945,10 @@ static int ffmpeg_GetFrameBuf( struct AVCodecContext *p_context,
     if( p_sys->p_va )
     {
 #ifdef HAVE_AVCODEC_VA
-        /* hwaccel_context is not present in old fffmpeg version */
+        /* hwaccel_context is not present in old ffmpeg version */
         if( vlc_va_Setup( p_sys->p_va,
-                          &p_sys->p_context->hwaccel_context, &p_dec->fmt_out.video.i_chroma,
-                          p_sys->p_context->width, p_sys->p_context->height ) )
+                          &p_context->hwaccel_context, &p_dec->fmt_out.video.i_chroma,
+                          p_context->width, p_context->height ) )
         {
             msg_Err( p_dec, "vlc_va_Setup failed" );
             return -1;
@@ -974,13 +976,12 @@ static int ffmpeg_GetFrameBuf( struct AVCodecContext *p_context,
     }
 
     wait_mt( p_sys );
-
     /* Some codecs set pix_fmt only after the 1st frame has been decoded,
      * so we need to check for direct rendering again. */
 
-    int i_width = p_sys->p_context->width;
-    int i_height = p_sys->p_context->height;
-    avcodec_align_dimensions( p_sys->p_context, &i_width, &i_height );
+    int i_width = p_context->width;
+    int i_height = p_context->height;
+    avcodec_align_dimensions( p_context, &i_width, &i_height );
 
     if( GetVlcChroma( &p_dec->fmt_out.video, p_context->pix_fmt ) != VLC_SUCCESS ||
         p_context->pix_fmt == PIX_FMT_PAL8 )
@@ -989,7 +990,7 @@ static int ffmpeg_GetFrameBuf( struct AVCodecContext *p_context,
     p_dec->fmt_out.i_codec = p_dec->fmt_out.video.i_chroma;
 
     /* Get a new picture */
-    p_pic = ffmpeg_NewPictBuf( p_dec, p_sys->p_context );
+    p_pic = ffmpeg_NewPictBuf( p_dec, p_context );
     if( !p_pic )
         goto no_dr;
     bool b_compatible = true;
@@ -1035,7 +1036,7 @@ static int ffmpeg_GetFrameBuf( struct AVCodecContext *p_context,
         p_sys->i_direct_rendering_used = 1;
     }
 
-    p_sys->p_context->draw_horiz_band = NULL;
+    p_context->draw_horiz_band = NULL;
 
     p_ff_pic->opaque = (void*)p_pic;
     p_ff_pic->type = FF_BUFFER_TYPE_USER;
@@ -1102,10 +1103,10 @@ static void ffmpeg_ReleaseFrameBuf( struct AVCodecContext *p_context,
 }
 
 #ifdef HAVE_AVCODEC_VA
-static enum PixelFormat ffmpeg_GetFormat( AVCodecContext *p_codec,
+static enum PixelFormat ffmpeg_GetFormat( AVCodecContext *p_context,
                                           const enum PixelFormat *pi_fmt )
 {
-    decoder_t *p_dec = p_codec->opaque;
+    decoder_t *p_dec = p_context->opaque;
     decoder_sys_t *p_sys = p_dec->p_sys;
 
     if( p_sys->p_va )
@@ -1158,14 +1159,14 @@ static enum PixelFormat ffmpeg_GetFormat( AVCodecContext *p_codec,
 #endif
 
         if( p_sys->p_va &&
-            p_sys->p_context->width > 0 && p_sys->p_context->height > 0 )
+            p_context->width > 0 && p_context->height > 0 )
         {
             /* We try to call vlc_va_Setup when possible to detect errors when
              * possible (later is too late) */
             if( vlc_va_Setup( p_sys->p_va,
-                              &p_sys->p_context->hwaccel_context,
+                              &p_context->hwaccel_context,
                               &p_dec->fmt_out.video.i_chroma,
-                              p_sys->p_context->width, p_sys->p_context->height ) )
+                              p_context->width, p_context->height ) )
             {
                 msg_Err( p_dec, "vlc_va_Setup failed" );
                 vlc_va_Delete( p_sys->p_va );
@@ -1182,13 +1183,13 @@ static enum PixelFormat ffmpeg_GetFormat( AVCodecContext *p_codec,
              * even if a new pixel format is renegociated
              */
             p_sys->b_direct_rendering = false;
-            p_sys->p_context->draw_horiz_band = NULL;
+            p_context->draw_horiz_band = NULL;
             return pi_fmt[i];
         }
     }
 
     /* Fallback to default behaviour */
-    return avcodec_default_get_format( p_codec, pi_fmt );
+    return avcodec_default_get_format( p_context, pi_fmt );
 }
 #endif