Remove compat with old FFmpeg decoding API
The new API has been introduced in 2016 in libavcodec 57.xx, it's very old. This will avoid to maintain two code paths for decoding.
This commit is contained in:
parent
55806e7d31
commit
de9b79ec2d
2 changed files with 0 additions and 27 deletions
|
@ -8,7 +8,6 @@
|
||||||
# define _DARWIN_C_SOURCE
|
# define _DARWIN_C_SOURCE
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <libavcodec/version.h>
|
|
||||||
#include <libavformat/version.h>
|
#include <libavformat/version.h>
|
||||||
#include <SDL2/SDL_version.h>
|
#include <SDL2/SDL_version.h>
|
||||||
|
|
||||||
|
@ -33,15 +32,6 @@
|
||||||
# define SCRCPY_LAVF_REQUIRES_REGISTER_ALL
|
# define SCRCPY_LAVF_REQUIRES_REGISTER_ALL
|
||||||
#endif
|
#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)
|
#if SDL_VERSION_ATLEAST(2, 0, 5)
|
||||||
// <https://wiki.libsdl.org/SDL_HINT_MOUSE_FOCUS_CLICKTHROUGH>
|
// <https://wiki.libsdl.org/SDL_HINT_MOUSE_FOCUS_CLICKTHROUGH>
|
||||||
# define SCRCPY_SDL_HAS_HINT_MOUSE_FOCUS_CLICKTHROUGH
|
# define SCRCPY_SDL_HAS_HINT_MOUSE_FOCUS_CLICKTHROUGH
|
||||||
|
|
|
@ -36,9 +36,6 @@ decoder_close(struct decoder *decoder) {
|
||||||
|
|
||||||
bool
|
bool
|
||||||
decoder_push(struct decoder *decoder, const AVPacket *packet) {
|
decoder_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_API
|
|
||||||
int ret;
|
int ret;
|
||||||
if ((ret = avcodec_send_packet(decoder->codec_ctx, packet)) < 0) {
|
if ((ret = avcodec_send_packet(decoder->codec_ctx, packet)) < 0) {
|
||||||
LOGE("Could not send video packet: %d", ret);
|
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);
|
LOGE("Could not receive video frame: %d", ret);
|
||||||
return false;
|
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);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue