Go to the documentation of this file.
34 int *pos_p,
int *nb_vop,
int *pos_vop2) {
36 const uint8_t *end = buf + buf_size, *
pos = buf;
44 for (
int i = 0;
i < 255 &&
pos +
i + 1 < end;
i++) {
45 if (
pos[
i] ==
'p' &&
pos[
i + 1] ==
'\0') {
46 *pos_p =
pos +
i - buf;
52 if (*nb_vop == 2 && pos_vop2) {
53 *pos_vop2 =
pos - buf - 4;
62 int pos_p = -1, nb_vop = 0, pos_vop2 = -1,
ret = 0;
74 "Missing one N-VOP packet, discarding one B-frame.\n");
79 if (!
s->b_frame_ref) {
83 s->b_frame_ref->data =
pkt->
data + pos_vop2;
84 s->b_frame_ref->size =
pkt->
size - pos_vop2;
89 "Found %d VOP headers in one packet, only unpacking one.\n", nb_vop);
92 if (nb_vop == 1 &&
s->b_frame_ref) {
105 s->b_frame_ref =
tmp;
112 }
else if (nb_vop >= 2) {
115 }
else if (pos_p >= 0) {
135 if (
ctx->par_in->extradata) {
138 if (pos_p_ext >= 0) {
140 "Updating DivX userdata (remove trailing 'p') in extradata.\n");
141 ctx->par_out->extradata[pos_p_ext] =
'\0';
159 .
name =
"mpeg4_unpack_bframes",
void av_packet_unref(AVPacket *pkt)
Wipe the packet.
#define AV_LOG_WARNING
Something somehow does not look correct.
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
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 uint8_t * avpriv_find_start_code(const uint8_t *p, const uint8_t *end, uint32_t *state)
AVBufferRef * av_buffer_ref(const AVBufferRef *buf)
Create a new reference to an AVBuffer.
The bitstream filter state.
static int mpeg4_unpack_bframes_filter(AVBSFContext *ctx, AVPacket *pkt)
static enum AVCodecID codec_ids[]
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
AVBufferRef * buf
A reference to the reference-counted buffer where the packet data is stored.
static void flush(AVCodecContext *avctx)
void av_buffer_unref(AVBufferRef **buf)
Free a given reference and automatically free the buffer if there are no more references to it.
AVCodecID
Identify the syntax and semantics of the bitstream.
static void scan_buffer(const uint8_t *buf, int buf_size, int *pos_p, int *nb_vop, int *pos_vop2)
static int mpeg4_unpack_bframes_init(AVBSFContext *ctx)
#define i(width, name, range_min, range_max)
#define USER_DATA_STARTCODE
void * priv_data
Opaque filter-specific private data.
AVBufferRef * b_frame_ref
int av_packet_make_writable(AVPacket *pkt)
Create a writable reference for the data described by a given packet, avoiding data copy if possible.
const AVBitStreamFilter ff_mpeg4_unpack_bframes_bsf
A reference to a data buffer.
This structure stores compressed data.
int ff_bsf_get_packet_ref(AVBSFContext *ctx, AVPacket *pkt)
Called by bitstream filters to get packet for filtering.
static void mpeg4_unpack_bframes_close_flush(AVBSFContext *bsfc)
void * priv_data
Format private data.