FFmpeg
Data Structures | Macros | Functions | Variables
filters.h File Reference
#include "libavutil/log.h"
#include "libavutil/rational.h"
#include "libavcodec/bsf.h"
#include "libavcodec/codec_par.h"
#include "libavcodec/packet.h"

Go to the source code of this file.

Data Structures

struct  AVBitStreamFilterPad
 A filter pad used for either input or output. More...
 
struct  AVBitStreamFilterLink
 Link properties exposed to filter code, but not external callers. More...
 

Macros

#define FFERROR_BSF_NOT_READY   FFERRTAG('N','R','D','Y')
 Special return code when activate() did not do anything. More...
 
#define FFERROR_SOURCE_EMPTY   FFERRTAG('M','P','T','Y')
 
#define FF_BSF_PAD_FLAG_NEEDS_WRITABLE   (1 << 0)
 The filter expects writable packets from its input link, duplicating data buffers if needed. More...
 
#define FF_BSF_PAD_FLAG_FREE_NAME   (1 << 1)
 The pad's name is allocated and should be freed generically. More...
 
#define BSFILTER_INOUTPADS(inout, array)
 
#define BSFILTER_INPUTS(array)   BSFILTER_INOUTPADS(inputs, (array))
 
#define BSFILTER_OUTPUTS(array)   BSFILTER_INOUTPADS(outputs, (array))
 
#define BSF_DEFINE_CLASS_EXT(name, desc, options)
 
#define BSF_DEFINE_CLASS(fname)   BSF_DEFINE_CLASS_EXT(fname, #fname, fname##_options)
 

Functions

void ff_bsf_set_ready (AVBitStreamFilterContext *filter, unsigned priority)
 Mark a filter ready and schedule it for activation. More...
 
int ff_bsf_filter_packet (AVBitStreamFilterLink *link, AVPacket *pkt)
 Send a packet of data to the next filter. More...
 
int ff_bsf_request_packet (AVBitStreamFilterLink *link)
 
int ff_bsf_inlink_consume_packet (AVBitStreamFilterLink *link, AVPacket **pkt)
 
void ff_bsf_inlink_request_packet (AVBitStreamFilterLink *link)
 
int ff_bsf_inlink_acknowledge_status (AVBitStreamFilterLink *link, int *rstatus, int64_t *rpts)
 
size_t ff_bsf_inlink_queued_packets (AVBitStreamFilterLink *link)
 
int ff_bsf_inlink_check_available_packet (AVBitStreamFilterLink *link)
 
void ff_bsf_inlink_set_status (AVBitStreamFilterLink *link, int status)
 
void ff_bsf_link_set_in_status (AVBitStreamFilterLink *link, int status, int64_t pts)
 
int ff_bsf_outlink_get_status (AVBitStreamFilterLink *link)
 
int ff_bsf_outlink_packet_wanted (AVBitStreamFilterLink *link)
 
unsigned ff_bsf_source_get_nb_failed_requests (const AVBitStreamFilterContext *src)
 Get the number of failed requests. More...
 

Variables

const AVBitStreamFilterPad ff_default_bsf_pad [1]
 

Macro Definition Documentation

◆ FFERROR_BSF_NOT_READY

#define FFERROR_BSF_NOT_READY   FFERRTAG('N','R','D','Y')

Special return code when activate() did not do anything.

Definition at line 32 of file filters.h.

◆ FFERROR_SOURCE_EMPTY

#define FFERROR_SOURCE_EMPTY   FFERRTAG('M','P','T','Y')

Definition at line 33 of file filters.h.

◆ FF_BSF_PAD_FLAG_NEEDS_WRITABLE

#define FF_BSF_PAD_FLAG_NEEDS_WRITABLE   (1 << 0)

The filter expects writable packets from its input link, duplicating data buffers if needed.

input pads only.

Definition at line 56 of file filters.h.

◆ FF_BSF_PAD_FLAG_FREE_NAME

#define FF_BSF_PAD_FLAG_FREE_NAME   (1 << 1)

The pad's name is allocated and should be freed generically.

Definition at line 61 of file filters.h.

◆ BSFILTER_INOUTPADS

#define BSFILTER_INOUTPADS (   inout,
  array 
)
Value:
.inout = array, \
.nb_ ## inout = FF_ARRAY_ELEMS(array)

Definition at line 142 of file filters.h.

◆ BSFILTER_INPUTS

#define BSFILTER_INPUTS (   array)    BSFILTER_INOUTPADS(inputs, (array))

Definition at line 145 of file filters.h.

◆ BSFILTER_OUTPUTS

#define BSFILTER_OUTPUTS (   array)    BSFILTER_INOUTPADS(outputs, (array))

Definition at line 146 of file filters.h.

◆ BSF_DEFINE_CLASS_EXT

#define BSF_DEFINE_CLASS_EXT (   name,
  desc,
  options 
)
Value:
static const AVClass name##_class = { \
.class_name = desc, \
.item_name = av_default_item_name, \
.option = options, \
.version = LIBAVUTIL_VERSION_INT, \
}

