Qt WinRT App无法访问文件权限被拒绝 [英] Qt WinRT App cannot access file permission denied

查看:488
本文介绍了Qt WinRT App无法访问文件权限被拒绝的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要使用Qt和FFMPEG来开发WinRT应用程序,根据这里的说明构建WinRT的ffmpeg,我可以将图书馆与我的项目联系起来。现在我需要使用 avformat_open_input 打开一个视频文件,但它总是给我输出

 视频解码错误权限被拒绝

以下是代码的相关部分, / p>

  int ret = avformat_open_input(& pFormatCtx,hls,NULL,NULL); 
if(ret!= 0)
{
char errbuf [128];
av_strerror(ret,errbuf,128);
qDebug()<视频解码错误<< QString :: fromLatin1(errbuf);

}

从上面的错误,它似乎有一些权限问题,我需要在 AppxManifest.xml 上添加任何其他权限,目前我使用的是由Qt创建者创建的默认清单。

尝试在清单页面添加文件协议,包含您要访问/创建或播放的文件扩展名。



例如,.xml,.txt,.etc ..



我总是面对这个'未知尝试访问文件而不添加ext文件协议时出现错误。



更新:
更多信息:
https://msdn.microsoft.com/library/windows/apps/hh464906.aspx#file_activation



执行以下操作:Package.appxmanifest>声明>添加文件类型关联>您的类型名称和分机。是必需的。



代码示例:

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

更改'myfile'和'.config'



祝你好运!


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.

解决方案

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!

这篇关于Qt WinRT App无法访问文件权限被拒绝的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