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. How to switch mediaservice backend to wmf ?
Forum Updated to NodeBB v4.3 + New Features

How to switch mediaservice backend to wmf ?

Scheduled Pinned Locked Moved Unsolved General and Desktop
10 Posts 3 Posters 1.8k Views 2 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.
  • M Offline
    M Offline
    MrKartofel
    wrote on last edited by MrKartofel
    #1

    I'm building an mp3 player and noticed that Qmediaplayer reports wrong duration(), I'm on Windows 10 and would like to switch the mediaservice backend (which is Direct Show by default) to Windows Media Foundation in order to see if it solves the duration problem. How can I do that ?

    I have read this Qt Documentation on the matter, but it does not provide clear instructions.

    1 Reply Last reply
    0
    • B Offline
      B Offline
      Bonnie
      wrote on last edited by
      #2

      If you are using MinGW versions there's no wmf support.

      M 1 Reply Last reply
      1
      • B Bonnie

        If you are using MinGW versions there's no wmf support.

        M Offline
        M Offline
        MrKartofel
        wrote on last edited by
        #3

        @Bonnie I'm using PyQt, do you know whether wmf is supported in my case ?

        B 1 Reply Last reply
        0
        • M MrKartofel

          @Bonnie I'm using PyQt, do you know whether wmf is supported in my case ?

          B Offline
          B Offline
          Bonnie
          wrote on last edited by Bonnie
          #4

          @MrKartofel
          Sorry, I don't know.
          But in C++ Qt, if wmf is supported (MSVC versions), it is actually the default backend of mediaservice.
          [Edited] I've tested in MSVC 5.15, the above I thought seems not true.
          I don't know the structure of PyQt, does it have "mediaservice" plugin folder with dlls?
          MinGW versions (wmf not supported) will only have "dsengine.dll", while MSVC versions (wmf supported) will have both "dsengine.dll" and "wmfengine.dll".
          If wmf is supported, the link you posted above already tells how to make it default: set the enviroment variable QT_MULTIMEDIA_PREFERRED_PLUGINS to windowsmediafoundation.
          If it has no effect, then I think wmf is not supported in that case.

          M 1 Reply Last reply
          0
          • B Bonnie

            @MrKartofel
            Sorry, I don't know.
            But in C++ Qt, if wmf is supported (MSVC versions), it is actually the default backend of mediaservice.
            [Edited] I've tested in MSVC 5.15, the above I thought seems not true.
            I don't know the structure of PyQt, does it have "mediaservice" plugin folder with dlls?
            MinGW versions (wmf not supported) will only have "dsengine.dll", while MSVC versions (wmf supported) will have both "dsengine.dll" and "wmfengine.dll".
            If wmf is supported, the link you posted above already tells how to make it default: set the enviroment variable QT_MULTIMEDIA_PREFERRED_PLUGINS to windowsmediafoundation.
            If it has no effect, then I think wmf is not supported in that case.

            M Offline
            M Offline
            MrKartofel
            wrote on last edited by
            #5

            @Bonnie Yes with PyQt there is a mediaservice plugin folder with both the "dsengine.dll" and "wmfengine.dll" (as well as "qtmedia_audioengine.dll"). I tried changing setting the QT_MULTIMEDIA_PREFERRED_PLUGINS environment variable to windowsmediafoundation using os.environ, but it has no effect. I don't understand why, especially since the "wmfengine.dll" is indeed present in the mediaservice folder.

            I know that it has no effect because trying to delete the dsengine.dll while running my music player app results in an error because dsengine.dll is "being used by Python". wmfengine.dll on the other hand, can be deleted without such error.

            It is too bad I can't change the plugin because DirectShow is really messing up the musicplayer, when I load files with "unusual" bitrates (e.g. 241 kbits/s), the duration is completely off, and using a time slider to move through the song will result in even worse duration bugs. But when I load files with "typical" bitrates (e.g. 128 kbits/s) it works flawlessly.

            JKSHJ 1 Reply Last reply
            0
            • M MrKartofel

              @Bonnie Yes with PyQt there is a mediaservice plugin folder with both the "dsengine.dll" and "wmfengine.dll" (as well as "qtmedia_audioengine.dll"). I tried changing setting the QT_MULTIMEDIA_PREFERRED_PLUGINS environment variable to windowsmediafoundation using os.environ, but it has no effect. I don't understand why, especially since the "wmfengine.dll" is indeed present in the mediaservice folder.

              I know that it has no effect because trying to delete the dsengine.dll while running my music player app results in an error because dsengine.dll is "being used by Python". wmfengine.dll on the other hand, can be deleted without such error.

              It is too bad I can't change the plugin because DirectShow is really messing up the musicplayer, when I load files with "unusual" bitrates (e.g. 241 kbits/s), the duration is completely off, and using a time slider to move through the song will result in even worse duration bugs. But when I load files with "typical" bitrates (e.g. 128 kbits/s) it works flawlessly.

              JKSHJ Offline
              JKSHJ Offline
              JKSH
              Moderators
              wrote on last edited by
              #6

              @MrKartofel said in How to switch mediaservice backend to wmf ?:

              there is a mediaservice plugin folder with both the "dsengine.dll" and "wmfengine.dll"

              What happens if you remove dsengine.dll?

              Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

              M 1 Reply Last reply
              0
              • JKSHJ JKSH

                @MrKartofel said in How to switch mediaservice backend to wmf ?:

                there is a mediaservice plugin folder with both the "dsengine.dll" and "wmfengine.dll"

                What happens if you remove dsengine.dll?

                M Offline
                M Offline
                MrKartofel
                wrote on last edited by
                #7

                @JKSH When I remove dsengine.dll from the mediaservice folder, I get the following warning :

                defaultServiceProvider::requestService(): no service found for - "org.qt-project.qt.mediaplayer"

                And when I try to play a music, nothing happens.

                B 1 Reply Last reply
                0
                • M MrKartofel

                  @JKSH When I remove dsengine.dll from the mediaservice folder, I get the following warning :

                  defaultServiceProvider::requestService(): no service found for - "org.qt-project.qt.mediaplayer"

                  And when I try to play a music, nothing happens.

                  B Offline
                  B Offline
                  Bonnie
                  wrote on last edited by
                  #8

                  @MrKartofel
                  One possible explanation is that your wmf plugin may be not loaded properly.
                  Try to run the app with setting QT_DEBUG_PLUGINS environment variable to 1 and check the output.
                  Not sure what kind of output would PyQt get though....

                  M 1 Reply Last reply
                  0
                  • B Bonnie

                    @MrKartofel
                    One possible explanation is that your wmf plugin may be not loaded properly.
                    Try to run the app with setting QT_DEBUG_PLUGINS environment variable to 1 and check the output.
                    Not sure what kind of output would PyQt get though....

                    M Offline
                    M Offline
                    MrKartofel
                    wrote on last edited by
                    #9

                    @Bonnie So I ran the app with the QT_DEBUG_PLUGINS environment variable set to 1, I got the following output (I only copied the part where it gets to the mediaservice folder) :

                    QFactoryLoader::QFactoryLoader() checking directory path "C:/Users/ MyUsername /miniconda3/envs/jdr/Library/plugins/mediaservice" ...
                    QFactoryLoader::QFactoryLoader() looking at "C:/Users/ MyUsername /miniconda3/envs/jdr/Library/plugins/mediaservice/dsengine.dll"
                    Found metadata in lib C:/Users/ MyUsername /miniconda3/envs/jdr/Library/plugins/mediaservice/dsengine.dll, metadata=
                    {
                        "IID": "org.qt-project.qt.mediaserviceproviderfactory/5.0",
                        "MetaData": {
                            "Keys": [
                                "directshow"
                            ],
                            "Services": [
                                "org.qt-project.qt.camera",
                                "org.qt-project.qt.mediaplayer"
                            ]
                        },
                        "className": "DSServicePlugin",
                        "debug": false,
                        "version": 329991
                    }
                    
                    
                    Got keys from plugin meta data ("directshow")
                    QFactoryLoader::QFactoryLoader() looking at "C:/Users/ MyUsername /miniconda3/envs/jdr/Library/plugins/mediaservice/qtmedia_audioengine.dll"
                    Found metadata in lib C:/Users/ MyUsername /miniconda3/envs/jdr/Library/plugins/mediaservice/qtmedia_audioengine.dll, metadata=
                    {
                        "IID": "org.qt-project.qt.mediaserviceproviderfactory/5.0",
                        "MetaData": {
                            "Keys": [
                                "audiocapture"
                            ],
                            "Services": [
                                "org.qt-project.qt.audiosource"
                            ]
                        },
                        "className": "AudioCaptureServicePlugin",
                        "debug": false,
                        "version": 329991
                    }
                    
                    
                    Got keys from plugin meta data ("audiocapture")
                    QFactoryLoader::QFactoryLoader() looking at "C:/Users/ MyUsername /miniconda3/envs/jdr/Library/plugins/mediaservice/wmfengine.dll"
                    Found metadata in lib C:/Users/ MyUsername /miniconda3/envs/jdr/Library/plugins/mediaservice/wmfengine.dll, metadata=
                    {
                        "IID": "org.qt-project.qt.mediaserviceproviderfactory/5.0",
                        "MetaData": {
                            "Keys": [
                                "windowsmediafoundation"
                            ],
                            "Services": [
                                "org.qt-project.qt.audiodecode"
                            ]
                        },
                        "className": "WMFServicePlugin",
                        "debug": false,
                        "version": 329991
                    }
                    
                    
                    Got keys from plugin meta data ("windowsmediafoundation")
                    QFactoryLoader::QFactoryLoader() checking directory path "C:/Users/MyUsername/miniconda3/envs/jdr/mediaservice" ...
                    loaded library "C:/Users/ MyUsername /miniconda3/envs/jdr/Library/plugins/mediaservice/dsengine.dll"
                    
                    

                    I also checked it with the QT_MULTIMEDIA_PREFERRED_PLUGINS environment variable set to windowsmediafoundation, but it does not seem to affect the debug output.

                    I appreciate your help, I don't know if you can do something with the output.

                    B 1 Reply Last reply
                    0
                    • M MrKartofel

                      @Bonnie So I ran the app with the QT_DEBUG_PLUGINS environment variable set to 1, I got the following output (I only copied the part where it gets to the mediaservice folder) :

                      QFactoryLoader::QFactoryLoader() checking directory path "C:/Users/ MyUsername /miniconda3/envs/jdr/Library/plugins/mediaservice" ...
                      QFactoryLoader::QFactoryLoader() looking at "C:/Users/ MyUsername /miniconda3/envs/jdr/Library/plugins/mediaservice/dsengine.dll"
                      Found metadata in lib C:/Users/ MyUsername /miniconda3/envs/jdr/Library/plugins/mediaservice/dsengine.dll, metadata=
                      {
                          "IID": "org.qt-project.qt.mediaserviceproviderfactory/5.0",
                          "MetaData": {
                              "Keys": [
                                  "directshow"
                              ],
                              "Services": [
                                  "org.qt-project.qt.camera",
                                  "org.qt-project.qt.mediaplayer"
                              ]
                          },
                          "className": "DSServicePlugin",
                          "debug": false,
                          "version": 329991
                      }
                      
                      
                      Got keys from plugin meta data ("directshow")
                      QFactoryLoader::QFactoryLoader() looking at "C:/Users/ MyUsername /miniconda3/envs/jdr/Library/plugins/mediaservice/qtmedia_audioengine.dll"
                      Found metadata in lib C:/Users/ MyUsername /miniconda3/envs/jdr/Library/plugins/mediaservice/qtmedia_audioengine.dll, metadata=
                      {
                          "IID": "org.qt-project.qt.mediaserviceproviderfactory/5.0",
                          "MetaData": {
                              "Keys": [
                                  "audiocapture"
                              ],
                              "Services": [
                                  "org.qt-project.qt.audiosource"
                              ]
                          },
                          "className": "AudioCaptureServicePlugin",
                          "debug": false,
                          "version": 329991
                      }
                      
                      
                      Got keys from plugin meta data ("audiocapture")
                      QFactoryLoader::QFactoryLoader() looking at "C:/Users/ MyUsername /miniconda3/envs/jdr/Library/plugins/mediaservice/wmfengine.dll"
                      Found metadata in lib C:/Users/ MyUsername /miniconda3/envs/jdr/Library/plugins/mediaservice/wmfengine.dll, metadata=
                      {
                          "IID": "org.qt-project.qt.mediaserviceproviderfactory/5.0",
                          "MetaData": {
                              "Keys": [
                                  "windowsmediafoundation"
                              ],
                              "Services": [
                                  "org.qt-project.qt.audiodecode"
                              ]
                          },
                          "className": "WMFServicePlugin",
                          "debug": false,
                          "version": 329991
                      }
                      
                      
                      Got keys from plugin meta data ("windowsmediafoundation")
                      QFactoryLoader::QFactoryLoader() checking directory path "C:/Users/MyUsername/miniconda3/envs/jdr/mediaservice" ...
                      loaded library "C:/Users/ MyUsername /miniconda3/envs/jdr/Library/plugins/mediaservice/dsengine.dll"
                      
                      

                      I also checked it with the QT_MULTIMEDIA_PREFERRED_PLUGINS environment variable set to windowsmediafoundation, but it does not seem to affect the debug output.

                      I appreciate your help, I don't know if you can do something with the output.

                      B Offline
                      B Offline
                      Bonnie
                      wrote on last edited by Bonnie
                      #10

                      @MrKartofel
                      From your output, the wmfengine only provides "org.qt-project.qt.audiodecode" service, no "org.qt-project.qt.mediaplayer".
                      That's different from MSVC versions.
                      So I think it can't be used as a QMediaPlayer backend.

                      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