[FFmpeg-devel] [PATCH 13/13] disable deprecation warnings in deprecated code

Andreas Cadhalpun andreas.cadhalpun at googlemail.com
Sat Aug 8 13:33:24 CEST 2015


Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun at googlemail.com>
---
 libavcodec/mpeg12dec.c     | 5 ++++-
 libavcodec/options_table.h | 3 +++
 libavcodec/pthread_frame.c | 9 ++++++++-
 libavcodec/resample.c      | 2 ++
 libavfilter/audio.c        | 2 ++
 libavfilter/avcodec.c      | 2 ++
 libavutil/frame.c          | 2 ++
 libavutil/opt.c            | 2 ++
 8 files changed, 25 insertions(+), 2 deletions(-)

diff --git a/libavcodec/mpeg12dec.c b/libavcodec/mpeg12dec.c
index 453cd6a..9b22809 100644
--- a/libavcodec/mpeg12dec.c
+++ b/libavcodec/mpeg12dec.c
@@ -1266,7 +1266,9 @@ static void setup_hwaccel_for_pixfmt(AVCodecContext *avctx)
 
         s->pack_pblocks = 1;
 #if FF_API_XVMC
+FF_DISABLE_DEPRECATION_WARNINGS
         avctx->xvmc_acceleration = 2;
+FF_ENABLE_DEPRECATION_WARNINGS
 #endif /* FF_API_XVMC */
     }
 }
