Qt WinRT App cannot access file permission denied



  • 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.


  • Moderators

    Where is the file located?



  • In the C drive,

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


  • Moderators

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



  • 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.



  • 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



  • @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.
    
    


  • 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



  • 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


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.