mirror of
https://github.com/taglib/taglib.git
synced 2025-06-04 01:28:21 -04:00
Merge branch 'master' into merge-master-to-taglib2
Conflicts: taglib/ogg/opus/opusproperties.cpp
This commit is contained in:
commit
50b55a8a94
@ -32,13 +32,6 @@
|
||||
|
||||
using namespace std;
|
||||
|
||||
TagLib::String formatSeconds(int seconds)
|
||||
{
|
||||
char secondsString[3];
|
||||
sprintf(secondsString, "%02i", seconds);
|
||||
return secondsString;
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
for(int i = 1; i < argc; i++) {
|
||||
@ -89,7 +82,7 @@ int main(int argc, char *argv[])
|
||||
cout << "bitrate - " << properties->bitrate() << endl;
|
||||
cout << "sample rate - " << properties->sampleRate() << endl;
|
||||
cout << "channels - " << properties->channels() << endl;
|
||||
cout << "length - " << minutes << ":" << formatSeconds(seconds) << endl;
|
||||
cout << "length - " << minutes << ":" << setfill('0') << setw(2) << seconds << endl;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
|
@ -42,11 +42,13 @@ class Opus::AudioProperties::PropertiesPrivate
|
||||
public:
|
||||
PropertiesPrivate() :
|
||||
length(0),
|
||||
bitrate(0),
|
||||
inputSampleRate(0),
|
||||
channels(0),
|
||||
opusVersion(0) {}
|
||||
|
||||
int length;
|
||||
int bitrate;
|
||||
int inputSampleRate;
|
||||
int channels;
|
||||
int opusVersion;
|
||||
@ -74,7 +76,7 @@ int Opus::AudioProperties::length() const
|
||||
|
||||
int Opus::AudioProperties::bitrate() const
|
||||
{
|
||||
return 0;
|
||||
return d->bitrate;
|
||||
}
|
||||
|
||||
int Opus::AudioProperties::sampleRate() const
|
||||
@ -144,8 +146,10 @@ void Opus::AudioProperties::read(File *file)
|
||||
const long long start = first->absoluteGranularPosition();
|
||||
const long long end = last->absoluteGranularPosition();
|
||||
|
||||
if(start >= 0 && end >= 0)
|
||||
d->length = (int) ((end - start - preSkip) / 48000);
|
||||
if(start >= 0 && end >= 0) {
|
||||
d->length = (int)((end - start - preSkip) / 48000);
|
||||
d->bitrate = (int)(file->length() * 8.0 / (1000.0 * d->length) + 0.5);
|
||||
}
|
||||
else {
|
||||
debug("Opus::Properties::read() -- The PCM values for the start or "
|
||||
"end of this file was incorrect.");
|
||||
|
@ -23,7 +23,7 @@ public:
|
||||
{
|
||||
Ogg::Opus::File f(TEST_FILE_PATH_C("correctness_gain_silent_output.opus"));
|
||||
CPPUNIT_ASSERT_EQUAL(7, f.audioProperties()->length());
|
||||
CPPUNIT_ASSERT_EQUAL(0, f.audioProperties()->bitrate());
|
||||
CPPUNIT_ASSERT_EQUAL(41, f.audioProperties()->bitrate());
|
||||
CPPUNIT_ASSERT_EQUAL(1, f.audioProperties()->channels());
|
||||
CPPUNIT_ASSERT_EQUAL(48000, f.audioProperties()->sampleRate());
|
||||
CPPUNIT_ASSERT_EQUAL(48000, ((Ogg::Opus::AudioProperties *)f.audioProperties())->inputSampleRate());
|
||||
|
Loading…
x
Reference in New Issue
Block a user