FFmpeg  4.3.6
bsf.c
Go to the documentation of this file.
1 /*
2  * This file is part of FFmpeg.
3  *
4  * FFmpeg is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * FFmpeg is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with FFmpeg; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17  */
18 
19 #include <string.h>
20 
21 #include "libavutil/avassert.h"
22 #include "libavutil/log.h"
23 #include "libavutil/mem.h"
24 #include "libavutil/opt.h"
25 #include "libavutil/avstring.h"
26 #include "libavutil/bprint.h"
27 
28 #include "bsf.h"
29 #include "bsf_internal.h"
30 #include "codec_desc.h"
31 #include "codec_par.h"
32 
33 #define IS_EMPTY(pkt) (!(pkt)->data && !(pkt)->side_data_elems)
34 
35 struct AVBSFInternal {
37  int eof;
38 };
39 
41 {
43 
44  if (!pctx || !*pctx)
45  return;
46  ctx = *pctx;
47 
48  if (ctx->filter->close)
49  ctx->filter->close(ctx);
50  if (ctx->filter->priv_class && ctx->priv_data)
51  av_opt_free(ctx->priv_data);
52 
53  if (ctx->internal)
55  av_freep(&ctx->internal);
56  av_freep(&ctx->priv_data);
57 
60 
61  av_freep(pctx);
62 }
63 
64 static void *bsf_child_next(void *obj, void *prev)
65 {
66  AVBSFContext *ctx = obj;
67  if (!prev && ctx->filter->priv_class)
68  return ctx->priv_data;
69  return NULL;
70 }
71 
72 static const char *bsf_to_name(void *bsf)
73 {
74  return ((AVBSFContext *)bsf)->filter->name;
75 }
76 
77 static const AVClass bsf_class = {
78  .class_name = "AVBSFContext",
79  .item_name = bsf_to_name,
80  .version = LIBAVUTIL_VERSION_INT,
81  .child_next = bsf_child_next,
82  .child_class_next = ff_bsf_child_class_next,
84 };
85 
87 {
88  return &bsf_class;
89 }
90 
92 {
94  AVBSFInternal *bsfi;
95  int ret;
96 
97  ctx = av_mallocz(sizeof(*ctx));
98  if (!ctx)
99  return AVERROR(ENOMEM);
100 
101  ctx->av_class = &bsf_class;
102  ctx->filter = filter;
103 
106  if (!ctx->par_in || !ctx->par_out) {
107  ret = AVERROR(ENOMEM);
108  goto fail;
109  }
110 
111  bsfi = av_mallocz(sizeof(*bsfi));
112  if (!bsfi) {
113  ret = AVERROR(ENOMEM);
114  goto fail;
115  }
116  ctx->internal = bsfi;
117 
118  bsfi->buffer_pkt = av_packet_alloc();
119  if (!bsfi->buffer_pkt) {
120  ret = AVERROR(ENOMEM);
121  goto fail;
122  }
123 
124  /* allocate priv data and init private options */
125  if (filter->priv_data_size) {
126  ctx->priv_data = av_mallocz(filter->priv_data_size);
127  if (!ctx->priv_data) {
128  ret = AVERROR(ENOMEM);
129  goto fail;
130  }
131  if (filter->priv_class) {
132  *(const AVClass **)ctx->priv_data = filter->priv_class;
134  }
135  }
136 
137  *pctx = ctx;
138  return 0;
139 fail:
140  av_bsf_free(&ctx);
141  return ret;
142 }
143 
145 {
146  int ret, i;
147 
148  /* check that the codec is supported */
149  if (ctx->filter->codec_ids) {
150  for (i = 0; ctx->filter->codec_ids[i] != AV_CODEC_ID_NONE; i++)
151  if (ctx->par_in->codec_id == ctx->filter->codec_ids[i])
152  break;
153  if (ctx->filter->codec_ids[i] == AV_CODEC_ID_NONE) {
155  av_log(ctx, AV_LOG_ERROR, "Codec '%s' (%d) is not supported by the "
156  "bitstream filter '%s'. Supported codecs are: ",
157  desc ? desc->name : "unknown", ctx->par_in->codec_id, ctx->filter->name);
158  for (i = 0; ctx->filter->codec_ids[i] != AV_CODEC_ID_NONE; i++) {
159  desc = avcodec_descriptor_get(ctx->filter->codec_ids[i]);
160  av_log(ctx, AV_LOG_ERROR, "%s (%d) ",
161  desc ? desc->name : "unknown", ctx->filter->codec_ids[i]);
162  }
163  av_log(ctx, AV_LOG_ERROR, "\n");
164  return AVERROR(EINVAL);
165  }
166  }
167 
168  /* initialize output parameters to be the same as input
169  * init below might overwrite that */
170  ret = avcodec_parameters_copy(ctx->par_out, ctx->par_in);
171  if (ret < 0)
172  return ret;
173 
174  ctx->time_base_out = ctx->time_base_in;
175 
176  if (ctx->filter->init) {
177  ret = ctx->filter->init(ctx);
178  if (ret < 0)
179  return ret;
180  }
181 
182  return 0;
183 }
184 
186 {
187  AVBSFInternal *bsfi = ctx->internal;
188 
189  bsfi->eof = 0;
190 
192 
193  if (ctx->filter->flush)
194  ctx->filter->flush(ctx);
195 }
196 
198 {
199  AVBSFInternal *bsfi = ctx->internal;
200  int ret;
201 
202  if (!pkt || IS_EMPTY(pkt)) {
203  bsfi->eof = 1;
204  return 0;
205  }
206 
207  if (bsfi->eof) {
208  av_log(ctx, AV_LOG_ERROR, "A non-NULL packet sent after an EOF.\n");
209  return AVERROR(EINVAL);
210  }
211 
212  if (!IS_EMPTY(bsfi->buffer_pkt))
213  return AVERROR(EAGAIN);
214 
215  ret = av_packet_make_refcounted(pkt);
216  if (ret < 0)
217  return ret;
218  av_packet_move_ref(bsfi->buffer_pkt, pkt);
219 
220  return 0;
221 }
222 
224 {
225  return ctx->filter->filter(ctx, pkt);
226 }
227 
229 {
230  AVBSFInternal *bsfi = ctx->internal;
231  AVPacket *tmp_pkt;
232 
233  if (bsfi->eof)
234  return AVERROR_EOF;
235 
236  if (IS_EMPTY(bsfi->buffer_pkt))
237  return AVERROR(EAGAIN);
238 
239  tmp_pkt = av_packet_alloc();
240  if (!tmp_pkt)
241  return AVERROR(ENOMEM);
242 
243  *pkt = bsfi->buffer_pkt;
244  bsfi->buffer_pkt = tmp_pkt;
245 
246  return 0;
247 }
248 
250 {
251  AVBSFInternal *bsfi = ctx->internal;
252 
253  if (bsfi->eof)
254  return AVERROR_EOF;
255 
256  if (IS_EMPTY(bsfi->buffer_pkt))
257  return AVERROR(EAGAIN);
258 
259  av_packet_move_ref(pkt, bsfi->buffer_pkt);
260 
261  return 0;
262 }
263 
264 typedef struct BSFListContext {
265  const AVClass *class;
266 
268  int nb_bsfs;
269 
270  unsigned idx; // index of currently processed BSF
271 
272  char * item_name;
274 
275 
276 static int bsf_list_init(AVBSFContext *bsf)
277 {
278  BSFListContext *lst = bsf->priv_data;
279  int ret, i;
280  const AVCodecParameters *cod_par = bsf->par_in;
281  AVRational tb = bsf->time_base_in;
282 
283  for (i = 0; i < lst->nb_bsfs; ++i) {
284  ret = avcodec_parameters_copy(lst->bsfs[i]->par_in, cod_par);
285  if (ret < 0)
286  goto fail;
287 
288  lst->bsfs[i]->time_base_in = tb;
289 
290  ret = av_bsf_init(lst->bsfs[i]);
291  if (ret < 0)
292  goto fail;
293 
294  cod_par = lst->bsfs[i]->par_out;
295  tb = lst->bsfs[i]->time_base_out;
296  }
297 
298  bsf->time_base_out = tb;
299  ret = avcodec_parameters_copy(bsf->par_out, cod_par);
300 
301 fail:
302  return ret;
303 }
304 
306 {
307  BSFListContext *lst = bsf->priv_data;
308  int ret, eof = 0;
309 
310  if (!lst->nb_bsfs)
311  return ff_bsf_get_packet_ref(bsf, out);
312 
313  while (1) {
314  /* get a packet from the previous filter up the chain */
315  if (lst->idx)
316  ret = av_bsf_receive_packet(lst->bsfs[lst->idx-1], out);
317  else
318  ret = ff_bsf_get_packet_ref(bsf, out);
319  if (ret == AVERROR(EAGAIN)) {
320  if (!lst->idx)
321  return ret;
322  lst->idx--;
323  continue;
324  } else if (ret == AVERROR_EOF) {
325  eof = 1;
326  } else if (ret < 0)
327  return ret;
328 
329  /* send it to the next filter down the chain */
330  if (lst->idx < lst->nb_bsfs) {
331  ret = av_bsf_send_packet(lst->bsfs[lst->idx], eof ? NULL : out);
332  av_assert1(ret != AVERROR(EAGAIN));
333  if (ret < 0) {
334  av_packet_unref(out);
335  return ret;
336  }
337  lst->idx++;
338  eof = 0;
339  } else if (eof) {
340  return ret;
341  } else {
342  return 0;
343  }
344  }
345 }
346 
347 static void bsf_list_flush(AVBSFContext *bsf)
348 {
349  BSFListContext *lst = bsf->priv_data;
350 
351  for (int i = 0; i < lst->nb_bsfs; i++)
352  av_bsf_flush(lst->bsfs[i]);
353  lst->idx = 0;
354 }
355 
356 static void bsf_list_close(AVBSFContext *bsf)
357 {
358  BSFListContext *lst = bsf->priv_data;
359  int i;
360 
361  for (i = 0; i < lst->nb_bsfs; ++i)
362  av_bsf_free(&lst->bsfs[i]);
363  av_freep(&lst->bsfs);
364  av_freep(&lst->item_name);
365 }
366 
367 static const char *bsf_list_item_name(void *ctx)
368 {
369  static const char *null_filter_name = "null";
370  AVBSFContext *bsf_ctx = ctx;
371  BSFListContext *lst = bsf_ctx->priv_data;
372 
373  if (!lst->nb_bsfs)
374  return null_filter_name;
375 
376  if (!lst->item_name) {
377  int i;
378  AVBPrint bp;
379  av_bprint_init(&bp, 16, 128);
380 
381  av_bprintf(&bp, "bsf_list(");
382  for (i = 0; i < lst->nb_bsfs; i++)
383  av_bprintf(&bp, i ? ",%s" : "%s", lst->bsfs[i]->filter->name);
384  av_bprintf(&bp, ")");
385 
386  av_bprint_finalize(&bp, &lst->item_name);
387  }
388 
389  return lst->item_name;
390 }
391 
392 static const AVClass bsf_list_class = {
393  .class_name = "bsf_list",
394  .item_name = bsf_list_item_name,
395  .version = LIBAVUTIL_VERSION_INT,
396 };
397 
399  .name = "bsf_list",
400  .priv_data_size = sizeof(BSFListContext),
401  .priv_class = &bsf_list_class,
402  .init = bsf_list_init,
405  .close = bsf_list_close,
406 };
407 
408 struct AVBSFList {
410  int nb_bsfs;
411 };
412 
414 {
415  return av_mallocz(sizeof(AVBSFList));
416 }
417 
419 {
420  int i;
421 
422  if (!*lst)
423  return;
424 
425  for (i = 0; i < (*lst)->nb_bsfs; ++i)
426  av_bsf_free(&(*lst)->bsfs[i]);
427  av_free((*lst)->bsfs);
428  av_freep(lst);
429 }
430 
432 {
433  return av_dynarray_add_nofree(&lst->bsfs, &lst->nb_bsfs, bsf);
434 }
435 
436 static int bsf_list_append_internal(AVBSFList *lst, const char *bsf_name, const char *options, AVDictionary ** options_dict)
437 {
438  int ret;
439  const AVBitStreamFilter *filter;
440  AVBSFContext *bsf;
441 
442  filter = av_bsf_get_by_name(bsf_name);
443  if (!filter)
444  return AVERROR_BSF_NOT_FOUND;
445 
446  ret = av_bsf_alloc(filter, &bsf);
447  if (ret < 0)
448  return ret;
449 
450  if (options && filter->priv_class) {
451  const AVOption *opt = av_opt_next(bsf->priv_data, NULL);
452  const char * shorthand[2] = {NULL};
453 
454  if (opt)
455  shorthand[0] = opt->name;
456 
457  ret = av_opt_set_from_string(bsf->priv_data, options, shorthand, "=", ":");
458  if (ret < 0)
459  goto end;
460  }
461 
462  if (options_dict) {
463  ret = av_opt_set_dict2(bsf, options_dict, AV_OPT_SEARCH_CHILDREN);
464  if (ret < 0)
465  goto end;
466  }
467 
468  ret = av_bsf_list_append(lst, bsf);
469 
470 end:
471  if (ret < 0)
472  av_bsf_free(&bsf);
473 
474  return ret;
475 }
476 
477 int av_bsf_list_append2(AVBSFList *lst, const char *bsf_name, AVDictionary ** options)
478 {
479  return bsf_list_append_internal(lst, bsf_name, NULL, options);
480 }
481 
483 {
484  int ret = 0;
486 
487  if ((*lst)->nb_bsfs == 1) {
488  *bsf = (*lst)->bsfs[0];
489  av_freep(&(*lst)->bsfs);
490  (*lst)->nb_bsfs = 0;
491  goto end;
492  }
493 
494  ret = av_bsf_alloc(&ff_list_bsf, bsf);
495  if (ret < 0)
496  return ret;
497 
498  ctx = (*bsf)->priv_data;
499 
500  ctx->bsfs = (*lst)->bsfs;
501  ctx->nb_bsfs = (*lst)->nb_bsfs;
502 
503 end:
504  av_freep(lst);
505  return ret;
506 }
507 
508 static int bsf_parse_single(char *str, AVBSFList *bsf_lst)
509 {
510  char *bsf_name, *bsf_options_str;
511 
512  bsf_name = av_strtok(str, "=", &bsf_options_str);
513  if (!bsf_name)
514  return AVERROR(EINVAL);
515 
516  return bsf_list_append_internal(bsf_lst, bsf_name, bsf_options_str, NULL);
517 }
518 
519 int av_bsf_list_parse_str(const char *str, AVBSFContext **bsf_lst)
520 {
521  AVBSFList *lst;
522  char *bsf_str, *buf, *dup, *saveptr;
523  int ret;
524 
525  if (!str)
526  return av_bsf_get_null_filter(bsf_lst);
527 
528  lst = av_bsf_list_alloc();
529  if (!lst)
530  return AVERROR(ENOMEM);
531 
532  if (!(dup = buf = av_strdup(str))) {
533  ret = AVERROR(ENOMEM);
534  goto end;
535  }
536 
537  while (bsf_str = av_strtok(buf, ",", &saveptr)) {
538  ret = bsf_parse_single(bsf_str, lst);
539  if (ret < 0)
540  goto end;
541 
542  buf = NULL;
543  }
544 
545  ret = av_bsf_list_finalize(&lst, bsf_lst);
546 end:
547  if (ret < 0)
548  av_bsf_list_free(&lst);
549  av_free(dup);
550  return ret;
551 }
552 
554 {
555  return av_bsf_alloc(&ff_list_bsf, bsf);
556 }
int av_bsf_list_append(AVBSFList *lst, AVBSFContext *bsf)
Append bitstream filter to the list of bitstream filters.
Definition: bsf.c:431
#define NULL
Definition: coverity.c:32
const AVBitStreamFilter * av_bsf_get_by_name(const char *name)
static int bsf_parse_single(char *str, AVBSFList *bsf_lst)
Definition: bsf.c:508
AVBSFContext ** bsfs
Definition: bsf.c:267
const AVClass * priv_class
A class for the private data, used to declare bitstream filter private AVOptions. ...
Definition: bsf.h:117
AVCodecParameters * par_out
Parameters of the output stream.
Definition: bsf.h:83
void av_bprintf(AVBPrint *buf, const char *fmt,...)
Definition: bprint.c:94
static void * bsf_child_next(void *obj, void *prev)
Definition: bsf.c:64
int av_bsf_get_null_filter(AVBSFContext **bsf)
Get null/pass-through bitstream filter.
Definition: bsf.c:553
AVOption.
Definition: opt.h:246
static void flush(AVCodecContext *avctx)
#define LIBAVUTIL_VERSION_INT
Definition: version.h:85
Memory handling functions.
unsigned idx
Definition: bsf.c:270
const char * desc
Definition: nvenc.c:79
static av_cold int init(AVCodecContext *avctx)
Definition: avrndec.c:35
void av_opt_set_defaults(void *s)
Set the values of all AVOption fields to their default values.
Definition: opt.c:1357
enum AVCodecID codec_id
Specific type of the encoded data (the codec used).
Definition: codec_par.h:60
const struct AVBitStreamFilter * filter
The bitstream filter this context is an instance of.
Definition: bsf.h:58
The bitstream filter state.
Definition: bsf.h:49
int(* init)(AVBSFContext *ctx)
Definition: bsf.h:128
Structure for chain/list of bitstream filters.
Definition: bsf.c:408
static AVPacket pkt
static const char * bsf_to_name(void *bsf)
Definition: bsf.c:72
static const AVClass bsf_class
Definition: bsf.c:77
void av_bsf_flush(AVBSFContext *ctx)
Reset the internal bitstream filter state / flush internal buffers.
Definition: bsf.c:185
void * priv_data
Opaque filter-specific private data.
Definition: bsf.h:70
This struct describes the properties of an encoded stream.
Definition: codec_par.h:52
int av_bprint_finalize(AVBPrint *buf, char **ret_str)
Finalize a print buffer.
Definition: bprint.c:235
int av_opt_set_from_string(void *ctx, const char *opts, const char *const *shorthand, const char *key_val_sep, const char *pairs_sep)
Parse the key-value pairs list in opts.
Definition: opt.c:1558
const char * class_name
The name of the class; usually it is the same name as the context structure type to which the AVClass...
Definition: log.h:72
const char * name
Definition: opt.h:247
static const AVClass bsf_list_class
Definition: bsf.c:392
static void filter(int16_t *output, ptrdiff_t out_stride, int16_t *low, ptrdiff_t low_stride, int16_t *high, ptrdiff_t high_stride, int len, int clip)
Definition: cfhd.c:196
void av_packet_free(AVPacket **pkt)
Free the packet, if the packet is reference counted, it will be unreferenced first.
Definition: avpacket.c:64
AVOptions.
static av_cold int end(AVCodecContext *avctx)
Definition: avrndec.c:92
const char * name
Definition: bsf.h:99
void av_packet_move_ref(AVPacket *dst, AVPacket *src)
Move every field in src to dst and reset src.
Definition: avpacket.c:663
#define AVERROR_EOF
End of file.
Definition: error.h:55
int av_dynarray_add_nofree(void *tab_ptr, int *nb_ptr, void *elem)
Add an element to a dynamic array.
Definition: mem.c:296
#define IS_EMPTY(pkt)
Definition: bsf.c:33
#define av_log(a,...)
static void bsf_list_flush(AVBSFContext *bsf)
Definition: bsf.c:347
void avcodec_parameters_free(AVCodecParameters **par)
Free an AVCodecParameters instance and everything associated with it and write NULL to the supplied p...
Definition: utils.c:2104
int av_bsf_alloc(const AVBitStreamFilter *filter, AVBSFContext **pctx)
Allocate a context for a given bitstream filter.
Definition: bsf.c:91
#define i(width, name, range_min, range_max)
Definition: cbs_h2645.c:269
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition: log.h:176
static int bsf_list_filter(AVBSFContext *bsf, AVPacket *out)
Definition: bsf.c:305
#define AVERROR(e)
Definition: error.h:43
enum AVCodecID * codec_ids
A list of codec ids supported by the filter, terminated by AV_CODEC_ID_NONE.
Definition: bsf.h:106
void av_bprint_init(AVBPrint *buf, unsigned size_init, unsigned size_max)
Definition: bprint.c:69
AVRational time_base_in
The timebase used for the timestamps of the input packets.
Definition: bsf.h:89
simple assert() macros that are a bit more flexible than ISO C assert().
const AVOption * av_opt_next(const void *obj, const AVOption *last)
Iterate over all AVOptions belonging to obj.
Definition: opt.c:45
void(* close)(AVBSFContext *ctx)
Definition: bsf.h:130
void * av_mallocz(size_t size)
Allocate a memory block with alignment suitable for all memory accesses (including vectors if availab...
Definition: mem.c:237
AVClassCategory category
Category used for visualization (like color) This is only set if the category is equal for all object...
Definition: log.h:130
static void bsf_list_close(AVBSFContext *bsf)
Definition: bsf.c:356
int eof
Definition: bsf.c:37
int av_bsf_list_append2(AVBSFList *lst, const char *bsf_name, AVDictionary **options)
Construct new bitstream filter context given it&#39;s name and options and append it to the list of bitst...
Definition: bsf.c:477
#define fail()
Definition: checkasm.h:123
int av_bsf_init(AVBSFContext *ctx)
Prepare the filter for use, after all the parameters and options have been set.
Definition: bsf.c:144
const AVClass * ff_bsf_child_class_next(const AVClass *prev)
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...
Definition: bsf.c:519
#define av_assert1(cond)
assert() equivalent, that does not lie in speed critical code.
Definition: avassert.h:53
#define AV_OPT_SEARCH_CHILDREN
Search in possible children of the given object first.
Definition: opt.h:558
AVRational time_base_out
The timebase used for the timestamps of the output packets.
Definition: bsf.h:95
int av_packet_make_refcounted(AVPacket *pkt)
Ensure the data described by a given packet is reference counted.
Definition: avpacket.c:671
char * item_name
Definition: bsf.c:272
AVFormatContext * ctx
Definition: movenc.c:48
const AVClass * av_class
A class for logging and AVOptions.
Definition: bsf.h:53
#define AVERROR_BSF_NOT_FOUND
Bitstream filter not found.
Definition: error.h:49
int priv_data_size
Definition: bsf.h:127
const AVClass * av_bsf_get_class(void)
Get the AVClass for AVBSFContext.
Definition: bsf.c:86
int av_opt_set_dict2(void *obj, AVDictionary **options, int search_flags)
Set all the options from a given dictionary on an object.
Definition: opt.c:1630
int nb_bsfs
Definition: bsf.c:268
int(* filter)(AVBSFContext *ctx, AVPacket *pkt)
Definition: bsf.h:129
AVBSFContext ** bsfs
Definition: bsf.c:409
int av_bsf_send_packet(AVBSFContext *ctx, AVPacket *pkt)
Submit a packet for filtering.
Definition: bsf.c:197
char * av_strdup(const char *s)
Duplicate a string.
Definition: mem.c:253
void av_packet_unref(AVPacket *pkt)
Wipe the packet.
Definition: avpacket.c:605
int av_bsf_receive_packet(AVBSFContext *ctx, AVPacket *pkt)
Retrieve a filtered packet.
Definition: bsf.c:223
Describe the class of an AVClass context structure.
Definition: log.h:67
AVBSFList * av_bsf_list_alloc(void)
Allocate empty list of bitstream filters.
Definition: bsf.c:413
AVPacket * buffer_pkt
Definition: bsf.c:36
Rational number (pair of numerator and denominator).
Definition: rational.h:58
const char * name
Name of the codec described by this descriptor.
Definition: codec_desc.h:46
int nb_bsfs
Definition: bsf.c:410
This struct describes the properties of a single codec described by an AVCodecID. ...
Definition: codec_desc.h:38
char * av_strtok(char *s, const char *delim, char **saveptr)
Split the string into several tokens which can be accessed by successive calls to av_strtok()...
Definition: avstring.c:184
void(* flush)(AVBSFContext *ctx)
Definition: bsf.h:131
AVCodecParameters * avcodec_parameters_alloc(void)
Allocate a new AVCodecParameters and set its fields to default values (unknown/invalid/0).
Definition: utils.c:2094
const AVBitStreamFilter ff_list_bsf
Definition: bsf.c:398
int av_bsf_list_finalize(AVBSFList **lst, AVBSFContext **bsf)
Finalize list of bitstream filters.
Definition: bsf.c:482
void av_opt_free(void *obj)
Free all allocated objects in obj.
Definition: opt.c:1610
const OptionDef options[]
Definition: ffmpeg_opt.c:3388
int ff_bsf_get_packet(AVBSFContext *ctx, AVPacket **pkt)
Called by the bitstream filters to get the next packet for filtering.
Definition: bsf.c:228
static const char * bsf_list_item_name(void *ctx)
Definition: bsf.c:367
#define av_free(p)
static int bsf_list_append_internal(AVBSFList *lst, const char *bsf_name, const char *options, AVDictionary **options_dict)
Definition: bsf.c:436
AVPacket * av_packet_alloc(void)
Allocate an AVPacket and set its fields to default values.
Definition: avpacket.c:53
const AVCodecDescriptor * avcodec_descriptor_get(enum AVCodecID id)
Definition: codec_desc.c:3394
static int bsf_list_init(AVBSFContext *bsf)
Definition: bsf.c:276
FILE * out
Definition: movenc.c:54
#define av_freep(p)
void av_bsf_free(AVBSFContext **pctx)
Free a bitstream filter context and everything associated with it; write NULL into the supplied point...
Definition: bsf.c:40
AVBSFInternal * internal
Opaque libavcodec internal data.
Definition: bsf.h:64
int avcodec_parameters_copy(AVCodecParameters *dst, const AVCodecParameters *src)
Copy the contents of src to dst.
Definition: utils.c:2115
This structure stores compressed data.
Definition: packet.h:332
AVCodecParameters * par_in
Parameters of the input stream.
Definition: bsf.h:77
int ff_bsf_get_packet_ref(AVBSFContext *ctx, AVPacket *pkt)
Called by bitstream filters to get packet for filtering.
Definition: bsf.c:249
#define tb
Definition: regdef.h:68
void av_bsf_list_free(AVBSFList **lst)
Free list of bitstream filters.
Definition: bsf.c:418