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. Taglib OGG CoverArt
Qt 6.11 is out! See what's new in the release blog

Taglib OGG CoverArt

Scheduled Pinned Locked Moved Unsolved General and Desktop
9 Posts 3 Posters 3.8k 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.
  • S Offline
    S Offline
    shahriar25
    wrote on last edited by
    #1

    Hi,
    I want to get coverart of ogg files with taglib. I want to be able to get a QImage from the coverart. I searched the internet but I couldn't find a good solution. Can someone help?

    1 Reply Last reply
    0
    • mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi
      disclaimer: I dont know taglib.

      http://stackoverflow.com/questions/6542465/c-taglib-cover-art-from-mpeg-4-files

      he seems to get image this way
      image.loadFromData((const uchar *) coverArt.data().data(),coverArt.data().size());
      So I wonder if it works for ogg too?

      1 Reply Last reply
      0
      • S Offline
        S Offline
        shahriar25
        wrote on last edited by
        #3

        No it does not. I tried to treat the ogg file like m4a or mp3 bu it didn't work. I got these to functions for getting images:

        QImage Music::imageForTag(TagLib::ID3v2::Tag *tag)
        {
        TagLib::ID3v2::FrameList l = tag->frameList("APIC");

        QImage image;
        
        if(l.isEmpty())
            return image;
        
        TagLib::ID3v2::AttachedPictureFrame *f =
            static_cast<TagLib::ID3v2::AttachedPictureFrame *>(l.front());
        
        image.loadFromData((const uchar *) f->picture().data(), f->picture().size());
        
        return image;
        

        }

        QImage Music::imageForTagMP4(TagLib::MP4::Tag *tag)
        {
        QImage image;

        if (tag->isEmpty())
            return image;
        
        TagLib::MP4::ItemListMap itemsListMap = tag->itemListMap();
        TagLib::MP4::Item coverItem = itemsListMap["covr"];
        TagLib::MP4::CoverArtList coverArtList = coverItem.toCoverArtList();
        TagLib::MP4::CoverArt coverArt = coverArtList.front();
        
        image.loadFromData((const uchar *) coverArt.data().data(),coverArt.data().size());
        
        return image;
        

        }

        1 Reply Last reply
        0
        • mrjjM Offline
          mrjjM Offline
          mrjj
          Lifetime Qt Champion
          wrote on last edited by
          #4

          Hi
          I dont think ogg files have cover art. ( not as default)
          http://stackoverflow.com/questions/4752020/how-do-i-use-taglib-to-read-write-coverart-in-different-audio-formats

          1 Reply Last reply
          0
          • S Offline
            S Offline
            shahriar25
            wrote on last edited by
            #5

            It says it is officially not supported. then I will set the default coverart icon for them.
            One more problem:
            I have a QMenu in my QMenuBar and it has an icon and a title. when I run the project it shows the icon but when I click on it it shows the title but I want it to show the icon. what should I do?

            mrjjM 1 Reply Last reply
            0
            • S shahriar25

              It says it is officially not supported. then I will set the default coverart icon for them.
              One more problem:
              I have a QMenu in my QMenuBar and it has an icon and a title. when I run the project it shows the icon but when I click on it it shows the title but I want it to show the icon. what should I do?

              mrjjM Offline
              mrjjM Offline
              mrjj
              Lifetime Qt Champion
              wrote on last edited by
              #6

              @shahriar25
              Hi, if I create a default project and create a menu item and set its icon.
              the icon and text is displayed all the time so not sure what happens to your icon/text.

              1 Reply Last reply
              0
              • S Offline
                S Offline
                shahriar25
                wrote on last edited by
                #7

                @mrjj
                Hi, see it your self:

                http://i68.tinypic.com/fu9pq9.png

                can I set the menu to only show the icon?

                1 Reply Last reply
                0
                • jsulmJ Offline
                  jsulmJ Offline
                  jsulm
                  Lifetime Qt Champion
                  wrote on last edited by
                  #8

                  What happens if you don't set text for the menu item?

                  https://forum.qt.io/topic/113070/qt-code-of-conduct

                  1 Reply Last reply
                  0
                  • S Offline
                    S Offline
                    shahriar25
                    wrote on last edited by
                    #9

                    @jsulm
                    when you don't click on it it shows the icon and when you do it becomes empty

                    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