Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QAudioDecoder does not expose metadata (Linux, GStreamer)

QAudioDecoder does not expose metadata (Linux, GStreamer)

Scheduled Pinned Locked Moved Unsolved General and Desktop
5 Posts 3 Posters 396 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • H Offline
    H Offline
    Hazzl
    wrote on last edited by
    #1

    Hi there,

    current Qt (5.13.1) does not seem to make audio file (mp3 or ogg) metadata available on Linux with gstreamer backend. I manage to decode the audio data just fine. However the MetadataAvailabe signal never fires. Also calling decoder->isMetaDataAvailable() always returns false. Is this expected behaviour? If so, how do I access metadata on this platform?

    Thanks
    Felix

    Pablo J. RoginaP 1 Reply Last reply
    0
    • H Hazzl

      Hi there,

      current Qt (5.13.1) does not seem to make audio file (mp3 or ogg) metadata available on Linux with gstreamer backend. I manage to decode the audio data just fine. However the MetadataAvailabe signal never fires. Also calling decoder->isMetaDataAvailable() always returns false. Is this expected behaviour? If so, how do I access metadata on this platform?

      Thanks
      Felix

      Pablo J. RoginaP Offline
      Pablo J. RoginaP Offline
      Pablo J. Rogina
      wrote on last edited by
      #2

      @Hazzl said in QAudioDecoder does not expose metadata (Linux, GStreamer):

      audio file (mp3 or ogg) metadata available on Linux

      just in case, are you positive the audio file you're working with has actual metadata?

      Upvote the answer(s) that helped you solve the issue
      Use "Topic Tools" button to mark your post as Solved
      Add screenshots via postimage.org
      Don't ask support requests via chat/PM. Please use the forum so others can benefit from the solution in the future

      H 1 Reply Last reply
      0
      • Pablo J. RoginaP Pablo J. Rogina

        @Hazzl said in QAudioDecoder does not expose metadata (Linux, GStreamer):

        audio file (mp3 or ogg) metadata available on Linux

        just in case, are you positive the audio file you're working with has actual metadata?

        H Offline
        H Offline
        Hazzl
        wrote on last edited by
        #3

        @Pablo-J-Rogina yes, the files have associated tags. Those are also the things that interest me. However, wouldn't other metadata like bitrate or duration show up in any case of a supported encoding without there being any tags?

        1 Reply Last reply
        0
        • H Offline
          H Offline
          Hazzl
          wrote on last edited by
          #4

          This is the code I'm working with:

          int main(int argc, char *argv[])
          {
              QCoreApplication a(argc, argv);
              QTextStream out(stdout, QIODevice::WriteOnly);
              QAudioDecoder player;
              QAudioFormat format;
          
              format.setChannelCount(2);
              format.setSampleSize(16);
              format.setSampleRate(48000);
              format.setCodec("audio/pcm");
              format.setSampleType(QAudioFormat::SignedInt);
              player.setSourceFilename(a.arguments().at(1));    
              player.setAudioFormat(format);
              player.connect(&player, &QAudioDecoder::finished, &a, &QCoreApplication::quit);
              player.connect(&player, &QAudioDecoder::bufferReady, [&]
              {
                  player.read();
              });
              player.connect(&player, &QMediaObject::metaDataAvailableChanged, [&]
              {
                  if (player.isMetaDataAvailable())
                  {
                      for (QString key: player.availableMetaData())
                          out << key << " = " << player.metaData(key).toString() << endl;
                      a.quit();
                  }
              });
              player.start();
          
              return a.exec();
          }
          

          This goes through the entire file and discards the decoded data. However I never get any metadata out. Curiously enough, if I replace QAudioDecoder with a QMediaPlayer then everything works as expected. Can anybody point out where I go wrong with my QAudioDecoder?

          1 Reply Last reply
          0
          • SGaistS Offline
            SGaistS Offline
            SGaist
            Lifetime Qt Champion
            wrote on last edited by
            #5

            Hi,

            I haven't take a look at the code of the class but from the documentation description I would say that its goal is to play efficiently local files without all the bells and whistles provided by QMediaPlayer.

            Interested in AI ? www.idiap.ch
            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

            1 Reply Last reply
            1

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved