FFmpeg
h264_mp4toannexb.c
Go to the documentation of this file.
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 "bsf.h"
29 #include "bsf_internal.h"
30 #include "bytestream.h"
31 #include "defs.h"
32 #include "h264.h"
33 
34 typedef struct H264BSFContext {
35  uint8_t *sps;
36  uint8_t *pps;
37  int sps_size;
38  int pps_size;
39  unsigned sps_buf_size;
40  unsigned pps_buf_size;
41  uint8_t length_size;
42  uint8_t new_idr;
43  uint8_t idr_sps_seen;
44  uint8_t idr_pps_seen;
47 
48 enum PsSource {
50  PS_NONE = 0,
52 };
53 
54 static void count_or_copy(uint8_t **out, uint64_t *out_size,
55  const uint8_t *in, int in_size, enum PsSource ps, int copy)
56 {
57  uint8_t start_code_size;
58 
59  if (ps == PS_OUT_OF_BAND)
60  /* start code already present in out-of-band ps data, so don't need to
61  * add it manually again
62  */
63  start_code_size = 0;
64  else if (ps == PS_IN_BAND || *out_size == 0)
65  start_code_size = 4;
66  else
67  start_code_size = 3;
68 
69  if (copy) {
70  memcpy(*out + start_code_size, in, in_size);
71  if (start_code_size == 4) {
72  AV_WB32(*out, 1);
73  } else if (start_code_size) {
74  (*out)[0] =
75  (*out)[1] = 0;
76  (*out)[2] = 1;
77  }
78  *out += start_code_size + in_size;
79  }
80  *out_size += start_code_size + in_size;
81 }
82 
84  uint8_t *extradata, int extradata_size)
85 {
87  GetByteContext ogb, *gb = &ogb;
88  uint16_t unit_size;
89  uint32_t total_size = 0;
90  uint8_t *out = NULL, unit_nb, sps_done = 0;
91  static const uint8_t nalu_header[4] = { 0, 0, 0, 1 };
92  const int padding = AV_INPUT_BUFFER_PADDING_SIZE;
93  int length_size, pps_offset = 0;
94 
95  bytestream2_init(gb, extradata, extradata_size);
96 
97  bytestream2_skipu(gb, 4);
98 
99  /* retrieve length coded size */
100  length_size = (bytestream2_get_byteu(gb) & 0x3) + 1;
101 
102  /* retrieve sps and pps unit(s) */
103  unit_nb = bytestream2_get_byteu(gb) & 0x1f; /* number of sps unit(s) */
104  if (!unit_nb) {
105  goto pps;
106  }
107 
108  while (unit_nb--) {
109  int err;
110 
111  /* possible overread ok due to padding */
112  unit_size = bytestream2_get_be16u(gb);
113  total_size += unit_size + 4;
114  av_assert1(total_size <= INT_MAX - padding);
115  if (bytestream2_get_bytes_left(gb) < unit_size + !sps_done) {
116  av_log(ctx, AV_LOG_ERROR, "Global extradata truncated, "
117  "corrupted stream or invalid MP4/AVCC bitstream\n");
118  av_free(out);
119  return AVERROR_INVALIDDATA;
120  }
121  if ((err = av_reallocp(&out, total_size + padding)) < 0)
122  return err;
123  memcpy(out + total_size - unit_size - 4, nalu_header, 4);
124  bytestream2_get_bufferu(gb, out + total_size - unit_size, unit_size);
125 pps:
126  if (!unit_nb && !sps_done++) {
127  unit_nb = bytestream2_get_byteu(gb); /* number of pps unit(s) */
128  pps_offset = total_size;
129  }
130  }
131 
132  if (out)
133  memset(out + total_size, 0, padding);
134 
135  if (pps_offset) {
136  uint8_t *sps;
137 
138  s->sps_size = pps_offset;
139  sps = av_fast_realloc(s->sps, &s->sps_buf_size, s->sps_size);
140  if (!sps) {
141  av_free(out);
142  return AVERROR(ENOMEM);
143  }
144  s->sps = sps;
145  memcpy(s->sps, out, s->sps_size);
146  } else {
148  "Warning: SPS NALU missing or invalid. "
149  "The resulting stream may not play.\n");
150  }
151  if (pps_offset < total_size) {
152  uint8_t *pps;
153 
154  s->pps_size = total_size - pps_offset;
155  pps = av_fast_realloc(s->pps, &s->pps_buf_size, s->pps_size);
156  if (!pps) {
157  av_freep(&s->sps);
158  av_free(out);
159  return AVERROR(ENOMEM);
160  }
161  s->pps = pps;
162  memcpy(s->pps, out + pps_offset, s->pps_size);
163  } else {
165  "Warning: PPS NALU missing or invalid. "
166  "The resulting stream may not play.\n");
167  }
168 
169  av_freep(&ctx->par_out->extradata);
170  ctx->par_out->extradata = out;
171  ctx->par_out->extradata_size = total_size;
172 
173  s->length_size = length_size;
174  s->new_idr = 1;
175  s->idr_sps_seen = 0;
176  s->idr_pps_seen = 0;
177  s->extradata_parsed = 1;
178 
179  return 0;
180 }
181 
182 static int h264_mp4toannexb_save_ps(uint8_t **dst, int *dst_size,
183  unsigned *dst_buf_size,
184  const uint8_t *nal, uint32_t nal_size,
185  int first)
186 {
187  static const uint8_t nalu_header[4] = { 0, 0, 0, 1 };
188  const int start_code_size = sizeof(nalu_header);
189  uint8_t *ptr;
190  uint32_t size;
191 
192  if (first)
193  size = 0;
194  else
195  size = *dst_size;
196 
197  ptr = av_fast_realloc(*dst, dst_buf_size, size + nal_size + start_code_size);
198  if (!ptr)
199  return AVERROR(ENOMEM);
200 
201  memcpy(ptr + size, nalu_header, start_code_size);
202  size += start_code_size;
203  memcpy(ptr + size, nal, nal_size);
204  size += nal_size;
205 
206  *dst = ptr;
207  *dst_size = size;
208  return 0;
209 }
210 
212  const uint8_t *buf,
213  const uint8_t *buf_end)
214 {
215  int sps_count = 0;
216  int pps_count = 0;
217  uint8_t unit_type;
218 
219  do {
220  uint32_t nal_size = 0;
221 
222  /* possible overread ok due to padding */
223  for (int i = 0; i < s->length_size; i++)
224  nal_size = (nal_size << 8) | buf[i];
225 
226  buf += s->length_size;
227 
228  /* This check requires the cast as the right side might
229  * otherwise be promoted to an unsigned value. */
230  if ((int64_t)nal_size > buf_end - buf)
231  return AVERROR_INVALIDDATA;
232 
233  if (!nal_size)
234  continue;
235 
236  unit_type = *buf & 0x1f;
237 
238  if (unit_type == H264_NAL_SPS) {
239  h264_mp4toannexb_save_ps(&s->sps, &s->sps_size, &s->sps_buf_size, buf,
240  nal_size, !sps_count);
241  sps_count++;
242  } else if (unit_type == H264_NAL_PPS) {
243  h264_mp4toannexb_save_ps(&s->pps, &s->pps_size, &s->pps_buf_size, buf,
244  nal_size, !pps_count);
245  pps_count++;
246  }
247 
248  buf += nal_size;
249  } while (buf < buf_end);
250 
251  return 0;
252 }
253 
255 {
256  int extra_size = ctx->par_in->extradata_size;
257 
258  /* retrieve sps and pps NAL units from extradata */
259  if (!extra_size ||
260  (extra_size >= 3 && AV_RB24(ctx->par_in->extradata) == 1) ||
261  (extra_size >= 4 && AV_RB32(ctx->par_in->extradata) == 1)) {
263  "The input looks like it is Annex B already\n");
264  } else if (extra_size >= 7) {
266  ctx->par_in->extradata,
267  ctx->par_in->extradata_size);
268  } else {
269  av_log(ctx, AV_LOG_ERROR, "Invalid extradata size: %d\n", extra_size);
270  return AVERROR_INVALIDDATA;
271  }
272 
273  return 0;
274 }
275 
277 {
279  AVPacket *in;
280  uint8_t unit_type, new_idr, sps_seen, pps_seen;
281  const uint8_t *buf;
282  const uint8_t *buf_end;
283  uint8_t *out;
284  uint64_t out_size;
285  int ret;
286  size_t extradata_size;
287  uint8_t *extradata;
288 
289  ret = ff_bsf_get_packet(ctx, &in);
290  if (ret < 0)
291  return ret;
292 
294  &extradata_size);
295  if (extradata) {
296  ret = h264_extradata_to_annexb(ctx, extradata, extradata_size);
297  if (ret < 0)
298  goto fail;
299  }
300 
301  /* nothing to filter */
302  if (!s->extradata_parsed) {
303  av_packet_move_ref(opkt, in);
304  av_packet_free(&in);
305  return 0;
306  }
307 
308  buf_end = in->data + in->size;
309  ret = h264_mp4toannexb_filter_ps(s, in->data, buf_end);
310  if (ret < 0)
311  goto fail;
312 
313 #define LOG_ONCE(...) \
314  if (j) \
315  av_log(__VA_ARGS__)
316  for (int j = 0; j < 2; j++) {
317  buf = in->data;
318  new_idr = s->new_idr;
319  sps_seen = s->idr_sps_seen;
320  pps_seen = s->idr_pps_seen;
321  out_size = 0;
322 
323  do {
324  uint32_t nal_size = 0;
325  enum PsSource ps;
326 
327  /* possible overread ok due to padding */
328  for (int i = 0; i < s->length_size; i++)
329  nal_size = (nal_size << 8) | buf[i];
330 
331  buf += s->length_size;
332 
333  /* This check requires the cast as the right side might
334  * otherwise be promoted to an unsigned value. */
335  if ((int64_t)nal_size > buf_end - buf) {
337  goto fail;
338  }
339 
340  if (!nal_size)
341  continue;
342 
343  unit_type = *buf & 0x1f;
344 
345  if (unit_type == H264_NAL_SPS) {
346  sps_seen = new_idr = 1;
347  } else if (unit_type == H264_NAL_PPS) {
348  pps_seen = new_idr = 1;
349  /* if SPS has not been seen yet, prepend the AVCC one to PPS */
350  if (!sps_seen) {
351  if (!s->sps_size) {
352  LOG_ONCE(ctx, AV_LOG_WARNING, "SPS not present in the stream, nor in AVCC, stream may be unreadable\n");
353  } else {
354  count_or_copy(&out, &out_size, s->sps, s->sps_size, PS_OUT_OF_BAND, j);
355  sps_seen = 1;
356  }
357  }
358  }
359 
360  /* If this is a new IDR picture following an IDR picture, reset the idr flag.
361  * Just check first_mb_in_slice to be 0 as this is the simplest solution.
362  * This could be checking idr_pic_id instead, but would complexify the parsing. */
363  if (!new_idr && unit_type == H264_NAL_IDR_SLICE && (buf[1] & 0x80))
364  new_idr = 1;
365 
366  /* prepend only to the first type 5 NAL unit of an IDR picture, if no sps/pps are already present */
367  if (new_idr && unit_type == H264_NAL_IDR_SLICE && !sps_seen && !pps_seen) {
368  if (s->sps_size)
369  count_or_copy(&out, &out_size, s->sps, s->sps_size, PS_OUT_OF_BAND, j);
370  if (s->pps_size)
371  count_or_copy(&out, &out_size, s->pps, s->pps_size, PS_OUT_OF_BAND, j);
372  new_idr = 0;
373  /* if only SPS has been seen, also insert PPS */
374  } else if (new_idr && unit_type == H264_NAL_IDR_SLICE && sps_seen && !pps_seen) {
375  if (!s->pps_size) {
376  LOG_ONCE(ctx, AV_LOG_WARNING, "PPS not present in the stream, nor in AVCC, stream may be unreadable\n");
377  } else {
378  count_or_copy(&out, &out_size, s->pps, s->pps_size, PS_OUT_OF_BAND, j);
379  }
380  }
381 
382  if (unit_type == H264_NAL_SPS || unit_type == H264_NAL_PPS)
383  ps = PS_IN_BAND;
384  else
385  ps = PS_NONE;
386  count_or_copy(&out, &out_size, buf, nal_size, ps, j);
387  if (unit_type == H264_NAL_SLICE) {
388  new_idr = 1;
389  sps_seen = 0;
390  pps_seen = 0;
391  }
392 
393  buf += nal_size;
394  } while (buf < buf_end);
395 
396  if (!j) {
397  if (out_size > INT_MAX - AV_INPUT_BUFFER_PADDING_SIZE) {
399  goto fail;
400  }
401  ret = av_new_packet(opkt, out_size);
402  if (ret < 0)
403  goto fail;
404  out = opkt->data;
405  }
406  }
407 #undef LOG_ONCE
408 
409  av_assert1(out_size == opkt->size);
410 
411  s->new_idr = new_idr;
412  s->idr_sps_seen = sps_seen;
413  s->idr_pps_seen = pps_seen;
414 
415  ret = av_packet_copy_props(opkt, in);
416  if (ret < 0)
417  goto fail;
418 
419 fail:
420  if (ret < 0)
421  av_packet_unref(opkt);
422  av_packet_free(&in);
423 
424  return ret;
425 }
426 
428 {
430 
431  av_freep(&s->sps);
432  av_freep(&s->pps);
433 }
434 
436 {
438 
439  s->idr_sps_seen = 0;
440  s->idr_pps_seen = 0;
441  s->new_idr = s->extradata_parsed;
442 }
443 
444 static const enum AVCodecID codec_ids[] = {
446 };
447 
449  .p.name = "h264_mp4toannexb",
450  .p.codec_ids = codec_ids,
451  .priv_data_size = sizeof(H264BSFContext),
454  .close = h264_mp4toannexb_close,
456 };
av_packet_unref
void av_packet_unref(AVPacket *pkt)
Wipe the packet.
Definition: packet.c:427
AV_LOG_WARNING
#define AV_LOG_WARNING
Something somehow does not look correct.
Definition: log.h:186
AVERROR
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later. That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another. Frame references ownership and permissions
bsf_internal.h
out
FILE * out
Definition: movenc.c:55
GetByteContext
Definition: bytestream.h:33
count_or_copy
static void count_or_copy(uint8_t **out, uint64_t *out_size, const uint8_t *in, int in_size, enum PsSource ps, int copy)
Definition: h264_mp4toannexb.c:54
AV_PKT_DATA_NEW_EXTRADATA
@ AV_PKT_DATA_NEW_EXTRADATA
The AV_PKT_DATA_NEW_EXTRADATA is used to notify the codec or the format that the extradata buffer was...
Definition: packet.h:56
H264BSFContext::sps
uint8_t * sps
Definition: h264_mp4toannexb.c:35
bytestream2_skipu
static av_always_inline void bytestream2_skipu(GetByteContext *g, unsigned int size)
Definition: bytestream.h:174
AVBitStreamFilter::name
const char * name
Definition: bsf.h:112
out_size
int out_size
Definition: movenc.c:56
AVPacket::data
uint8_t * data
Definition: packet.h:524
AV_LOG_VERBOSE
#define AV_LOG_VERBOSE
Detailed information.
Definition: log.h:196
H264BSFContext::extradata_parsed
int extradata_parsed
Definition: h264_mp4toannexb.c:45
filter
filter_frame For filters that do not use the this method is called when a frame is pushed to the filter s input It can be called at any time except in a reentrant way If the input frame is enough to produce then the filter should push the output frames on the output link immediately As an exception to the previous rule if the input frame is enough to produce several output frames then the filter needs output only at least one per link The additional frames can be left buffered in the filter
Definition: filter_design.txt:228
H264_NAL_PPS
@ H264_NAL_PPS
Definition: h264.h:42
ff_bsf_get_packet
int ff_bsf_get_packet(AVBSFContext *ctx, AVPacket **pkt)
Called by the bitstream filters to get the next packet for filtering.
Definition: bsf.c:235
av_packet_free
void av_packet_free(AVPacket **pkt)
Free the packet, if the packet is reference counted, it will be unreferenced first.
Definition: packet.c:74
AVBSFContext
The bitstream filter state.
Definition: bsf.h:68
H264BSFContext::pps_buf_size
unsigned pps_buf_size
Definition: h264_mp4toannexb.c:40
bsf.h
H264BSFContext::idr_sps_seen
uint8_t idr_sps_seen
Definition: h264_mp4toannexb.c:43
fail
#define fail()
Definition: checkasm.h:179
codec_ids
static enum AVCodecID codec_ids[]
Definition: h264_mp4toannexb.c:444
h264_mp4toannexb_filter_ps
static int h264_mp4toannexb_filter_ps(H264BSFContext *s, const uint8_t *buf, const uint8_t *buf_end)
Definition: h264_mp4toannexb.c:211
first
trying all byte sequences megabyte in length and selecting the best looking sequence will yield cases to try But first
Definition: rate_distortion.txt:12
avassert.h
AV_LOG_ERROR
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition: log.h:180
h264_mp4toannexb_init
static int h264_mp4toannexb_init(AVBSFContext *ctx)
Definition: h264_mp4toannexb.c:254
H264BSFContext::pps_size
int pps_size
Definition: h264_mp4toannexb.c:38
av_fast_realloc
void * av_fast_realloc(void *ptr, unsigned int *size, size_t min_size)
Reallocate the given buffer if it is not large enough, otherwise do nothing.
Definition: mem.c:497
intreadwrite.h
s
#define s(width, name)
Definition: cbs_vp9.c:198
av_new_packet
int av_new_packet(AVPacket *pkt, int size)
Allocate the payload of a packet and initialize its fields with default values.
Definition: packet.c:98
PS_OUT_OF_BAND
@ PS_OUT_OF_BAND
Definition: h264_mp4toannexb.c:49
ctx
AVFormatContext * ctx
Definition: movenc.c:49
H264BSFContext
Definition: h264_mp4toannexb.c:34
AV_CODEC_ID_H264
@ AV_CODEC_ID_H264
Definition: codec_id.h:79
ff_h264_mp4toannexb_bsf
const FFBitStreamFilter ff_h264_mp4toannexb_bsf
Definition: h264_mp4toannexb.c:448
H264BSFContext::sps_buf_size
unsigned sps_buf_size
Definition: h264_mp4toannexb.c:39
NULL
#define NULL
Definition: coverity.c:32
FFBitStreamFilter
Definition: bsf_internal.h:27
flush
void(* flush)(AVBSFContext *ctx)
Definition: dts2pts.c:368
av_packet_move_ref
void av_packet_move_ref(AVPacket *dst, AVPacket *src)
Move every field in src to dst and reset src.
Definition: packet.c:484
PS_NONE
@ PS_NONE
Definition: h264_mp4toannexb.c:50
bytestream2_get_bytes_left
static av_always_inline int bytestream2_get_bytes_left(GetByteContext *g)
Definition: bytestream.h:158
AVCodecID
AVCodecID
Identify the syntax and semantics of the bitstream.
Definition: codec_id.h:49
AV_WB32
#define AV_WB32(p, v)
Definition: intreadwrite.h:417
FFBitStreamFilter::p
AVBitStreamFilter p
The public AVBitStreamFilter.
Definition: bsf_internal.h:31
init
int(* init)(AVBSFContext *ctx)
Definition: dts2pts.c:366
AVPacket::size
int size
Definition: packet.h:525
copy
static void copy(const float *p1, float *p2, const int length)
Definition: vf_vaguedenoiser.c:186
size
int size
Definition: twinvq_data.h:10344
av_reallocp
int av_reallocp(void *ptr, size_t size)
Allocate, reallocate, or free a block of memory through a pointer to a pointer.
Definition: mem.c:188
H264_NAL_SPS
@ H264_NAL_SPS
Definition: h264.h:41
AV_RB32
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_WL32 unsigned int_TMPL AV_WL24 unsigned int_TMPL AV_WL16 uint64_t_TMPL AV_WB64 unsigned int_TMPL AV_RB32
Definition: bytestream.h:96
H264_NAL_IDR_SLICE
@ H264_NAL_IDR_SLICE
Definition: h264.h:39
LOG_ONCE
#define LOG_ONCE(...)
h264_mp4toannexb_save_ps
static int h264_mp4toannexb_save_ps(uint8_t **dst, int *dst_size, unsigned *dst_buf_size, const uint8_t *nal, uint32_t nal_size, int first)
Definition: h264_mp4toannexb.c:182
av_packet_copy_props
int av_packet_copy_props(AVPacket *dst, const AVPacket *src)
Copy only "properties" fields from src to dst.
Definition: packet.c:390
H264_NAL_SLICE
@ H264_NAL_SLICE
Definition: h264.h:35
AV_CODEC_ID_NONE
@ AV_CODEC_ID_NONE
Definition: codec_id.h:50
i
#define i(width, name, range_min, range_max)
Definition: cbs_h2645.c:256
av_packet_get_side_data
uint8_t * av_packet_get_side_data(const AVPacket *pkt, enum AVPacketSideDataType type, size_t *size)
Get side information from packet.
Definition: packet.c:252
H264BSFContext::length_size
uint8_t length_size
Definition: h264_mp4toannexb.c:41
av_assert1
#define av_assert1(cond)
assert() equivalent, that does not lie in speed critical code.
Definition: avassert.h:56
h264_mp4toannexb_close
static void h264_mp4toannexb_close(AVBSFContext *ctx)
Definition: h264_mp4toannexb.c:427
PsSource
PsSource
Definition: h264_mp4toannexb.c:48
H264BSFContext::new_idr
uint8_t new_idr
Definition: h264_mp4toannexb.c:42
ret
ret
Definition: filter_design.txt:187
H264BSFContext::pps
uint8_t * pps
Definition: h264_mp4toannexb.c:36
sps
static int FUNC() sps(CodedBitstreamContext *ctx, RWContext *rw, H264RawSPS *current)
Definition: cbs_h264_syntax_template.c:260
h264_mp4toannexb_filter
static int h264_mp4toannexb_filter(AVBSFContext *ctx, AVPacket *opkt)
Definition: h264_mp4toannexb.c:276
AV_INPUT_BUFFER_PADDING_SIZE
#define AV_INPUT_BUFFER_PADDING_SIZE
Definition: defs.h:40
defs.h
h264_extradata_to_annexb
static int h264_extradata_to_annexb(AVBSFContext *ctx, uint8_t *extradata, int extradata_size)
Definition: h264_mp4toannexb.c:83
pps
uint64_t pps
Definition: dovi_rpuenc.c:35
mem.h
bytestream2_get_bufferu
static av_always_inline unsigned int bytestream2_get_bufferu(GetByteContext *g, uint8_t *dst, unsigned int size)
Definition: bytestream.h:277
av_free
#define av_free(p)
Definition: tableprint_vlc.h:33
AVPacket
This structure stores compressed data.
Definition: packet.h:501
av_freep
#define av_freep(p)
Definition: tableprint_vlc.h:34
bytestream.h
h264.h
bytestream2_init
static av_always_inline void bytestream2_init(GetByteContext *g, const uint8_t *buf, int buf_size)
Definition: bytestream.h:137
av_log
#define av_log(a,...)
Definition: tableprint_vlc.h:27
AVERROR_INVALIDDATA
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
Definition: error.h:61
PS_IN_BAND
@ PS_IN_BAND
Definition: h264_mp4toannexb.c:51
AV_RB24
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_WL32 unsigned int_TMPL AV_WL24 unsigned int_TMPL AV_WL16 uint64_t_TMPL AV_WB64 unsigned int_TMPL AV_WB32 unsigned int_TMPL AV_RB24
Definition: bytestream.h:97
H264BSFContext::sps_size
int sps_size
Definition: h264_mp4toannexb.c:37
AVFormatContext::priv_data
void * priv_data
Format private data.
Definition: avformat.h:1283
h264_mp4toannexb_flush
static void h264_mp4toannexb_flush(AVBSFContext *ctx)
Definition: h264_mp4toannexb.c:435
H264BSFContext::idr_pps_seen
uint8_t idr_pps_seen
Definition: h264_mp4toannexb.c:44