From 095347ffe4c73143dbeb7b05cde8891fd1289389 Mon Sep 17 00:00:00 2001 From: Andreas Cadhalpun Date: Sat, 8 Aug 2015 10:41:33 +0200 Subject: [PATCH] disable deprecation warnings in deprecated code Reviewed-by: wm4 Signed-off-by: Andreas Cadhalpun --- 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 ++ 7 files changed, 23 insertions(+), 2 deletions(-) diff --git a/libavcodec/mpeg12dec.c b/libavcodec/mpeg12dec.c index 3e5ef0e31e..5f42e95f70 100644 --- a/libavcodec/mpeg12dec.c +++ b/libavcodec/mpeg12dec.c @@ -1276,7 +1276,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 */ } } @@ -2919,6 +2921,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) @@ -2950,7 +2953,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 93d4f779a4..d4711edd37 100644 --- a/libavcodec/options_table.h +++ b/libavcodec/options_table.h @@ -26,6 +26,7 @@ #include #include +#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}, @@ -504,6 +506,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 5a3214caf4..a63210c209 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 c45aa16cd1..0f5ee84942 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 1e1d8e04df..a49bcf4f20 100644 --- a/libavfilter/audio.c +++ b/libavfilter/audio.c @@ -81,6 +81,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, @@ -167,4 +168,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 def735f84d..bf7d8e1596 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 4ae75ef5d2..3a84811b87 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;