2011-05-31 19:04:45 +02:00
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
2010-11-06 23:04:47 +01:00
|
|
|
|
// LameXP - Audio Encoder Front-End
|
2016-01-03 15:53:42 +01:00
|
|
|
|
// Copyright (C) 2004-2016 LoRd_MuldeR <MuldeR2@GMX.de>
|
2010-11-06 23:04:47 +01:00
|
|
|
|
//
|
|
|
|
|
// This program is free software; you can redistribute it and/or modify
|
|
|
|
|
// it under the terms of the GNU General Public License as published by
|
|
|
|
|
// the Free Software Foundation; either version 2 of the License, or
|
2013-10-23 20:56:57 +02:00
|
|
|
|
// (at your option) any later version, but always including the *additional*
|
|
|
|
|
// restrictions defined in the "License.txt" file.
|
2010-11-06 23:04:47 +01:00
|
|
|
|
//
|
|
|
|
|
// This program is distributed in the hope that it will be useful,
|
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
// GNU General Public License for more details.
|
|
|
|
|
//
|
|
|
|
|
// You should have received a copy of the GNU General Public License along
|
|
|
|
|
// with this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
|
// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
|
|
//
|
|
|
|
|
// http://www.gnu.org/licenses/gpl-2.0.txt
|
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
#include "Model_AudioFile.h"
|
|
|
|
|
|
2014-11-25 02:14:42 +01:00
|
|
|
|
//Internal
|
2013-10-12 20:38:07 +02:00
|
|
|
|
#include "Global.h"
|
|
|
|
|
|
2014-11-25 02:14:42 +01:00
|
|
|
|
//MUtils
|
|
|
|
|
#include <MUtils/Global.h>
|
|
|
|
|
|
|
|
|
|
//Qt
|
2010-11-06 23:04:47 +01:00
|
|
|
|
#include <QTime>
|
2011-01-14 23:34:31 +01:00
|
|
|
|
#include <QObject>
|
2011-03-20 23:32:11 +01:00
|
|
|
|
#include <QMutexLocker>
|
|
|
|
|
#include <QFile>
|
|
|
|
|
|
2014-11-25 02:14:42 +01:00
|
|
|
|
//CRT
|
2013-10-12 20:38:07 +02:00
|
|
|
|
#include <limits.h>
|
2011-05-31 19:04:45 +02:00
|
|
|
|
|
2012-08-22 23:52:55 +02:00
|
|
|
|
const unsigned int AudioFileModel::BITDEPTH_IEEE_FLOAT32 = UINT_MAX-1;
|
|
|
|
|
|
2013-10-13 20:50:12 +02:00
|
|
|
|
#define PRINT_S(VAR) do \
|
|
|
|
|
{ \
|
2014-11-25 02:14:42 +01:00
|
|
|
|
if((VAR).isEmpty()) qDebug(#VAR " = N/A"); else qDebug(#VAR " = \"%s\"", MUTILS_UTF8((VAR))); \
|
2013-10-13 20:50:12 +02:00
|
|
|
|
} \
|
|
|
|
|
while(0)
|
|
|
|
|
|
|
|
|
|
#define PRINT_U(VAR) do \
|
|
|
|
|
{ \
|
|
|
|
|
if((VAR) < 1) qDebug(#VAR " = N/A"); else qDebug(#VAR " = %u", (VAR)); \
|
|
|
|
|
} \
|
|
|
|
|
while(0)
|
|
|
|
|
|
2014-02-08 17:24:54 +01:00
|
|
|
|
//if((!(OTHER.NAME.isEmpty())) && ((FORCE) || (this.NAME.isEmpty()))) /*this.NAME = OTHER.NAME;*/ \
|
|
|
|
|
|
|
|
|
|
#define UPDATE_STR(OTHER, FORCE, NAME) do \
|
|
|
|
|
{ \
|
|
|
|
|
if(!(((OTHER).NAME).isEmpty())) \
|
|
|
|
|
{ \
|
|
|
|
|
if((FORCE) || ((this->NAME).isEmpty())) (this->NAME) = ((OTHER).NAME); \
|
|
|
|
|
} \
|
|
|
|
|
} \
|
|
|
|
|
while(0)
|
|
|
|
|
|
|
|
|
|
#define UPDATE_INT(OTHER, FORCE, NAME) do \
|
|
|
|
|
{ \
|
|
|
|
|
if(((OTHER).NAME) > 0) \
|
|
|
|
|
{ \
|
|
|
|
|
if((FORCE) || ((this->NAME) == 0)) (this->NAME) = ((OTHER).NAME); \
|
|
|
|
|
} \
|
|
|
|
|
} \
|
|
|
|
|
while(0)
|
|
|
|
|
|
|
|
|
|
#define ASSIGN_VAL(OTHER, NAME) do \
|
|
|
|
|
{ \
|
|
|
|
|
(this->NAME) = ((OTHER).NAME); \
|
|
|
|
|
} \
|
|
|
|
|
while(0)
|
|
|
|
|
|
2013-10-12 20:38:07 +02:00
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
// Audio File - Meta Info
|
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
2010-11-06 23:04:47 +01:00
|
|
|
|
|
2013-10-12 20:38:07 +02:00
|
|
|
|
AudioFileModel_MetaInfo::AudioFileModel_MetaInfo(void)
|
2010-11-06 23:04:47 +01:00
|
|
|
|
{
|
2013-10-12 20:38:07 +02:00
|
|
|
|
reset();
|
2010-11-06 23:04:47 +01:00
|
|
|
|
}
|
|
|
|
|
|
2013-10-12 20:38:07 +02:00
|
|
|
|
AudioFileModel_MetaInfo::AudioFileModel_MetaInfo(const AudioFileModel_MetaInfo &model)
|
2011-01-14 23:34:31 +01:00
|
|
|
|
{
|
2014-02-08 17:24:54 +01:00
|
|
|
|
ASSIGN_VAL(model, m_titel);
|
|
|
|
|
ASSIGN_VAL(model, m_artist);
|
|
|
|
|
ASSIGN_VAL(model, m_album);
|
|
|
|
|
ASSIGN_VAL(model, m_genre);
|
|
|
|
|
ASSIGN_VAL(model, m_comment);
|
|
|
|
|
ASSIGN_VAL(model, m_cover);
|
|
|
|
|
ASSIGN_VAL(model, m_year);
|
|
|
|
|
ASSIGN_VAL(model, m_position);
|
2011-01-14 23:34:31 +01:00
|
|
|
|
}
|
|
|
|
|
|
2013-10-12 20:38:07 +02:00
|
|
|
|
AudioFileModel_MetaInfo &AudioFileModel_MetaInfo::operator=(const AudioFileModel_MetaInfo &model)
|
2011-01-14 23:34:31 +01:00
|
|
|
|
{
|
2014-02-08 17:24:54 +01:00
|
|
|
|
ASSIGN_VAL(model, m_titel);
|
|
|
|
|
ASSIGN_VAL(model, m_artist);
|
|
|
|
|
ASSIGN_VAL(model, m_album);
|
|
|
|
|
ASSIGN_VAL(model, m_genre);
|
|
|
|
|
ASSIGN_VAL(model, m_comment);
|
|
|
|
|
ASSIGN_VAL(model, m_cover);
|
|
|
|
|
ASSIGN_VAL(model, m_year);
|
|
|
|
|
ASSIGN_VAL(model, m_position);
|
2011-01-14 23:34:31 +01:00
|
|
|
|
|
|
|
|
|
return (*this);
|
|
|
|
|
}
|
|
|
|
|
|
2014-02-08 17:24:54 +01:00
|
|
|
|
#define IS_EMPTY(X) ((X).isEmpty() ? "YES" : "NO")
|
|
|
|
|
|
2013-10-13 20:50:12 +02:00
|
|
|
|
void AudioFileModel_MetaInfo::update(const AudioFileModel_MetaInfo &model, const bool replace)
|
2013-10-12 22:55:41 +02:00
|
|
|
|
{
|
2014-02-08 17:24:54 +01:00
|
|
|
|
UPDATE_STR(model, replace, m_titel);
|
|
|
|
|
UPDATE_STR(model, replace, m_artist);
|
|
|
|
|
UPDATE_STR(model, replace, m_album);
|
|
|
|
|
UPDATE_STR(model, replace, m_genre);
|
|
|
|
|
UPDATE_STR(model, replace, m_comment);
|
|
|
|
|
UPDATE_STR(model, replace, m_cover);
|
|
|
|
|
UPDATE_INT(model, replace, m_year);
|
|
|
|
|
UPDATE_INT(model, replace, m_position);
|
2013-10-12 22:55:41 +02:00
|
|
|
|
}
|
|
|
|
|
|
2013-10-12 20:38:07 +02:00
|
|
|
|
AudioFileModel_MetaInfo::~AudioFileModel_MetaInfo(void)
|
2010-11-06 23:04:47 +01:00
|
|
|
|
{
|
2013-10-12 20:38:07 +02:00
|
|
|
|
/*nothing to do*/
|
2010-11-06 23:04:47 +01:00
|
|
|
|
}
|
|
|
|
|
|
2013-10-12 20:38:07 +02:00
|
|
|
|
void AudioFileModel_MetaInfo::reset(void)
|
2010-11-06 23:04:47 +01:00
|
|
|
|
{
|
2013-10-12 20:38:07 +02:00
|
|
|
|
m_titel.clear();
|
|
|
|
|
m_artist.clear();
|
|
|
|
|
m_album.clear();
|
|
|
|
|
m_genre.clear();
|
|
|
|
|
m_comment.clear();
|
|
|
|
|
m_cover.clear();
|
|
|
|
|
m_year = 0;
|
|
|
|
|
m_position = 0;
|
2010-11-06 23:04:47 +01:00
|
|
|
|
}
|
|
|
|
|
|
2013-10-13 20:50:12 +02:00
|
|
|
|
void AudioFileModel_MetaInfo::print(void) const
|
|
|
|
|
{
|
|
|
|
|
PRINT_S(m_titel);
|
|
|
|
|
PRINT_S(m_artist);
|
|
|
|
|
PRINT_S(m_album);
|
|
|
|
|
PRINT_S(m_genre);
|
|
|
|
|
PRINT_S(m_comment);
|
|
|
|
|
PRINT_S(m_cover.filePath());
|
|
|
|
|
PRINT_U(m_year);
|
|
|
|
|
PRINT_U(m_position);
|
|
|
|
|
}
|
|
|
|
|
|
2015-10-24 13:43:25 +02:00
|
|
|
|
bool AudioFileModel_MetaInfo::empty(const bool &ignoreArtwork) const
|
|
|
|
|
{
|
|
|
|
|
bool isEmpty = true;
|
|
|
|
|
|
|
|
|
|
if(!m_titel.isEmpty()) isEmpty = false;
|
|
|
|
|
if(!m_artist.isEmpty()) isEmpty = false;
|
|
|
|
|
if(!m_album.isEmpty()) isEmpty = false;
|
|
|
|
|
if(!m_genre.isEmpty()) isEmpty = false;
|
|
|
|
|
if(!m_comment.isEmpty()) isEmpty = false;
|
|
|
|
|
if(m_year) isEmpty = false;
|
|
|
|
|
if(m_position) isEmpty = false;
|
|
|
|
|
|
|
|
|
|
if(!ignoreArtwork)
|
|
|
|
|
{
|
|
|
|
|
if(!m_cover.isEmpty())
|
|
|
|
|
{
|
|
|
|
|
isEmpty = false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return isEmpty;
|
|
|
|
|
}
|
|
|
|
|
|
2013-10-12 20:38:07 +02:00
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
// Audio File - Technical Info
|
|
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
2010-11-06 23:04:47 +01:00
|
|
|
|
|
2013-10-12 20:38:07 +02:00
|
|
|
|
AudioFileModel_TechInfo::AudioFileModel_TechInfo(void)
|
2010-11-06 23:04:47 +01:00
|
|
|
|
{
|
2013-10-12 20:38:07 +02:00
|
|
|
|
reset();
|
2010-11-06 23:04:47 +01:00
|
|
|
|
}
|
|
|
|
|
|
2013-10-12 20:38:07 +02:00
|
|
|
|
AudioFileModel_TechInfo::AudioFileModel_TechInfo(const AudioFileModel_TechInfo &model)
|
2011-03-20 23:32:11 +01:00
|
|
|
|
{
|
2014-02-08 17:24:54 +01:00
|
|
|
|
ASSIGN_VAL(model, m_containerType);
|
|
|
|
|
ASSIGN_VAL(model, m_containerProfile);
|
|
|
|
|
ASSIGN_VAL(model, m_audioType);
|
|
|
|
|
ASSIGN_VAL(model, m_audioProfile);
|
|
|
|
|
ASSIGN_VAL(model, m_audioVersion);
|
|
|
|
|
ASSIGN_VAL(model, m_audioEncodeLib);
|
|
|
|
|
ASSIGN_VAL(model, m_audioSamplerate);
|
|
|
|
|
ASSIGN_VAL(model, m_audioChannels);
|
|
|
|
|
ASSIGN_VAL(model, m_audioBitdepth);
|
|
|
|
|
ASSIGN_VAL(model, m_audioBitrate);
|
|
|
|
|
ASSIGN_VAL(model, m_audioBitrateMode);
|
|
|
|
|
ASSIGN_VAL(model, m_duration);
|
2011-03-20 23:32:11 +01:00
|
|
|
|
}
|
|
|
|
|
|
2013-10-12 20:38:07 +02:00
|
|
|
|
AudioFileModel_TechInfo &AudioFileModel_TechInfo::operator=(const AudioFileModel_TechInfo &model)
|
2010-11-06 23:04:47 +01:00
|
|
|
|
{
|
2014-02-08 17:24:54 +01:00
|
|
|
|
ASSIGN_VAL(model, m_containerType);
|
|
|
|
|
ASSIGN_VAL(model, m_containerProfile);
|
|
|
|
|
ASSIGN_VAL(model, m_audioType);
|
|
|
|
|
ASSIGN_VAL(model, m_audioProfile);
|
|
|
|
|
ASSIGN_VAL(model, m_audioVersion);
|
|
|
|
|
ASSIGN_VAL(model, m_audioEncodeLib);
|
|
|
|
|
ASSIGN_VAL(model, m_audioSamplerate);
|
|
|
|
|
ASSIGN_VAL(model, m_audioChannels);
|
|
|
|
|
ASSIGN_VAL(model, m_audioBitdepth);
|
|
|
|
|
ASSIGN_VAL(model, m_audioBitrate);
|
|
|
|
|
ASSIGN_VAL(model, m_audioBitrateMode);
|
|
|
|
|
ASSIGN_VAL(model, m_duration);
|
2010-11-06 23:04:47 +01:00
|
|
|
|
|
2013-10-12 20:38:07 +02:00
|
|
|
|
return (*this);
|
2010-11-06 23:04:47 +01:00
|
|
|
|
}
|
|
|
|
|
|
2013-10-12 20:38:07 +02:00
|
|
|
|
AudioFileModel_TechInfo::~AudioFileModel_TechInfo(void)
|
2010-11-06 23:04:47 +01:00
|
|
|
|
{
|
2013-10-12 20:38:07 +02:00
|
|
|
|
/*nothing to do*/
|
2010-11-06 23:04:47 +01:00
|
|
|
|
}
|
|
|
|
|
|
2013-10-12 20:38:07 +02:00
|
|
|
|
void AudioFileModel_TechInfo::reset(void)
|
2010-11-06 23:04:47 +01:00
|
|
|
|
{
|
2013-10-12 20:38:07 +02:00
|
|
|
|
m_containerType.clear();
|
|
|
|
|
m_containerProfile.clear();
|
|
|
|
|
m_audioType.clear();
|
|
|
|
|
m_audioProfile.clear();
|
|
|
|
|
m_audioVersion.clear();
|
|
|
|
|
m_audioEncodeLib.clear();
|
|
|
|
|
m_audioSamplerate = 0;
|
|
|
|
|
m_audioChannels = 0;
|
|
|
|
|
m_audioBitdepth = 0;
|
|
|
|
|
m_audioBitrate = 0;
|
|
|
|
|
m_audioBitrateMode = 0;
|
2013-10-12 22:55:41 +02:00
|
|
|
|
m_duration = 0;
|
2010-11-06 23:04:47 +01:00
|
|
|
|
}
|
|
|
|
|
|
2013-10-12 20:38:07 +02:00
|
|
|
|
////////////////////////////////////////////////////////////
|
|
|
|
|
// Audio File Model
|
|
|
|
|
////////////////////////////////////////////////////////////
|
2010-11-06 23:04:47 +01:00
|
|
|
|
|
2013-10-12 20:38:07 +02:00
|
|
|
|
AudioFileModel::AudioFileModel(const QString &path)
|
|
|
|
|
:
|
|
|
|
|
m_filePath(path)
|
2010-11-06 23:04:47 +01:00
|
|
|
|
{
|
2013-10-12 20:38:07 +02:00
|
|
|
|
m_metaInfo.reset();
|
|
|
|
|
m_techInfo.reset();
|
2010-11-06 23:04:47 +01:00
|
|
|
|
}
|
|
|
|
|
|
2013-10-12 20:38:07 +02:00
|
|
|
|
AudioFileModel::AudioFileModel(const AudioFileModel &model)
|
2010-11-06 23:04:47 +01:00
|
|
|
|
{
|
2014-02-08 17:24:54 +01:00
|
|
|
|
ASSIGN_VAL(model, m_filePath);
|
|
|
|
|
ASSIGN_VAL(model, m_metaInfo);
|
|
|
|
|
ASSIGN_VAL(model, m_techInfo);
|
2010-11-06 23:04:47 +01:00
|
|
|
|
}
|
|
|
|
|
|
2013-10-12 20:38:07 +02:00
|
|
|
|
AudioFileModel &AudioFileModel::operator=(const AudioFileModel &model)
|
2010-11-06 23:04:47 +01:00
|
|
|
|
{
|
2014-02-08 17:24:54 +01:00
|
|
|
|
ASSIGN_VAL(model, m_filePath);
|
|
|
|
|
ASSIGN_VAL(model, m_metaInfo);
|
|
|
|
|
ASSIGN_VAL(model, m_techInfo);
|
2010-11-06 23:04:47 +01:00
|
|
|
|
|
2013-10-12 20:38:07 +02:00
|
|
|
|
return (*this);
|
2010-11-06 23:04:47 +01:00
|
|
|
|
}
|
|
|
|
|
|
2013-10-12 20:38:07 +02:00
|
|
|
|
AudioFileModel::~AudioFileModel(void)
|
2010-11-06 23:04:47 +01:00
|
|
|
|
{
|
2013-10-12 20:38:07 +02:00
|
|
|
|
/*nothing to do*/
|
2010-11-06 23:04:47 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2013-10-12 20:38:07 +02:00
|
|
|
|
void AudioFileModel::reset(void)
|
2011-05-31 19:04:45 +02:00
|
|
|
|
{
|
2013-10-12 20:38:07 +02:00
|
|
|
|
m_filePath.clear();
|
|
|
|
|
m_metaInfo.reset();
|
|
|
|
|
m_techInfo.reset();
|
2011-05-31 19:04:45 +02:00
|
|
|
|
}
|
|
|
|
|
|
2013-10-12 20:38:07 +02:00
|
|
|
|
/*------------------------------------*/
|
|
|
|
|
/* Helper functions
|
|
|
|
|
/*------------------------------------*/
|
2011-05-31 19:04:45 +02:00
|
|
|
|
|
2013-10-12 20:38:07 +02:00
|
|
|
|
const QString AudioFileModel::durationInfo(void) const
|
2010-11-06 23:04:47 +01:00
|
|
|
|
{
|
2013-10-12 22:55:41 +02:00
|
|
|
|
if(m_techInfo.duration())
|
2010-11-06 23:04:47 +01:00
|
|
|
|
{
|
2013-10-12 22:55:41 +02:00
|
|
|
|
QTime time = QTime().addSecs(m_techInfo.duration());
|
2010-11-06 23:04:47 +01:00
|
|
|
|
return time.toString("hh:mm:ss");
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
return QString();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2013-10-12 20:38:07 +02:00
|
|
|
|
const QString AudioFileModel::containerInfo(void) const
|
2010-11-06 23:04:47 +01:00
|
|
|
|
{
|
2013-10-12 20:38:07 +02:00
|
|
|
|
if(!m_techInfo.containerType().isEmpty())
|
2010-11-06 23:04:47 +01:00
|
|
|
|
{
|
2013-10-12 20:38:07 +02:00
|
|
|
|
QString info = m_techInfo.containerType();
|
|
|
|
|
if(!m_techInfo.containerProfile().isEmpty()) info.append(QString(" (%1: %2)").arg(tr("Profile"), m_techInfo.containerProfile()));
|
2010-11-06 23:04:47 +01:00
|
|
|
|
return info;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
return QString();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2013-10-12 20:38:07 +02:00
|
|
|
|
const QString AudioFileModel::audioBaseInfo(void) const
|
2010-11-06 23:04:47 +01:00
|
|
|
|
{
|
2013-10-12 20:38:07 +02:00
|
|
|
|
if(m_techInfo.audioSamplerate() || m_techInfo.audioChannels() || m_techInfo.audioBitdepth())
|
2010-11-06 23:04:47 +01:00
|
|
|
|
{
|
|
|
|
|
QString info;
|
2013-10-12 20:38:07 +02:00
|
|
|
|
if(m_techInfo.audioChannels())
|
2010-11-06 23:04:47 +01:00
|
|
|
|
{
|
|
|
|
|
if(!info.isEmpty()) info.append(", ");
|
2013-10-12 20:38:07 +02:00
|
|
|
|
info.append(QString("%1: %2").arg(tr("Channels"), QString::number(m_techInfo.audioChannels())));
|
2010-11-06 23:04:47 +01:00
|
|
|
|
}
|
2013-10-12 20:38:07 +02:00
|
|
|
|
if(m_techInfo.audioSamplerate())
|
2010-11-06 23:04:47 +01:00
|
|
|
|
{
|
|
|
|
|
if(!info.isEmpty()) info.append(", ");
|
2013-10-12 20:38:07 +02:00
|
|
|
|
info.append(QString("%1: %2 Hz").arg(tr("Samplerate"), QString::number(m_techInfo.audioSamplerate())));
|
2010-11-06 23:04:47 +01:00
|
|
|
|
}
|
2013-10-12 20:38:07 +02:00
|
|
|
|
if(m_techInfo.audioBitdepth())
|
2010-11-06 23:04:47 +01:00
|
|
|
|
{
|
|
|
|
|
if(!info.isEmpty()) info.append(", ");
|
2013-10-12 20:38:07 +02:00
|
|
|
|
if(m_techInfo.audioBitdepth() == BITDEPTH_IEEE_FLOAT32)
|
2012-08-22 23:52:55 +02:00
|
|
|
|
{
|
|
|
|
|
info.append(QString("%1: %2 Bit (IEEE Float)").arg(tr("Bitdepth"), QString::number(32)));
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2013-10-12 20:38:07 +02:00
|
|
|
|
info.append(QString("%1: %2 Bit").arg(tr("Bitdepth"), QString::number(m_techInfo.audioBitdepth())));
|
2012-08-22 23:52:55 +02:00
|
|
|
|
}
|
2010-11-06 23:04:47 +01:00
|
|
|
|
}
|
|
|
|
|
return info;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
return QString();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2013-10-12 20:38:07 +02:00
|
|
|
|
const QString AudioFileModel::audioCompressInfo(void) const
|
2010-11-06 23:04:47 +01:00
|
|
|
|
{
|
2013-10-12 20:38:07 +02:00
|
|
|
|
if(!m_techInfo.audioType().isEmpty())
|
2010-11-06 23:04:47 +01:00
|
|
|
|
{
|
|
|
|
|
QString info;
|
2013-10-12 20:38:07 +02:00
|
|
|
|
if(!m_techInfo.audioProfile().isEmpty() || !m_techInfo.audioVersion().isEmpty())
|
2010-11-06 23:04:47 +01:00
|
|
|
|
{
|
2011-01-14 23:34:31 +01:00
|
|
|
|
info.append(QString("%1: ").arg(tr("Type")));
|
2010-11-06 23:04:47 +01:00
|
|
|
|
}
|
2013-10-12 20:38:07 +02:00
|
|
|
|
info.append(m_techInfo.audioType());
|
|
|
|
|
if(!m_techInfo.audioProfile().isEmpty())
|
2010-11-06 23:04:47 +01:00
|
|
|
|
{
|
2013-10-12 20:38:07 +02:00
|
|
|
|
info.append(QString(", %1: %2").arg(tr("Profile"), m_techInfo.audioProfile()));
|
2010-11-06 23:04:47 +01:00
|
|
|
|
}
|
2013-10-12 20:38:07 +02:00
|
|
|
|
if(!m_techInfo.audioVersion().isEmpty())
|
2010-11-06 23:04:47 +01:00
|
|
|
|
{
|
2013-10-12 20:38:07 +02:00
|
|
|
|
info.append(QString(", %1: %2").arg(tr("Version"), m_techInfo.audioVersion()));
|
2010-11-06 23:04:47 +01:00
|
|
|
|
}
|
2013-10-12 20:38:07 +02:00
|
|
|
|
if(m_techInfo.audioBitrate() > 0)
|
2011-05-31 19:04:45 +02:00
|
|
|
|
{
|
2013-10-12 20:38:07 +02:00
|
|
|
|
switch(m_techInfo.audioBitrateMode())
|
2011-05-31 19:04:45 +02:00
|
|
|
|
{
|
|
|
|
|
case BitrateModeConstant:
|
2013-10-12 20:38:07 +02:00
|
|
|
|
info.append(QString(", %1: %2 kbps (%3)").arg(tr("Bitrate"), QString::number(m_techInfo.audioBitrate()), tr("Constant")));
|
2011-05-31 19:04:45 +02:00
|
|
|
|
break;
|
|
|
|
|
case BitrateModeVariable:
|
2014-11-25 02:14:42 +01:00
|
|
|
|
info.append(MUTILS_QSTR(L", %1: \u2248%2 kbps (%3)").arg(tr("Bitrate"), QString::number(m_techInfo.audioBitrate()), tr("Variable")));
|
2011-05-31 19:04:45 +02:00
|
|
|
|
break;
|
|
|
|
|
default:
|
2013-10-12 20:38:07 +02:00
|
|
|
|
info.append(QString(", %1: %2 kbps").arg(tr("Bitrate"), QString::number(m_techInfo.audioBitrate())));
|
2011-05-31 19:04:45 +02:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
2013-10-12 20:38:07 +02:00
|
|
|
|
if(!m_techInfo.audioEncodeLib().isEmpty())
|
2012-08-01 00:17:12 +02:00
|
|
|
|
{
|
2013-10-12 20:38:07 +02:00
|
|
|
|
info.append(QString(", %1: %2").arg(tr("Encoder"), m_techInfo.audioEncodeLib()));
|
2012-08-01 00:17:12 +02:00
|
|
|
|
}
|
2010-11-06 23:04:47 +01:00
|
|
|
|
return info;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
return QString();
|
|
|
|
|
}
|
|
|
|
|
}
|