Go to the documentation of this file.
59 for (pass = 1; pass <= 2; pass++) {
60 long value, range_start, range_end;
65 for (str = list_string; *str;) {
66 value = strtol(str, &value_end, 0);
69 str = (
const char *)value_end;
73 range_end = strtol(str, &value_end, 0);
116 if (
ctx->passthrough)
126 if (
ctx->mode != NOOP) {
128 for (j = 0; j <
ctx->nb_types; j++) {
132 if (
ctx->mode == REMOVE ? j < ctx->nb_types
133 : j >=
ctx->nb_types)
163 if (
ctx->pass_types &&
ctx->remove_types) {
165 "remove_types is required.\n");
169 if (
ctx->pass_types) {
172 &
ctx->type_list, &
ctx->nb_types);
177 }
else if (
ctx->remove_types) {
180 &
ctx->type_list, &
ctx->nb_types);
186 ctx->passthrough =
true;
196 ctx->cbc->decompose_unit_types =
ctx->type_list;
197 ctx->cbc->nb_decompose_unit_types = 0;
228 #define OFFSET(x) offsetof(FilterUnitsContext, x)
229 #define FLAGS (AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_BSF_PARAM)
231 {
"pass_types",
"List of unit types to pass through the filter.",
234 {
"remove_types",
"List of unit types to remove in the filter.",
238 {
"discard",
"Remove the selected frames",
241 {
"none" ,
"discard none",
244 {
"default" ,
"discard none, but can be changed after dynamically",
247 {
"nonref",
"discard all non-reference frames",
250 {
"bidir",
"discard all bidirectional frames",
253 {
"nonintra",
"discard all frames except I frames",
256 {
"nonkey",
"discard all frames except keyframes",
259 {
"all",
"discard all frames",
263 {
"discard_flags",
"flags to control the discard frame behavior",
266 {
"keep_non_vcl",
"non-vcl units even if the picture has been dropped",
280 .
p.
name =
"filter_units",
void av_packet_unref(AVPacket *pkt)
Wipe the packet.
AVCodecParameters * par_in
Parameters of the input stream.
uint8_t * extradata
Extra binary data needed for initializing the decoder, codec-dependent.
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later. That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another. Frame references ownership and permissions
av_cold void ff_cbs_fragment_free(CodedBitstreamFragment *frag)
Free the units array of a fragment in addition to what ff_cbs_fragment_reset does.
int ff_cbs_read_extradata(CodedBitstreamContext *ctx, CodedBitstreamFragment *frag, const AVCodecParameters *par)
Read the extradata bitstream found in codec parameters into a fragment, then split into units and dec...
CodedBitstreamContext * cbc
void ff_cbs_fragment_reset(CodedBitstreamFragment *frag)
Free the units contained in a fragment as well as the fragment's own data buffer, but not the units a...
Context structure for coded bitstream operations.
void(* filter)(uint8_t *src, int stride, int qscale)
CodedBitstreamUnitType type
Codec-specific type of this unit.
const char * remove_types
static int filter_units_make_type_list(const char *list_string, CodedBitstreamUnitType **type_list, int *nb_types)
The bitstream filter state.
av_cold void ff_cbs_close(CodedBitstreamContext **ctx_ptr)
Close a context and free all internal state.
@ DISCARD_FLAG_KEEP_NON_VCL
keep non-vcl units even if the picture has been dropped.
@ AVDISCARD_NONE
discard nothing
int ff_cbs_write_extradata(CodedBitstreamContext *ctx, AVCodecParameters *par, CodedBitstreamFragment *frag)
Write the bitstream of a fragment to the extradata in codec parameters.
AVCodecParameters * par_out
Parameters of the output stream.
CodedBitstreamUnit * units
Pointer to an array of units of length nb_units_allocated.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Coded bitstream fragment structure, combining one or more units.
int ff_cbs_write_packet(CodedBitstreamContext *ctx, AVPacket *pkt, CodedBitstreamFragment *frag)
Write the bitstream of a fragment to a packet.
@ AVDISCARD_BIDIR
discard all bidirectional frames
@ AVDISCARD_ALL
discard all
#define LIBAVUTIL_VERSION_INT
Describe the class of an AVClass context structure.
CodedBitstreamUnitType * type_list
enum AVCodecID ff_cbs_all_codec_ids[]
Table of all supported codec IDs.
const char * av_default_item_name(void *ptr)
Return the context name.
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining list
AVBitStreamFilter p
The public AVBitStreamFilter.
@ AVDISCARD_NONKEY
discard all frames except keyframes
static const AVClass filter_units_class
int(* init)(AVBSFContext *ctx)
static int filter_units_init(AVBSFContext *bsf)
@ AVDISCARD_DEFAULT
discard useless packets like 0 size packets in avi
void ff_cbs_discard_units(CodedBitstreamContext *ctx, CodedBitstreamFragment *frag, enum AVDiscard skip, int flags)
Discard units accroding to 'skip'.
static int filter_units_filter(AVBSFContext *bsf, AVPacket *pkt)
@ AVDISCARD_NONINTRA
discard all non intra frames
#define i(width, name, range_min, range_max)
#define av_malloc_array(a, b)
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 value
void * priv_data
Opaque filter-specific private data.
const char * class_name
The name of the class; usually it is the same name as the context structure type to which the AVClass...
uint32_t CodedBitstreamUnitType
The codec-specific type of a bitstream unit.
enum FilterUnitsContext::@62 mode
@ AV_OPT_TYPE_INT
Underlying C type is int.
int ff_cbs_read_packet(CodedBitstreamContext *ctx, CodedBitstreamFragment *frag, const AVPacket *pkt)
Read the data bitstream from a packet into a fragment, then split into units and decompose.
static void filter_units_close(AVBSFContext *bsf)
av_cold int ff_cbs_init(CodedBitstreamContext **ctx_ptr, enum AVCodecID codec_id, void *log_ctx)
Create and initialise a new context for the given codec.
enum AVCodecID codec_id
Specific type of the encoded data (the codec used).
This structure stores compressed data.
static const AVOption filter_units_options[]
@ AV_OPT_TYPE_FLAGS
Underlying C type is unsigned int.
int ff_bsf_get_packet_ref(AVBSFContext *ctx, AVPacket *pkt)
Called by bitstream filters to get packet for filtering.
CodedBitstreamFragment fragment
@ AV_OPT_TYPE_STRING
Underlying C type is a uint8_t* that is either NULL or points to a C string allocated with the av_mal...
@ AVDISCARD_NONREF
discard all non reference
@ AV_OPT_TYPE_CONST
Special option type for declaring named constants.
int nb_units
Number of units in this fragment.
void ff_cbs_delete_unit(CodedBitstreamFragment *frag, int position)
Delete a unit from a fragment and free all memory it uses.
const FFBitStreamFilter ff_filter_units_bsf