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. Qt WinRT App cannot access file permission denied

Qt WinRT App cannot access file permission denied

Scheduled Pinned Locked Moved Unsolved General and Desktop
9 Posts 3 Posters 2.4k 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
    haris123
    wrote on last edited by
    #1

    I need to develop WinRT App using Qt and FFMPEG, I build the ffmpeg for WinRT based on the instruction here and I am able to link the library with my project. Now I need to open a video file using avformat_open_input but it always giving me the output

    video decode error "Permission denied"
    

    Below is the relevant part of the code,

     int ret = avformat_open_input(&pFormatCtx, hls, NULL, NULL);
        if(ret != 0)
        {
            char errbuf[128];
            av_strerror(ret, errbuf, 128);
            qDebug()<<"video decode error"<<QString::fromLatin1(errbuf);
          
        }
    

    From the above error it seems some permission issue, do I need to add any additional permission on AppxManifest.xml currently I am using default manifest which is created by Qt creator.

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

      Where is the file located?

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

      1 Reply Last reply
      0
      • H Offline
        H Offline
        haris123
        wrote on last edited by
        #3

        In the C drive,

        C:\Users\haris\Videos\testVideo\5.mp4

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

          I'm not a WinRT expert but I think you need additional permissions for the Videos directory.

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

          1 Reply Last reply
          0
          • H Offline
            H Offline
            haris123
            wrote on last edited by
            #5

            Yes, that what I confused, how can grant the permission to access file? Does the third party library need some extra permission as ffmpeg lib is used to open video file.

            1 Reply Last reply
            0
            • patrikdP Offline
              patrikdP Offline
              patrikd
              wrote on last edited by
              #6

              hi haris,
              within the package.appxmanifest under "functions" (not sure if its called so in the english Version) you can define the rights for the app. one of the rights is the videolibrary. maybe this is the right one.
              best,
              patrik

              1 Reply Last reply
              0
              • H Offline
                H Offline
                haris123
                wrote on last edited by
                #7

                @patrikd said:

                e package.appx

                Hi Patrik

                Here the complete Appmanifest.xml

                <?xml version="1.0" encoding="utf-8"?>
                
                <Package xmlns="http://schemas.microsoft.com/appx/2010/manifest" xmlns:m2="http://schemas.microsoft.com/appx/2013/manifest">
                
                  <Identity
                
                    Name="987a0812-0cf7-43ce-a1d1-d9057e6eb124"
                
                    ProcessorArchitecture="x64"
                
                    Publisher="CN=haris"
                
                    Version="1.0.0.0" />
                
                  <Properties>
                
                    <DisplayName>MyApp</DisplayName>
                
                    <PublisherDisplayName>Default publisher display name</PublisherDisplayName>
                
                    <Logo>assets/logo_store.png</Logo>
                
                  </Properties>
                
                  <Prerequisites>
                
                    <OSMinVersion>6.3.0</OSMinVersion>
                
                    <OSMaxVersionTested>6.3.0</OSMaxVersionTested>
                
                  </Prerequisites>
                
                  <Resources>
                
                    <Resource Language="en" />
                
                  </Resources>
                
                  <Applications>
                
                    <Application
                
                      Id="App"
                
                      Executable="MyApp.exe"
                
                      EntryPoint="MyApp.App">
                
                      <m2:VisualElements
                
                        DisplayName="MyApp"
                
                        Description="Default package description"
                
                        BackgroundColor="green"
                
                        ForegroundText="light"
                
                        Square150x150Logo="assets/logo_150x150.png"
                
                        Square30x30Logo="assets/logo_30x30.png">
                
                        <m2:DefaultTile Square310x310Logo="assets/logo_310x310.png"
                
                          Wide310x150Logo="assets/logo_310x150.png"
                
                          Square70x70Logo="assets/logo_70x70.png">
                
                          <m2:ShowNameOnTiles>
                
                            <m2:ShowOn Tile="square150x150Logo" />
                
                            <m2:ShowOn Tile="wide310x150Logo" />
                
                            <m2:ShowOn Tile="square310x310Logo" />
                
                          </m2:ShowNameOnTiles>
                
                        </m2:DefaultTile>
                
                        <m2:SplashScreen Image="assets/logo_620x300.png" />
                
                      </m2:VisualElements>
                
                    </Application>
                
                  </Applications>
                
                  
                 <Capabilities>
                    <Capability Name="musicLibrary" />
                    <Capability Name="internetClient" />
                    <Capability Name="videosLibrary" />
                    <Capability Name="picturesLibrary" />
                  </Capabilities>
                
                
                  <Dependencies>
                
                    <PackageDependency Name="Microsoft.VCLibs.120.00.Debug" />
                
                  </Dependencies>
                
                </Package>
                
                <!-- Generated by qmake using the winrt-x64-msvc2013 mkspec. -->
                

                Where these lines

                <Capabilities>
                   <Capability Name="musicLibrary" />
                   <Capability Name="internetClient" />
                   <Capability Name="videosLibrary" />
                   <Capability Name="picturesLibrary" />
                 </Capabilities>
                
                I have added manually, but still no luck.
                
                
                1 Reply Last reply
                0
                • patrikdP Offline
                  patrikdP Offline
                  patrikd
                  wrote on last edited by
                  #8

                  hi haris,
                  when I set this flag under vs2015 my entry in the manifest is a little different:

                  <uap:Capability Name="videosLibrary" />
                  

                  but no idea if this "uap:" is needed.
                  I'm sorry, I have only little experience on WinRT. Maybe the output is missleading. I would try to access a text file for debug in this folder directly from my application to make sure that this is really the reason.
                  best,
                  patrik

                  1 Reply Last reply
                  0
                  • H Offline
                    H Offline
                    haris123
                    wrote on last edited by haris123
                    #9

                    Thanks for the help, my project was created on QtCreator and trying to run from QtCreator itself. I tried from the above code in manifest but some error appears while running like ```
                    Unable to find a run profile for MyApp.exe

                    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