@@ -2898,6 +2900,7 @@ AVCodec ff_mpegvideo_decoder = {
 
 #if FF_API_XVMC
 #if CONFIG_MPEG_XVMC_DECODER
+FF_DISABLE_DEPRECATION_WARNINGS
 static av_cold int mpeg_mc_decode_init(AVCodecContext *avctx)
 {
     if (avctx->active_thread_type & FF_THREAD_SLICE)
@@ -2929,7 +2932,7 @@ AVCodec ff_mpeg_xvmc_decoder = {
                       AV_CODEC_CAP_DELAY,
     .flush          = flush,
 };
-
+FF_ENABLE_DEPRECATION_WARNINGS
 #endif
 #endif /* FF_API_XVMC */
 
diff --git a/libavcodec/options_table.h b/libavcodec/options_table.h
index 0fc343a..7a2790f 100644
--- a/libavcodec/options_table.h
+++ b/libavcodec/options_table.h
@@ -26,6 +26,7 @@
 #include <limits.h>
 #include <stdint.h>
 
+#include "libavutil/internal.h"
 #include "libavutil/opt.h"
 #include "avcodec.h"
 #include "version.h"
@@ -41,6 +42,7 @@
 
 #define AV_CODEC_DEFAULT_BITRATE 200*1000
 
+FF_DISABLE_DEPRECATION_WARNINGS
 static const AVOption avcodec_options[] = {
 {"b", "set bitrate (in bits/s)", OFFSET(bit_rate), AV_OPT_TYPE_INT, {.i64 = AV_CODEC_DEFAULT_BITRATE }, 0, INT_MAX, A|V|E},
 {"ab", "set bitrate (in bits/s)", OFFSET(bit_rate), AV_OPT_TYPE_INT, {.i64 = 128*1000 }, 0, INT_MAX, A|E},
@@ -506,6 +508,7 @@ static const AVOption avcodec_options[] = {
 {"video_size", "set video size", OFFSET(width), AV_OPT_TYPE_IMAGE_SIZE, {.str=NULL}, 0, INT_MAX, 0 },
 {NULL},
 };
+FF_ENABLE_DEPRECATION_WARNINGS
 
 #undef A
 #undef V
diff --git a/libavcodec/pthread_frame.c b/libavcodec/pthread_frame.c
index 5a3214c..a63210c 100644
--- a/libavcodec/pthread_frame.c
+++ b/libavcodec/pthread_frame.c
@@ -151,8 +151,10 @@ static attribute_align_arg void *frame_worker_thread(void *arg)
 
         if (fctx->die) break;
 
+FF_DISABLE_DEPRECATION_WARNINGS
         if (!codec->update_thread_context && THREAD_SAFE_CALLBACKS(avctx))
             ff_thread_finish_setup(avctx);
+FF_ENABLE_DEPRECATION_WARNINGS
 
         av_frame_unref(p->frame);
         p->got_frame = 0;
@@ -771,8 +773,10 @@ void ff_thread_flush(AVCodecContext *avctx)
 int ff_thread_can_start_frame(AVCodecContext *avctx)
 {
     PerThreadContext *p = avctx->internal->thread_ctx;
+FF_DISABLE_DEPRECATION_WARNINGS
     if ((avctx->active_thread_type&FF_THREAD_FRAME) && p->state != STATE_SETTING_UP &&
         (avctx->codec->update_thread_context || !THREAD_SAFE_CALLBACKS(avctx))) {
+FF_ENABLE_DEPRECATION_WARNINGS
         return 0;
     }
     return 1;
@@ -790,8 +794,10 @@ static int thread_get_buffer_internal(AVCodecContext *avctx, ThreadFrame *f, int
     if (!(avctx->active_thread_type & FF_THREAD_FRAME))
         return ff_get_buffer(avctx, f->f, flags);
 
+FF_DISABLE_DEPRECATION_WARNINGS
     if (p->state != STATE_SETTING_UP &&
         (avctx->codec->update_thread_context || !THREAD_SAFE_CALLBACKS(avctx))) {
+FF_ENABLE_DEPRECATION_WARNINGS
         av_log(avctx, AV_LOG_ERROR, "get_buffer() cannot be called after ff_thread_finish_setup()\n");
         return -1;
     }
@@ -831,9 +837,10 @@ FF_ENABLE_DEPRECATION_WARNINGS
         pthread_mutex_unlock(&p->progress_mutex);
 
     }
+FF_DISABLE_DEPRECATION_WARNINGS
     if (!THREAD_SAFE_CALLBACKS(avctx) && !avctx->codec->update_thread_context)
         ff_thread_finish_setup(avctx);
-
+FF_ENABLE_DEPRECATION_WARNINGS
     if (err)
         av_buffer_unref(&f->progress);
 
diff --git a/libavcodec/resample.c b/libavcodec/resample.c
index c45aa16..0f5ee84 100644
--- a/libavcodec/resample.c
+++ b/libavcodec/resample.c
@@ -33,6 +33,7 @@
 #include "libavutil/samplefmt.h"
 
 #if FF_API_AVCODEC_RESAMPLE
+FF_DISABLE_DEPRECATION_WARNINGS
 
 #define MAX_CHANNELS 8
 
@@ -440,4 +441,5 @@ void audio_resample_close(ReSampleContext *s)
     av_free(s);
 }
 
+FF_ENABLE_DEPRECATION_WARNINGS
 #endif
diff --git a/libavfilter/audio.c b/libavfilter/audio.c
index 8148fda..e322298 100644
--- a/libavfilter/audio.c
+++ b/libavfilter/audio.c
@@ -85,6 +85,7 @@ AVFrame *ff_get_audio_buffer(AVFilterLink *link, int nb_samples)
 }
 
 #if FF_API_AVFILTERBUFFER
+FF_DISABLE_DEPRECATION_WARNINGS
 AVFilterBufferRef* avfilter_get_audio_buffer_ref_from_arrays_channels(uint8_t **data,
                                                                       int linesize,int perms,
                                                                       int nb_samples,
@@ -171,4 +172,5 @@ AVFilterBufferRef* avfilter_get_audio_buffer_ref_from_arrays(uint8_t **data,
                                                               nb_samples, sample_fmt,
                                                               channels, channel_layout);
 }
+FF_ENABLE_DEPRECATION_WARNINGS
 #endif
diff --git a/libavfilter/avcodec.c b/libavfilter/avcodec.c
index def735f..bf7d8e1 100644
--- a/libavfilter/avcodec.c
+++ b/libavfilter/avcodec.c
@@ -29,6 +29,7 @@
 #include "libavutil/opt.h"
 
 #if FF_API_AVFILTERBUFFER
+FF_DISABLE_DEPRECATION_WARNINGS
 AVFilterBufferRef *avfilter_get_video_buffer_ref_from_frame(const AVFrame *frame,
                                                             int perms)
 {
@@ -134,4 +135,5 @@ int avfilter_copy_buf_props(AVFrame *dst, const AVFilterBufferRef *src)
 
     return 0;
 }
+FF_ENABLE_DEPRECATION_WARNINGS
 #endif
diff --git a/libavutil/frame.c b/libavutil/frame.c
index 4ae75ef..3a84811 100644
--- a/libavutil/frame.c
+++ b/libavutil/frame.c
@@ -290,7 +290,9 @@ static int frame_copy_props(AVFrame *dst, const AVFrame *src, int force_copy)
     dst->sample_rate            = src->sample_rate;
     dst->opaque                 = src->opaque;
 #if FF_API_AVFRAME_LAVC
+FF_DISABLE_DEPRECATION_WARNINGS
     dst->type                   = src->type;
+FF_ENABLE_DEPRECATION_WARNINGS
 #endif
     dst->pkt_pts                = src->pkt_pts;
     dst->pkt_dts                = src->pkt_dts;
diff --git a/libavutil/opt.c b/libavutil/opt.c
index 62db1b5..b5df9a3 100644
--- a/libavutil/opt.c
+++ b/libavutil/opt.c
@@ -1178,11 +1178,13 @@ int av_opt_show2(void *obj, void *av_log_obj, int req_flags, int rej_flags)
 void av_opt_set_defaults(void *s)
 {
 #if FF_API_OLD_AVOPTIONS
+FF_DISABLE_DEPRECATION_WARNINGS
     av_opt_set_defaults2(s, 0, 0);
 }
 
 void av_opt_set_defaults2(void *s, int mask, int flags)
 {
+FF_ENABLE_DEPRECATION_WARNINGS
 #endif
     const AVOption *opt = NULL;
     while ((opt = av_opt_next(s, opt))) {
-- 
2.4.6


More information about the ffmpeg-devel mailing list