decoder/ffmpeg: require at least version 11.12
This is the version in Debian Jessie (oldstable).
This commit is contained in:
parent
027e562f65
commit
69f4178bff
1
NEWS
1
NEWS
|
@ -19,6 +19,7 @@ ver 0.21 (not yet released)
|
||||||
* tags
|
* tags
|
||||||
- new tags "OriginalDate", "MUSICBRAINZ_WORKID"
|
- new tags "OriginalDate", "MUSICBRAINZ_WORKID"
|
||||||
* decoder
|
* decoder
|
||||||
|
- ffmpeg: require at least version 11.12
|
||||||
- gme: try loading m3u sidecar files
|
- gme: try loading m3u sidecar files
|
||||||
- hybrid_dsd: new decoder plugin
|
- hybrid_dsd: new decoder plugin
|
||||||
- mad: move "gapless_mp3_playback" setting to "decoder" block
|
- mad: move "gapless_mp3_playback" setting to "decoder" block
|
||||||
|
|
|
@ -911,7 +911,7 @@ MPD_ENABLE_AUTO_LIB(aac, FAAD, faad, NeAACDecOpen, [-lfaad], [],
|
||||||
|
|
||||||
dnl ---------------------------------- ffmpeg ---------------------------------
|
dnl ---------------------------------- ffmpeg ---------------------------------
|
||||||
MPD_ENABLE_AUTO_PKG(ffmpeg, FFMPEG,
|
MPD_ENABLE_AUTO_PKG(ffmpeg, FFMPEG,
|
||||||
[libavformat >= 53.17 libavcodec >= 53.25 libavutil >= 51.17],
|
[libavformat >= 56.1 libavcodec >= 56.1 libavutil >= 54.3],
|
||||||
[ffmpeg decoder library], [libavformat+libavcodec+libavutil not found])
|
[ffmpeg decoder library], [libavformat+libavcodec+libavutil not found])
|
||||||
|
|
||||||
dnl ----------------------------------- FLAC ----------------------------------
|
dnl ----------------------------------- FLAC ----------------------------------
|
||||||
|
|
|
@ -47,10 +47,7 @@ extern "C" {
|
||||||
#include <libavformat/avformat.h>
|
#include <libavformat/avformat.h>
|
||||||
#include <libavformat/avio.h>
|
#include <libavformat/avio.h>
|
||||||
#include <libavutil/avutil.h>
|
#include <libavutil/avutil.h>
|
||||||
|
|
||||||
#if LIBAVUTIL_VERSION_MAJOR >= 53
|
|
||||||
#include <libavutil/frame.h>
|
#include <libavutil/frame.h>
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
@ -539,8 +536,6 @@ FfmpegScanMetadata(const AVFormatContext &format_context, int audio_stream,
|
||||||
handler);
|
handler);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if LIBAVFORMAT_VERSION_INT >= AV_VERSION_INT(56, 1, 0)
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
FfmpegScanTag(const AVFormatContext &format_context, int audio_stream,
|
FfmpegScanTag(const AVFormatContext &format_context, int audio_stream,
|
||||||
TagBuilder &tag)
|
TagBuilder &tag)
|
||||||
|
@ -571,8 +566,6 @@ FfmpegCheckTag(DecoderClient &client, InputStream &is,
|
||||||
client.SubmitTag(is, tag.Commit());
|
client.SubmitTag(is, tag.Commit());
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
FfmpegDecode(DecoderClient &client, InputStream &input,
|
FfmpegDecode(DecoderClient &client, InputStream &input,
|
||||||
AVFormatContext &format_context)
|
AVFormatContext &format_context)
|
||||||
|
@ -598,17 +591,11 @@ FfmpegDecode(DecoderClient &client, InputStream &input,
|
||||||
|
|
||||||
const auto &codec_params = GetCodecParameters(av_stream);
|
const auto &codec_params = GetCodecParameters(av_stream);
|
||||||
|
|
||||||
#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(54, 25, 0)
|
|
||||||
const AVCodecDescriptor *codec_descriptor =
|
const AVCodecDescriptor *codec_descriptor =
|
||||||
avcodec_descriptor_get(codec_params.codec_id);
|
avcodec_descriptor_get(codec_params.codec_id);
|
||||||
if (codec_descriptor != nullptr)
|
if (codec_descriptor != nullptr)
|
||||||
FormatDebug(ffmpeg_domain, "codec '%s'",
|
FormatDebug(ffmpeg_domain, "codec '%s'",
|
||||||
codec_descriptor->name);
|
codec_descriptor->name);
|
||||||
#else
|
|
||||||
if (codec_context->codec_name[0] != 0)
|
|
||||||
FormatDebug(ffmpeg_domain, "codec '%s'",
|
|
||||||
codec_context->codec_name);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
AVCodec *codec = avcodec_find_decoder(codec_params.codec_id);
|
AVCodec *codec = avcodec_find_decoder(codec_params.codec_id);
|
||||||
|
|
||||||
|
@ -670,24 +657,14 @@ FfmpegDecode(DecoderClient &client, InputStream &input,
|
||||||
|
|
||||||
FfmpegParseMetaData(client, format_context, audio_stream);
|
FfmpegParseMetaData(client, format_context, audio_stream);
|
||||||
|
|
||||||
#if LIBAVUTIL_VERSION_MAJOR >= 53
|
|
||||||
AVFrame *frame = av_frame_alloc();
|
AVFrame *frame = av_frame_alloc();
|
||||||
#else
|
|
||||||
AVFrame *frame = avcodec_alloc_frame();
|
|
||||||
#endif
|
|
||||||
if (!frame) {
|
if (!frame) {
|
||||||
LogError(ffmpeg_domain, "Could not allocate frame");
|
LogError(ffmpeg_domain, "Could not allocate frame");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
AtScopeExit(&frame) {
|
AtScopeExit(&frame) {
|
||||||
#if LIBAVUTIL_VERSION_MAJOR >= 53
|
|
||||||
av_frame_free(&frame);
|
av_frame_free(&frame);
|
||||||
#elif LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(54, 28, 0)
|
|
||||||
avcodec_free_frame(&frame);
|
|
||||||
#else
|
|
||||||
av_free(frame);
|
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
|
|
||||||
FfmpegBuffer interleaved_buffer;
|
FfmpegBuffer interleaved_buffer;
|
||||||
|
@ -720,9 +697,7 @@ FfmpegDecode(DecoderClient &client, InputStream &input,
|
||||||
/* end of file */
|
/* end of file */
|
||||||
break;
|
break;
|
||||||
|
|
||||||
#if LIBAVFORMAT_VERSION_INT >= AV_VERSION_INT(56, 1, 0)
|
|
||||||
FfmpegCheckTag(client, input, format_context, audio_stream);
|
FfmpegCheckTag(client, input, format_context, audio_stream);
|
||||||
#endif
|
|
||||||
|
|
||||||
if (packet.size > 0 && packet.stream_index == audio_stream) {
|
if (packet.size > 0 && packet.stream_index == audio_stream) {
|
||||||
cmd = ffmpeg_send_packet(client, input,
|
cmd = ffmpeg_send_packet(client, input,
|
||||||
|
|
|
@ -22,15 +22,6 @@
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#include <libavutil/mem.h>
|
#include <libavutil/mem.h>
|
||||||
|
|
||||||
#if LIBAVUTIL_VERSION_INT >= AV_VERSION_INT(52, 18, 0)
|
|
||||||
#define HAVE_AV_FAST_MALLOC
|
|
||||||
#else
|
|
||||||
#include <libavcodec/avcodec.h>
|
|
||||||
#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(52, 25, 0)
|
|
||||||
#define HAVE_AV_FAST_MALLOC
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
|
@ -53,14 +44,7 @@ public:
|
||||||
|
|
||||||
gcc_malloc
|
gcc_malloc
|
||||||
void *Get(size_t min_size) {
|
void *Get(size_t min_size) {
|
||||||
#ifdef HAVE_AV_FAST_MALLOC
|
|
||||||
av_fast_malloc(&data, &size, min_size);
|
av_fast_malloc(&data, &size, min_size);
|
||||||
#else
|
|
||||||
void *new_data = av_fast_realloc(data, &size, min_size);
|
|
||||||
if (new_data == nullptr)
|
|
||||||
return AVERROR(ENOMEM);
|
|
||||||
data = new_data;
|
|
||||||
#endif
|
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue