[vlc-devel] commit: ffmpeg: API change (Alexis Ballier )

git version control git at videolan.org
Thu Sep 11 02:02:29 CEST 2008


vlc | branch: 0.9-bugfix | Alexis Ballier <aballier at gentoo.org> | Tue Sep  9 21:48:16 2008 +0200| [ea8ca6a380e8c0945ec929a112ae3d4f34385cdd] | committer: Christophe Mutricy 

ffmpeg: API change

Fix build with libavcodec 52: few renamings, the way to specify trellis quantization has changed. error_resilience has been renamed to error_recognition; I've left the option named ffmpeg-error-resilience since I am not sure if it is worth renaming the option here.

Signed-off-by: Derk-Jan Hartman <hartman at videolan.org>
(cherry picked from commit fa68d1aeabd85449220afc083448c92e7ec58b1a)

Signed-off-by: Christophe Mutricy <xtophe at videolan.org>

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=ea8ca6a380e8c0945ec929a112ae3d4f34385cdd
---

 modules/codec/avcodec/audio.c   |    4 ++++
 modules/codec/avcodec/encoder.c |   16 ++++++++++++++++
 modules/codec/avcodec/video.c   |    9 +++++++++
 modules/demux/avformat/demux.c  |    4 ++++
 4 files changed, 33 insertions(+), 0 deletions(-)

diff --git a/modules/codec/avcodec/audio.c b/modules/codec/avcodec/audio.c
index 55a71d3..6bf9af4 100644
--- a/modules/codec/avcodec/audio.c
+++ b/modules/codec/avcodec/audio.c
@@ -125,7 +125,11 @@ int InitAudioDec( decoder_t *p_dec, AVCodecContext *p_context,
 
     p_sys->p_context->block_align = p_dec->fmt_in.audio.i_blockalign;
     p_sys->p_context->bit_rate = p_dec->fmt_in.i_bitrate;
+#if LIBAVCODEC_VERSION_INT < ((52<<16)+(0<<8)+0)
     p_sys->p_context->bits_per_sample = p_dec->fmt_in.audio.i_bitspersample;
+#else
+    p_sys->p_context->bits_per_coded_sample = p_dec->fmt_in.audio.i_bitspersample;
+#endif
 
     if( p_dec->fmt_in.i_extra > 0 )
     {
diff --git a/modules/codec/avcodec/encoder.c b/modules/codec/avcodec/encoder.c
index 5445579..9e115b2 100644
--- a/modules/codec/avcodec/encoder.c
+++ b/modules/codec/avcodec/encoder.c
@@ -510,8 +510,12 @@ int OpenEncoder( vlc_object_t *p_this )
             }
         }
 
+#if LIBAVCODEC_VERSION_INT < ((52<<16)+(0<<8)+0)
         if ( p_sys->b_trellis )
             p_context->flags |= CODEC_FLAG_TRELLIS_QUANT;
+#else
+        p_context->trellis = p_sys->b_trellis;
+#endif
 
         if ( p_sys->i_qmin > 0 && p_sys->i_qmin == p_sys->i_qmax )
             p_context->flags |= CODEC_FLAG_QSCALE;
@@ -838,7 +842,11 @@ static block_t *EncodeVideo( encoder_t *p_enc, picture_t *p_pict )
             if ( current_date + HURRY_UP_GUARD3 > frame.pts )
             {
                 p_sys->p_context->mb_decision = FF_MB_DECISION_SIMPLE;
+#if LIBAVCODEC_VERSION_INT < ((52<<16)+(0<<8)+0)
                 p_sys->p_context->flags &= ~CODEC_FLAG_TRELLIS_QUANT;
+#else
+                p_sys->p_context->trellis = 0;
+#endif
                 msg_Dbg( p_enc, "hurry up mode 3" );
             }
             else
@@ -847,15 +855,23 @@ static block_t *EncodeVideo( encoder_t *p_enc, picture_t *p_pict )
 
                 if ( current_date + HURRY_UP_GUARD2 > frame.pts )
                 {
+#if LIBAVCODEC_VERSION_INT < ((52<<16)+(0<<8)+0)
                     p_sys->p_context->flags &= ~CODEC_FLAG_TRELLIS_QUANT;
+#else
+                    p_sys->p_context->trellis = 0;
+#endif
                     p_sys->p_context->noise_reduction = p_sys->i_noise_reduction
                          + (HURRY_UP_GUARD2 + current_date - frame.pts) / 500;
                     msg_Dbg( p_enc, "hurry up mode 2" );
                 }
                 else
                 {
+#if LIBAVCODEC_VERSION_INT < ((52<<16)+(0<<8)+0)
                     if ( p_sys->b_trellis )
                         p_sys->p_context->flags |= CODEC_FLAG_TRELLIS_QUANT;
+#else
+                    p_sys->p_context->trellis = p_sys->b_trellis;
+#endif
 
                     p_sys->p_context->noise_reduction =
                         p_sys->i_noise_reduction;
diff --git a/modules/codec/avcodec/video.c b/modules/codec/avcodec/video.c
index 4381853..cba209c 100644
--- a/modules/codec/avcodec/video.c
+++ b/modules/codec/avcodec/video.c
@@ -200,13 +200,22 @@ int InitVideoDec( decoder_t *p_dec, AVCodecContext *p_context,
     p_sys->p_context->codec_tag = ffmpeg_CodecTag( p_dec->fmt_in.i_codec );
     p_sys->p_context->width  = p_dec->fmt_in.video.i_width;
     p_sys->p_context->height = p_dec->fmt_in.video.i_height;
+#if LIBAVCODEC_VERSION_INT < ((52<<16)+(0<<8)+0)
     p_sys->p_context->bits_per_sample = p_dec->fmt_in.video.i_bits_per_pixel;
+#else
+    p_sys->p_context->bits_per_coded_sample = p_dec->fmt_in.video.i_bits_per_pixel;
+#endif
 
     /*  ***** Get configuration of ffmpeg plugin ***** */
     p_sys->p_context->workaround_bugs =
         config_GetInt( p_dec, "ffmpeg-workaround-bugs" );
+#if LIBAVCODEC_VERSION_INT < ((52<<16)+(0<<8)+0)
     p_sys->p_context->error_resilience =
         config_GetInt( p_dec, "ffmpeg-error-resilience" );
+#else
+    p_sys->p_context->error_recognition =
+        config_GetInt( p_dec, "ffmpeg-error-resilience" );
+#endif
 
     var_Create( p_dec, "grayscale", VLC_VAR_BOOL | VLC_VAR_DOINHERIT );
     var_Get( p_dec, "grayscale", &val );
diff --git a/modules/demux/avformat/demux.c b/modules/demux/avformat/demux.c
index 365d6a1..c9481bd 100644
--- a/modules/demux/avformat/demux.c
+++ b/modules/demux/avformat/demux.c
@@ -215,7 +215,11 @@ int OpenDemux( vlc_object_t *p_this )
             es_format_Init( &fmt, AUDIO_ES, fcc );
             fmt.audio.i_channels = cc->channels;
             fmt.audio.i_rate = cc->sample_rate;
+#if LIBAVCODEC_VERSION_INT < ((52<<16)+(0<<8)+0)
             fmt.audio.i_bitspersample = cc->bits_per_sample;
+#else
+            fmt.audio.i_bitspersample = cc->bits_per_coded_sample;
+#endif
             fmt.audio.i_blockalign = cc->block_align;
             psz_type = "audio";
             break;




More information about the vlc-devel mailing list