FFmpeg
Data Structures | Macros | Enumerations | Functions
cbs_bsf.h File Reference
#include "libavutil/log.h"
#include "libavutil/opt.h"
#include "bsf.h"
#include "codec_id.h"
#include "cbs.h"
#include "packet.h"

Go to the source code of this file.

Data Structures

struct  CBSBSFType
 
struct  CBSBSFContext
 

Macros

#define BSF_ELEMENT_OPTIONS_PIR(name, help, field, opt_flags)
 
#define BSF_ELEMENT_OPTIONS_PIRE(name, help, field, opt_flags)
 

Enumerations

enum  { BSF_ELEMENT_PASS, BSF_ELEMENT_INSERT, BSF_ELEMENT_REMOVE, BSF_ELEMENT_EXTRACT }
 

Functions

int ff_cbs_bsf_generic_init (AVBSFContext *bsf, const CBSBSFType *type)
 Initialise generic CBS BSF setup. More...
 
void ff_cbs_bsf_generic_close (AVBSFContext *bsf)
 Close a generic CBS BSF instance. More...
 
int ff_cbs_bsf_generic_filter (AVBSFContext *bsf, AVPacket *pkt)
 Filter operation for CBS BSF. More...
 

Macro Definition Documentation

◆ BSF_ELEMENT_OPTIONS_PIR

#define BSF_ELEMENT_OPTIONS_PIR (   name,
  help,
  field,
  opt_flags 
)
Value:
{ .i64 = BSF_ELEMENT_PASS }, \
BSF_ELEMENT_PASS, BSF_ELEMENT_REMOVE, opt_flags, name }, \
{ "pass", NULL, 0, AV_OPT_TYPE_CONST, \
{ .i64 = BSF_ELEMENT_PASS }, .flags = opt_flags, .unit = name }, \
{ "insert", NULL, 0, AV_OPT_TYPE_CONST, \
{ .i64 = BSF_ELEMENT_INSERT }, .flags = opt_flags, .unit = name }, \
{ "remove", NULL, 0, AV_OPT_TYPE_CONST, \
{ .i64 = BSF_ELEMENT_REMOVE }, .flags = opt_flags, .unit = name }

Definition at line 112 of file cbs_bsf.h.

◆ BSF_ELEMENT_OPTIONS_PIRE

#define BSF_ELEMENT_OPTIONS_PIRE (   name,
  help,
  field,
  opt_flags 
)
Value:
{ .i64 = BSF_ELEMENT_PASS }, \
BSF_ELEMENT_PASS, BSF_ELEMENT_EXTRACT, opt_flags, name }, \
{ "pass", NULL, 0, AV_OPT_TYPE_CONST, \
{ .i64 = BSF_ELEMENT_PASS }, .flags = opt_flags, .unit = name }, \
{ "insert", NULL, 0, AV_OPT_TYPE_CONST, \
{ .i64 = BSF_ELEMENT_INSERT }, .flags = opt_flags, .unit = name }, \
{ "remove", NULL, 0, AV_OPT_TYPE_CONST, \
{ .i64 = BSF_ELEMENT_REMOVE }, .flags = opt_flags, .unit = name }, \
{ "extract", NULL, 0, AV_OPT_TYPE_CONST, \
{ .i64 = BSF_ELEMENT_EXTRACT }, .flags = opt_flags, .unit = name } \

Definition at line 123 of file cbs_bsf.h.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
BSF_ELEMENT_PASS 
BSF_ELEMENT_INSERT 
BSF_ELEMENT_REMOVE 
BSF_ELEMENT_EXTRACT 

Definition at line 97 of file cbs_bsf.h.

Function Documentation

◆ ff_cbs_bsf_generic_init()

int ff_cbs_bsf_generic_init ( AVBSFContext bsf,
const CBSBSFType type 
)

Initialise generic CBS BSF setup.

Creates the input and output CBS instances, and applies the filter to the extradata on the input codecpar if any is present.

Since it calls the update_fragment() function immediately to deal with extradata, this should be called after any codec-specific setup is done (probably at the end of the AVBitStreamFilter.init function).

Definition at line 110 of file cbs_bsf.c.

Referenced by av1_metadata_init(), h264_metadata_init(), h264_redundant_pps_init(), h265_metadata_init(), mpeg2_metadata_init(), and vp9_metadata_init().

◆ ff_cbs_bsf_generic_close()

void ff_cbs_bsf_generic_close ( AVBSFContext bsf)

Close a generic CBS BSF instance.

If no other deinitialisation is required then this function can be used directly as AVBitStreamFilter.close.

Definition at line 150 of file cbs_bsf.c.

◆ ff_cbs_bsf_generic_filter()

int ff_cbs_bsf_generic_filter ( AVBSFContext bsf,
AVPacket pkt 
)

Filter operation for CBS BSF.

Reads the input packet into a CBS fragment, calls update_fragment() on it, then writes the result to an output packet. If the input packet has AV_PKT_DATA_NEW_EXTRADATA side-data associated with it then it does the same thing to that new extradata to form the output side-data first.

If the BSF does not do anything else then this function can be used directly as AVBitStreamFilter.filter.

Definition at line 61 of file cbs_bsf.c.

name
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf default minimum maximum flags name is the option name
Definition: writing_filters.txt:88
BSF_ELEMENT_INSERT
@ BSF_ELEMENT_INSERT
Definition: cbs_bsf.h:104
BSF_ELEMENT_REMOVE
@ BSF_ELEMENT_REMOVE
Definition: cbs_bsf.h:106
field
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this field
Definition: writing_filters.txt:78
NULL
#define NULL
Definition: coverity.c:32
BSF_ELEMENT_PASS
@ BSF_ELEMENT_PASS
Definition: cbs_bsf.h:99
BSF_ELEMENT_EXTRACT
@ BSF_ELEMENT_EXTRACT
Definition: cbs_bsf.h:109
help
static void help(void)
Definition: dct.c:451
OFFSET
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf default minimum maximum flags name is the option keep it simple and lowercase description are in without and describe what they for example set the foo of the bar offset is the offset of the field in your see the OFFSET() macro
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Definition: opt.h:224
AV_OPT_TYPE_CONST
@ AV_OPT_TYPE_CONST
Definition: opt.h:233