FFmpeg  4.4.4
Data Structures | Macros | Functions | Variables
bsf.c File Reference
#include <string.h>
#include "libavutil/avassert.h"
#include "libavutil/log.h"
#include "libavutil/mem.h"
#include "libavutil/opt.h"
#include "libavutil/avstring.h"
#include "libavutil/bprint.h"
#include "bsf.h"
#include "bsf_internal.h"
#include "codec_desc.h"
#include "codec_par.h"

Go to the source code of this file.

Data Structures

struct  AVBSFInternal
 
struct  BSFListContext
 
struct  AVBSFList
 Structure for chain/list of bitstream filters. More...
 

Macros

#define IS_EMPTY(pkt)   (!(pkt)->data && !(pkt)->side_data_elems)
 

Functions

void av_bsf_free (AVBSFContext **pctx)
 Free a bitstream filter context and everything associated with it; write NULL into the supplied pointer. More...
 
static voidbsf_child_next (void *obj, void *prev)
 
static const char * bsf_to_name (void *bsf)
 
const AVClassav_bsf_get_class (void)
 Get the AVClass for AVBSFContext. More...
 
int av_bsf_alloc (const AVBitStreamFilter *filter, AVBSFContext **pctx)
 Allocate a context for a given bitstream filter. More...
 
int av_bsf_init (AVBSFContext *ctx)
 Prepare the filter for use, after all the parameters and options have been set. More...
 
void av_bsf_flush (AVBSFContext *ctx)
 Reset the internal bitstream filter state. More...
 
int av_bsf_send_packet (AVBSFContext *ctx, AVPacket *pkt)
 Submit a packet for filtering. More...
 
int av_bsf_receive_packet (AVBSFContext *ctx, AVPacket *pkt)
 Retrieve a filtered packet. More...
 
int ff_bsf_get_packet (AVBSFContext *ctx, AVPacket **pkt)
 Called by the bitstream filters to get the next packet for filtering. More...
 
int ff_bsf_get_packet_ref (AVBSFContext *ctx, AVPacket *pkt)
 Called by bitstream filters to get packet for filtering. More...
 
static int bsf_list_init (AVBSFContext *bsf)
 
static int bsf_list_filter (AVBSFContext *bsf, AVPacket *out)
 
static void bsf_list_flush (AVBSFContext *bsf)
 
static void bsf_list_close (AVBSFContext *bsf)
 
static const char * bsf_list_item_name (void *ctx)
 
AVBSFListav_bsf_list_alloc (void)
 Allocate empty list of bitstream filters. More...
 
void av_bsf_list_free (AVBSFList **lst)
 Free list of bitstream filters. More...
 
int av_bsf_list_append (AVBSFList *lst, AVBSFContext *bsf)
 Append bitstream filter to the list of bitstream filters. More...
 
static int bsf_list_append_internal (AVBSFList *lst, const char *bsf_name, const char *options, AVDictionary **options_dict)
 
int av_bsf_list_append2 (AVBSFList *lst, const char *bsf_name, AVDictionary **options)
 Construct new bitstream filter context given it's name and options and append it to the list of bitstream filters. More...
 
int av_bsf_list_finalize (AVBSFList **lst, AVBSFContext **bsf)
 Finalize list of bitstream filters. More...
 
static int bsf_parse_single (char *str, AVBSFList *bsf_lst)
 
int av_bsf_list_parse_str (const char *str, AVBSFContext **bsf_lst)
 Parse string describing list of bitstream filters and create single AVBSFContext describing the whole chain of bitstream filters. More...
 
int av_bsf_get_null_filter (AVBSFContext **bsf)
 Get null/pass-through bitstream filter. More...
 

Variables

static const AVClass bsf_class
 
static const AVClass bsf_list_class
 
const AVBitStreamFilter ff_list_bsf
 

Macro Definition Documentation

◆ IS_EMPTY

#define IS_EMPTY (   pkt)    (!(pkt)->data && !(pkt)->side_data_elems)

Definition at line 33 of file bsf.c.

Function Documentation

◆ bsf_child_next()

static void* bsf_child_next ( void obj,
void prev 
)
static

Definition at line 65 of file bsf.c.

◆ bsf_to_name()

static const char* bsf_to_name ( void bsf)
static

Definition at line 73 of file bsf.c.

◆ ff_bsf_get_packet()

int ff_bsf_get_packet ( AVBSFContext ctx,
AVPacket **  pkt 
)

Called by the bitstream filters to get the next packet for filtering.

The filter is responsible for either freeing the packet or passing it to the caller.

Definition at line 232 of file bsf.c.

