]> git.sesse.net Git - vlc/blobdiff - modules/codec/avcodec/video.c
avcodec: drop deprecated qstride / qscale_table
[vlc] / modules / codec / avcodec / video.c
index 637f39704286e6e33f08426e587564cf1beeffdf..ac7f51d4fce25642a76c0d1f5661df17af8bbc05 100644 (file)
@@ -75,11 +75,8 @@ struct decoder_sys_t
 
 
     /* */
-#if LIBAVCODEC_VERSION_MAJOR < 54
-    AVPaletteControl palette;
-#else
-# warning FIXME
-#endif
+    //AVPaletteControl palette;
+#warning FIXME
 
     /* */
     bool b_flush;
@@ -212,11 +209,7 @@ int InitVideoDec( decoder_t *p_dec, AVCodecContext *p_context,
     /*  ***** Get configuration of ffmpeg plugin ***** */
     p_sys->p_context->workaround_bugs =
         var_InheritInteger( p_dec, "avcodec-workaround-bugs" );
-#if LIBAVCODEC_VERSION_MAJOR < 54
-    p_sys->p_context->error_recognition =
-#else
     p_sys->p_context->err_recognition =
-#endif
         var_InheritInteger( p_dec, "avcodec-error-resilience" );
 
     if( var_CreateGetBool( p_dec, "grayscale" ) )
@@ -294,8 +287,8 @@ int InitVideoDec( decoder_t *p_dec, AVCodecContext *p_context,
     if( var_CreateGetBool( p_dec, "avcodec-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_CSCD &&
-        p_sys->i_codec_id != CODEC_ID_CINEPAK &&
+        p_sys->i_codec_id != AV_CODEC_ID_TSCC && p_sys->i_codec_id != AV_CODEC_ID_CSCD &&
+        p_sys->i_codec_id != AV_CODEC_ID_CINEPAK &&
         !p_sys->p_context->debug_mv )
     {
         /* Some codecs set pix_fmt only after the 1st frame has been decoded,
@@ -340,10 +333,10 @@ int InitVideoDec( decoder_t *p_dec, AVCodecContext *p_context,
 
     char *hw = var_CreateGetString( p_dec, "avcodec-hw" ); /* FIXME */
     if( (hw == NULL || strcasecmp( hw, "none" )) &&
-        (i_codec_id == CODEC_ID_MPEG1VIDEO || i_codec_id == CODEC_ID_MPEG2VIDEO ||
-         i_codec_id == CODEC_ID_MPEG4 ||
-         i_codec_id == CODEC_ID_H264 ||
-         i_codec_id == CODEC_ID_VC1 || i_codec_id == CODEC_ID_WMV3) )
+        (i_codec_id == AV_CODEC_ID_MPEG1VIDEO || i_codec_id == AV_CODEC_ID_MPEG2VIDEO ||
+         i_codec_id == AV_CODEC_ID_MPEG4 ||
+         i_codec_id == AV_CODEC_ID_H264 ||
+         i_codec_id == AV_CODEC_ID_VC1 || i_codec_id == AV_CODEC_ID_WMV3) )
     {
 #ifdef HAVE_AVCODEC_MT
         if( p_sys->p_context->thread_type & FF_THREAD_FRAME )
@@ -352,7 +345,7 @@ int InitVideoDec( decoder_t *p_dec, AVCodecContext *p_context,
             p_sys->p_context->thread_type &= ~FF_THREAD_FRAME;
         }
         if( ( p_sys->p_context->thread_type & FF_THREAD_SLICE ) &&
-            ( i_codec_id == CODEC_ID_MPEG1VIDEO || i_codec_id == CODEC_ID_MPEG2VIDEO ) )
+            ( i_codec_id == AV_CODEC_ID_MPEG1VIDEO || i_codec_id == AV_CODEC_ID_MPEG2VIDEO ) )
         {
             msg_Warn( p_dec, "threaded slice decoding is not compatible with libavcodec-hw, disabled" );
             p_sys->p_context->thread_type &= ~FF_THREAD_SLICE;
@@ -383,39 +376,8 @@ int InitVideoDec( decoder_t *p_dec, AVCodecContext *p_context,
     }
     p_dec->fmt_out.i_codec = p_dec->fmt_out.video.i_chroma;
 
-#if LIBAVCODEC_VERSION_MAJOR < 54
     /* Setup palette */
-    memset( &p_sys->palette, 0, sizeof(p_sys->palette) );
-    if( p_dec->fmt_in.video.p_palette )
-    {
-        p_sys->palette.palette_changed = 1;
-
-        for( int i = 0; i < __MIN( AVPALETTE_COUNT, p_dec->fmt_in.video.p_palette->i_entries ); i++ )
-        {
-            union {
-                uint32_t u;
-                uint8_t a[4];
-            } c;
-            c.a[0] = p_dec->fmt_in.video.p_palette->palette[i][0];
-            c.a[1] = p_dec->fmt_in.video.p_palette->palette[i][1];
-            c.a[2] = p_dec->fmt_in.video.p_palette->palette[i][2];
-            c.a[3] = p_dec->fmt_in.video.p_palette->palette[i][3];
-
-            p_sys->palette.palette[i] = c.u;
-        }
-        p_sys->p_context->palctrl = &p_sys->palette;
-
-        p_dec->fmt_out.video.p_palette = malloc( sizeof(video_palette_t) );
-        if( p_dec->fmt_out.video.p_palette )
-            *p_dec->fmt_out.video.p_palette = *p_dec->fmt_in.video.p_palette;
-    }
-    else if( p_sys->i_codec_id != CODEC_ID_MSVIDEO1 && p_sys->i_codec_id != CODEC_ID_CINEPAK )
-    {
-        p_sys->p_context->palctrl = &p_sys->palette;
-    }
-#else
-# warning FIXME
-#endif
+# warning FIXME: palette
 
     /* ***** init this codec with special data ***** */
     ffmpeg_InitCodec( p_dec );
@@ -770,24 +732,6 @@ picture_t *DecodeVideo( decoder_t *p_dec, block_t **pp_block )
             p_pic->b_progressive = !p_sys->p_ff_pic->interlaced_frame;
             p_pic->b_top_field_first = p_sys->p_ff_pic->top_field_first;
 
-            p_pic->i_qstride = p_sys->p_ff_pic->qstride;
-            int i_mb_h = ( p_pic->format.i_height + 15 ) / 16;
-            p_pic->p_q = malloc( p_pic->i_qstride * i_mb_h );
-            memcpy( p_pic->p_q, p_sys->p_ff_pic->qscale_table,
-                    p_pic->i_qstride * i_mb_h );
-            switch( p_sys->p_ff_pic->qscale_type )
-            {
-                case FF_QSCALE_TYPE_MPEG1:
-                    p_pic->i_qtype = QTYPE_MPEG1;
-                    break;
-                case FF_QSCALE_TYPE_MPEG2:
-                    p_pic->i_qtype = QTYPE_MPEG2;
-                    break;
-                case FF_QSCALE_TYPE_H264:
-                    p_pic->i_qtype = QTYPE_H264;
-                    break;
-            }
-
             return p_pic;
         }
         else
@@ -838,7 +782,7 @@ static void ffmpeg_InitCodec( decoder_t *p_dec )
 
     if( !i_size ) return;
 
-    if( p_sys->i_codec_id == CODEC_ID_SVQ3 )
+    if( p_sys->i_codec_id == AV_CODEC_ID_SVQ3 )
     {
         uint8_t *p;
 
@@ -968,10 +912,6 @@ static int ffmpeg_GetFrameBuf( struct AVCodecContext *p_context,
         /* */
         p_ff_pic->type = FF_BUFFER_TYPE_USER;
 
-#if LIBAVCODEC_VERSION_MAJOR < 54
-        p_ff_pic->age = 256*256*256*64;
-#endif
-
         if( vlc_va_Get( p_sys->p_va, p_ff_pic ) )
         {
             msg_Err( p_dec, "VaGrabSurface failed" );
@@ -1012,11 +952,11 @@ static int ffmpeg_GetFrameBuf( struct AVCodecContext *p_context,
         unsigned i_align;
         switch( p_sys->i_codec_id )
         {
-        case CODEC_ID_SVQ1:
-        case CODEC_ID_VP5:
-        case CODEC_ID_VP6:
-        case CODEC_ID_VP6F:
-        case CODEC_ID_VP6A:
+        case AV_CODEC_ID_SVQ1:
+        case AV_CODEC_ID_VP5:
+        case AV_CODEC_ID_VP6:
+        case AV_CODEC_ID_VP6F:
+        case AV_CODEC_ID_VP6A:
             i_align = 16;
             break;
         default:
@@ -1060,10 +1000,6 @@ static int ffmpeg_GetFrameBuf( struct AVCodecContext *p_context,
     p_ff_pic->linesize[2] = p_pic->p[2].i_pitch;
     p_ff_pic->linesize[3] = 0;
 
-#if LIBAVCODEC_VERSION_MAJOR < 54
-    p_ff_pic->age = 256*256*256*64;
-#endif
-
     post_mt( p_sys );
     return 0;