summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlvw <lvw@e10066b5-e1e2-0310-b819-94efdf66514b>2004-09-01 08:57:53 +0000
committerlvw <lvw@e10066b5-e1e2-0310-b819-94efdf66514b>2004-09-01 08:57:53 +0000
commit49f3190394b3c6f7ee4a4fac41b61ba6beedfbf1 (patch)
tree72a651919fea7e0777635b9f35705a560d87b82c
parent7b6f0861b2786fadd26ebb6a2b22a6332f748620 (diff)
downloadvdr-plugin-muggle-49f3190394b3c6f7ee4a4fac41b61ba6beedfbf1.tar.gz
vdr-plugin-muggle-49f3190394b3c6f7ee4a4fac41b61ba6beedfbf1.tar.bz2
Hooked up audio properties to GD database schema.
git-svn-id: https://vdr-muggle.svn.sourceforge.net/svnroot/vdr-muggle/branches/ogg_player@135 e10066b5-e1e2-0310-b819-94efdf66514b
-rw-r--r--gd_content_interface.c62
-rw-r--r--gd_content_interface.h25
2 files changed, 74 insertions, 13 deletions
diff --git a/gd_content_interface.c b/gd_content_interface.c
index 3622f37..6a9bc32 100644
--- a/gd_content_interface.c
+++ b/gd_content_interface.c
@@ -294,35 +294,35 @@ bool mgGdTrack::readData()
// note: this does not work with empty album or genre fields
result = mgSqlReadQuery(&m_db,
"SELECT tracks.artist, album.title, tracks.title, "
- " tracks.mp3file, genre.genre, tracks.year, "
- " tracks.rating, tracks.length "
- "FROM tracks, album, genre "
+ "tracks.mp3file, genre.genre, tracks.year, "
+ "tracks.rating, tracks.length, tracks.samplerate, tracks.channels, tracks.bitrate "
+ "FROM tracks, album, genre "
"WHERE tracks.id=%d "
"AND album.cddbid=tracks.sourceid AND "
- " genre.id=tracks.genre1",
+ "genre.id=tracks.genre1",
m_uniqID);
nrows = mysql_num_rows(result);
nfields = mysql_num_fields(result);
- if(nrows == 0)
+ if( nrows == 0 )
{
- mgWarning("No entries found \n");
+ mgWarning( "No entries found \n" );
return false;
}
else
{
- if( nrows > 1 )
- {
- mgWarning("mgGdTrack::readData: More than one entry found. Using first entry.");
- }
+ if( nrows > 1 )
+ {
+ mgWarning("mgGdTrack::readData: More than one entry found. Using first entry.");
+ }
MYSQL_ROW row = mysql_fetch_row(result);
m_artist = row[0];
m_album = row[1];
m_title = row[2];
m_mp3file = row[3];
- m_genre = row[4];
+ m_genre = row[4];
if( sscanf( row[5], "%d", &m_year) != 1 )
{
@@ -339,6 +339,18 @@ bool mgGdTrack::readData()
mgError( "Invalid duration '%s' in database", row [7]);
}
+ if( row[8] && sscanf( row[8], "%d", &m_samplerate ) != 1 )
+ {
+ mgError( "Invalid samplerate '%s' in database", row [7]);
+ }
+
+ if( row[9] && sscanf( row[9], "%d", &m_channels ) != 1 )
+ {
+ mgError( "Invalid channels '%s' in database", row [7]);
+ }
+
+ m_bitrate = row[10];
+
}
m_retrieved = true;
return true;
@@ -446,6 +458,34 @@ int mgGdTrack::getDuration()
}
return m_rating;
}
+
+int mgGdTrack::getSampleRate()
+{
+ if(!m_retrieved)
+ {
+ readData();
+ }
+ return m_samplerate;
+}
+
+int mgGdTrack::getChannels()
+{
+ if(!m_retrieved)
+ {
+ readData();
+ }
+ return m_channels;
+}
+
+string mgGdTrack::getBitrate()
+{
+ if(!m_retrieved)
+ {
+ readData();
+ }
+ return m_bitrate;
+}
+
string mgGdTrack::getImageFile()
{
return "dummyImg.jpg";
diff --git a/gd_content_interface.h b/gd_content_interface.h
index 9bb9213..83d6bdd 100644
--- a/gd_content_interface.h
+++ b/gd_content_interface.h
@@ -217,6 +217,18 @@ class mgGdTrack : public mgContentItem
*/
virtual int getRating();
+ /*! \brief obtain the samplerate of the track
+ */
+ virtual int getSampleRate();
+
+ /*! \brief obtain the number of audio channels of the track
+ */
+ virtual int getChannels();
+
+ /*! \brief obtain the bitrate of the track
+ */
+ virtual string getBitrate();
+
/*!
* \brief obtain the complete track information
*/
@@ -328,12 +340,21 @@ private:
int m_rating;
/*!
- * \brief The length of the file in bytes.
- * \todo TODO: is this true? Or what length are we talking about?
+ * \brief The length of the track in seconds
*/
int m_length;
/*!
+ * \brief The sampling rate of the track in Hz
+ */
+ int m_samplerate;
+
+ /*!
+ * \brief The number of channels of the track
+ */
+ int m_channels;
+
+ /*!
* \brief Access the data of the item from the database and fill actual data fields
*
* In order to avoid abundant queries to the database, the content fields