typedef struct OH_AVCodecBufferAttr {
/* Presentation timestamp of this Buffer in microseconds */
int64_t pts;
/* The size of the data contained in the Buffer in bytes */
int32_t size;
/* The starting offset of valid data in this Buffer */
int32_t offset;
/* The flags this Buffer has, which is also a combination of multiple {@link OH_AVCodecBufferFlags}. */
uint32_t flags;
} OH_AVCodecBufferAttr;
在 HarmonyOS 中,可以通过
OH_AVBuffer_SetBufferAttr
和OH_AVBuffer_GetBufferAttr
来设置和获取包含pts
的OH_AVCodecBufferAttr
结构体信息,从而确保设置的pts
能够准确反映视频帧的时间信息。具体可参考以下代码示例: