FFmpeg
Loading...
Searching...
No Matches
packet.c File Reference
#include <string.h>
#include "libavutil/avassert.h"
#include "libavutil/avutil.h"
#include "libavutil/container_fifo.h"
#include "libavutil/mathematics.h"
#include "libavutil/mem.h"
#include "libavutil/rational.h"
#include "defs.h"
#include "packet.h"
#include "packet_internal.h"

Go to the source code of this file.

Functions

static void get_packet_defaults (AVPacket *pkt)
 
AVPacketav_packet_alloc (void)
 Allocate an AVPacket and set its fields to default values.
 
void av_packet_free (AVPacket **pkt)
 Free the packet, if the packet is reference counted, it will be unreferenced first.
 
static int packet_alloc (AVBufferRef **buf, int size)
 
int av_new_packet (AVPacket *pkt, int size)
 Allocate the payload of a packet and initialize its fields with default values.
 
void av_shrink_packet (AVPacket *pkt, int size)
 Reduce packet size, correctly zeroing padding.
 
int av_grow_packet (AVPacket *pkt, int grow_by)
 Increase packet size, correctly zeroing padding.
 
int av_packet_from_data (AVPacket *pkt, uint8_t *data, int size)
 Initialize a reference-counted packet from av_malloc()ed data.
 
void av_packet_free_side_data (AVPacket *pkt)
 Convenience function to free all the side data stored.
 
int av_packet_add_side_data (AVPacket *pkt, enum AVPacketSideDataType type, uint8_t *data, size_t size)
 Wrap an existing array as a packet side data.
 
uint8_t * av_packet_new_side_data (AVPacket *pkt, enum AVPacketSideDataType type, size_t size)
 Allocate new information of a packet.
 
uint8_t * av_packet_get_side_data (const AVPacket *pkt, enum AVPacketSideDataType type, size_t *size)
 Get side information from packet.
 
const char * av_packet_side_data_name (enum AVPacketSideDataType type)
 
uint8_t * av_packet_pack_dictionary (const AVDictionary *dict, size_t *size)
 Pack a dictionary for use in side_data.
 
int av_packet_unpack_dictionary (const uint8_t *data, size_t size, AVDictionary **dict)
 Unpack a dictionary from side_data.
 
int av_packet_shrink_side_data (AVPacket *pkt, enum AVPacketSideDataType type, size_t size)
 Shrink the already allocated side data buffer.
 
int av_packet_copy_props (AVPacket *dst, const AVPacket *src)
 Copy only "properties" fields from src to dst.
 
void av_packet_unref (AVPacket *pkt)
 Wipe the packet.
 
int av_packet_ref (AVPacket *dst, const AVPacket *src)
 Setup a new reference to the data described by a given packet.
 
AVPacketav_packet_clone (const AVPacket *src)
 Create a new packet that references the same data as src.
 
void av_packet_move_ref (AVPacket *dst, AVPacket *src)
 Move every field in src to dst and reset src.
 
int av_packet_make_refcounted (AVPacket *pkt)
 Ensure the data described by a given packet is reference counted.
 
int av_packet_make_writable (AVPacket *pkt)
 Create a writable reference for the data described by a given packet, avoiding data copy if possible.
 
void av_packet_rescale_ts (AVPacket *pkt, AVRational src_tb, AVRational dst_tb)
 Convert valid timing fields (timestamps / durations) in a packet from one timebase to another.
 
int ff_side_data_set_prft (AVPacket *pkt, int64_t timestamp)
 
const AVPacketSideDataav_packet_side_data_get (const AVPacketSideData *sd, int nb_sd, enum AVPacketSideDataType type)
 Get side information from a side data array.
 
static AVPacketSideDatapacket_side_data_add (AVPacketSideData **psd, int *pnb_sd, enum AVPacketSideDataType type, void *data, size_t size)
 
AVPacketSideDataav_packet_side_data_add (AVPacketSideData **psd, int *pnb_sd, enum AVPacketSideDataType type, void *data, size_t size, int flags)
 Wrap existing data as packet side data.
 
AVPacketSideDataav_packet_side_data_new (AVPacketSideData **psd, int *pnb_sd, enum AVPacketSideDataType type, size_t size, int flags)
 Allocate a new packet side data.
 
void av_packet_side_data_remove (AVPacketSideData *sd, int *pnb_sd, enum AVPacketSideDataType type)
 Remove side data of the given type from a side data array.
 
void av_packet_side_data_free (AVPacketSideData **psd, int *pnb_sd)
 Convenience function to free all the side data stored in an array, and the array itself.
 
static void * container_packet_alloc (void *opaque)
 
static void container_packet_reset (void *opaque, void *obj)
 
static void container_packet_free (void *opaque, void *obj)
 
static int container_packet_transfer (void *opaque, void *dst, void *src, unsigned flags)
 
AVContainerFifoav_container_fifo_alloc_avpacket (unsigned flags)
 Allocate an AVContainerFifo instance for AVPacket.
 

Function Documentation

◆ get_packet_defaults()

static void get_packet_defaults ( AVPacket * pkt)
static

Definition at line 53 of file packet.c.

Referenced by av_new_packet(), av_packet_alloc(), av_packet_move_ref(), and av_packet_unref().

◆ packet_alloc()

static int packet_alloc ( AVBufferRef ** buf,
int size )
static

◆ ff_side_data_set_prft()

int ff_side_data_set_prft ( AVPacket * pkt,
int64_t timestamp )

Definition at line 548 of file packet.c.

Referenced by X264_frame().

◆ packet_side_data_add()

static AVPacketSideData * packet_side_data_add ( AVPacketSideData ** psd,
int * pnb_sd,
enum AVPacketSideDataType type,
void * data,
size_t size )
static

Definition at line 580 of file packet.c.

Referenced by av_packet_side_data_add(), and av_packet_side_data_new().

◆ container_packet_alloc()

static void * container_packet_alloc ( void * opaque)
static

Definition at line 670 of file packet.c.

Referenced by av_container_fifo_alloc_avpacket().

◆ container_packet_reset()

static void container_packet_reset ( void * opaque,
void * obj )
static

Definition at line 675 of file packet.c.

Referenced by av_container_fifo_alloc_avpacket().

◆ container_packet_free()

static void container_packet_free ( void * opaque,
void * obj )
static

Definition at line 680 of file packet.c.

Referenced by av_container_fifo_alloc_avpacket().

◆ container_packet_transfer()

static int container_packet_transfer ( void * opaque,
void * dst,
void * src,
unsigned flags )
static

Definition at line 686 of file packet.c.

Referenced by av_container_fifo_alloc_avpacket().