libsaria: Find audio properties of each scanned song
This gives me the length, bitrate, sample rate and number of channels.
This commit is contained in:
parent
333a3a4b04
commit
3255b045f0
|
@ -15,6 +15,10 @@ class TrackTag
|
|||
string genre;
|
||||
unsigned int year;
|
||||
unsigned int track;
|
||||
int length;
|
||||
int bitrate;
|
||||
int sample;
|
||||
int channels;
|
||||
|
||||
public:
|
||||
TrackTag(string);
|
||||
|
|
|
@ -22,20 +22,29 @@ void TrackTag::print_tag()
|
|||
TrackTag::TrackTag(string file)
|
||||
{
|
||||
Tag *tag;
|
||||
AudioProperties *prop;
|
||||
FileRef ref(file.c_str());
|
||||
|
||||
if (ref.isNull())
|
||||
throw "Error tagging file: " + file;
|
||||
|
||||
tag = ref.tag();
|
||||
filepath = file;
|
||||
title = tag->title().to8Bit();
|
||||
artist = tag->artist().to8Bit();
|
||||
album = tag->album().to8Bit();
|
||||
comment = tag->comment().to8Bit();
|
||||
genre = tag->genre().to8Bit();
|
||||
year = tag->year();
|
||||
track = tag->track();
|
||||
|
||||
/* Extract tags */
|
||||
tag = ref.tag();
|
||||
title = tag->title().to8Bit();
|
||||
artist = tag->artist().to8Bit();
|
||||
album = tag->album().to8Bit();
|
||||
comment = tag->comment().to8Bit();
|
||||
genre = tag->genre().to8Bit();
|
||||
year = tag->year();
|
||||
track = tag->track();
|
||||
|
||||
/* Extract audio properties */
|
||||
prop = ref.audioProperties();
|
||||
length = prop->length();
|
||||
bitrate = prop->bitrate();
|
||||
sample = prop->sampleRate();
|
||||
channels = prop->channels();
|
||||
}
|
||||
|
||||
TrackTag::~TrackTag()
|
||||
|
|
Loading…
Reference in New Issue