ffmpeg之AvPacket

一、av_packet_alloc

AVPacket* av_packet_alloc(void )

  • Allocate an AVPacket and set its fields to default values.
    The resulting struct must be freed using av_packet_free().
  • 开辟packet空间并初始化默认值,需要ac_packet_free()释放空间

二、ac_packet_free

| void av_packet_free ( AVPacket ** pkt )

  • Free the packet, if the packet is reference counted, it will be unreferenced first.
  • 释放AVpacket空间,当引用有引用的时候会释放引用

三、av_init_packet

void av_init_packet(AVPacket * pkt)

  • Initialize optional fields of a packet with default values.
  • Note, this does not touch the data and size members, which have to be initialized separately.
  • 初始化packet的值为默认值,注意:该函数不会影响data引用的数据缓存空间和size,需要单独处理。

四、av_packet_unref

void av_packet_unref ( AVPacket **pkt)

  • Wipe the packet.
  • Unreference the buffer referenced by the packet and reset the remaining packet fields to their default values.
  • 将缓存空间的引用计数-1,并将Packet中的其他字段设为初始值。如果引用计数为0,自动的释放缓存空间。

https://www.ffmpeg.org/doxygen/trunk/group__lavc__packet.html#gaaf85aa950695631e0217a16062289b66

你可能感兴趣的:(ffmpeg之AvPacket)