FFmpeg coverage


Directory: ../../../ffmpeg/
File: src/libavcodec/bsf.c
Date: 2026-07-22 00:55:30
Exec Total Coverage
Lines: 194 274 70.8%
Functions: 20 26 76.9%
Branches: 96 158 60.8%

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