FFmpeg coverage


Directory: ../../../ffmpeg/
File: src/libavcodec/bsf.c
Date: 2022-07-04 19:11:22
Exec Total Coverage
Lines: 196 273 71.8%
Branches: 96 156 61.5%

Line Branch Exec Source
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 "config_components.h"
22
23 #include "libavutil/avassert.h"
24 #include "libavutil/log.h"
25 #include "libavutil/mem.h"
26 #include "libavutil/opt.h"
27 #include "libavutil/avstring.h"
28 #include "libavutil/bprint.h"
29
30 #include "bsf.h"
31 #include "bsf_internal.h"
32 #include "codec_desc.h"
33 #include "codec_par.h"
34
35 #define IS_EMPTY(pkt) (!(pkt)->data && !(pkt)->side_data_elems)
36
37 820443 static av_always_inline const FFBitStreamFilter *ff_bsf(const AVBitStreamFilter *bsf)
38 {
39 820443 return (const FFBitStreamFilter*)bsf;
40 }
41
42 typedef struct FFBSFContext {
43 AVBSFContext pub;
44 AVPacket *buffer_pkt;
45 int eof;
46 } FFBSFContext;
47
48 1199831 static av_always_inline FFBSFContext *ffbsfcontext(AVBSFContext *ctx)
49 {
50 1199831 return (FFBSFContext *)ctx;
51 }
52
53 72807 void av_bsf_free(AVBSFContext **pctx)
54 {
55 AVBSFContext *ctx;
56 FFBSFContext *bsfi;
57
58
3/4
✓ Branch 0 taken 72807 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 58608 times.
✓ Branch 3 taken 14199 times.
72807 if (!pctx || !*pctx)
59 58608 return;
60 14199 ctx = *pctx;
61 14199 bsfi = ffbsfcontext(ctx);
62
63
2/2
✓ Branch 0 taken 1304 times.
✓ Branch 1 taken 12895 times.
14199 if (ctx->priv_data) {
64
2/2
✓ Branch 1 taken 1284 times.
✓ Branch 2 taken 20 times.
1304 if (ff_bsf(ctx->filter)->close)
65 1284 ff_bsf(ctx->filter)->close(ctx);
66
2/2
✓ Branch 0 taken 785 times.
✓ Branch 1 taken 519 times.
1304 if (ctx->filter->priv_class)
67 785 av_opt_free(ctx->priv_data);
68 1304 av_freep(&ctx->priv_data);
69 }
70 14199 av_packet_free(&bsfi->buffer_pkt);
71
72 14199 avcodec_parameters_free(&ctx->par_in);
73 14199 avcodec_parameters_free(&ctx->par_out);
74
75 14199 av_freep(pctx);
76 }
77
78 static void *bsf_child_next(void *obj, void *prev)
79 {
80 AVBSFContext *ctx = obj;
81 if (!prev && ctx->filter->priv_class)
82 return ctx->priv_data;
83 return NULL;
84 }
85
86 3 static const char *bsf_to_name(void *bsf)
87 {
88 3 return ((AVBSFContext *)bsf)->filter->name;
89 }
90
91 static const AVClass bsf_class = {
92 .class_name = "AVBSFContext",
93 .item_name = bsf_to_name,
94 .version = LIBAVUTIL_VERSION_INT,
95 .child_next = bsf_child_next,
96 .child_class_iterate = ff_bsf_child_class_iterate,
97 .category = AV_CLASS_CATEGORY_BITSTREAM_FILTER,
98 };
99
100 const AVClass *av_bsf_get_class(void)
101 {
102 return &bsf_class;
103 }
104
105 14199 int av_bsf_alloc(const AVBitStreamFilter *filter, AVBSFContext **pctx)
106 {
107 AVBSFContext *ctx;
108 FFBSFContext *bsfi;
109 int ret;
110
111 14199 bsfi = av_mallocz(sizeof(*bsfi));
112
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 14199 times.
14199 if (!bsfi)
113 return AVERROR(ENOMEM);
114 14199 ctx = &bsfi->pub;
115
116 14199 ctx->av_class = &bsf_class;
117 14199 ctx->filter = filter;
118
119 14199 ctx->par_in = avcodec_parameters_alloc();
120 14199 ctx->par_out = avcodec_parameters_alloc();
121
2/4
✓ Branch 0 taken 14199 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 14199 times.
14199 if (!ctx->par_in || !ctx->par_out) {
122 ret = AVERROR(ENOMEM);
123 goto fail;
124 }
125 /* allocate priv data and init private options */
126
2/2
✓ Branch 1 taken 1304 times.
✓ Branch 2 taken 12895 times.
14199 if (ff_bsf(filter)->priv_data_size) {
127 1304 ctx->priv_data = av_mallocz(ff_bsf(filter)->priv_data_size);
128
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1304 times.
1304 if (!ctx->priv_data) {
129 ret = AVERROR(ENOMEM);
130 goto fail;
131 }
132
2/2
✓ Branch 0 taken 785 times.
✓ Branch 1 taken 519 times.
1304 if (filter->priv_class) {
133 785 *(const AVClass **)ctx->priv_data = filter->priv_class;
134 785 av_opt_set_defaults(ctx->priv_data);
135 }
136 }
137 14199 bsfi->buffer_pkt = av_packet_alloc();
138
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 14199 times.
14199 if (!bsfi->buffer_pkt) {
139 ret = AVERROR(ENOMEM);
140 goto fail;
141 }
142
143 14199 *pctx = ctx;
144 14199 return 0;
145 fail:
146 av_bsf_free(&ctx);
147 return ret;
148 }
149
150 14199 int av_bsf_init(AVBSFContext *ctx)
151 {
152 int ret, i;
153
154 /* check that the codec is supported */
155
2/2
✓ Branch 0 taken 1295 times.
✓ Branch 1 taken 12904 times.
14199 if (ctx->filter->codec_ids) {
156
1/2
✓ Branch 0 taken 4961 times.
✗ Branch 1 not taken.
4961 for (i = 0; ctx->filter->codec_ids[i] != AV_CODEC_ID_NONE; i++)
157
2/2
✓ Branch 0 taken 1295 times.
✓ Branch 1 taken 3666 times.
4961 if (ctx->par_in->codec_id == ctx->filter->codec_ids[i])
158 1295 break;
159
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1295 times.
1295 if (ctx->filter->codec_ids[i] == AV_CODEC_ID_NONE) {
160 const AVCodecDescriptor *desc = avcodec_descriptor_get(ctx->par_in->codec_id);
161 av_log(ctx, AV_LOG_ERROR, "Codec '%s' (%d) is not supported by the "
162 "bitstream filter '%s'. Supported codecs are: ",
163 desc ? desc->name : "unknown", ctx->par_in->codec_id, ctx->filter->name);
164 for (i = 0; ctx->filter->codec_ids[i] != AV_CODEC_ID_NONE; i++) {
165 enum AVCodecID codec_id = ctx->filter->codec_ids[i];
166 av_log(ctx, AV_LOG_ERROR, "%s (%d) ",
167 avcodec_get_name(codec_id), codec_id);
168 }
169 av_log(ctx, AV_LOG_ERROR, "\n");
170 return AVERROR(EINVAL);
171 }
172 }
173
174 /* initialize output parameters to be the same as input
175 * init below might overwrite that */
176 14199 ret = avcodec_parameters_copy(ctx->par_out, ctx->par_in);
177
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 14199 times.
14199 if (ret < 0)
178 return ret;
179
180 14199 ctx->time_base_out = ctx->time_base_in;
181
182
2/2
✓ Branch 1 taken 1294 times.
✓ Branch 2 taken 12905 times.
14199 if (ff_bsf(ctx->filter)->init) {
183 1294 ret = ff_bsf(ctx->filter)->init(ctx);
184
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1294 times.
1294 if (ret < 0)
185 return ret;
186 }
187
188 14199 return 0;
189 }
190
191 89 void av_bsf_flush(AVBSFContext *ctx)
192 {
193 89 FFBSFContext *const bsfi = ffbsfcontext(ctx);
194
195 89 bsfi->eof = 0;
196
197 89 av_packet_unref(bsfi->buffer_pkt);
198
199
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 89 times.
89 if (ff_bsf(ctx->filter)->flush)
200 ff_bsf(ctx->filter)->flush(ctx);
201 89 }
202
203 398613 int av_bsf_send_packet(AVBSFContext *ctx, AVPacket *pkt)
204 {
205 398613 FFBSFContext *const bsfi = ffbsfcontext(ctx);
206 int ret;
207
208
5/6
✓ Branch 0 taken 398517 times.
✓ Branch 1 taken 96 times.
✓ Branch 2 taken 6138 times.
✓ Branch 3 taken 392379 times.
✓ Branch 4 taken 6138 times.
✗ Branch 5 not taken.
398613 if (!pkt || IS_EMPTY(pkt)) {
209
2/2
✓ Branch 0 taken 6138 times.
✓ Branch 1 taken 96 times.
6234 if (pkt)
210 6138 av_packet_unref(pkt);
211 6234 bsfi->eof = 1;
212 6234 return 0;
213 }
214
215
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 392379 times.
392379 if (bsfi->eof) {
216 av_log(ctx, AV_LOG_ERROR, "A non-NULL packet sent after an EOF.\n");
217 return AVERROR(EINVAL);
218 }
219
220
3/4
✓ Branch 0 taken 392312 times.
✓ Branch 1 taken 67 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 392312 times.
392379 if (!IS_EMPTY(bsfi->buffer_pkt))
221 67 return AVERROR(EAGAIN);
222
223 392312 ret = av_packet_make_refcounted(pkt);
224
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 392312 times.
392312 if (ret < 0)
225 return ret;
226 392312 av_packet_move_ref(bsfi->buffer_pkt, pkt);
227
228 392312 return 0;
229 }
230
231 786770 int av_bsf_receive_packet(AVBSFContext *ctx, AVPacket *pkt)
232 {
233 786770 return ff_bsf(ctx->filter)->filter(ctx, pkt);
234 }
235
236 897 int ff_bsf_get_packet(AVBSFContext *ctx, AVPacket **pkt)
237 {
238 897 FFBSFContext *const bsfi = ffbsfcontext(ctx);
239 AVPacket *tmp_pkt;
240
241
2/2
✓ Branch 0 taken 6 times.
✓ Branch 1 taken 891 times.
897 if (bsfi->eof)
242 6 return AVERROR_EOF;
243
244
3/4
✓ Branch 0 taken 445 times.
✓ Branch 1 taken 446 times.
✓ Branch 2 taken 445 times.
✗ Branch 3 not taken.
891 if (IS_EMPTY(bsfi->buffer_pkt))
245 445 return AVERROR(EAGAIN);
246
247 446 tmp_pkt = av_packet_alloc();
248
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 446 times.
446 if (!tmp_pkt)
249 return AVERROR(ENOMEM);
250
251 446 *pkt = bsfi->buffer_pkt;
252 446 bsfi->buffer_pkt = tmp_pkt;
253
254 446 return 0;
255 }
256
257 786033 int ff_bsf_get_packet_ref(AVBSFContext *ctx, AVPacket *pkt)
258 {
259 786033 FFBSFContext *const bsfi = ffbsfcontext(ctx);
260
261
2/2
✓ Branch 0 taken 6239 times.
✓ Branch 1 taken 779794 times.
786033 if (bsfi->eof)
262 6239 return AVERROR_EOF;
263
264
3/4
✓ Branch 0 taken 387930 times.
✓ Branch 1 taken 391864 times.
✓ Branch 2 taken 387930 times.
✗ Branch 3 not taken.
779794 if (IS_EMPTY(bsfi->buffer_pkt))
265 387930 return AVERROR(EAGAIN);
266
267 391864 av_packet_move_ref(pkt, bsfi->buffer_pkt);
268
269 391864 return 0;
270 }
271
272 typedef struct BSFListContext {
273 const AVClass *class;
274
275 AVBSFContext **bsfs;
276 int nb_bsfs;
277
278 unsigned idx; // index of currently processed BSF
279
280 char * item_name;
281 } BSFListContext;
282
283
284 2 static int bsf_list_init(AVBSFContext *bsf)
285 {
286 2 BSFListContext *lst = bsf->priv_data;
287 int ret, i;
288 2 const AVCodecParameters *cod_par = bsf->par_in;
289 2 AVRational tb = bsf->time_base_in;
290
291
2/2
✓ Branch 0 taken 4 times.
✓ Branch 1 taken 2 times.
6 for (i = 0; i < lst->nb_bsfs; ++i) {
292 4 ret = avcodec_parameters_copy(lst->bsfs[i]->par_in, cod_par);
293
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
4 if (ret < 0)
294 goto fail;
295
296 4 lst->bsfs[i]->time_base_in = tb;
297
298 4 ret = av_bsf_init(lst->bsfs[i]);
299
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
4 if (ret < 0)
300 goto fail;
301
302 4 cod_par = lst->bsfs[i]->par_out;
303 4 tb = lst->bsfs[i]->time_base_out;
304 }
305
306 2 bsf->time_base_out = tb;
307 2 ret = avcodec_parameters_copy(bsf->par_out, cod_par);
308
309 2 fail:
310 2 return ret;
311 }
312
313 16 static int bsf_list_filter(AVBSFContext *bsf, AVPacket *out)
314 {
315 16 BSFListContext *lst = bsf->priv_data;
316 16 int ret, eof = 0;
317
318
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 16 times.
16 if (!lst->nb_bsfs)
319 return ff_bsf_get_packet_ref(bsf, out);
320
321 while (1) {
322 /* get a packet from the previous filter up the chain */
323
2/2
✓ Branch 0 taken 24 times.
✓ Branch 1 taken 24 times.
48 if (lst->idx)
324 24 ret = av_bsf_receive_packet(lst->bsfs[lst->idx-1], out);
325 else
326 24 ret = ff_bsf_get_packet_ref(bsf, out);
327
2/2
✓ Branch 0 taken 25 times.
✓ Branch 1 taken 23 times.
48 if (ret == AVERROR(EAGAIN)) {
328
2/2
✓ Branch 0 taken 11 times.
✓ Branch 1 taken 14 times.
25 if (!lst->idx)
329 11 return ret;
330 14 lst->idx--;
331 14 continue;
332
2/2
✓ Branch 0 taken 6 times.
✓ Branch 1 taken 17 times.
23 } else if (ret == AVERROR_EOF) {
333 6 eof = 1;
334
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 17 times.
17 } else if (ret < 0)
335 return ret;
336
337 /* send it to the next filter down the chain */
338
2/2
✓ Branch 0 taken 18 times.
✓ Branch 1 taken 5 times.
23 if (lst->idx < lst->nb_bsfs) {
339
2/2
✓ Branch 0 taken 14 times.
✓ Branch 1 taken 4 times.
18 ret = av_bsf_send_packet(lst->bsfs[lst->idx], eof ? NULL : out);
340 av_assert1(ret != AVERROR(EAGAIN));
341
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 18 times.
18 if (ret < 0) {
342 av_packet_unref(out);
343 return ret;
344 }
345 18 lst->idx++;
346 18 eof = 0;
347
2/2
✓ Branch 0 taken 2 times.
✓ Branch 1 taken 3 times.
5 } else if (eof) {
348 2 return ret;
349 } else {
350 3 return 0;
351 }
352 }
353 }
354
355 static void bsf_list_flush(AVBSFContext *bsf)
356 {
357 BSFListContext *lst = bsf->priv_data;
358
359 for (int i = 0; i < lst->nb_bsfs; i++)
360 av_bsf_flush(lst->bsfs[i]);
361 lst->idx = 0;
362 }
363
364 2 static void bsf_list_close(AVBSFContext *bsf)
365 {
366 2 BSFListContext *lst = bsf->priv_data;
367 int i;
368
369
2/2
✓ Branch 0 taken 4 times.
✓ Branch 1 taken 2 times.
6 for (i = 0; i < lst->nb_bsfs; ++i)
370 4 av_bsf_free(&lst->bsfs[i]);
371 2 av_freep(&lst->bsfs);
372 2 av_freep(&lst->item_name);
373 2 }
374
375 static const char *bsf_list_item_name(void *ctx)
376 {
377 static const char *null_filter_name = "null";
378 AVBSFContext *bsf_ctx = ctx;
379 BSFListContext *lst = bsf_ctx->priv_data;
380
381 if (!lst->nb_bsfs)
382 return null_filter_name;
383
384 if (!lst->item_name) {
385 int i;
386 AVBPrint bp;
387 av_bprint_init(&bp, 16, 128);
388
389 av_bprintf(&bp, "bsf_list(");
390 for (i = 0; i < lst->nb_bsfs; i++)
391 av_bprintf(&bp, i ? ",%s" : "%s", lst->bsfs[i]->filter->name);
392 av_bprintf(&bp, ")");
393
394 av_bprint_finalize(&bp, &lst->item_name);
395 }
396
397 return lst->item_name;
398 }
399
400 static const AVClass bsf_list_class = {
401 .class_name = "bsf_list",
402 .item_name = bsf_list_item_name,
403 .version = LIBAVUTIL_VERSION_INT,
404 };
405
406 static const FFBitStreamFilter list_bsf = {
407 .p.name = "bsf_list",
408 .p.priv_class = &bsf_list_class,
409 .priv_data_size = sizeof(BSFListContext),
410 .init = bsf_list_init,
411 .filter = bsf_list_filter,
412 .flush = bsf_list_flush,
413 .close = bsf_list_close,
414 };
415
416 struct AVBSFList {
417 AVBSFContext **bsfs;
418 int nb_bsfs;
419 };
420
421 582 AVBSFList *av_bsf_list_alloc(void)
422 {
423 582 return av_mallocz(sizeof(AVBSFList));
424 }
425
426 void av_bsf_list_free(AVBSFList **lst)
427 {
428 int i;
429
430 if (!*lst)
431 return;
432
433 for (i = 0; i < (*lst)->nb_bsfs; ++i)
434 av_bsf_free(&(*lst)->bsfs[i]);
435 av_free((*lst)->bsfs);
436 av_freep(lst);
437 }
438
439 584 int av_bsf_list_append(AVBSFList *lst, AVBSFContext *bsf)
440 {
441 584 return av_dynarray_add_nofree(&lst->bsfs, &lst->nb_bsfs, bsf);
442 }
443
444 584 static int bsf_list_append_internal(AVBSFList *lst, const char *bsf_name, const char *options, AVDictionary ** options_dict)
445 {
446 int ret;
447 const AVBitStreamFilter *filter;
448 AVBSFContext *bsf;
449
450 584 filter = av_bsf_get_by_name(bsf_name);
451
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 584 times.
584 if (!filter)
452 return AVERROR_BSF_NOT_FOUND;
453
454 584 ret = av_bsf_alloc(filter, &bsf);
455
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 584 times.
584 if (ret < 0)
456 return ret;
457
458
3/4
✓ Branch 0 taken 18 times.
✓ Branch 1 taken 566 times.
✓ Branch 2 taken 18 times.
✗ Branch 3 not taken.
584 if (options && filter->priv_class) {
459 18 const AVOption *opt = av_opt_next(bsf->priv_data, NULL);
460 18 const char * shorthand[2] = {NULL};
461
462
1/2
✓ Branch 0 taken 18 times.
✗ Branch 1 not taken.
18 if (opt)
463 18 shorthand[0] = opt->name;
464
465 18 ret = av_opt_set_from_string(bsf->priv_data, options, shorthand, "=", ":");
466
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 18 times.
18 if (ret < 0)
467 goto end;
468 }
469
470
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 584 times.
584 if (options_dict) {
471 ret = av_opt_set_dict2(bsf, options_dict, AV_OPT_SEARCH_CHILDREN);
472 if (ret < 0)
473 goto end;
474 }
475
476 584 ret = av_bsf_list_append(lst, bsf);
477
478 584 end:
479
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 584 times.
584 if (ret < 0)
480 av_bsf_free(&bsf);
481
482 584 return ret;
483 }
484
485 int av_bsf_list_append2(AVBSFList *lst, const char *bsf_name, AVDictionary ** options)
486 {
487 return bsf_list_append_internal(lst, bsf_name, NULL, options);
488 }
489
490 582 int av_bsf_list_finalize(AVBSFList **lst, AVBSFContext **bsf)
491 {
492 582 int ret = 0;
493 BSFListContext *ctx;
494
495
2/2
✓ Branch 0 taken 580 times.
✓ Branch 1 taken 2 times.
582 if ((*lst)->nb_bsfs == 1) {
496 580 *bsf = (*lst)->bsfs[0];
497 580 av_freep(&(*lst)->bsfs);
498 580 (*lst)->nb_bsfs = 0;
499 580 goto end;
500 }
501
502 2 ret = av_bsf_alloc(&list_bsf.p, bsf);
503
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 2 times.
2 if (ret < 0)
504 return ret;
505
506 2 ctx = (*bsf)->priv_data;
507
508 2 ctx->bsfs = (*lst)->bsfs;
509 2 ctx->nb_bsfs = (*lst)->nb_bsfs;
510
511 582 end:
512 582 av_freep(lst);
513 582 return ret;
514 }
515
516 584 static int bsf_parse_single(char *str, AVBSFList *bsf_lst)
517 {
518 char *bsf_name, *bsf_options_str;
519
520 584 bsf_name = av_strtok(str, "=", &bsf_options_str);
521
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 584 times.
584 if (!bsf_name)
522 return AVERROR(EINVAL);
523
524 584 return bsf_list_append_internal(bsf_lst, bsf_name, bsf_options_str, NULL);
525 }
526
527 13475 int av_bsf_list_parse_str(const char *str, AVBSFContext **bsf_lst)
528 {
529 AVBSFList *lst;
530 int ret;
531
532
2/2
✓ Branch 0 taken 12893 times.
✓ Branch 1 taken 582 times.
13475 if (!str)
533 12893 return av_bsf_get_null_filter(bsf_lst);
534
535 582 lst = av_bsf_list_alloc();
536
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 582 times.
582 if (!lst)
537 return AVERROR(ENOMEM);
538
539 do {
540 584 char *bsf_str = av_get_token(&str, ",");
541 584 ret = bsf_parse_single(bsf_str, lst);
542 584 av_free(bsf_str);
543
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 584 times.
584 if (ret < 0)
544 goto end;
545
3/4
✓ Branch 0 taken 2 times.
✓ Branch 1 taken 582 times.
✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
584 } while (*str && *++str);
546
547 582 ret = av_bsf_list_finalize(&lst, bsf_lst);
548 582 end:
549
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 582 times.
582 if (ret < 0)
550 av_bsf_list_free(&lst);
551 582 return ret;
552 }
553
554 12893 int av_bsf_get_null_filter(AVBSFContext **bsf)
555 {
556 #if CONFIG_NULL_BSF
557 extern const FFBitStreamFilter ff_null_bsf;
558 12893 return av_bsf_alloc(&ff_null_bsf.p, bsf);
559 #else
560 return av_bsf_alloc(&list_bsf.p, bsf);
561 #endif
562 }
563