strawberry-audio-player-win.../3rdparty/taglib/asf/asfproperties.cpp

161 lines
4.7 KiB
C++
Raw Normal View History

2018-05-10 15:29:28 +02:00
/**************************************************************************
copyright : (C) 2005-2007 by Lukáš Lalinský
email : lalinsky@gmail.com
**************************************************************************/
/***************************************************************************
* This library is free software; you can redistribute it and/or modify *
* it under the terms of the GNU Lesser General Public License version *
* 2.1 as published by the Free Software Foundation. *
* *
* This library 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 *
* Lesser General Public License for more details. *
* *
* You should have received a copy of the GNU Lesser General Public *
* License along with this library; if not, write to the Free Software *
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA *
* 02110-1301 USA *
* *
* Alternatively, this file is available under the Mozilla Public *
* License Version 1.1. You may obtain a copy of the License at *
* http://www.mozilla.org/MPL/ *
***************************************************************************/
2020-06-26 23:30:30 +02:00
#include "tdebug.h"
#include "tstring.h"
2018-05-10 15:29:28 +02:00
#include "asfproperties.h"
using namespace Strawberry_TagLib::TagLib;
2018-05-10 15:29:28 +02:00
class ASF::AudioProperties::AudioPropertiesPrivate {
2020-06-13 19:02:42 +02:00
public:
2020-06-26 23:30:30 +02:00
explicit AudioPropertiesPrivate() : length(0),
bitrate(0),
sampleRate(0),
channels(0),
bitsPerSample(0),
codec(ASF::AudioProperties::Unknown),
encrypted(false) {}
2018-05-10 15:29:28 +02:00
int length;
int bitrate;
int sampleRate;
int channels;
int bitsPerSample;
ASF::AudioProperties::Codec codec;
2018-05-10 15:29:28 +02:00
String codecName;
String codecDescription;
bool encrypted;
};
////////////////////////////////////////////////////////////////////////////////
// public members
////////////////////////////////////////////////////////////////////////////////
2020-06-26 23:30:30 +02:00
ASF::AudioProperties::AudioProperties() : Strawberry_TagLib::TagLib::AudioProperties(), d(new AudioPropertiesPrivate()) {
2018-05-10 15:29:28 +02:00
}
ASF::AudioProperties::~AudioProperties() {
2018-05-10 15:29:28 +02:00
delete d;
}
int ASF::AudioProperties::lengthInSeconds() const {
2018-05-10 15:29:28 +02:00
return d->length / 1000;
}
int ASF::AudioProperties::lengthInMilliseconds() const {
2018-05-10 15:29:28 +02:00
return d->length;
}
int ASF::AudioProperties::bitrate() const {
2018-05-10 15:29:28 +02:00
return d->bitrate;
}
int ASF::AudioProperties::sampleRate() const {
2018-05-10 15:29:28 +02:00
return d->sampleRate;
}
int ASF::AudioProperties::channels() const {
2018-05-10 15:29:28 +02:00
return d->channels;
}
int ASF::AudioProperties::bitsPerSample() const {
2018-05-10 15:29:28 +02:00
return d->bitsPerSample;
}
ASF::AudioProperties::Codec ASF::AudioProperties::codec() const {
2018-05-10 15:29:28 +02:00
return d->codec;
}
String ASF::AudioProperties::codecName() const {
2018-05-10 15:29:28 +02:00
return d->codecName;
}
String ASF::AudioProperties::codecDescription() const {
2018-05-10 15:29:28 +02:00
return d->codecDescription;
}
bool ASF::AudioProperties::isEncrypted() const {
2018-05-10 15:29:28 +02:00
return d->encrypted;
}
////////////////////////////////////////////////////////////////////////////////
// private members
////////////////////////////////////////////////////////////////////////////////
void ASF::AudioProperties::setLengthInMilliseconds(int value) {
2018-05-10 15:29:28 +02:00
d->length = value;
}
void ASF::AudioProperties::setBitrate(int value) {
2018-05-10 15:29:28 +02:00
d->bitrate = value;
}
void ASF::AudioProperties::setSampleRate(int value) {
2018-05-10 15:29:28 +02:00
d->sampleRate = value;
}
void ASF::AudioProperties::setChannels(int value) {
2018-05-10 15:29:28 +02:00
d->channels = value;
}
void ASF::AudioProperties::setBitsPerSample(int value) {
2018-05-10 15:29:28 +02:00
d->bitsPerSample = value;
}
void ASF::AudioProperties::setCodec(int value) {
2020-06-13 19:02:42 +02:00
switch (value) {
case 0x0160:
d->codec = WMA1;
break;
case 0x0161:
d->codec = WMA2;
break;
case 0x0162:
d->codec = WMA9Pro;
break;
case 0x0163:
d->codec = WMA9Lossless;
break;
default:
d->codec = Unknown;
break;
2018-05-10 15:29:28 +02:00
}
2018-05-10 15:29:28 +02:00
}
void ASF::AudioProperties::setCodecName(const String &value) {
2018-05-10 15:29:28 +02:00
d->codecName = value;
}
void ASF::AudioProperties::setCodecDescription(const String &value) {
2018-05-10 15:29:28 +02:00
d->codecDescription = value;
}
void ASF::AudioProperties::setEncrypted(bool value) {
2018-05-10 15:29:28 +02:00
d->encrypted = value;
}