aboutsummaryrefslogtreecommitdiff
path: root/src/plugins/Input
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/Input')
-rw-r--r--src/plugins/Input/ffmpeg/decoder_ffmpeg.cpp50
-rw-r--r--src/plugins/Input/ffmpeg/decoderffmpegfactory.cpp29
-rw-r--r--src/plugins/Input/ffmpeg/ffmpegmetadatamodel.cpp2
-rw-r--r--src/plugins/Input/ffmpeg/settingsdialog.cpp29
4 files changed, 103 insertions, 7 deletions
diff --git a/src/plugins/Input/ffmpeg/decoder_ffmpeg.cpp b/src/plugins/Input/ffmpeg/decoder_ffmpeg.cpp
index a2596353a..b72660514 100644
--- a/src/plugins/Input/ffmpeg/decoder_ffmpeg.cpp
+++ b/src/plugins/Input/ffmpeg/decoder_ffmpeg.cpp
@@ -1,5 +1,5 @@
/***************************************************************************
- * Copyright (C) 2006-2013 by Ilya Kotov *
+ * Copyright (C) 2006-2014 by Ilya Kotov *
* forkotov02@hotmail.ru *
* *
* This program is free software; you can redistribute it and/or modify *
@@ -21,6 +21,12 @@
#include <QObject>
#include <QFile>
#include "decoder_ffmpeg.h"
+#if (LIBAVCODEC_VERSION_INT >= ((55<<16)+(34<<8)+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
@@ -83,12 +89,18 @@ DecoderFFmpeg::~DecoderFFmpeg()
m_temp_pkt.size = 0;
if (ic)
avformat_free_context(ic);
- if(m_pkt.data)
+ if(m_pkt.data)
av_free_packet(&m_pkt);
if(m_stream)
av_free(m_stream);
+
if(m_decoded_frame)
+#if (LIBAVCODEC_VERSION_INT >= ((55<<16)+(34<<8)+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()
@@ -187,7 +199,7 @@ bool DecoderFFmpeg::initialize()
break;
}
-#if (LIBAVCODEC_VERSION_INT >= ((55<<16)+(39<<8)+100)) //ffmpeg 2.1
+#if (LIBAVCODEC_VERSION_INT >= ((55<<16)+(34<<8)+0)) //libav-10: 55.34.1; ffmpeg-2.1: 55.39.100
if (c->channels == 1)
{
c->request_channel_layout = AV_CH_LAYOUT_MONO;
@@ -222,12 +234,21 @@ bool DecoderFFmpeg::initialize()
return false;
}
+#if (LIBAVCODEC_VERSION_INT >= ((55<<16)+(34<<8)+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 (LIBAVCODEC_VERSION_INT >= ((55<<16)+(34<<8)+0)) //libav 10
+ if(c->codec_id == AV_CODEC_ID_SHORTEN) //ffmpeg bug workaround
+ m_totalTime = 0;
+#else
if(c->codec_id == CODEC_ID_SHORTEN) //ffmpeg bug workaround
m_totalTime = 0;
+#endif
Qmmp::AudioFormat format = Qmmp::PCM_UNKNOWM;
@@ -330,7 +351,12 @@ qint64 DecoderFFmpeg::ffmpeg_decode()
int got_frame = 0;
if(m_pkt.stream_index == wma_idx)
{
+
+#if (LIBAVCODEC_VERSION_INT >= ((55<<16)+(34<<8)+0)) //libav-10: 55.34.1; ffmpeg-2.1: 55.39.100
+
+#else
avcodec_get_frame_defaults(m_decoded_frame);
+#endif
int l = avcodec_decode_audio4(c, m_decoded_frame, &got_frame, &m_temp_pkt);
@@ -388,7 +414,11 @@ void DecoderFFmpeg::fillBuffer()
m_temp_pkt.size = 0;
continue;
}
+#if (LIBAVCODEC_VERSION_INT >= ((55<<16)+(34<<8)+0)) //libav 10
+ if(m_seekTime && c->codec_id == AV_CODEC_ID_APE)
+#else
if(m_seekTime && c->codec_id == CODEC_ID_APE)
+#endif
{
int64_t rescaledPts = av_rescale(m_pkt.pts,
AV_TIME_BASE * (int64_t)
@@ -400,8 +430,11 @@ void DecoderFFmpeg::fillBuffer()
m_skipBytes = 0;
m_seekTime = 0;
}
-
+#if (LIBAVCODEC_VERSION_INT >= ((55<<16)+(34<<8)+0)) //libav 10
+ if(m_skipBytes > 0 && c->codec_id == AV_CODEC_ID_APE)
+#else
if(m_skipBytes > 0 && c->codec_id == CODEC_ID_APE)
+#endif
{
while (m_skipBytes > 0)
{
@@ -440,7 +473,11 @@ void DecoderFFmpeg::fillBuffer()
m_output_at = 0;
m_temp_pkt.size = 0;
+#if (LIBAVCODEC_VERSION_INT >= ((55<<16)+(34<<8)+0)) //libav 10
+ if(c->codec_id == AV_CODEC_ID_SHORTEN || c->codec_id == AV_CODEC_ID_TWINVQ)
+#else
if(c->codec_id == CODEC_ID_SHORTEN || c->codec_id == CODEC_ID_TWINVQ)
+#endif
{
if(m_pkt.data)
av_free_packet(&m_pkt);
@@ -451,8 +488,13 @@ void DecoderFFmpeg::fillBuffer()
}
else if(m_output_at == 0)
{
+#if (LIBAVCODEC_VERSION_INT >= ((55<<16)+(34<<8)+0)) //libav 10
+ if(c->codec_id == AV_CODEC_ID_SHORTEN || c->codec_id == AV_CODEC_ID_TWINVQ)
+ continue;
+#else
if(c->codec_id == CODEC_ID_SHORTEN || c->codec_id == CODEC_ID_TWINVQ)
continue;
+#endif
if(m_pkt.data)
av_free_packet(&m_pkt);
diff --git a/src/plugins/Input/ffmpeg/decoderffmpegfactory.cpp b/src/plugins/Input/ffmpeg/decoderffmpegfactory.cpp
index 4039a1737..397b9e6e4 100644
--- a/src/plugins/Input/ffmpeg/decoderffmpegfactory.cpp
+++ b/src/plugins/Input/ffmpeg/decoderffmpegfactory.cpp
@@ -1,5 +1,5 @@
/***************************************************************************
- * Copyright (C) 2008-2013 by Ilya Kotov *
+ * Copyright (C) 2008-2014 by Ilya Kotov *
* forkotov02@hotmail.ru *
* *
* This program is free software; you can redistribute it and/or modify *
@@ -95,6 +95,32 @@ const DecoderProperties DecoderFFmpegFactory::properties() const
filters = settings.value("FFMPEG/filters", filters).toStringList();
//removed unsupported filters
+#if (LIBAVCODEC_VERSION_INT >= ((55<<16)+(34<<8)+0)) //libav 10
+ if(!avcodec_find_decoder(AV_CODEC_ID_WMAV1))
+ filters.removeAll("*.wma");
+ if(!avcodec_find_decoder(AV_CODEC_ID_APE))
+ filters.removeAll("*.ape");
+ if(!avcodec_find_decoder(AV_CODEC_ID_TTA))
+ filters.removeAll("*.tta");
+ if(!avcodec_find_decoder(AV_CODEC_ID_AAC))
+ filters.removeAll("*.aac");
+ if(!avcodec_find_decoder(AV_CODEC_ID_MP3))
+ filters.removeAll("*.mp3");
+ if(!avcodec_find_decoder(AV_CODEC_ID_AAC) && !avcodec_find_decoder(AV_CODEC_ID_ALAC))
+ filters.removeAll("*.m4a");
+ if(!avcodec_find_decoder(AV_CODEC_ID_RA_288))
+ filters.removeAll("*.ra");
+ if(!avcodec_find_decoder(AV_CODEC_ID_SHORTEN))
+ filters.removeAll("*.shn");
+ if(!avcodec_find_decoder(AV_CODEC_ID_EAC3))
+ filters.removeAll("*.ac3");
+ if(!avcodec_find_decoder(AV_CODEC_ID_DTS))
+ filters.removeAll("*.dts");
+ if(!avcodec_find_decoder(AV_CODEC_ID_TRUEHD))
+ filters.removeAll("*.mka");
+ if(!avcodec_find_decoder(AV_CODEC_ID_TWINVQ))
+ filters.removeAll("*.vqf");
+#else
if(!avcodec_find_decoder(CODEC_ID_WMAV1))
filters.removeAll("*.wma");
if(!avcodec_find_decoder(CODEC_ID_APE))
@@ -119,6 +145,7 @@ const DecoderProperties DecoderFFmpegFactory::properties() const
filters.removeAll("*.mka");
if(!avcodec_find_decoder(CODEC_ID_TWINVQ))
filters.removeAll("*.vqf");
+#endif
DecoderProperties properties;
diff --git a/src/plugins/Input/ffmpeg/ffmpegmetadatamodel.cpp b/src/plugins/Input/ffmpeg/ffmpegmetadatamodel.cpp
index 5a49eca81..3f38be4be 100644
--- a/src/plugins/Input/ffmpeg/ffmpegmetadatamodel.cpp
+++ b/src/plugins/Input/ffmpeg/ffmpegmetadatamodel.cpp
@@ -1,5 +1,5 @@
/***************************************************************************
- * Copyright (C) 2009-2013 by Ilya Kotov *
+ * Copyright (C) 2009-2014 by Ilya Kotov *
* forkotov02@hotmail.ru *
* *
* This program is free software; you can redistribute it and/or modify *
diff --git a/src/plugins/Input/ffmpeg/settingsdialog.cpp b/src/plugins/Input/ffmpeg/settingsdialog.cpp
index 058acc055..5024e8a1b 100644
--- a/src/plugins/Input/ffmpeg/settingsdialog.cpp
+++ b/src/plugins/Input/ffmpeg/settingsdialog.cpp
@@ -1,5 +1,5 @@
/***************************************************************************
- * Copyright (C) 2008-2013 by Ilya Kotov *
+ * Copyright (C) 2008-2014 by Ilya Kotov *
* forkotov02@hotmail.ru *
* *
* This program is free software; you can redistribute it and/or modify *
@@ -38,6 +38,32 @@ SettingsDialog::SettingsDialog(QWidget *parent)
QStringList filters;
filters << "*.wma" << "*.ape" << "*.tta" << "*.m4a" << "*.ra" << "*.shn" << "*.vqf" << "*.ac3";
filters = settings.value("FFMPEG/filters", filters).toStringList();
+#if (LIBAVCODEC_VERSION_INT >= ((55<<16)+(34<<8)+0)) //libav 10
+ ui.wmaCheckBox->setEnabled(avcodec_find_decoder(AV_CODEC_ID_WMAV1));
+ ui.wmaCheckBox->setChecked(filters.contains("*.wma") && avcodec_find_decoder(AV_CODEC_ID_WMAV1));
+ ui.apeCheckBox->setEnabled(avcodec_find_decoder(AV_CODEC_ID_APE));
+ ui.apeCheckBox->setChecked(filters.contains("*.ape") && avcodec_find_decoder(AV_CODEC_ID_APE));
+ ui.ttaCheckBox->setEnabled(avcodec_find_decoder(AV_CODEC_ID_TTA));
+ ui.ttaCheckBox->setChecked(filters.contains("*.tta") && avcodec_find_decoder(AV_CODEC_ID_TTA));
+ ui.aacCheckBox->setEnabled(avcodec_find_decoder(AV_CODEC_ID_AAC));
+ ui.aacCheckBox->setChecked(filters.contains("*.aac") && avcodec_find_decoder(AV_CODEC_ID_AAC));
+ ui.mp3CheckBox->setEnabled(avcodec_find_decoder(AV_CODEC_ID_MP3));
+ ui.mp3CheckBox->setChecked(filters.contains("*.mp3") && avcodec_find_decoder(AV_CODEC_ID_MP3));
+ ui.mp4CheckBox->setEnabled(avcodec_find_decoder(AV_CODEC_ID_AAC));
+ ui.mp4CheckBox->setChecked(filters.contains("*.m4a") && (avcodec_find_decoder(AV_CODEC_ID_AAC)
+ || avcodec_find_decoder(AV_CODEC_ID_ALAC)));
+ ui.raCheckBox->setEnabled(avcodec_find_decoder(AV_CODEC_ID_RA_288));
+ ui.raCheckBox->setChecked(filters.contains("*.ra") && avcodec_find_decoder(AV_CODEC_ID_RA_288));
+ ui.shCheckBox->setChecked(filters.contains("*.shn") && avcodec_find_decoder(AV_CODEC_ID_SHORTEN));
+ ui.ac3CheckBox->setEnabled(avcodec_find_decoder(AV_CODEC_ID_EAC3));
+ ui.ac3CheckBox->setChecked(filters.contains("*.ac3") && avcodec_find_decoder(AV_CODEC_ID_EAC3));
+ ui.dtsCheckBox->setEnabled(avcodec_find_decoder(AV_CODEC_ID_DTS));
+ ui.dtsCheckBox->setChecked(filters.contains("*.dts") && avcodec_find_decoder(AV_CODEC_ID_DTS));
+ ui.mkaCheckBox->setEnabled(avcodec_find_decoder(AV_CODEC_ID_TRUEHD));
+ ui.mkaCheckBox->setChecked(filters.contains("*.mka") && avcodec_find_decoder(AV_CODEC_ID_TRUEHD));
+ ui.vqfCheckBox->setEnabled(avcodec_find_decoder(AV_CODEC_ID_TWINVQ));
+ ui.vqfCheckBox->setChecked(filters.contains("*.vqf") && avcodec_find_decoder(AV_CODEC_ID_TWINVQ));
+#else
ui.wmaCheckBox->setEnabled(avcodec_find_decoder(CODEC_ID_WMAV1));
ui.wmaCheckBox->setChecked(filters.contains("*.wma") && avcodec_find_decoder(CODEC_ID_WMAV1));
ui.apeCheckBox->setEnabled(avcodec_find_decoder(CODEC_ID_APE));
@@ -62,6 +88,7 @@ SettingsDialog::SettingsDialog(QWidget *parent)
ui.mkaCheckBox->setChecked(filters.contains("*.mka") && avcodec_find_decoder(CODEC_ID_TRUEHD));
ui.vqfCheckBox->setEnabled(avcodec_find_decoder(CODEC_ID_TWINVQ));
ui.vqfCheckBox->setChecked(filters.contains("*.vqf") && avcodec_find_decoder(CODEC_ID_TWINVQ));
+#endif
}
SettingsDialog::~SettingsDialog()