Phonon, MP3 Tags

Alles rund um die Programmierung mit Qt
Antworten
Silicomancer
Beiträge: 17
Registriert: 3. Dezember 2009 14:04

Phonon, MP3 Tags

Beitrag von Silicomancer »

Hello out here!

I just found out a strange behaviour of the Phonon media object. I tried to read mp3 tags of a sound file but it returns trash only.
I testet the same file with WinAmp and a common MP3-Tagger - both showed valid tags while phonon fails to read them. Also the Musik Player demo application of Qt fails (it show a lot of chinese characters only).

The call

Code: Alles auswählen

qDebug() << demoPlayer->metaData();
returns

Code: Alles auswählen

QMap(("ARTIST", "???????? ???????")("DESCRIPTION", "???? ?????")("TITLE", "???? ?????"))
However "Title" should read "Body Blows" and "Artist" should read "Allister Brimble".

Anyone an idea?

--
Regards
Silcomancer
AuE
Beiträge: 918
Registriert: 5. August 2008 10:58

Beitrag von AuE »

Wich encoding?

If the other programms are able to read - there's a phonon bug or maybe the encoding is wrong. I cant reproduce this since I don't work with phonon but strange characters in the demo indicate that there is may be the/a problem.
Jordy
Beiträge: 22
Registriert: 15. August 2005 17:22

Beitrag von Jordy »

AuE hat geschrieben:Wich encoding?

If the other programms are able to read - there's a phonon bug or maybe the encoding is wrong. I cant reproduce this since I don't work with phonon but strange characters in the demo indicate that there is may be the/a problem.
Encoding? I don't know. How can I find out?

Even if you don't work with phonon, you can start Qt's media player demo, don't you?
AuE
Beiträge: 918
Registriert: 5. August 2008 10:58

Beitrag von AuE »

No I cant.... have no phonon ;-)
sudo make
g++ -c -m64 -pipe -O2 -Wall -W -D_REENTRANT -DQT_NO_DEBUG -DQT_PHONON_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I../../../mkspecs/linux-g++-64 -I. -I../../../include/QtCore -I../../../include/QtGui -I../../../include/phonon -I../../../include -I../../../include/phonon_compat/phonon -I../../../include/phonon_compat -I../../../include/phonon/Phonon -I. -o main.o main.cpp
g++ -c -m64 -pipe -O2 -Wall -W -D_REENTRANT -DQT_NO_DEBUG -DQT_PHONON_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I../../../mkspecs/linux-g++-64 -I. -I../../../include/QtCore -I../../../include/QtGui -I../../../include/phonon -I../../../include -I../../../include/phonon_compat/phonon -I../../../include/phonon_compat -I../../../include/phonon/Phonon -I. -o mainwindow.o mainwindow.cpp
/opt/qtsdk-2009.05/qt/bin/moc -DQT_NO_DEBUG -DQT_PHONON_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I../../../mkspecs/linux-g++-64 -I. -I../../../include/QtCore -I../../../include/QtGui -I../../../include/phonon -I../../../include -I../../../include/phonon_compat/phonon -I../../../include/phonon_compat -I../../../include/phonon/Phonon -I. mainwindow.h -o moc_mainwindow.cpp
g++ -c -m64 -pipe -O2 -Wall -W -D_REENTRANT -DQT_NO_DEBUG -DQT_PHONON_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I../../../mkspecs/linux-g++-64 -I. -I../../../include/QtCore -I../../../include/QtGui -I../../../include/phonon -I../../../include -I../../../include/phonon_compat/phonon -I../../../include/phonon_compat -I../../../include/phonon/Phonon -I. -o moc_mainwindow.o moc_mainwindow.cpp
g++ -m64 -Wl,-O1 -Wl,-rpath,/opt/qtsdk-2009.05/qt/lib -o qmusicplayer main.o mainwindow.o moc_mainwindow.o -L/opt/qtsdk-2009.05/qt/lib -lphonon -lQtGui -L/opt/qtsdk-2009.05/qt/lib -L/usr/X11R6/lib64 -lQtCore -lpthread
/usr/bin/ld: cannot find -lphonon
collect2: ld returned 1 exit status
AuE
Beiträge: 918
Registriert: 5. August 2008 10:58

Beitrag von AuE »

QStringList MediaObject::metaData ( const QString & key ) const

Returns the strings associated with the given key.

Backends should use the keys specified in the Ogg Vorbis documentation: http://xiph.org/vorbis/doc/v-comment.html

Therefore the following should work with every backend:

Note that meta data is not resolved before the metaDataChanged() signal is emitted.

A typical usage looks like this:

setMetaArtist(media->metaData("ARTIST"));
setMetaAlbum(media->metaData("ALBUM"));
setMetaTitle(media->metaData("TITLE"));
setMetaDate(media->metaData("DATE"));
setMetaGenre(media->metaData("GENRE"));
setMetaTrack(media->metaData("TRACKNUMBER"));
setMetaComment(media->metaData("DESCRIPTION"));
Silicomancer
Beiträge: 17
Registriert: 3. Dezember 2009 14:04

Beitrag von Silicomancer »

Sorry for the late answers.

Now I had time to try out that signal... I connect a slot to the metaDataChanged() signal:

Code: Alles auswählen

void MetaDataChanged()
{
   qDebug() << demoPlayer->metaData("TITLE");
}
It is called as expected but it also does not work. :(

More ideas? You mentioned encoding...
Antworten