Definition at line 150 of file filters.h.

◆ BSF_DEFINE_CLASS

#define BSF_DEFINE_CLASS (   fname)    BSF_DEFINE_CLASS_EXT(fname, #fname, fname##_options)

Definition at line 158 of file filters.h.

Function Documentation

◆ ff_bsf_set_ready()

void ff_bsf_set_ready ( AVBitStreamFilterContext filter,
unsigned  priority 
)

Mark a filter ready and schedule it for activation.

This is automatically done when something happens to the filter (queued packet, status change, request on output). Filters implementing the activate callback can call it directly to perform one more round of processing later. It is also useful for filters reacting to external or asynchronous events.

Definition at line 395 of file bitstreamfilter.c.

Referenced by ff_bsf_filter_packet(), ff_bsf_inlink_request_packet(), ff_bsf_link_set_in_status(), ff_bsf_request_packet(), filter_packet_to_filter(), forward_status_change(), and link_set_out_status().

◆ ff_bsf_filter_packet()

int ff_bsf_filter_packet ( AVBitStreamFilterLink link,
AVPacket pkt 
)

Send a packet of data to the next filter.

Parameters
linkthe output link over which the data is being sent
pkta reference to the buffer of data being sent. The receiving filter will free this reference when it no longer needs it or pass it on to the next filter.
Returns
>= 0 on success, a negative AVERROR on error. The receiving filter is responsible for unreferencing pkt in case of error.

Definition at line 661 of file bitstreamfilter.c.

Referenced by av_bsf_source_add_packet(), default_filter_packet(), and lcevc_merge().

◆ ff_bsf_request_packet()

int ff_bsf_request_packet ( AVBitStreamFilterLink link)

Definition at line 563 of file bitstreamfilter.c.

Referenced by request_packet_to_filter().

◆ ff_bsf_inlink_consume_packet()

int ff_bsf_inlink_consume_packet ( AVBitStreamFilterLink link,
AVPacket **  pkt 
)

◆ ff_bsf_inlink_request_packet()

void ff_bsf_inlink_request_packet ( AVBitStreamFilterLink link)

◆ ff_bsf_inlink_acknowledge_status()

int ff_bsf_inlink_acknowledge_status ( AVBitStreamFilterLink link,
int *  rstatus,
int64_t rpts 
)

Definition at line 805 of file bitstreamfilter.c.

Referenced by av_bsf_sink_get_packet(), and consume_from_fifos().

◆ ff_bsf_inlink_queued_packets()

size_t ff_bsf_inlink_queued_packets ( AVBitStreamFilterLink link)

Definition at line 821 of file bitstreamfilter.c.

◆ ff_bsf_inlink_check_available_packet()

int ff_bsf_inlink_check_available_packet ( AVBitStreamFilterLink link)

Definition at line 827 of file bitstreamfilter.c.

◆ ff_bsf_inlink_set_status()

void ff_bsf_inlink_set_status ( AVBitStreamFilterLink link,
int  status 
)

Definition at line 870 of file bitstreamfilter.c.

Referenced by ff_packetsync_activate(), and filter_activate_default().

◆ ff_bsf_link_set_in_status()

void ff_bsf_link_set_in_status ( AVBitStreamFilterLink link,
int  status,
int64_t  pts 
)

◆ ff_bsf_outlink_get_status()

int ff_bsf_outlink_get_status ( AVBitStreamFilterLink link)

◆ ff_bsf_outlink_packet_wanted()

int ff_bsf_outlink_packet_wanted ( AVBitStreamFilterLink link)

Definition at line 896 of file bitstreamfilter.c.

Referenced by consume_from_fifos().

◆ ff_bsf_source_get_nb_failed_requests()

unsigned ff_bsf_source_get_nb_failed_requests ( const AVBitStreamFilterContext src)

Get the number of failed requests.

A failed request is when the request_packet method is called while no packet is present in the buffer. The number is reset when a packet is added.

Definition at line 159 of file source.c.

Referenced by av_bsf_graph_source_needs_input().

Variable Documentation

◆ ff_default_bsf_pad

const AVBitStreamFilterPad ff_default_bsf_pad[1]

Definition at line 902 of file bitstreamfilter.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
FF_ARRAY_ELEMS
#define FF_ARRAY_ELEMS(a)
Definition: sinewin_tablegen.c:29
LIBAVUTIL_VERSION_INT
#define LIBAVUTIL_VERSION_INT
Definition: version.h:85
AVClass
Describe the class of an AVClass context structure.
Definition: log.h:76
av_default_item_name
const char * av_default_item_name(void *ptr)
Return the context name.
Definition: log.c:242
options
const OptionDef options[]
array
static int array[MAX_W *MAX_W]
Definition: jpeg2000dwt.c:116
desc
const char * desc
Definition: libsvtav1.c:83
AV_CLASS_CATEGORY_BITSTREAM_FILTER
@ AV_CLASS_CATEGORY_BITSTREAM_FILTER
Definition: log.h:37