c++ - OpenH264 DecodeFrameNoDelay 输出格式
问题描述
我已经使用 OpenH264 教程 ( https://github.com/cisco/openh264/wiki/UsageExampleForDecoder ) 成功解码了 H264 帧,但我无法从教程中弄清楚输出格式是什么。
我正在使用“unsigned char *pDataResult[3];” (本教程中的 pData),它会被填充,但我需要知道长度才能将其转换为字节缓冲区以将其返回给 java。我还需要知道这些数据的所有权是什么(它似乎归解码器所有)。据我所知,教程或文档中没有提到此信息。
unsigned char *pDataResult[3];
int iRet = pSvcDecoder->DecodeFrameNoDelay(pBuf, iSize, pDataResult, &sDstBufInfo);
本教程还列出了一个初始化程序,但给出了“...”作为赋值。
//output: [0~2] for Y,U,V buffer for Decoding only
unsigned char *pData[3] =...;
YUV 数据是否为空值终止?
TagSysMemBuffer 有 SBufferInfo 最后一个参数:
typedef struct TagSysMemBuffer {
int iWidth; ///< width of decoded pic for display
int iHeight; ///< height of decoded pic for display
int iFormat; ///< type is "EVideoFormatType"
int iStride[2]; ///< stride of 2 component
} SSysMEMBuffer;
长度可能在那里,但不清楚。也许每个缓冲区都是“iWidth * iHeight”?
解决方案
pData is freed in decoder destructor with WelsFreeDynamicMemory in decoder.cpp, just as you supposed. Decoder itself assign nullptr's to channels, but it's fine to initialize pData with them as a good habit. You have iSize parameter as input, that is the byte buffers length you want.
推荐阅读
- javascript - 我如何使 QuerySelectorAll() 选择所有 html 标签并通过访问 html 标签的索引进行更改
- javascript - 如何从选定的复选框传递值
- apache-camel - 如何在Apache Camel中以间隔时间开始一条到另一条的路线
- python - 无法在 docker 中运行的浏览器中打开页面
- json - JSON对象的MQTT数据格式
- tableau-api - 在 Tableau 中过滤 Tableau 度量名称
- java - 我们如何编写模拟时钟的角度表达式?
- swift - 异步数据加载迅速
- android - 支持多种构建类型的华为 IAP
- sql-server - 在内存(嵌入式)数据库中配置 SQL Server 以在 Spring 中进行测试