FFmpeg
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Macros | Functions
avpacket.c File Reference
#include <string.h>
#include "libavutil/avassert.h"
#include "libavutil/common.h"
#include "libavutil/internal.h"
#include "libavutil/mathematics.h"
#include "libavutil/mem.h"
#include "avcodec.h"
#include "bytestream.h"
#include "internal.h"

Go to the source code of this file.

Macros

#define ALLOC_MALLOC(data, size)   data = av_malloc(size)
 
#define ALLOC_BUF(data, size)
 
#define DUP_DATA(dst, src, size, padding, ALLOC)
 
#define FF_MERGE_MARKER   0x8c4d9d108e25e9feULL
 

Functions

void av_init_packet (AVPacket *pkt)
 Initialize optional fields of a packet with default values. More...
 
AVPacketav_packet_alloc (void)
 Allocate an AVPacket and set its fields to default values. More...
 
void av_packet_free (AVPacket **pkt)
 Free the packet, if the packet is reference counted, it will be unreferenced first. More...
 
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. More...
 
void av_shrink_packet (AVPacket *pkt, int size)
 Reduce packet size, correctly zeroing padding. More...
 
int av_grow_packet (AVPacket *pkt, int grow_by)
 Increase packet size, correctly zeroing padding. More...
 
int av_packet_from_data (AVPacket *pkt, uint8_t *data, int size)
 Initialize a reference-counted packet from av_malloc()ed data. More...
 
static int copy_packet_data (AVPacket *pkt, const AVPacket *src, int dup)
 
int av_copy_packet_side_data (AVPacket *pkt, const AVPacket *src)
 Copy packet side data. More...
 
FF_ENABLE_DEPRECATION_WARNINGS int av_dup_packet (AVPacket *pkt)
 
int av_copy_packet (AVPacket *dst, const AVPacket *src)
 Copy packet, including contents. More...
 
void av_packet_free_side_data (AVPacket *pkt)
 Convenience function to free all the side data stored. More...
 
FF_DISABLE_DEPRECATION_WARNINGS
void 
av_free_packet (AVPacket *pkt)
 Free a packet. More...
 
FF_ENABLE_DEPRECATION_WARNINGS 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. More...
 
uint8_tav_packet_new_side_data (AVPacket *pkt, enum AVPacketSideDataType type, int size)
 Allocate new information of a packet. More...
 
uint8_tav_packet_get_side_data (const AVPacket *pkt, enum AVPacketSideDataType type, int *size)
 Get side information from packet. More...
 
const char * av_packet_side_data_name (enum AVPacketSideDataType type)
 
int av_packet_merge_side_data (AVPacket *pkt)
 
int av_packet_split_side_data (AVPacket *pkt)
 
uint8_tav_packet_pack_dictionary (AVDictionary *dict, int *size)
 Pack a dictionary for use in side_data. More...
 
int av_packet_unpack_dictionary (const uint8_t *data, int size, AVDictionary **dict)
 Unpack a dictionary from side_data. More...
 
int av_packet_shrink_side_data (AVPacket *pkt, enum AVPacketSideDataType type, int size)
 Shrink the already allocated side data buffer. More...
 
int av_packet_copy_props (AVPacket *dst, const AVPacket *src)
 Copy only "properties" fields from src to dst. More...
 
void av_packet_unref (AVPacket *pkt)
 Wipe the packet. More...
 
int av_packet_ref (AVPacket *dst, const AVPacket *src)
 Setup a new reference to the data described by a given packet. More...
 
AVPacketav_packet_clone (const AVPacket *src)
 Create a new packet that references the same data as src. More...
 
void av_packet_move_ref (AVPacket *dst, AVPacket *src)
 Move every field in src to dst and reset src. More...
 
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. More...
 
int ff_side_data_set_encoder_stats (AVPacket *pkt, int quality, int64_t *error, int error_count, int pict_type)
 

Macro Definition Documentation

#define ALLOC_MALLOC (   data,
  size 
)    data = av_malloc(size)

Definition at line 170 of file avpacket.c.

Referenced by av_copy_packet_side_data().

#define ALLOC_BUF (   data,
  size 
)
Value:
do { \
data = pkt->buf ? pkt->buf->data : NULL; \
} while (0)
#define NULL
Definition: coverity.c:32
ptrdiff_t const GLvoid * data
Definition: opengl_enc.c:101
static AVPacket pkt
ptrdiff_t size
Definition: opengl_enc.c:101
AVBufferRef * buf
A reference to the reference-counted buffer where the packet data is stored.
Definition: avcodec.h:1640
int av_buffer_realloc(AVBufferRef **pbuf, int size)
Reallocate a given buffer.
Definition: buffer.c:169
uint8_t * data
The data buffer.
Definition: buffer.h:89

Definition at line 171 of file avpacket.c.

Referenced by copy_packet_data().

#define DUP_DATA (   dst,
  src,
  size,
  padding,
  ALLOC 
)
Value:
do { \
if (padding) { \
if ((unsigned)(size) > \
goto failed_alloc; \
} else { \
ALLOC(data, size); \
} \
if (!data) \
goto failed_alloc; \
memcpy(data, src, size); \
if (padding) \
memset((uint8_t *)data + size, 0, \
dst = data; \
} while (0)
ptrdiff_t const GLvoid * data
Definition: opengl_enc.c:101
#define src
Definition: vp8dsp.c:254
uint8_t
ptrdiff_t size
Definition: opengl_enc.c:101
typedef void(APIENTRY *FF_PFNGLACTIVETEXTUREPROC)(GLenum texture)
if(ret< 0)
Definition: vf_mcdeint.c:282
#define AV_INPUT_BUFFER_PADDING_SIZE
Required number of additionally allocated bytes at the end of the input bitstream for decoding...
Definition: avcodec.h:769

Definition at line 177 of file avpacket.c.

Referenced by av_copy_packet_side_data(), and copy_packet_data().

#define FF_MERGE_MARKER   0x8c4d9d108e25e9feULL

Definition at line 395 of file avpacket.c.

Referenced by av_packet_merge_side_data(), and av_packet_split_side_data().

Function Documentation

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

Definition at line 71 of file avpacket.c.

Referenced by av_new_packet(), and av_packet_ref().

static int copy_packet_data ( AVPacket pkt,
const AVPacket src,
int  dup 
)
static

Definition at line 198 of file avpacket.c.

Referenced by av_copy_packet(), and av_dup_packet().

int ff_side_data_set_encoder_stats ( AVPacket pkt,
int  quality,
int64_t *  error,
int  error_count,
int  pict_type 
)