我已经使用 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”?