QtMultimedia (Qt 4.8): adding codecs



  • Hello,

    Since, in a near future, Phonon won't be supported anymore, I've decided to start using the QtMultimedia module and to create my own library, whose features will look like Phonon's ones. Firstly I searched codecs which are already supported by Qt and my laptop; that's why I've coded this program:
    @#include <QtCore>
    #include <QtGui>
    #include <QtMultimedia>

    int main(int argc, char* argv[])
    {
    QApplication app(argc, argv);

    QTextEdit tE;
    QString str;
    str.clear();
    tE.setReadOnly(true);
    tE.show();
    
    QList<QAudioDeviceInfo> adis(QAudioDeviceInfo::availableDevices(QAudio::AudioOutput));
    QStringList codecs;
    
    tE.append(QString("<b>Available audio output device(s)</b>"));
    for(int i = 0 ; i < adis.size() ; i++)
    {
        tE.append(adis.at(i).deviceName());
    }
    tE.append(QString("<br/>"));
    
    for(int i = 0 ; i < adis.size() ; i++)
    {
        str.append("<b>Available codec(s) for ");
        str.append(adis.at(i).deviceName());
        str.append("</b>");
        tE.append(str);
        str.clear();
    
        codecs = adis.at(i).supportedCodecs();
        while(!codecs.isEmpty())
        {
            tE.append(codecs.takeFirst());
        }
    
        tE.append(QString("<br/>"));
    }
    
    return app.exec();
    

    }@

    As you may imagine, I was quite deceived when I saw that only one codec (PCM) was supported. I would also like adding few other codecs, like AAC, FLAC, MPEG and Vorbis. However, I don't know at all how I can do it; and that's why I'm asking for your help.

    Thank you in advance.

    Adishatz!


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.