Qt WinRT App 无法访问文件权限被拒绝

标签 qt ffmpeg windows-runtime

我需要使用 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/

相关文章:

c++ - Qt atomic int 获取并立即设置

ffmpeg - 找不到流 0 的编解码器参数(视频 : hevc, 无):未指定大小

c - 从类型 'atomic_int' 分配给类型 'int' 时,类型不兼容

ffmpeg - 编译 ffmpeg 时出现 libavcodec/libfdk-aacenc.c 错误

c# - Windows RT 和 C#

xaml - 使用 Template10 时,特殊字符(如 Ü、ä、Ö)在运行时无法正确显示

c# - Win 8 RT路由参数

c++ - Qt/C++ - 将字符串时间戳转换为 uint

c++ - QMetaObject::invokeMethod 无法调用 QML/JS 函数

qt - Visual Studio + CMake + Qt Quick : how to debug QML files?