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)
Forum Updated to NodeBB v4.3 + New Features

QAudioDecoder does not expose metadata (Linux, GStreamer)

Scheduled Pinned Locked Moved Unsolved General and Desktop
5 Posts 3 Posters 478 Views 3 Watching
  • 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 6 Oct 2019, 19:50 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

    P 1 Reply Last reply 7 Oct 2019, 17:16
    0
    • H Hazzl
      6 Oct 2019, 19:50

      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

      P Offline
      P Offline
      Pablo J. Rogina
      wrote on 7 Oct 2019, 17:16 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 7 Oct 2019, 21:11
      0
      • P Pablo J. Rogina
        7 Oct 2019, 17:16

        @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 7 Oct 2019, 21:11 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 11 Oct 2019, 14:56 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
          • S Offline
            S Offline
            SGaist
            Lifetime Qt Champion
            wrote on 11 Oct 2019, 19:42 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

            1/5

            6 Oct 2019, 19:50

            • Login

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