我需要使用 Qt 和 FFMPEG 开发 WinRT 应用程序,我根据指令 here 为 WinRT 构建 ffmpeg我可以将库与我的项目链接起来。现在我需要使用 avformat_open_input
打开一个视频文件但它总是给我输出
video decode error "Permission denied"
下面是代码的相关部分,
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);
}
从上面的错误看来是一些权限问题,我需要在
AppxManifest.xml
上添加任何额外的权限吗?目前我正在使用由 Qt 创建者创建的默认 list 。
最佳答案
尝试将文件协议(protocol)添加到 list 页面,包含您要访问/创建或播放的文件扩展名..
例如,.xml、.txt、.etc..
尝试在不添加 ext 文件协议(protocol)的情况下访问文件时,我总是遇到这个“未知”错误。
更新:
更多信息:https://msdn.microsoft.com/library/windows/apps/hh464906.aspx#file_activation
这样做:Package.appxmanifest > 声明 > 添加“文件类型关联” > 你的类型名称和分机。是必须的。
代码中的示例:
<Extensions>
<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”
祝你好运!
关于Qt WinRT App 无法访问文件权限被拒绝,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35551995/