aboutsummaryrefslogtreecommitdiff
path: root/src/plugins/Input
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/Input')
-rw-r--r--src/plugins/Input/ffmpeg/CMakeLists.txt5
-rw-r--r--src/plugins/Input/ffmpeg/decoder_ffmpeg.cpp68
-rw-r--r--src/plugins/Input/ffmpeg/ffmpegmetadatamodel.cpp11
3 files changed, 8 insertions, 76 deletions
diff --git a/src/plugins/Input/ffmpeg/CMakeLists.txt b/src/plugins/Input/ffmpeg/CMakeLists.txt
index e11a0d54c..5612c67b9 100644
--- a/src/plugins/Input/ffmpeg/CMakeLists.txt
+++ b/src/plugins/Input/ffmpeg/CMakeLists.txt
@@ -10,9 +10,8 @@ include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../../../)
link_directories(${CMAKE_CURRENT_BINARY_DIR}/../../../qmmp)
# minimal supported versions
-# libav-0.9: libavcodec-54.35.0, libavformat-54.20.3, libavutil-52.3.0
-# ffmpeg-2.0: libavcodec-55.18.102, libavformat-55.12.100, libavutil-52.38.100
-pkg_check_modules(FFMPEG libavcodec>=54.35.0 libavformat>=54.20.0 libavutil>=52.3.0)
+# ffmpeg-3.2: libavcodec-57.64.100, libavformat-57.56.100, libavutil-55.34.100
+pkg_check_modules(FFMPEG libavcodec>=57.64.0 libavformat>=57.56.0 libavutil>=55.34.0)
include_directories(${FFMPEG_INCLUDE_DIRS})
link_directories(${FFMPEG_LIBRARY_DIRS})
diff --git a/src/plugins/Input/ffmpeg/decoder_ffmpeg.cpp b/src/plugins/Input/ffmpeg/decoder_ffmpeg.cpp
index 9a8b27fcb..53beb5ba1 100644
--- a/src/plugins/Input/ffmpeg/decoder_ffmpeg.cpp
+++ b/src/plugins/Input/ffmpeg/decoder_ffmpeg.cpp
@@ -1,5 +1,5 @@
/***************************************************************************
- * Copyright (C) 2006-2019 by Ilya Kotov *
+ * Copyright (C) 2006-2020 by Ilya Kotov *
* forkotov02@ya.ru *
* *
* This program is free software; you can redistribute it and/or modify *
@@ -21,12 +21,10 @@
#include <QtDebug>
#include "replaygainreader.h"
#include "decoder_ffmpeg.h"
-#if (LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(55,34,0)) //libav-10: 55.34.1; ffmpeg-2.1: 55.39.100
extern "C"{
#include <libavutil/channel_layout.h>
#include <libavutil/frame.h>
}
-#endif
// callbacks
@@ -95,18 +93,13 @@ DecoderFFmpeg::~DecoderFFmpeg()
{
m_bitrate = 0;
m_temp_pkt.size = 0;
-#if (LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(57,48,0)) //ffmpeg-3.1: 57.48.101
if(c)
avcodec_free_context(&c);
-#endif
if (ic)
avformat_free_context(ic);
if(m_pkt.data)
-#if (LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(57,24,102)) //ffmpeg-3.0
av_packet_unref(&m_pkt);
-#else
- av_free_packet(&m_pkt);
-#endif
+
if(m_stream)
#if (LIBAVFORMAT_VERSION_INT >= AV_VERSION_INT(57, 80, 100)) //ffmpeg-3.4
avio_context_free(&m_stream);
@@ -115,11 +108,7 @@ DecoderFFmpeg::~DecoderFFmpeg()
#endif
if(m_decoded_frame)
-#if (LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(55,34,0)) //libav-10: 55.34.1; ffmpeg-2.1: 55.39.100
av_frame_free(&m_decoded_frame);
-#else
- av_free(m_decoded_frame);
-#endif
}
bool DecoderFFmpeg::initialize()
@@ -221,10 +210,7 @@ bool DecoderFFmpeg::initialize()
ReplayGainReader rg(ic);
setReplayGainInfo(rg.replayGainInfo());
-#if (LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(57,4,0)) //ffmpeg-3.1: 57.48.101
c = avcodec_alloc_context3(nullptr);
-#endif
-
ic->flags |= AVFMT_FLAG_GENPTS;
av_read_play(ic);
audioIndex = av_find_best_stream(ic, AVMEDIA_TYPE_AUDIO, -1, -1, nullptr, 0);
@@ -234,13 +220,8 @@ bool DecoderFFmpeg::initialize()
return false;
}
-#if (LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(57,48,0)) //ffmpeg-3.1: 57.48.101
avcodec_parameters_to_context(c, ic->streams[audioIndex]->codecpar);
-#else
- c = ic->streams[audioIndex]->codec;
-#endif
-#if (LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(55,34,0)) //libav-10: 55.34.1; ffmpeg-2.1: 55.39.100
if (c->channels == 1)
{
c->request_channel_layout = AV_CH_LAYOUT_MONO;
@@ -251,13 +232,6 @@ bool DecoderFFmpeg::initialize()
c->request_channel_layout = AV_CH_LAYOUT_STEREO;
m_channels = 2;
}
-#else
- if (c->channels > 0)
- c->request_channels = qMin(2, c->channels);
- else
- c->request_channels = 2;
- m_channels = c->request_channels;
-#endif
av_dump_format(ic,0,nullptr,0);
@@ -275,12 +249,7 @@ bool DecoderFFmpeg::initialize()
return false;
}
-#if (LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(55,34,0)) //libav-10: 55.34.1; ffmpeg-2.1: 55.39.100
m_decoded_frame = av_frame_alloc();
-#else
- m_decoded_frame = avcodec_alloc_frame();
-#endif
-
m_totalTime = input()->isSequential() ? 0 : ic->duration * 1000 / AV_TIME_BASE;
if(c->codec_id == AV_CODEC_ID_SHORTEN) //ffmpeg bug workaround
@@ -378,14 +347,6 @@ qint64 DecoderFFmpeg::ffmpeg_decode()
int got_frame = 0;
if(m_pkt.stream_index == audioIndex)
{
-
-#if (LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(55,34,0)) //libav-10: 55.34.1; ffmpeg-2.1: 55.39.100
-
-#else
- avcodec_get_frame_defaults(m_decoded_frame);
-#endif
-
-#if (LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(57,48,0)) //ffmpeg-3.1: 57.48.101
int send_err = 0, receive_err = 0;
if(m_temp_pkt.data)
@@ -411,9 +372,6 @@ qint64 DecoderFFmpeg::ffmpeg_decode()
{
got_frame = m_decoded_frame->pkt_size;
}
-#else
- int l = avcodec_decode_audio4(c, m_decoded_frame, &got_frame, &m_temp_pkt);
-#endif
if(got_frame)
out_size = av_samples_get_buffer_size(nullptr, c->channels, m_decoded_frame->nb_samples,
@@ -431,11 +389,7 @@ qint64 DecoderFFmpeg::ffmpeg_decode()
m_temp_pkt.size -= l;
}
if (!m_temp_pkt.size && m_pkt.data)
-#if (LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(57,24,102)) //ffmpeg-3.0
av_packet_unref(&m_pkt);
-#else
- av_free_packet(&m_pkt);
-#endif
return out_size;
}
@@ -448,11 +402,7 @@ void DecoderFFmpeg::seek(qint64 pos)
m_seekTime = timestamp;
av_seek_frame(ic, -1, timestamp, AVSEEK_FLAG_BACKWARD);
avcodec_flush_buffers(c);
-#if (LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(57,24,102)) //ffmpeg-3.0
av_packet_unref(&m_pkt);
-#else
- av_free_packet(&m_pkt);
-#endif
m_temp_pkt.size = 0;
}
@@ -475,11 +425,7 @@ void DecoderFFmpeg::fillBuffer()
m_temp_pkt.size = 0;
if(m_pkt.data)
{
-#if (LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(57,24,102)) //ffmpeg-3.0
av_packet_unref(&m_pkt);
-#else
- av_free_packet(&m_pkt);
-#endif
continue;
}
return;
@@ -536,11 +482,8 @@ void DecoderFFmpeg::fillBuffer()
m_temp_pkt.size = 0;
if(m_pkt.data)
-#if (LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(57,24,102)) //ffmpeg-3.0
av_packet_unref(&m_pkt);
-#else
- av_free_packet(&m_pkt);
-#endif
+
m_pkt.data = nullptr;
m_temp_pkt.size = 0;
break;
@@ -552,11 +495,8 @@ void DecoderFFmpeg::fillBuffer()
else if(m_output_at == 0)
{
if(m_pkt.data)
-#if (LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(57,24,102)) //ffmpeg-3.0
av_packet_unref(&m_pkt);
-#else
- av_free_packet(&m_pkt);
-#endif
+
m_pkt.data = nullptr;
m_temp_pkt.size = 0;
continue;
diff --git a/src/plugins/Input/ffmpeg/ffmpegmetadatamodel.cpp b/src/plugins/Input/ffmpeg/ffmpegmetadatamodel.cpp
index d12931d19..eeb7d3681 100644
--- a/src/plugins/Input/ffmpeg/ffmpegmetadatamodel.cpp
+++ b/src/plugins/Input/ffmpeg/ffmpegmetadatamodel.cpp
@@ -1,5 +1,5 @@
/***************************************************************************
- * Copyright (C) 2009-2019 by Ilya Kotov *
+ * Copyright (C) 2009-2020 by Ilya Kotov *
* forkotov02@ya.ru *
* *
* This program is free software; you can redistribute it and/or modify *
@@ -48,19 +48,12 @@ FFmpegMetaDataModel::FFmpegMetaDataModel(const QString &path) : MetaDataModel(tr
avformat_find_stream_info(in, nullptr);
av_read_play(in);
-#if (LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(57,48,0)) //ffmpeg-3.1: 57.48.101
AVCodecParameters *c = nullptr;
-#else
- AVCodecContext *c = nullptr;
-#endif
for (uint idx = 0; idx < in->nb_streams; idx++)
{
-#if (LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(57,48,0)) //ffmpeg-3.1: 57.48.101
c = in->streams[idx]->codecpar;
-#else
- c = in->streams[idx]->codec;
-#endif
+
if (c->codec_type == AVMEDIA_TYPE_VIDEO && c->codec_id == AV_CODEC_ID_MJPEG)
break;
}