FFmpeg coverage


Directory: ../../../ffmpeg/
File: src/libavcodec/bsf/h264_mp4toannexb.c
Date: 2026-08-11 17:55:23
Exec Total Coverage
Lines: 188 232 81.0%
Functions: 7 8 87.5%
Branches: 110 156 70.5%

Line Branch Exec Source
1 /*
2 * H.264 MP4 to Annex B byte stream format filter
3 * Copyright (c) 2007 Benoit Fouet <benoit.fouet@free.fr>
4 *
5 * This file is part of FFmpeg.
6 *
7 * FFmpeg is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
11 *
12 * FFmpeg is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with FFmpeg; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 */
21
22 #include <string.h>
23
24 #include "libavutil/avassert.h"
25 #include "libavutil/intreadwrite.h"
26 #include "libavutil/mem.h"
27
28 #include "libavcodec/bsf.h"
29 #include "libavcodec/bsf_internal.h"
30 #include "libavcodec/bytestream.h"
31 #include "libavcodec/defs.h"
32 #include "libavcodec/h264.h"
33 #include "libavcodec/sei.h"
34
35 typedef struct H264BSFContext {
36 uint8_t *sps;
37 uint8_t *pps;
38 int sps_size;
39 int pps_size;
40 unsigned sps_buf_size;
41 unsigned pps_buf_size;
42 uint8_t length_size;
43 uint8_t new_idr;
44 uint8_t idr_sps_seen;
45 uint8_t idr_pps_seen;
46 int extradata_parsed;
47 } H264BSFContext;
48
49 enum PsSource {
50 PS_OUT_OF_BAND = -1,
51 PS_NONE = 0,
52 PS_IN_BAND = 1,
53 };
54
55 3618 static void count_or_copy(uint8_t **out, uint64_t *out_size,
56 const uint8_t *in, int in_size, enum PsSource ps, int copy)
57 {
58 uint8_t start_code_size;
59
60
2/2
✓ Branch 0 taken 108 times.
✓ Branch 1 taken 3510 times.
3618 if (ps == PS_OUT_OF_BAND)
61 /* start code already present in out-of-band ps data, so don't need to
62 * add it manually again
63 */
64 108 start_code_size = 0;
65
4/4
✓ Branch 0 taken 3506 times.
✓ Branch 1 taken 4 times.
✓ Branch 2 taken 820 times.
✓ Branch 3 taken 2686 times.
3510 else if (ps == PS_IN_BAND || *out_size == 0)
66 824 start_code_size = 4;
67 else
68 2686 start_code_size = 3;
69
70
2/2
✓ Branch 0 taken 1809 times.
✓ Branch 1 taken 1809 times.
3618 if (copy) {
71 1809 memcpy(*out + start_code_size, in, in_size);
72
2/2
✓ Branch 0 taken 412 times.
✓ Branch 1 taken 1397 times.
1809 if (start_code_size == 4) {
73 412 AV_WB32(*out, 1);
74
2/2
✓ Branch 0 taken 1343 times.
✓ Branch 1 taken 54 times.
1397 } else if (start_code_size) {
75 1343 (*out)[0] =
76 1343 (*out)[1] = 0;
77 1343 (*out)[2] = 1;
78 }
79 1809 *out += start_code_size + in_size;
80 }
81 3618 *out_size += start_code_size + in_size;
82 3618 }
83
84 8 static int h264_extradata_to_annexb(AVBSFContext *ctx,
85 const uint8_t *extradata, int extradata_size,
86 uint8_t **out_extradata, int *out_extradata_size)
87 {
88 8 H264BSFContext *s = ctx->priv_data;
89 8 GetByteContext ogb, *gb = &ogb;
90 uint16_t unit_size;
91 8 uint32_t total_size = 0;
92 8 uint8_t *out = NULL, unit_nb, sps_done = 0;
93 static const uint8_t nalu_header[4] = { 0, 0, 0, 1 };
94 8 const int padding = AV_INPUT_BUFFER_PADDING_SIZE;
95 8 int length_size, pps_offset = 0;
96
97
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 8 times.
8 if (extradata_size < 7) {
98 av_log(ctx, AV_LOG_ERROR, "Invalid extradata size: %d\n", extradata_size);
99 return AVERROR_INVALIDDATA;
100 }
101
102 8 bytestream2_init(gb, extradata, extradata_size);
103
104 8 bytestream2_skipu(gb, 4);
105
106 /* retrieve length coded size */
107 8 length_size = (bytestream2_get_byteu(gb) & 0x3) + 1;
108
109 /* retrieve sps and pps unit(s) */
110 8 unit_nb = bytestream2_get_byteu(gb) & 0x1f; /* number of sps unit(s) */
111
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 8 times.
8 if (!unit_nb) {
112 goto pps;
113 }
114
115
2/2
✓ Branch 0 taken 16 times.
✓ Branch 1 taken 8 times.
24 while (unit_nb--) {
116 int err;
117
118 /* possible overread ok due to padding */
119 16 unit_size = bytestream2_get_be16u(gb);
120 16 total_size += unit_size + 4;
121 av_assert1(total_size <= INT_MAX - padding);
122
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 16 times.
16 if (bytestream2_get_bytes_left(gb) < unit_size + !sps_done) {
123 av_log(ctx, AV_LOG_ERROR, "Global extradata truncated, "
124 "corrupted stream or invalid MP4/AVCC bitstream\n");
125 av_free(out);
126 return AVERROR_INVALIDDATA;
127 }
128
1/2
✗ Branch 1 not taken.
✓ Branch 2 taken 16 times.
16 if ((err = av_reallocp(&out, total_size + padding)) < 0)
129 return err;
130 16 memcpy(out + total_size - unit_size - 4, nalu_header, 4);
131 16 bytestream2_get_bufferu(gb, out + total_size - unit_size, unit_size);
132 16 pps:
133
3/4
✓ Branch 0 taken 16 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 8 times.
✓ Branch 3 taken 8 times.
16 if (!unit_nb && !sps_done++) {
134 8 unit_nb = bytestream2_get_byteu(gb); /* number of pps unit(s) */
135 8 pps_offset = total_size;
136 }
137 }
138
139
1/2
✓ Branch 0 taken 8 times.
✗ Branch 1 not taken.
8 if (out)
140 8 memset(out + total_size, 0, padding);
141
142
1/2
✓ Branch 0 taken 8 times.
✗ Branch 1 not taken.
8 if (pps_offset) {
143 uint8_t *sps;
144
145 8 s->sps_size = pps_offset;
146 8 sps = av_fast_realloc(s->sps, &s->sps_buf_size, s->sps_size);
147
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 8 times.
8 if (!sps) {
148 av_free(out);
149 return AVERROR(ENOMEM);
150 }
151 8 s->sps = sps;
152 8 memcpy(s->sps, out, s->sps_size);
153 } else {
154 av_log(ctx, AV_LOG_WARNING,
155 "Warning: SPS NALU missing or invalid. "
156 "The resulting stream may not play.\n");
157 }
158
1/2
✓ Branch 0 taken 8 times.
✗ Branch 1 not taken.
8 if (pps_offset < total_size) {
159 uint8_t *pps;
160
161 8 s->pps_size = total_size - pps_offset;
162 8 pps = av_fast_realloc(s->pps, &s->pps_buf_size, s->pps_size);
163
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 8 times.
8 if (!pps) {
164 av_freep(&s->sps);
165 av_free(out);
166 return AVERROR(ENOMEM);
167 }
168 8 s->pps = pps;
169 8 memcpy(s->pps, out + pps_offset, s->pps_size);
170 } else {
171 av_log(ctx, AV_LOG_WARNING,
172 "Warning: PPS NALU missing or invalid. "
173 "The resulting stream may not play.\n");
174 }
175
176
3/4
✓ Branch 0 taken 7 times.
✓ Branch 1 taken 1 times.
✓ Branch 2 taken 7 times.
✗ Branch 3 not taken.
8 if (out_extradata && out_extradata_size) {
177 7 av_freep(out_extradata);
178 7 *out_extradata = out;
179 7 *out_extradata_size = total_size;
180 } else
181 1 av_freep(&out);
182
183 8 s->length_size = length_size;
184 8 s->new_idr = 1;
185 8 s->idr_sps_seen = 0;
186 8 s->idr_pps_seen = 0;
187 8 s->extradata_parsed = 1;
188
189 8 return 0;
190 }
191
192 2 static int h264_mp4toannexb_save_ps(uint8_t **dst, int *dst_size,
193 unsigned *dst_buf_size,
194 const uint8_t *nal, uint32_t nal_size,
195 int first)
196 {
197 static const uint8_t nalu_header[4] = { 0, 0, 0, 1 };
198 2 const int start_code_size = sizeof(nalu_header);
199 uint8_t *ptr;
200 uint32_t size;
201
202
1/2
✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
2 if (first)
203 2 size = 0;
204 else
205 size = *dst_size;
206
207 2 ptr = av_fast_realloc(*dst, dst_buf_size, size + nal_size + start_code_size);
208
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 2 times.
2 if (!ptr)
209 return AVERROR(ENOMEM);
210
211 2 memcpy(ptr + size, nalu_header, start_code_size);
212 2 size += start_code_size;
213 2 memcpy(ptr + size, nal, nal_size);
214 2 size += nal_size;
215
216 2 *dst = ptr;
217 2 *dst_size = size;
218 2 return 0;
219 }
220
221 412 static int h264_mp4toannexb_filter_ps(H264BSFContext *s,
222 const uint8_t *buf,
223 const uint8_t *buf_end)
224 {
225 412 int sps_count = 0;
226 412 int pps_count = 0;
227 uint8_t unit_type;
228
229 do {
230 1760 uint32_t nal_size = 0;
231
232 /* possible overread ok due to padding */
233
2/2
✓ Branch 0 taken 7040 times.
✓ Branch 1 taken 1760 times.
8800 for (int i = 0; i < s->length_size; i++)
234 7040 nal_size = (nal_size << 8) | buf[i];
235
236 1760 buf += s->length_size;
237
238 /* This check requires the cast as the right side might
239 * otherwise be promoted to an unsigned value. */
240
2/2
✓ Branch 0 taken 1 times.
✓ Branch 1 taken 1759 times.
1760 if ((int64_t)nal_size > buf_end - buf)
241 1 return AVERROR_INVALIDDATA;
242
243
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1759 times.
1759 if (!nal_size)
244 continue;
245
246 1759 unit_type = *buf & 0x1f;
247
248
2/2
✓ Branch 0 taken 1 times.
✓ Branch 1 taken 1758 times.
1759 if (unit_type == H264_NAL_SPS) {
249 1 h264_mp4toannexb_save_ps(&s->sps, &s->sps_size, &s->sps_buf_size, buf,
250 nal_size, !sps_count);
251 1 sps_count++;
252
2/2
✓ Branch 0 taken 1 times.
✓ Branch 1 taken 1757 times.
1758 } else if (unit_type == H264_NAL_PPS) {
253 1 h264_mp4toannexb_save_ps(&s->pps, &s->pps_size, &s->pps_buf_size, buf,
254 nal_size, !pps_count);
255 1 pps_count++;
256 }
257
258 1759 buf += nal_size;
259
2/2
✓ Branch 0 taken 1348 times.
✓ Branch 1 taken 411 times.
1759 } while (buf < buf_end);
260
261 411 return 0;
262 }
263
264 7 static int h264_mp4toannexb_init(AVBSFContext *ctx)
265 {
266 7 int extra_size = ctx->par_in->extradata_size;
267
268 /* retrieve sps and pps NAL units from extradata */
269
2/4
✓ Branch 0 taken 7 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 7 times.
✗ Branch 3 not taken.
7 if (!extra_size ||
270
2/4
✓ Branch 0 taken 7 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 7 times.
✗ Branch 3 not taken.
7 (extra_size >= 3 && AV_RB24(ctx->par_in->extradata) == 1) ||
271
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 7 times.
7 (extra_size >= 4 && AV_RB32(ctx->par_in->extradata) == 1)) {
272 av_log(ctx, AV_LOG_VERBOSE,
273 "The input looks like it is Annex B already\n");
274 return 0;
275 }
276 7 return h264_extradata_to_annexb(ctx,
277 7 ctx->par_in->extradata,
278 7 ctx->par_in->extradata_size,
279 7 &ctx->par_out->extradata,
280 7 &ctx->par_out->extradata_size);
281 }
282
283 831 static int h264_mp4toannexb_filter(AVBSFContext *ctx, AVPacket *opkt)
284 {
285 831 H264BSFContext *s = ctx->priv_data;
286 AVPacket *in;
287 uint8_t unit_type, new_idr, sps_seen, pps_seen;
288 const uint8_t *buf;
289 const uint8_t *buf_end;
290 uint8_t *out;
291 uint64_t out_size;
292 int ret;
293 size_t extradata_size;
294 uint8_t *extradata;
295
296 831 ret = ff_bsf_get_packet(ctx, &in);
297
2/2
✓ Branch 0 taken 419 times.
✓ Branch 1 taken 412 times.
831 if (ret < 0)
298 419 return ret;
299
300 412 extradata = av_packet_get_side_data(in, AV_PKT_DATA_NEW_EXTRADATA,
301 &extradata_size);
302
3/4
✓ Branch 0 taken 1 times.
✓ Branch 1 taken 411 times.
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
412 if (extradata && extradata[0] == 1) {
303 1 ret = h264_extradata_to_annexb(ctx, extradata, extradata_size, NULL, NULL);
304
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
1 if (ret < 0)
305 goto fail;
306 1 av_packet_side_data_remove(in->side_data, &in->side_data_elems,
307 AV_PKT_DATA_NEW_EXTRADATA);
308 }
309
310 /* nothing to filter */
311
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 412 times.
412 if (!s->extradata_parsed) {
312 av_packet_move_ref(opkt, in);
313 av_packet_free(&in);
314 return 0;
315 }
316
317 412 buf_end = in->data + in->size;
318 412 ret = h264_mp4toannexb_filter_ps(s, in->data, buf_end);
319
2/2
✓ Branch 0 taken 1 times.
✓ Branch 1 taken 411 times.
412 if (ret < 0)
320 1 goto fail;
321
322 #define LOG_ONCE(...) \
323 if (j) \
324 av_log(__VA_ARGS__)
325
2/2
✓ Branch 0 taken 822 times.
✓ Branch 1 taken 411 times.
1233 for (int j = 0; j < 2; j++) {
326 822 buf = in->data;
327 822 new_idr = s->new_idr;
328 822 sps_seen = s->idr_sps_seen;
329 822 pps_seen = s->idr_pps_seen;
330 822 out_size = 0;
331
332 do {
333 3510 uint32_t nal_size = 0;
334 enum PsSource ps;
335
336 /* possible overread ok due to padding */
337
2/2
✓ Branch 0 taken 14040 times.
✓ Branch 1 taken 3510 times.
17550 for (int i = 0; i < s->length_size; i++)
338 14040 nal_size = (nal_size << 8) | buf[i];
339
340 3510 buf += s->length_size;
341
342 /* This check requires the cast as the right side might
343 * otherwise be promoted to an unsigned value. */
344
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 3510 times.
3510 if ((int64_t)nal_size > buf_end - buf) {
345 ret = AVERROR_INVALIDDATA;
346 goto fail;
347 }
348
349
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 3510 times.
3510 if (!nal_size)
350 continue;
351
352 3510 unit_type = *buf & 0x1f;
353
354
2/2
✓ Branch 0 taken 2 times.
✓ Branch 1 taken 3508 times.
3510 if (unit_type == H264_NAL_SPS) {
355 2 sps_seen = new_idr = 1;
356
2/2
✓ Branch 0 taken 2 times.
✓ Branch 1 taken 3506 times.
3508 } else if (unit_type == H264_NAL_PPS) {
357 2 pps_seen = new_idr = 1;
358 /* if SPS has not been seen yet, prepend the AVCC one to PPS */
359
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 2 times.
2 if (!sps_seen) {
360 if (!s->sps_size) {
361 LOG_ONCE(ctx, AV_LOG_WARNING, "SPS not present in the stream, nor in AVCC, stream may be unreadable\n");
362 } else {
363 count_or_copy(&out, &out_size, s->sps, s->sps_size, PS_OUT_OF_BAND, j);
364 sps_seen = 1;
365 }
366 }
367 }
368
369 /* If this is a new IDR picture following an IDR picture, reset the idr flag.
370 * Just check first_mb_in_slice to be 0 as this is the simplest solution.
371 * This could be checking idr_pic_id instead, but would complexify the parsing. */
372
5/6
✓ Branch 0 taken 70 times.
✓ Branch 1 taken 3440 times.
✓ Branch 2 taken 56 times.
✓ Branch 3 taken 14 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 56 times.
3510 if (!new_idr && unit_type == H264_NAL_IDR_SLICE && (buf[1] & 0x80))
373 new_idr = 1;
374
375 /* If this is a buffering period SEI without a corresponding sps/pps
376 * then prepend any existing sps/pps before the SEI */
377
5/6
✓ Branch 0 taken 864 times.
✓ Branch 1 taken 2646 times.
✓ Branch 2 taken 40 times.
✓ Branch 3 taken 824 times.
✓ Branch 4 taken 40 times.
✗ Branch 5 not taken.
3510 if (unit_type == H264_NAL_SEI && buf[1] == SEI_TYPE_BUFFERING_PERIOD &&
378
1/2
✓ Branch 0 taken 40 times.
✗ Branch 1 not taken.
40 !sps_seen && !pps_seen) {
379
1/2
✓ Branch 0 taken 40 times.
✗ Branch 1 not taken.
40 if (s->sps_size) {
380 40 count_or_copy(&out, &out_size, s->sps, s->sps_size, PS_OUT_OF_BAND, j);
381 40 sps_seen = 1;
382 }
383
1/2
✓ Branch 0 taken 40 times.
✗ Branch 1 not taken.
40 if (s->pps_size) {
384 40 count_or_copy(&out, &out_size, s->pps, s->pps_size, PS_OUT_OF_BAND, j);
385 40 pps_seen = 1;
386 }
387 }
388
389 /* prepend only to the first type 5 NAL unit of an IDR picture, if no sps/pps are already present */
390
7/8
✓ Branch 0 taken 3440 times.
✓ Branch 1 taken 70 times.
✓ Branch 2 taken 84 times.
✓ Branch 3 taken 3356 times.
✓ Branch 4 taken 14 times.
✓ Branch 5 taken 70 times.
✓ Branch 6 taken 14 times.
✗ Branch 7 not taken.
3510 if (new_idr && unit_type == H264_NAL_IDR_SLICE && !sps_seen && !pps_seen) {
391
1/2
✓ Branch 0 taken 14 times.
✗ Branch 1 not taken.
14 if (s->sps_size)
392 14 count_or_copy(&out, &out_size, s->sps, s->sps_size, PS_OUT_OF_BAND, j);
393
1/2
✓ Branch 0 taken 14 times.
✗ Branch 1 not taken.
14 if (s->pps_size)
394 14 count_or_copy(&out, &out_size, s->pps, s->pps_size, PS_OUT_OF_BAND, j);
395 14 new_idr = 0;
396 /* if only SPS has been seen, also insert PPS */
397
6/8
✓ Branch 0 taken 3426 times.
✓ Branch 1 taken 70 times.
✓ Branch 2 taken 70 times.
✓ Branch 3 taken 3356 times.
✓ Branch 4 taken 70 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 70 times.
3496 } else if (new_idr && unit_type == H264_NAL_IDR_SLICE && sps_seen && !pps_seen) {
398 if (!s->pps_size) {
399 LOG_ONCE(ctx, AV_LOG_WARNING, "PPS not present in the stream, nor in AVCC, stream may be unreadable\n");
400 } else {
401 count_or_copy(&out, &out_size, s->pps, s->pps_size, PS_OUT_OF_BAND, j);
402 }
403 }
404
405
4/4
✓ Branch 0 taken 3508 times.
✓ Branch 1 taken 2 times.
✓ Branch 2 taken 2 times.
✓ Branch 3 taken 3506 times.
3510 if (unit_type == H264_NAL_SPS || unit_type == H264_NAL_PPS)
406 4 ps = PS_IN_BAND;
407 else
408 3506 ps = PS_NONE;
409 3510 count_or_copy(&out, &out_size, buf, nal_size, ps, j);
410
2/2
✓ Branch 0 taken 1760 times.
✓ Branch 1 taken 1750 times.
3510 if (unit_type == H264_NAL_SLICE) {
411 1760 new_idr = 1;
412 1760 sps_seen = 0;
413 1760 pps_seen = 0;
414 }
415
416 3510 buf += nal_size;
417
2/2
✓ Branch 0 taken 2688 times.
✓ Branch 1 taken 822 times.
3510 } while (buf < buf_end);
418
419
2/2
✓ Branch 0 taken 411 times.
✓ Branch 1 taken 411 times.
822 if (!j) {
420
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 411 times.
411 if (out_size > INT_MAX - AV_INPUT_BUFFER_PADDING_SIZE) {
421 ret = AVERROR_INVALIDDATA;
422 goto fail;
423 }
424 411 ret = av_new_packet(opkt, out_size);
425
1/2
✗ Branch 0 not taken.
✓ Branch 1 taken 411 times.
411 if (ret < 0)
426 goto fail;
427 411 out = opkt->data;
428 }
429 }
430 #undef LOG_ONCE
431
432 av_assert1(out_size == opkt->size);
433
434 411 s->new_idr = new_idr;
435 411 s->idr_sps_seen = sps_seen;
436 411 s->idr_pps_seen = pps_seen;
437
438 411 ret = av_packet_copy_props(opkt, in);
439
1/2
✓ Branch 0 taken 411 times.
✗ Branch 1 not taken.
411 if (ret < 0)
440 goto fail;
441
442 411 fail:
443
2/2
✓ Branch 0 taken 1 times.
✓ Branch 1 taken 411 times.
412 if (ret < 0)
444 1 av_packet_unref(opkt);
445 412 av_packet_free(&in);
446
447 412 return ret;
448 }
449
450 7 static void h264_mp4toannexb_close(AVBSFContext *ctx)
451 {
452 7 H264BSFContext *s = ctx->priv_data;
453
454 7 av_freep(&s->sps);
455 7 av_freep(&s->pps);
456 7 }
457
458 static void h264_mp4toannexb_flush(AVBSFContext *ctx)
459 {
460 H264BSFContext *s = ctx->priv_data;
461
462 s->idr_sps_seen = 0;
463 s->idr_pps_seen = 0;
464 s->new_idr = s->extradata_parsed;
465 }
466
467 static const enum AVCodecID codec_ids[] = {
468 AV_CODEC_ID_H264, AV_CODEC_ID_NONE,
469 };
470
471 const FFBitStreamFilter ff_h264_mp4toannexb_bsf = {
472 .p.name = "h264_mp4toannexb",
473 .p.codec_ids = codec_ids,
474 .priv_data_size = sizeof(H264BSFContext),
475 .init = h264_mp4toannexb_init,
476 .filter = h264_mp4toannexb_filter,
477 .close = h264_mp4toannexb_close,
478 .flush = h264_mp4toannexb_flush,
479 };
480