Display and control your Android device
Remove compat with old FFmpeg decoding API
Romain Vimontde9b79ec2dd7
diff --git a/app/src/compat.h b/app/src/compat.hindex 9a84a4c1..f3e7bd7a 100644--- a/app/src/compat.h+++ b/app/src/compat.h@@ -8,7 +8,6 @@# define _DARWIN_C_SOURCE#endif-#include <libavcodec/version.h>#include <libavformat/version.h>#include <SDL2/SDL_version.h>@@ -33,15 +32,6 @@# define SCRCPY_LAVF_REQUIRES_REGISTER_ALL#endif-// In ffmpeg/doc/APIchanges:-// 2016-04-21 - 7fc329e - lavc 57.37.100 - avcodec.h-// Add a new audio/video encoding and decoding API with decoupled input-// and output -- avcodec_send_packet(), avcodec_receive_frame(),-// avcodec_send_frame() and avcodec_receive_packet().-#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(57, 37, 100)-# define SCRCPY_LAVF_HAS_NEW_ENCODING_DECODING_API-#endif-#if SDL_VERSION_ATLEAST(2, 0, 5)// <https://wiki.libsdl.org/SDL_HINT_MOUSE_FOCUS_CLICKTHROUGH># define SCRCPY_SDL_HAS_HINT_MOUSE_FOCUS_CLICKTHROUGHdiff --git a/app/src/decoder.c b/app/src/decoder.cindex b7101194..f05303a3 100644--- a/app/src/decoder.c+++ b/app/src/decoder.c@@ -36,9 +36,6 @@ decoder_close(struct decoder *decoder) {booldecoder_push(struct decoder *decoder, const AVPacket *packet) {-// the new decoding/encoding API has been introduced by:-// <http://git.videolan.org/?p=ffmpeg.git;a=commitdiff;h=7fc329e2dd6226dfecaa4a1d7adf353bf2773726>-#ifdef SCRCPY_LAVF_HAS_NEW_ENCODING_DECODING_APIint ret;if ((ret = avcodec_send_packet(decoder->codec_ctx, packet)) < 0) {LOGE("Could not send video packet: %d", ret);@@ -53,19 +50,5 @@ decoder_push(struct decoder *decoder, const AVPacket *packet) {LOGE("Could not receive video frame: %d", ret);return false;}-#else- int got_picture;- int len = avcodec_decode_video2(decoder->codec_ctx,- decoder->video_buffer->producer_frame,- &got_picture,- packet);- if (len < 0) {- LOGE("Could not decode video packet: %d", len);- return false;- }- if (got_picture) {- video_buffer_producer_offer_frame(decoder->video_buffer);- }-#endifreturn true;}