diff mbox series

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

Message ID c1b4313e50fb3d409b8c51c6c1540177985c41eb.1589015523.git.gang.zhao.42@gmail.com
State New
Headers show
Series Untitled series #1167
Related show

Commit Message

Zhao, Gang May 9, 2020, 9:15 a.m. UTC
Disable deprecation declarations compile warning when we really need
to call these deprecated functions.

Signed-off-by: Zhao, Gang <gang.zhao.42@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 mbox series

Patch

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);