libsaria: Find audio information, too

Length, bitrate and various other fields.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
This commit is contained in:
Bryan Schumaker 2012-03-18 13:46:45 -04:00
parent 97a0bb7260
commit c38eaccf3a
2 changed files with 10 additions and 3 deletions

View File

@ -21,11 +21,11 @@ namespace libsaria
/* string lenstr;*/
unsigned int year;
unsigned int track;
/* int length;
int length;
int bitrate;
int sample;
int channels;
sid_t songid;
/* sid_t songid;
string *artist_lc;
string *album_lc;

View File

@ -14,7 +14,7 @@ namespace libsaria
void Track::read_tags()
{
TagLib::Tag *tag;
//TagLib::AudioProperties *prop;
TagLib::AudioProperties *prop;
TagLib::FileRef ref(filepath.c_str());
if (ref.isNull())
@ -29,6 +29,13 @@ namespace libsaria
genre = tag->genre().to8Bit(true);
year = tag->year();
track = tag->track();
/* Extract audio properties */
prop = ref.audioProperties();
length = prop->length();
bitrate = prop->bitrate();
sample = prop->sampleRate();
channels = prop->channels();
}
Track::Track(string file, struct library::Path *lib_path)