FFmpeg
Loading...
Searching...
No Matches
bsf.h
Go to the documentation of this file.
1/*
2 * Bitstream filters public API
3 *
4 * This file is part of FFmpeg.
5 *
6 * FFmpeg is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * FFmpeg is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with FFmpeg; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 */
20
21#ifndef AVCODEC_BSF_H
22#define AVCODEC_BSF_H
23
24#include "libavutil/dict.h"
25#include "libavutil/log.h"
26#include "libavutil/rational.h"
27
28#include "codec_id.h"
29#include "codec_par.h"
30#include "packet.h"
31
32/**
33 * @defgroup lavc_bsf Bitstream filters
34 * @ingroup libavc
35 *
36 * Bitstream filters transform encoded media data without decoding it. This
37 * allows e.g. manipulating various header values. Bitstream filters operate on
38 * @ref AVPacket "AVPackets".
39 *
40 * The bitstream filtering API is centered around two structures:
41 * AVBitStreamFilter and AVBSFContext. The former represents a bitstream filter
42 * in abstract, the latter a specific filtering process. Obtain an
43 * AVBitStreamFilter using av_bsf_get_by_name() or av_bsf_iterate(), then pass
44 * it to av_bsf_alloc() to create an AVBSFContext. Fill in the user-settable
45 * AVBSFContext fields, as described in its documentation, then call
46 * av_bsf_init() to prepare the filter context for use.
47 *
48 * Submit packets for filtering using av_bsf_send_packet(), obtain filtered
49 * results with av_bsf_receive_packet(). When no more input packets will be
50 * sent, submit a NULL AVPacket to signal the end of the stream to the filter.
51 * av_bsf_receive_packet() will then return trailing packets, if any are
52 * produced by the filter.
53 *
54 * Finally, free the filter context with av_bsf_free().
55 * @{
56 */
57
58/**
59 * The bitstream filter state.
60 *
61 * This struct must be allocated with av_bsf_alloc() and freed with
62 * av_bsf_free().
63 *
64 * The fields in the struct will only be changed (by the caller or by the
65 * filter) as described in their documentation, and are to be considered
66 * immutable otherwise.
67 */
68typedef struct AVBSFContext {
69 /**
70 * A class for logging and AVOptions
71 */
73
74 /**
75 * The bitstream filter this context is an instance of.
76 */
78
79 /**
80 * Opaque filter-specific private data. If filter->priv_class is non-NULL,
81 * this is an AVOptions-enabled struct.
82 */
83 void *priv_data;
84
85 /**
86 * Parameters of the input stream. This field is allocated in
87 * av_bsf_alloc(), it needs to be filled by the caller before
88 * av_bsf_init().
89 */
91
92 /**
93 * Parameters of the output stream. This field is allocated in
94 * av_bsf_alloc(), it is set by the filter in av_bsf_init().
95 */
97
98 /**
99 * The timebase used for the timestamps of the input packets. Set by the
100 * caller before av_bsf_init().
101 */
103
104 /**
105 * The timebase used for the timestamps of the output packets. Set by the
106 * filter in av_bsf_init().
107 */
110
111typedef struct AVBitStreamFilter {
112 const char *name;
113
114 /**
115 * A list of codec ids supported by the filter, terminated by
116 * AV_CODEC_ID_NONE.
117 * May be NULL, in that case the bitstream filter works with any codec id.
118 */
119 const enum AVCodecID *codec_ids;
120
121 /**
122 * A class for the private data, used to declare bitstream filter private
123 * AVOptions. This field is NULL for bitstream filters that do not declare
124 * any options.
125 *
126 * If this field is non-NULL, the first member of the filter private data
127 * must be a pointer to AVClass, which will be set by libavcodec generic
128 * code to this class.
129 */
132
133/**
134 * @return a bitstream filter with the specified name or NULL if no such
135 * bitstream filter exists.
136 */
137const AVBitStreamFilter *av_bsf_get_by_name(const char *name);
138
139/**
140 * Iterate over all registered bitstream filters.
141 *
142 * @param opaque a pointer where libavcodec will store the iteration state. Must
143 * point to NULL to start the iteration.
144 *
145 * @return the next registered bitstream filter or NULL when the iteration is
146 * finished
147 */
148const AVBitStreamFilter *av_bsf_iterate(void **opaque);
149
150/**
151 * Allocate a context for a given bitstream filter. The caller must fill in the
152 * context parameters as described in the documentation and then call
153 * av_bsf_init() before sending any data to the filter.
154 *
155 * @param filter the filter for which to allocate an instance.
156 * @param[out] ctx a pointer into which the pointer to the newly-allocated context
157 * will be written. It must be freed with av_bsf_free() after the
158 * filtering is done.
159 *
160 * @return 0 on success, a negative AVERROR code on failure
161 */
163
164/**
165 * Prepare the filter for use, after all the parameters and options have been
166 * set.
167 *
168 * @param ctx a AVBSFContext previously allocated with av_bsf_alloc()
169 */
171
172/**
173 * Submit a packet for filtering.
174 *
175 * After sending each packet, the filter must be completely drained by calling
176 * av_bsf_receive_packet() repeatedly until it returns AVERROR(EAGAIN) or
177 * AVERROR_EOF.
178 *
179 * @param ctx an initialized AVBSFContext
180 * @param pkt the packet to filter. The bitstream filter will take ownership of
181 * the packet and reset the contents of pkt. pkt is not touched if an error occurs.
182 * If pkt is empty (i.e. NULL, or pkt->data is NULL and pkt->side_data_elems zero),
183 * it signals the end of the stream (i.e. no more non-empty packets will be sent;
184 * sending more empty packets does nothing) and will cause the filter to output
185 * any packets it may have buffered internally.
186 *
187 * @return
188 * - 0 on success.
189 * - AVERROR(EAGAIN) if packets need to be retrieved from the filter (using
190 * av_bsf_receive_packet()) before new input can be consumed.
191 * - Another negative AVERROR value if an error occurs.
192 */
194
195/**
196 * Retrieve a filtered packet.
197 *
198 * @param ctx an initialized AVBSFContext
199 * @param[out] pkt this struct will be filled with the contents of the filtered
200 * packet. It is owned by the caller and must be freed using
201 * av_packet_unref() when it is no longer needed.
202 * This parameter should be "clean" (i.e. freshly allocated
203 * with av_packet_alloc() or unreffed with av_packet_unref())
204 * when this function is called. If this function returns
205 * successfully, the contents of pkt will be completely
206 * overwritten by the returned data. On failure, pkt is not
207 * touched.
208 *
209 * @return
210 * - 0 on success.
211 * - AVERROR(EAGAIN) if more packets need to be sent to the filter (using
212 * av_bsf_send_packet()) to get more output.
213 * - AVERROR_EOF if there will be no further output from the filter.
214 * - Another negative AVERROR value if an error occurs.
215 *
216 * @note one input packet may result in several output packets, so after sending
217 * a packet with av_bsf_send_packet(), this function needs to be called
218 * repeatedly until it stops returning 0. It is also possible for a filter to
219 * output fewer packets than were sent to it, so this function may return
220 * AVERROR(EAGAIN) immediately after a successful av_bsf_send_packet() call.
221 */
223
224/**
225 * Reset the internal bitstream filter state. Should be called e.g. when seeking.
226 */
228
229/**
230 * Free a bitstream filter context and everything associated with it; write NULL
231 * into the supplied pointer.
232 */
234
235/**
236 * Get the AVClass for AVBSFContext. It can be used in combination with
237 * AV_OPT_SEARCH_FAKE_OBJ for examining options.
238 *
239 * @see av_opt_find().
240 */
241const AVClass *av_bsf_get_class(void);
242
243/**
244 * Structure for chain/list of bitstream filters.
245 * Empty list can be allocated by av_bsf_list_alloc().
246 */
247typedef struct AVBSFList AVBSFList;
248
249/**
250 * Allocate empty list of bitstream filters.
251 * The list must be later freed by av_bsf_list_free()
252 * or finalized by av_bsf_list_finalize().
253 *
254 * @return Pointer to @ref AVBSFList on success, NULL in case of failure
255 */
257
258/**
259 * Free list of bitstream filters.
260 *
261 * @param lst Pointer to pointer returned by av_bsf_list_alloc()
262 */
263void av_bsf_list_free(AVBSFList **lst);
264
265/**
266 * Append bitstream filter to the list of bitstream filters.
267 *
268 * @param lst List to append to
269 * @param bsf Filter context to be appended
270 *
271 * @return >=0 on success, negative AVERROR in case of failure
272 */
274
275/**
276 * Construct new bitstream filter context given it's name and options
277 * and append it to the list of bitstream filters.
278 *
279 * @param lst List to append to
280 * @param bsf_name Name of the bitstream filter
281 * @param options Options for the bitstream filter, can be set to NULL
282 *
283 * @return >=0 on success, negative AVERROR in case of failure
284 */
285int av_bsf_list_append2(AVBSFList *lst, const char * bsf_name, AVDictionary **options);
286/**
287 * Finalize list of bitstream filters.
288 *
289 * This function will transform @ref AVBSFList to single @ref AVBSFContext,
290 * so the whole chain of bitstream filters can be treated as single filter
291 * freshly allocated by av_bsf_alloc().
292 * If the call is successful, @ref AVBSFList structure is freed and lst
293 * will be set to NULL. In case of failure, caller is responsible for
294 * freeing the structure by av_bsf_list_free()
295 *
296 * @param lst Filter list structure to be transformed
297 * @param[out] bsf Pointer to be set to newly created @ref AVBSFContext structure
298 * representing the chain of bitstream filters
299 *
300 * @return >=0 on success, negative AVERROR in case of failure
301 */
303
304/**
305 * Parse string describing list of bitstream filters and create single
306 * @ref AVBSFContext describing the whole chain of bitstream filters.
307 * Resulting @ref AVBSFContext can be treated as any other @ref AVBSFContext freshly
308 * allocated by av_bsf_alloc().
309 *
310 * @param str String describing chain of bitstream filters in format
311 * `bsf1[=opt1=val1:opt2=val2][,bsf2]`
312 * @param[out] bsf Pointer to be set to newly created @ref AVBSFContext structure
313 * representing the chain of bitstream filters
314 *
315 * @return >=0 on success, negative AVERROR in case of failure
316 */
317int av_bsf_list_parse_str(const char *str, AVBSFContext **bsf);
318
319/**
320 * Get null/pass-through bitstream filter.
321 *
322 * @param[out] bsf Pointer to be set to new instance of pass-through bitstream filter
323 *
324 * @return
325 */
327
328/**
329 * @defgroup lavc_bsfgraph Bitstream filter graph
330 * Experimental graph-based API for bitstream filters.
331 * @{
332 */
333
334/**
335 * A link between two filters. This contains pointers to the source and
336 * destination filters between which this link exists, and the indexes of
337 * the pads involved.
338 */
340
341/**
342 * A filter pad used for either input or output.
343 */
345
346/** An instance of a filter */
348 /**
349 * A class for logging and AVOptions
350 */
352
353 /**
354 * The bitstream filter this context is an instance of.
355 */
357
358 /**
359 * name of this filter instance
360 */
361 char *name;
362
363 AVBitStreamFilterPad *input_pads; ///< array of input pads
364 AVBitStreamFilterLink **inputs; ///< array of pointers to input links
365 unsigned nb_inputs; ///< number of input pads
366
367 AVBitStreamFilterPad *output_pads; ///< array of output pads
368 AVBitStreamFilterLink **outputs; ///< array of pointers to output links
369 unsigned nb_outputs; ///< number of output pads
370
371 /**
372 * Opaque filter-specific private data. If filter->priv_class is non-NULL,
373 * this is an AVOptions-enabled struct.
374 */
376
377 /**
378 * filtergraph this filter belongs to
379 */
382
383/**
384 * The number of the filter inputs is not determined just by the filter's static
385 * inputs. The filter might add additional inputs during initialization depending
386 * on the options supplied to it.
387 */
388#define AV_BSF_FLAG_DYNAMIC_INPUTS (1 << 0)
389/**
390 * The number of the filter outputs is not determined just by the filter's static
391 * outputs. The filter might add additional outputs during initialization depending
392 * on the options supplied to it.
393 */
394#define AV_BSF_FLAG_DYNAMIC_OUTPUTS (1 << 1)
395/**
396 * The filter is a "metadata" filter - it does not modify the packet data in any
397 * way. It may only affect the metadata (i.e. those fields copied by
398 * av_packet_copy_props()).
399 *
400 * More precisely, this means that the data of any packet output by the filter
401 * must be exactly equal to some packet that is received on one of its inputs.
402 * Furthermore, all packets produced on a given output must correspond to packet
403 * received on the same input and their order must be unchanged.
404 * Note that the filter may still drop or duplicate the frames.
405 */
406#define AV_BSF_FLAG_METADATA_ONLY (1 << 2)
407
408/**
409 * Get the name of an AVBitStreamFilterPad.
410 *
411 * @param pads an array of AVBitStreamFilterPads
412 * @param pad_idx index of the pad in the array; it is the caller's
413 * responsibility to ensure the index is valid
414 *
415 * @return name of the pad_idx'th pad in pads
416 */
417const char *av_bsf_pad_get_name(const AVBitStreamFilterPad *pads, int pad_idx);
418
419/**
420 * Get the codec ids supported by an AVBitStreamFilterPad.
421 *
422 * @param pads an array of AVBitStreamFilterPads
423 * @param pad_idx index of the pad in the array; it is the caller's
424 * responsibility to ensure the index is valid
425 *
426 * @return an array of AVCodecID terminated by AV_CODEC_ID_NONE, or NULL
427 * if the pad has no codec id constrains.
428 */
429const enum AVCodecID *av_bsf_pad_get_codec_ids(const AVBitStreamFilterPad *pads, int pad_idx);
430
431/**
432 * Link two filters together.
433 *
434 * @param src the source filter
435 * @param srcpad index of the output pad on the source filter
436 * @param dst the destination filter
437 * @param dstpad index of the input pad on the destination filter
438 * @return zero on success
439 */
440int av_bsf_link(AVBitStreamFilterContext *src, unsigned srcpad,
441 AVBitStreamFilterContext *dst, unsigned dstpad);
442
443/**
444 * Initialize a filter with the supplied parameters.
445 *
446 * @param ctx uninitialized filter context to initialize
447 * @param args Options to initialize the filter with. This must be a
448 * ':'-separated list of options in the 'key=value' form.
449 * May be NULL if the options have been set directly using the
450 * AVOptions API or there are no options that need to be set.
451 * @return 0 on success, a negative AVERROR on failure
452 */
453int av_bsf_init_str(AVBitStreamFilterContext *ctx, const char *args);
454
455/**
456 * Initialize a filter with the supplied dictionary of options.
457 *
458 * @param ctx uninitialized filter context to initialize
459 * @param options An AVDictionary filled with options for this filter. On
460 * return this parameter will be destroyed and replaced with
461 * a dict containing options that were not found. This dictionary
462 * must be freed by the caller.
463 * May be NULL, then this function is equivalent to
464 * av_bsf_init_str() with the second parameter set to NULL.
465 * @return 0 on success, a negative AVERROR on failure
466 *
467 * @note This function and av_bsf_init_str() do essentially the same thing,
468 * the difference is in manner in which the options are passed. It is up to the
469 * calling code to choose whichever is more preferable. The two functions also
470 * behave differently when some of the provided options are not declared as
471 * supported by the filter. In such a case, av_bsf_init_str() will fail, but
472 * this function will leave those extra options in the options AVDictionary and
473 * continue as usual.
474 */
476
479
481
482 unsigned nb_filters;
483
484 /**
485 * Sets the maximum number of buffered packets in the filtergraph combined.
486 *
487 * Zero means no limit. This field must be set before calling
488 * av_bsf_graph_config().
489 */
492
493/**
494 * Allocate a filter graph.
495 *
496 * @return the allocated filter graph on success or NULL.
497 */
499
500/**
501 * Create a new filter instance in a filter graph.
502 *
503 * @param[out] filt_ctx A pointer into which the pointer to the newly-allocated context
504 * will be written on success. May be NULL. Note that it is also
505 * retrievable directly through AVBitStreamFilterGraph.filters or
506 * with @ref av_bsf_graph_get_filter().
507 * @param[in] filter the filter to create an instance of
508 * @param[in] name Name to give to the new instance (will be copied to
509 * AVBitStreamFilterContext.name). This may be used by the caller to
510 * identify different filters, libavcodec itself assigns no semantics
511 * to this parameter. May be NULL.
512 * @param[in] graph graph in which the new filter will be used
513 *
514 * @note On failure and if filt_ctx is not NULL, *filt_ctx will be set to NULL.
515 * @return a negative AVERROR error code in case of failure, a non negative value otherwise
516 */
519 const char *name,
521
522/**
523 * A convenience wrapper that allocates and initializes a filter in a single
524 * step. The filter instance is created from the filter filt and inited with the
525 * parameter args.
526 *
527 * @param[out] filt_ctx A pointer into which the pointer to the newly-allocated context
528 * will be written on success. May be NULL. Note that it is also
529 * retrievable directly through AVBitStreamFilterGraph.filters or
530 * with @ref av_bsf_graph_get_filter().
531 * @param[in] name the instance name to give to the created filter instance
532 * @param[in] graph_ctx the filter graph
533 * @return a negative AVERROR error code in case of failure, a non negative value otherwise
534 *
535 * @note On failure and if filt_ctx is not NULL, *filt_ctx will be set to NULL.
536 * @warning Since the filter is initialized after this function successfully
537 * returns, you MUST NOT set any further options on it. If you need to
538 * do that, call ::av_bsf_graph_alloc_filter(), followed by setting
539 * the options, followed by ::av_bsf_init_dict() instead of this
540 * function.
541 */
543 const AVBitStreamFilter *filt,
544 const char *name, AVDictionary **options,
545 AVBitStreamFilterGraph *graph_ctx);
546
547/**
548 * Get a filter instance identified by instance name from graph.
549 *
550 * @param graph filter graph to search through.
551 * @param name filter instance name (should be unique in the graph).
552 * @return the pointer to the found filter instance or NULL if it
553 * cannot be found.
554 */
556
557/**
558 * Check validity and configure all the links and formats in the graph.
559 *
560 * @param graphctx the filter graph
561 * @param log_ctx context used for logging
562 * @return >= 0 in case of success, a negative AVERROR code otherwise
563 */
564int av_bsf_graph_config(AVBitStreamFilterGraph *graphctx, void *log_ctx);
565
566/**
567 * Get the index of the source filter in the filtergraph that reported needing
568 * input more urgently.
569 *
570 * @return the index value of a source filter in the filtergraph, or AVERROR(EOF)
571 * if no source is accepting more packets.
572 */
574
575/**
576 * Free a graph, destroy its links, and set *graph to NULL.
577 * If *graph is NULL, do nothing.
578 */
580
581/**
582 * @defgroup lavc_bsfgraph_source Packet source API
583 *
584 * The source filter is there to connect filter graphs to applications
585 * They have a single output, connected to the graph, and no input.
586 * Packets must be fed to it using av_bsf_source_add_packet().
587 * @{
588 */
589
590enum {
591 /**
592 * Immediately push the packet to the output.
593 */
595
596 /**
597 * Keep a reference to the packet.
598 */
600};
601
602/**
603 * Initialize the source filter with the provided parameters.
604 * This function may be called multiple times, the later calls override the
605 * previous ones. Some of the parameters may also be set through AVOptions, then
606 * whatever method is used last takes precedence.
607 *
608 * @param ctx an instance of the source filter
609 * @param param the stream parameters. The packet later passed to this filter
610 * must conform to those parameters. All the allocated fields in
611 * param remain owned by the caller, libavcodec will make internal
612 * copies or references when necessary.
613 * @return 0 on success, a negative AVERROR code on failure.
614 */
616
617/**
618 * Add a packet to the buffer source.
619 *
620 * By default, this function will take ownership of the reference(s) and reset
621 * the packet. This can be controlled using the flags.
622 *
623 * If this function returns an error, the input packet is not touched.
624 *
625 * @param buffer_src pointer to a source filter context
626 * @param packet a packet, or NULL to mark EOF
627 * @param flags a combination of AV_BSF_FLAG_*
628 * @return >= 0 in case of success, a negative AVERROR code
629 * in case of failure
630 */
633
634/**
635 * Returns 0 or a negative AVERROR code. Currently, this will only ever
636 * return AVERROR(EOF), to indicate that the buffer source has been closed,
637 * either as a result of av_bsf_source_close(), or because the downstream
638 * filter is no longer accepting new data.
639 */
641
642/**
643 * Close the source after EOF.
644 *
645 * This is similar to passing NULL to av_bsf_source_add_packet()
646 * except it takes the timestamp of the EOF, i.e. the timestamp of the end
647 * of the last packet.
648 */
650
651/**
652 * @}
653 */
654
655/**
656 * @defgroup lavc_bsfgraph_sink Packet sink API
657 * @{
658 *
659 * The sink filter is there to connect filter graphs to applications
660 * They have a single input, connected to the graph, and no output.
661 * Packets must be extracted using av_bsf_sink_get_packet().
662 */
663
664enum {
665 /**
666 * Tell av_buffersink_get_buffer_ref() to read video/samples buffer
667 * reference, but not remove it from the buffer. This is useful if you
668 * need only to read a video/samples buffer, without to fetch it.
669 */
671
672 /**
673 * Tell av_bsf_sink_get_packet() not to request a packet from its input.
674 * If a packet is already buffered, it is read (and removed from the buffer),
675 * but if no packet is present, return AVERROR(EAGAIN).
676 */
678};
679
680/**
681 * Get a packet with filtered data from sink and put it in packet.
682 *
683 * @param ctx pointer to a sink filter context.
684 * @param packet pointer to an allocated packet that will be filled with data.
685 * The data must be freed using av_packet_unref() / av_packet_free()
686 * @param flags a combination of AV_BSF_SINK_FLAG_* flags
687 *
688 * @retval AVERROR(EAGAIN) output could not be produced.
689 * if AV_BSF_SINK_FLAG_NO_REQUEST was not set,
690 * @ref av_bsf_graph_needs_input can be called to
691 * know which source needs input more urgently.
692 * @retval >= 0 success
693 * @retval "another negative error code" legitimate error
694 */
696
699
700/**
701 * @}
702 *
703 * @}
704 *
705 * @}
706 */
707
708#endif // AVCODEC_BSF_H
uint8_t ptrdiff_t const uint8_t ptrdiff_t int intptr_t intptr_t int int16_t * dst
Definition dsp.h:87
static const int8_t filt[NUMTAPS *2]
Definition af_earwax.c:40
static AVFormatContext * ctx
#define flags(name, subs,...)
Definition cbs_h264.c:74
long long int64_t
Definition coverity.c:34
static AVPacket * pkt
Public dictionary API.
void av_bsf_free(AVBSFContext **ctx)
Free a bitstream filter context and everything associated with it; write NULL into the supplied point...
Definition bsf.c:47
void av_bsf_list_free(AVBSFList **lst)
Free list of bitstream filters.
Definition bsf.c:423
const AVBitStreamFilter * av_bsf_iterate(void **opaque)
Iterate over all registered bitstream filters.
int av_bsf_init(AVBSFContext *ctx)
Prepare the filter for use, after all the parameters and options have been set.
Definition bsf.c:147
int av_bsf_list_append(AVBSFList *lst, AVBSFContext *bsf)
Append bitstream filter to the list of bitstream filters.
Definition bsf.c:436
void av_bsf_flush(AVBSFContext *ctx)
Reset the internal bitstream filter state.
Definition bsf.c:188
const AVClass * av_bsf_get_class(void)
Get the AVClass for AVBSFContext.
Definition bsf.c:94
int av_bsf_alloc(const AVBitStreamFilter *filter, AVBSFContext **ctx)
Allocate a context for a given bitstream filter.
Definition bsf.c:99
int av_bsf_receive_packet(AVBSFContext *ctx, AVPacket *pkt)
Retrieve a filtered packet.
Definition bsf.c:228
int av_bsf_list_finalize(AVBSFList **lst, AVBSFContext **bsf)
Finalize list of bitstream filters.
Definition bsf.c:487
int av_bsf_send_packet(AVBSFContext *ctx, AVPacket *pkt)
Submit a packet for filtering.
Definition bsf.c:200
AVBSFList * av_bsf_list_alloc(void)
Allocate empty list of bitstream filters.
Definition bsf.c:418
int av_bsf_list_parse_str(const char *str, AVBSFContext **bsf)
Parse string describing list of bitstream filters and create single AVBSFContext describing the whole...
Definition bsf.c:524
int av_bsf_get_null_filter(AVBSFContext **bsf)
Get null/pass-through bitstream filter.
Definition bsf.c:551
const AVBitStreamFilter * av_bsf_get_by_name(const char *name)
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 bitst...
Definition bsf.c:482
int av_bsf_sink_get_packet(AVBitStreamFilterContext *ctx, AVPacket *pkt, int flags)
Get a packet with filtered data from sink and put it in packet.
Definition sink.c:52
const AVCodecParameters * av_bsf_sink_get_parameters(const AVBitStreamFilterContext *ctx)
Definition sink.c:132
AVRational av_bsf_sink_get_time_base(const AVBitStreamFilterContext *ctx)
Definition sink.c:126
@ AV_BSF_SINK_FLAG_PEEK
Tell av_buffersink_get_buffer_ref() to read video/samples buffer reference, but not remove it from th...
Definition bsf.h:670
@ AV_BSF_SINK_FLAG_NO_REQUEST
Tell av_bsf_sink_get_packet() not to request a packet from its input.
Definition bsf.h:677
int av_bsf_source_close(AVBitStreamFilterContext *ctx, int64_t pts, unsigned flags)
Close the source after EOF.
Definition source.c:118
int av_bsf_source_get_status(AVBitStreamFilterContext *ctx)
Returns 0 or a negative AVERROR code.
Definition source.c:127
int av_bsf_source_parameters_set(AVBitStreamFilterContext *ctx, const AVCodecParameters *par)
Initialize the source filter with the provided parameters.
Definition source.c:46
av_warn_unused_result int av_bsf_source_add_packet(AVBitStreamFilterContext *ctx, AVPacket *pkt, int flags)
Add a packet to the buffer source.
Definition source.c:67
@ AV_BSF_SOURCE_FLAG_PUSH
Immediately push the packet to the output.
Definition bsf.h:594
@ AV_BSF_SOURCE_FLAG_KEEP_REF
Keep a reference to the packet.
Definition bsf.h:599
enum AVCodecID * av_bsf_pad_get_codec_ids(const AVBitStreamFilterPad *pads, int pad_idx)
Get the codec ids supported by an AVBitStreamFilterPad.
int av_bsf_init_dict(AVBitStreamFilterContext *ctx, AVDictionary **options)
Initialize a filter with the supplied dictionary of options.
int av_bsf_init_str(AVBitStreamFilterContext *ctx, const char *args)
Initialize a filter with the supplied parameters.
AVBitStreamFilterGraph * av_bsf_graph_alloc(void)
Allocate a filter graph.
Definition bsfgraph.c:48
int av_bsf_link(AVBitStreamFilterContext *src, unsigned srcpad, AVBitStreamFilterContext *dst, unsigned dstpad)
Link two filters together.
int av_bsf_graph_source_needs_input(const AVBitStreamFilterGraph *graph)
Get the index of the source filter in the filtergraph that reported needing input more urgently.
Definition bsfgraph.c:383
int av_bsf_graph_create_filter(AVBitStreamFilterContext **filt_ctx, const AVBitStreamFilter *filt, const char *name, AVDictionary **options, AVBitStreamFilterGraph *graph_ctx)
A convenience wrapper that allocates and initializes a filter in a single step.
Definition bsfgraph.c:113
const char * av_bsf_pad_get_name(const AVBitStreamFilterPad *pads, int pad_idx)
Get the name of an AVBitStreamFilterPad.
int av_bsf_graph_config(AVBitStreamFilterGraph *graphctx, void *log_ctx)
Check validity and configure all the links and formats in the graph.
Definition bsfgraph.c:294
void av_bsf_graph_free(AVBitStreamFilterGraph **graph)
Free a graph, destroy its links, and set *graph to NULL.
Definition bsfgraph.c:93
AVBitStreamFilterContext * av_bsf_graph_get_filter(AVBitStreamFilterGraph *graph, const char *name)
Get a filter instance identified by instance name from graph.
Definition bsfgraph.c:82
int av_bsf_graph_alloc_filter(AVBitStreamFilterContext **filt_ctx, const AVBitStreamFilter *filter, const char *name, AVBitStreamFilterGraph *graph)
Create a new filter instance in a filter graph.
Definition bsfgraph.c:139
AVCodecID
Identify the syntax and semantics of the bitstream.
Definition codec_id.h:47
#define av_warn_unused_result
Definition attributes.h:91
const char * name
Definition qsvenc.c:142
Utilities for rational number calculation.
The bitstream filter state.
Definition bsf.h:68
AVRational time_base_out
The timebase used for the timestamps of the output packets.
Definition bsf.h:108
void * priv_data
Opaque filter-specific private data.
Definition bsf.h:83
AVCodecParameters * par_in
Parameters of the input stream.
Definition bsf.h:90
const AVClass * av_class
A class for logging and AVOptions.
Definition bsf.h:72
AVCodecParameters * par_out
Parameters of the output stream.
Definition bsf.h:96
AVRational time_base_in
The timebase used for the timestamps of the input packets.
Definition bsf.h:102
const struct AVBitStreamFilter * filter
The bitstream filter this context is an instance of.
Definition bsf.h:77
Structure for chain/list of bitstream filters.
Definition bsf.c:413
An instance of a filter.
Definition bsf.h:347
AVBitStreamFilterPad * output_pads
array of output pads
Definition bsf.h:367
unsigned nb_inputs
number of input pads
Definition bsf.h:365
const struct AVBitStreamFilter * filter
The bitstream filter this context is an instance of.
Definition bsf.h:356
void * priv_data
Opaque filter-specific private data.
Definition bsf.h:375
struct AVBitStreamFilterGraph * graph
filtergraph this filter belongs to
Definition bsf.h:380
AVBitStreamFilterLink ** outputs
array of pointers to output links
Definition bsf.h:368
const AVClass * av_class
A class for logging and AVOptions.
Definition bsf.h:351
AVBitStreamFilterPad * input_pads
array of input pads
Definition bsf.h:363
unsigned nb_outputs
number of output pads
Definition bsf.h:369
char * name
name of this filter instance
Definition bsf.h:361
AVBitStreamFilterLink ** inputs
array of pointers to input links
Definition bsf.h:364
unsigned max_buffered_packets
Sets the maximum number of buffered packets in the filtergraph combined.
Definition bsf.h:490
const AVClass * av_class
Definition bsf.h:478
unsigned nb_filters
Definition bsf.h:482
AVBitStreamFilterContext ** filters
Definition bsf.h:480
A filter pad used for either input or output.
Definition filters.h:35
const AVClass * priv_class
A class for the private data, used to declare bitstream filter private AVOptions.
Definition bsf.h:130
const char * name
Definition bsf.h:112
enum AVCodecID * codec_ids
A list of codec ids supported by the filter, terminated by AV_CODEC_ID_NONE.
Definition bsf.h:119
Describe the class of an AVClass context structure.
Definition log.h:76
This struct describes the properties of an encoded stream.
Definition codec_par.h:49
This structure stores compressed data.
Definition packet.h:580
Rational number (pair of numerator and denominator).
Definition rational.h:58
void(* filter)(uint8_t *src, ptrdiff_t stride, int qscale)
Definition h263dsp.c:29
#define src
Definition vp8dsp.c:248
static int64_t pts