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

Zhao, Gang gang.zhao.42 at gmail.com
Sat May 2 13:10:13 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>
---
 libavcodec/encode.c               | 4 ++++
 libavcodec/frame_thread_encoder.c | 4 ++++
 2 files changed, 8 insertions(+)

diff --git libavcodec/encode.c libavcodec/encode.c
index 9ed2cf0f59..f787aceaf8 100644
--- libavcodec/encode.c
+++ libavcodec/encode.c
@@ -368,11 +368,15 @@ 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) {
+#if FF_API_PKT_PTS
+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
+#endif
     } else {
         ret = AVERROR(EINVAL);
     }
diff --git libavcodec/frame_thread_encoder.c libavcodec/frame_thread_encoder.c
index 949bc69f81..cb04e1fe61 100644
--- libavcodec/frame_thread_encoder.c
+++ libavcodec/frame_thread_encoder.c
@@ -86,7 +86,11 @@ static void * attribute_align_arg worker(void *v){
         pthread_mutex_unlock(&c->task_fifo_mutex);
         frame = task.indata;
 
+#if FF_API_PKT_PTS
+FF_DISABLE_DEPRECATION_WARNINGS
         ret = avcodec_encode_video2(avctx, pkt, frame, &got_packet);
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif
         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