[FFmpeg-devel] [PATCH v2 4/4] avcodec/encode: avcodec/frame_thread_encoder: Fixed a compile warning

Zhao, Gang gang.zhao.42 at gmail.com
Sat May 9 12:15:20 EEST 2020


Disable deprecation declarations compile warning when we really need
to call these deprecated functions.

Signed-off-by: Zhao, Gang <gang.zhao.42 at gmail.com>
---
Changes from v1:
Removed unnecessary #if check

 libavcodec/encode.c               | 2 ++
 libavcodec/frame_thread_encoder.c | 2 ++
 2 files changed, 4 insertions(+)

diff --git libavcodec/encode.c libavcodec/encode.c
index 9ed2cf0f59..59f1254d61 100644
--- libavcodec/encode.c
+++ libavcodec/encode.c
@@ -368,11 +368,13 @@ static int do_encode(AVCodecContext *avctx, const AVFrame *frame, int *got_packe
     avctx->internal->buffer_pkt_valid = 0;
 
     if (avctx->codec_type == AVMEDIA_TYPE_VIDEO) {
+FF_DISABLE_DEPRECATION_WARNINGS
         ret = avcodec_encode_video2(avctx, avctx->internal->buffer_pkt,
                                     frame, got_packet);
     } else if (avctx->codec_type == AVMEDIA_TYPE_AUDIO) {
         ret = avcodec_encode_audio2(avctx, avctx->internal->buffer_pkt,
                                     frame, got_packet);
+FF_ENABLE_DEPRECATION_WARNINGS
     } else {
         ret = AVERROR(EINVAL);
     }
diff --git libavcodec/frame_thread_encoder.c libavcodec/frame_thread_encoder.c
index 949bc69f81..87e3b470e5 100644
--- libavcodec/frame_thread_encoder.c
+++ libavcodec/frame_thread_encoder.c
@@ -86,7 +86,9 @@ static void * attribute_align_arg worker(void *v){
         pthread_mutex_unlock(&c->task_fifo_mutex);
         frame = task.indata;
 
+FF_DISABLE_DEPRECATION_WARNINGS
         ret = avcodec_encode_video2(avctx, pkt, frame, &got_packet);
+FF_ENABLE_DEPRECATION_WARNINGS
         pthread_mutex_lock(&c->buffer_mutex);
         av_frame_unref(frame);
         pthread_mutex_unlock(&c->buffer_mutex);
-- 
2.17.1



More information about the ffmpeg-devel mailing list