Referenced by h264_mp4toannexb_filter(), text2movsub(), and vp9_raw_reorder_filter().

◆ ff_bsf_get_packet_ref()

int ff_bsf_get_packet_ref ( AVBSFContext ctx,
AVPacket pkt 
)

Called by bitstream filters to get packet for filtering.

The reference to packet is moved to provided packet structure.

Parameters
ctxpointer to AVBSFContext of filter
pktpointer to packet to move reference to
Returns
0 on success, negative AVERROR in case of failure

Definition at line 253 of file bsf.c.

Referenced by aac_adtstoasc_filter(), av1_frame_merge_filter(), av1_frame_split_filter(), bsf_list_filter(), chomp_filter(), dump_extradata(), extract_extradata_filter(), ff_cbs_bsf_generic_filter(), filter_units_filter(), mov2textsub(), mpeg4_unpack_bframes_filter(), noise(), rechunk_filter(), remove_extradata(), setts_filter(), trace_headers(), truehd_core_filter(), vp9_superframe_filter(), and vp9_superframe_split_filter().

◆ bsf_list_init()

static int bsf_list_init ( AVBSFContext bsf)
static

Definition at line 280 of file bsf.c.

◆ bsf_list_filter()

static int bsf_list_filter ( AVBSFContext bsf,
AVPacket out 
)
static

Definition at line 309 of file bsf.c.

◆ bsf_list_flush()

static void bsf_list_flush ( AVBSFContext bsf)
static

Definition at line 351 of file bsf.c.

◆ bsf_list_close()

static void bsf_list_close ( AVBSFContext bsf)
static

Definition at line 360 of file bsf.c.

◆ bsf_list_item_name()

static const char* bsf_list_item_name ( void ctx)
static

Definition at line 371 of file bsf.c.

◆ bsf_list_append_internal()

static int bsf_list_append_internal ( AVBSFList lst,
const char *  bsf_name,
const char *  options,
AVDictionary **  options_dict 
)
static

Definition at line 440 of file bsf.c.

Referenced by av_bsf_list_append2(), and bsf_parse_single().

◆ bsf_parse_single()

static int bsf_parse_single ( char *  str,
AVBSFList bsf_lst 
)
static

Definition at line 512 of file bsf.c.

Referenced by av_bsf_list_parse_str().

Variable Documentation

◆ bsf_class

const AVClass bsf_class
static
Initial value:
= {
.class_name = "AVBSFContext",
.item_name = bsf_to_name,
.child_next = bsf_child_next,
.child_class_iterate = ff_bsf_child_class_iterate,
}
const AVClass * ff_bsf_child_class_iterate(void **opaque)
static const char * bsf_to_name(void *bsf)
Definition: bsf.c:73
static void * bsf_child_next(void *obj, void *prev)
Definition: bsf.c:65
#define LIBAVUTIL_VERSION_INT
Definition: version.h:85
@ AV_CLASS_CATEGORY_BITSTREAM_FILTER
Definition: log.h:38
AVClassCategory category
Category used for visualization (like color) This is only set if the category is equal for all object...
Definition: log.h:133

Definition at line 78 of file bsf.c.

Referenced by av_bsf_alloc(), and av_bsf_get_class().

◆ bsf_list_class

const AVClass bsf_list_class
static
Initial value:
= {
.class_name = "bsf_list",
.item_name = bsf_list_item_name,
}
static const char * bsf_list_item_name(void *ctx)
Definition: bsf.c:371

Definition at line 396 of file bsf.c.

◆ ff_list_bsf

const AVBitStreamFilter ff_list_bsf
Initial value:
= {
.name = "bsf_list",
.priv_data_size = sizeof(BSFListContext),
.priv_class = &bsf_list_class,
.close = bsf_list_close,
}
static void flush(AVCodecContext *avctx)
static av_cold int init(AVCodecContext *avctx)
Definition: avrndec.c:31
static void bsf_list_close(AVBSFContext *bsf)
Definition: bsf.c:360
static int bsf_list_init(AVBSFContext *bsf)
Definition: bsf.c:280
static const AVClass bsf_list_class
Definition: bsf.c:396
static void bsf_list_flush(AVBSFContext *bsf)
Definition: bsf.c:351
static int bsf_list_filter(AVBSFContext *bsf, AVPacket *out)
Definition: bsf.c:309
static av_always_inline void filter(int16_t *output, ptrdiff_t out_stride, const int16_t *low, ptrdiff_t low_stride, const int16_t *high, ptrdiff_t high_stride, int len, int clip)
Definition: cfhddsp.c:27

Definition at line 402 of file bsf.c.

Referenced by av_bsf_get_null_filter(), and av_bsf_list_finalize().