Go to the documentation of this file.
33 #define MIN_HEVCC_LENGTH 23
43 int length_size, num_arrays,
i, j;
46 uint8_t *new_extradata =
NULL;
47 size_t new_extradata_size = 0;
52 length_size = (bytestream2_get_byte(&gb) & 3) + 1;
53 num_arrays = bytestream2_get_byte(&gb);
55 for (
i = 0;
i < num_arrays;
i++) {
56 int type = bytestream2_get_byte(&gb) & 0x3f;
57 int cnt = bytestream2_get_be16(&gb);
67 for (j = 0; j < cnt; j++) {
68 const int nalu_len = bytestream2_get_be16(&gb);
80 AV_WB32(new_extradata + new_extradata_size, 1);
82 new_extradata_size += 4 + nalu_len;
88 ctx->par_out->extradata = new_extradata;
89 ctx->par_out->extradata_size = new_extradata_size;
91 if (!new_extradata_size)
109 "The input looks like it is Annex B already\n");
114 s->length_size =
ret;
115 s->extradata_parsed = 1;
134 if (!
s->extradata_parsed) {
143 uint32_t nalu_size = 0;
145 int is_irap, add_extradata, extra_size, prev_size;
151 for (
i = 0;
i <
s->length_size;
i++)
152 nalu_size = (nalu_size << 8) | bytestream2_get_byte(&gb);
159 nalu_type = (bytestream2_peek_byte(&gb) >> 1) & 0x3f;
164 add_extradata = is_irap && !got_irap;
165 extra_size = add_extradata *
ctx->par_out->extradata_size;
168 if (
FFMIN(INT_MAX, SIZE_MAX) < 4ULL + nalu_size + extra_size) {
173 prev_size =
out->size;
180 memcpy(
out->data + prev_size,
ctx->par_out->extradata, extra_size);
181 AV_WB32(
out->data + prev_size + extra_size, 1);
202 .
p.
name =
"hevc_mp4toannexb",
void av_packet_unref(AVPacket *pkt)
Wipe the packet.
#define AV_LOG_WARNING
Something somehow does not look correct.
int av_grow_packet(AVPacket *pkt, int grow_by)
Increase packet size, correctly zeroing padding.
#define AV_LOG_VERBOSE
Detailed information.
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
const FFBitStreamFilter ff_hevc_mp4toannexb_bsf
int ff_bsf_get_packet(AVBSFContext *ctx, AVPacket **pkt)
Called by the bitstream filters to get the next packet for filtering.
void av_packet_free(AVPacket **pkt)
Free the packet, if the packet is reference counted, it will be unreferenced first.
The bitstream filter state.
static av_always_inline void bytestream2_skip(GetByteContext *g, unsigned int size)
static int hevc_mp4toannexb_init(AVBSFContext *ctx)
static int hevc_mp4toannexb_filter(AVBSFContext *ctx, AVPacket *out)
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf type
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
static av_always_inline unsigned int bytestream2_get_buffer(GetByteContext *g, uint8_t *dst, unsigned int size)
void av_packet_move_ref(AVPacket *dst, AVPacket *src)
Move every field in src to dst and reset src.
static av_always_inline int bytestream2_get_bytes_left(GetByteContext *g)
AVCodecID
Identify the syntax and semantics of the bitstream.
AVBitStreamFilter p
The public AVBitStreamFilter.
int(* init)(AVBSFContext *ctx)
int av_reallocp(void *ptr, size_t size)
Allocate, reallocate, or free a block of memory through a pointer to a pointer.
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
static enum AVCodecID codec_ids[]
@ HEVC_NAL_RSV_IRAP_VCL23
int av_packet_copy_props(AVPacket *dst, const AVPacket *src)
Copy only "properties" fields from src to dst.
#define i(width, name, range_min, range_max)
#define AV_INPUT_BUFFER_PADDING_SIZE
This structure stores compressed data.
static av_always_inline void bytestream2_init(GetByteContext *g, const uint8_t *buf, int buf_size)
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
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
static int hevc_extradata_to_annexb(AVBSFContext *ctx)
void * priv_data
Format private data.