Skip to content

Display and control your Android device

Remove compat with old FFmpeg codec params API

Romain Vimont5d9e96dc4eaa
diff --git a/app/src/compat.h b/app/src/compat.h
index f3e7bd7a..9d9a7884 100644
--- a/app/src/compat.h
+++ b/app/src/compat.h
@@ -11,16 +11,6 @@
#include <libavformat/version.h>
#include <SDL2/SDL_version.h>
-// In ffmpeg/doc/APIchanges:
-// 2016-04-11 - 6f69f7a / 9200514 - lavf 57.33.100 / 57.5.0 - avformat.h
-// Add AVStream.codecpar, deprecate AVStream.codec.
-#if (LIBAVFORMAT_VERSION_MICRO >= 100 /* FFmpeg */ && \
- LIBAVFORMAT_VERSION_INT >= AV_VERSION_INT(57, 33, 100)) \
- || (LIBAVFORMAT_VERSION_MICRO < 100 && /* Libav */ \
- LIBAVFORMAT_VERSION_INT >= AV_VERSION_INT(57, 5, 0))
-# define SCRCPY_LAVF_HAS_NEW_CODEC_PARAMS_API
-#endif
-
// In ffmpeg/doc/APIchanges:
// 2018-02-06 - 0694d87024 - lavf 58.9.100 - avformat.h
// Deprecate use of av_register_input_format(), av_register_output_format(),
diff --git a/app/src/recorder.c b/app/src/recorder.c
index 3f5eb0d0..c0d7aed1 100644
--- a/app/src/recorder.c
+++ b/app/src/recorder.c
@@ -141,19 +141,11 @@ recorder_open(struct recorder *recorder, const AVCodec *input_codec) {
return false;
}
-#ifdef SCRCPY_LAVF_HAS_NEW_CODEC_PARAMS_API
ostream->codecpar->codec_type = AVMEDIA_TYPE_VIDEO;
ostream->codecpar->codec_id = input_codec->id;
ostream->codecpar->format = AV_PIX_FMT_YUV420P;
ostream->codecpar->width = recorder->declared_frame_size.width;
ostream->codecpar->height = recorder->declared_frame_size.height;
-#else
- ostream->codec->codec_type = AVMEDIA_TYPE_VIDEO;
- ostream->codec->codec_id = input_codec->id;
- ostream->codec->pix_fmt = AV_PIX_FMT_YUV420P;
- ostream->codec->width = recorder->declared_frame_size.width;
- ostream->codec->height = recorder->declared_frame_size.height;
-#endif
int ret = avio_open(&recorder->ctx->pb, recorder->filename,
AVIO_FLAG_WRITE);
@@ -188,13 +180,8 @@ recorder_write_header(struct recorder *recorder, const AVPacket *packet) {
// copy the first packet to the extra data
memcpy(extradata, packet->data, packet->size);
-#ifdef SCRCPY_LAVF_HAS_NEW_CODEC_PARAMS_API
ostream->codecpar->extradata = extradata;
ostream->codecpar->extradata_size = packet->size;
-#else
- ostream->codec->extradata = extradata;
- ostream->codec->extradata_size = packet->size;
-#endif
int ret = avformat_write_header(recorder->ctx, NULL);
if (ret < 0) {