gpt4 book ai didi

c++ - 如何从ffmpeg获取文件描述符

转载 作者:行者123 更新时间:2023-11-30 02:33:54 26 4
gpt4 key购买 nike


我在我的 C++ 项目中使用 ffmpeg,我需要获取打开文件的文件描述符,如下所示:

    AVFormatContext* pFormatCtx = avformat_alloc_context();
avformat_open_input(&pFormatCtx, "C:\\a.avi", NULL, NULL);
uint64_t fileDescriptor = getDescriptor();

是否可以获取描述符以及如何获取?

最佳答案

某些情况下,以下可能有效:

#include "libavformat/avio.h"

[..]

AVIOContext *pb = pFormatCtx->pb;
URLContext *url = pb->opaque;
int fd = ffurl_get_file_handle(url);

很明显,您在这里访问的是内部变量,所以如果它有效,请认为自己很幸运。不要发布使用它的代码,因为它不是公共(public) API。

关于c++ - 如何从ffmpeg获取文件描述符,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34989356/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com