Qt WinRT App cannot access file permission denied

耗尽温柔 提交于 2019-12-25 07:11:37

问题


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:


Try to add a file protocol to the manifest page, contains your file extension you want to access/ create or play with..

for example, .xml, .txt, .etc..

I always face this 'unknown' error when try to access files without adding the ext file protocol..

UPDATE: More Information: https://msdn.microsoft.com/library/windows/apps/hh464906.aspx#file_activation

Do it by: Package.appxmanifest > Declarations > Add a 'File Type Association' > your type name and ext. is required.

Example in a code:

  <Extensions>
    <uap:Extension Category="windows.fileTypeAssociation">
      <uap:FileTypeAssociation Name="myfile">
        <uap:SupportedFileTypes>
          <uap:FileType>.config</uap:FileType>
        </uap:SupportedFileTypes>
      </uap:FileTypeAssociation>
    </uap:Extension>
  </Extensions> 

Change 'myfile' and '.config'

Good luck!



来源:https://stackoverflow.com/questions/35551995/qt-winrt-app-cannot-access-file-permission-denied

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!