lavc/packet: add API for an AVPacket-based AVContainerFifo

pull/391/head
Anton Khirnov 1 month ago
parent 2e956d9c0f
commit 2ac34d0854
  1. 3
      doc/APIchanges
  2. 33
      libavcodec/packet.c
  3. 7
      libavcodec/packet.h
  4. 2
      libavcodec/version.h

@ -2,6 +2,9 @@ The last version increases of all libraries were on 2024-03-07
API changes, most recent first:
2024-12-15 - xxxxxxxxxx - lavc 61.27.100 packet.h
Add av_container_fifo_alloc_avpacket().
2024-12-15 - xxxxxxxxxx - lavu 59.51.100 - refstruct.h container_fifo.h
Add a new public header refstruct.h with new API for
reference-counted objects.

@ -23,6 +23,7 @@
#include "libavutil/avassert.h"
#include "libavutil/avutil.h"
#include "libavutil/container_fifo.h"
#include "libavutil/intreadwrite.h"
#include "libavutil/mathematics.h"
#include "libavutil/mem.h"
@ -752,3 +753,35 @@ void av_packet_side_data_free(AVPacketSideData **psd, int *pnb_sd)
av_freep(psd);
*pnb_sd = 0;
}
static void *container_packet_alloc(void *opaque)
{
return av_packet_alloc();
}
static void container_packet_reset(void *opaque, void *obj)
{
av_packet_unref(obj);
}
static void container_packet_free(void *opaque, void *obj)
{
AVPacket *pkt = obj;
av_packet_free(&pkt);
}
static int container_packet_transfer(void *opaque, void *dst, void *src, unsigned flags)
{
if (flags & AV_CONTAINER_FIFO_FLAG_REF)
return av_packet_ref(dst, src);
av_packet_move_ref(dst, src);
return 0;
}
AVContainerFifo *av_container_fifo_alloc_avpacket(unsigned flags)
{
return av_container_fifo_alloc(NULL, container_packet_alloc,
container_packet_reset, container_packet_free,
container_packet_transfer, 0);
}

@ -880,6 +880,13 @@ int av_packet_make_writable(AVPacket *pkt);
*/
void av_packet_rescale_ts(AVPacket *pkt, AVRational tb_src, AVRational tb_dst);
/**
* Allocate an AVContainerFifo instance for AVPacket.
*
* @param flags currently unused
*/
struct AVContainerFifo *av_container_fifo_alloc_avpacket(unsigned flags);
/**
* @}
*/

@ -29,7 +29,7 @@
#include "version_major.h"
#define LIBAVCODEC_VERSION_MINOR 26
#define LIBAVCODEC_VERSION_MINOR 27
#define LIBAVCODEC_VERSION_MICRO 100
#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \

Loading…
Cancel
Save