34 int *pos_p,
int *nb_vop,
int *pos_vop2) {
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");
89 "Found %d VOP headers in one packet, only unpacking one.\n", nb_vop);
112 }
else if (nb_vop >= 2) {
114 pkt->
size = pos_vop2;
115 }
else if (pos_p >= 0) {
121 pkt->
data[pos_p] =
'\0';
138 if (pos_p_ext >= 0) {
140 "Updating DivX userdata (remove trailing 'p') in extradata.\n");
159 .
name =
"mpeg4_unpack_bframes",
AVCodecParameters * par_out
Parameters of the output stream.
void av_buffer_unref(AVBufferRef **buf)
Free a given reference and automatically free the buffer if there are no more references to it...
static void flush(AVCodecContext *avctx)
#define AV_LOG_WARNING
Something somehow does not look correct.
static av_cold int init(AVCodecContext *avctx)
The bitstream filter state.
void * priv_data
Opaque filter-specific private data.
#define USER_DATA_STARTCODE
static void filter(int16_t *output, ptrdiff_t out_stride, int16_t *low, ptrdiff_t low_stride, int16_t *high, ptrdiff_t high_stride, int len, int clip)
const AVBitStreamFilter ff_mpeg4_unpack_bframes_bsf
static av_cold int end(AVCodecContext *avctx)
static int mpeg4_unpack_bframes_filter(AVBSFContext *ctx, AVPacket *pkt)
const uint8_t * avpriv_find_start_code(const uint8_t *p, const uint8_t *end, uint32_t *state)
int av_packet_make_writable(AVPacket *pkt)
Create a writable reference for the data described by a given packet, avoiding data copy if possible...
#define i(width, name, range_min, range_max)
AVCodecID
Identify the syntax and semantics of the bitstream.
#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.
int extradata_size
Size of the extradata content in bytes.
static void mpeg4_unpack_bframes_close_flush(AVBSFContext *bsfc)
static int mpeg4_unpack_bframes_init(AVBSFContext *ctx)
void av_packet_unref(AVPacket *pkt)
Wipe the packet.
uint8_t * data
The data buffer.
static void scan_buffer(const uint8_t *buf, int buf_size, int *pos_p, int *nb_vop, int *pos_vop2)
int size
Size of data in bytes.
static enum AVCodecID codec_ids[]
AVBufferRef * b_frame_ref
A reference to a data buffer.
common internal api header.
AVBufferRef * av_buffer_ref(AVBufferRef *buf)
Create a new reference to an AVBuffer.
uint8_t * extradata
Extra binary data needed for initializing the decoder, codec-dependent.
This structure stores compressed data.
AVCodecParameters * par_in
Parameters of the input stream.
int ff_bsf_get_packet_ref(AVBSFContext *ctx, AVPacket *pkt)
Called by bitstream filters to get packet for filtering.