Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. 3rd Party Software
  4. Alternative to taglib.dll
Forum Updated to NodeBB v4.3 + New Features

Alternative to taglib.dll

Scheduled Pinned Locked Moved Unsolved 3rd Party Software
7 Posts 2 Posters 2.3k Views 1 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.
  • UnitScanU Offline
    UnitScanU Offline
    UnitScan
    wrote on last edited by UnitScan
    #1

    I hope this is the right section. I created an audio player with the Qt libraries. Since the native library QMediaPlayer does not has a function to calculate the length of the currently not reproduced media, I have resorted to using the taglib.dll library. Is there anything better

    1 Reply Last reply
    0
    • ? Offline
      ? Offline
      A Former User
      wrote on last edited by
      #2

      Maybe you don't need third-party library after all (this will depend on your app requirements).

      Here is possible solution:

      Instantiate one 'QMediaPlayer' object that will be used for playback, and another one (or more) that will be used for querying media duration and metadata of file(s) that are not playing currently.

      Note that you can't get access to this information immediately after you set media with 'QMediaPlayer::setMedia' method, you will need to create some slots and connect them to the appropriate 'QMediaPlayer' signals.
      For duration (and possibly some other info's) create one slot and connect him to the 'QMediaPlayer::mediaStatusChanged' signal and when media status changes to 'QMediaPlayer::LoadedMedia' you should be able to obtain duration.
      For metadata create another slot and connect him to the 'QMediaPlayer::metaDataAvailableChanged' signal and when metadata is available you can check what metadata is available with 'QMediaObject::availableMetaData' and than obtain metadata that you are interested in with 'QMediaObject::metaData' method.

      1 Reply Last reply
      0
      • UnitScanU Offline
        UnitScanU Offline
        UnitScan
        wrote on last edited by
        #3

        I followed your instructions, , and I found the bug. Playlist is stored to, e.g., playlist.m3u file. The .m3u lines are in the form

        D:/Music/mysong.mp3

        Calling "reader" the instance of QMediaPlayer used to receive data, through the command

        reader->setMedia(QMediaContent(QUrl(line)))
        

        The file path becomes

        d:/Music/mysong.mp3

        So QMediaPlayer can not find the file

        1 Reply Last reply
        0
        • ? Offline
          ? Offline
          A Former User
          wrote on last edited by
          #4

          Try:

          reader->setMedia(QUrl::fromLocalFile(line))
          

          instead of:

          reader->setMedia(QMediaContent(QUrl(line)))
          
          1 Reply Last reply
          0
          • UnitScanU Offline
            UnitScanU Offline
            UnitScan
            wrote on last edited by
            #5
            QFile inputFile("playlist.m3u");
                if (inputFile.open(QIODevice::ReadOnly))
                {
                   QTextStream in(&inputFile);
                   while (!in.atEnd())
                   {
                       reader->setMedia(QUrl::fromLocalFile(in.readLine()));
                       qDebug() << reader->duration();
                   }
                   inputFile.close();
                }
            

            returns 0 :(

            1 Reply Last reply
            0
            • ? Offline
              ? Offline
              A Former User
              wrote on last edited by
              #6

              Since you posted only the code I can only guess that now your 'reader' object finds the file but returns duration of -1. If that is the case I suggest that you read my first post more carefully, if this is not the case describe the current issue.

              1 Reply Last reply
              0
              • ? Offline
                ? Offline
                A Former User
                wrote on last edited by
                #7

                @UnitScan if you are still heaving trouble with this take a look at https://github.com/casdevel/qminex/tree/master/multimedia/media_info.

                1 Reply Last reply
                0

                • Login

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