Go to the documentation of this file.
48 if (
i <= 3 || (
i == 4 &&
bits < (1 << 4)))
62 int start_pos, temporal_id, spatial_id;
66 type, &temporal_id, &spatial_id);
77 uint32_t temporal_unit_size, frame_unit_size, obu_unit_size;
84 ret =
leb(&pb, &temporal_unit_size);
88 ret =
leb(&pb, &frame_unit_size);
89 if (
ret < 0 || ((int64_t)frame_unit_size +
ret) > temporal_unit_size)
92 temporal_unit_size -=
ret;
93 ret =
leb(&pb, &obu_unit_size);
94 if (
ret < 0 || ((int64_t)obu_unit_size +
ret) >= frame_unit_size)
98 temporal_unit_size -= obu_unit_size +
ret;
99 frame_unit_size -= obu_unit_size +
ret;
107 if (ret < 0 || type != AV1_OBU_TEMPORAL_DELIMITER || obu_size > 0)
109 cnt += obu_unit_size;
112 ret =
leb(&pb, &obu_unit_size);
113 if (
ret < 0 || ((int64_t)obu_unit_size +
ret) > frame_unit_size)
124 cnt += obu_unit_size;
140 temporal_unit_size -= obu_unit_size +
ret;
141 frame_unit_size -= obu_unit_size +
ret;
142 }
while (frame_unit_size);
156 "not found. This is a bug, please report it.\n");
192 uint32_t obu_unit_size;
197 if (
c->temporal_unit_size ||
c->frame_unit_size)
202 if (!
c->temporal_unit_size) {
203 len =
leb(
s->pb, &
c->temporal_unit_size);
207 if (!
c->frame_unit_size) {
208 len =
leb(
s->pb, &
c->frame_unit_size);
209 if (
len < 0 || ((int64_t)
c->frame_unit_size +
len) >
c->temporal_unit_size)
211 c->temporal_unit_size -=
len;
214 len =
leb(
s->pb, &obu_unit_size);
215 if (
len < 0 || ((int64_t)obu_unit_size +
len) >
c->frame_unit_size)
221 if (
ret != obu_unit_size)
224 c->temporal_unit_size -= obu_unit_size +
len;
225 c->frame_unit_size -= obu_unit_size +
len;
231 "av1_frame_merge filter\n");
238 "send output packet\n");
254 #define OFFSET(x) offsetof(AnnexBContext, x)
255 #define DEC AV_OPT_FLAG_DECODING_PARAM
static int annexb_read_header(AVFormatContext *s)
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
AVStream * avformat_new_stream(AVFormatContext *s, const AVCodec *c)
Add a new stream to a media file.
enum AVMediaType codec_type
General type of the encoded data.
AVCodecContext * avctx
The codec context used by avformat_find_stream_info, the parser, etc.
#define AVERROR_EOF
End of file.
static int annexb_probe(const AVProbeData *p)
@ AV_OPT_TYPE_VIDEO_RATE
offset must point to AVRational
int av_bsf_init(AVBSFContext *ctx)
Prepare the filter for use, after all the parameters and options have been set.
static av_cold int end(AVCodecContext *avctx)
AVStreamInternal * internal
An opaque field for libavformat internal usage.
int error
contains the error code or 0 if no error happened
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
int buf_size
Size of buf except extra allocated bytes.
static const AVOption annexb_options[]
@ AV1_OBU_TEMPORAL_DELIMITER
The bitstream filter state.
const AVBitStreamFilter * av_bsf_get_by_name(const char *name)
AVInputFormat ff_av1_demuxer
static av_cold int read_close(AVFormatContext *ctx)
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 int annexb_read_packet(AVFormatContext *s, AVPacket *pkt)
static int parse_obu_header(const uint8_t *buf, int buf_size, int64_t *obu_size, int *start_pos, int *type, int *temporal_id, int *spatial_id)
unsigned char * buf
Buffer must have AVPROBE_PADDING_SIZE of extra allocated bytes filled with zero.
enum AVStreamParseType need_parsing
AVCodecParameters * codecpar
Codec parameters associated with this stream.
#define LIBAVUTIL_VERSION_INT
static int read_header(FFV1Context *f)
Describe the class of an AVClass context structure.
Rational number (pair of numerator and denominator).
const char * av_default_item_name(void *ptr)
Return the context name.
static int leb(AVIOContext *pb, uint32_t *len)
This structure contains the data a format has to probe a file.
static int annexb_read_close(AVFormatContext *s)
Undefined Behavior In the C some operations are like signed integer dereferencing freed accessing outside allocated Undefined Behavior must not occur in a C it is not safe even if the output of undefined operations is unused The unsafety may seem nit picking but Optimizing compilers have in fact optimized code on the assumption that no undefined Behavior occurs Optimizing code based on wrong assumptions can and has in some cases lead to effects beyond the output of computations The signed integer overflow problem in speed critical code Code which is highly optimized and works with signed integers sometimes has the problem that often the output of the computation does not c
int ffio_init_context(AVIOContext *s, unsigned char *buffer, int buffer_size, int write_flag, void *opaque, int(*read_packet)(void *opaque, uint8_t *buf, int buf_size), int(*write_packet)(void *opaque, uint8_t *buf, int buf_size), int64_t(*seek)(void *opaque, int64_t offset, int whence))
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
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_WB24 unsigned int_TMPL AV_WB16 unsigned int_TMPL byte
@ AV1_OBU_SEQUENCE_HEADER
int avio_r8(AVIOContext *s)
int av_bsf_receive_packet(AVBSFContext *ctx, AVPacket *pkt)
Retrieve a filtered packet.
#define i(width, name, range_min, range_max)
static const AVClass annexb_demuxer_class
static int read_obu(const uint8_t *buf, int size, int64_t *obu_size, int *type)
static int read_packet(void *opaque, uint8_t *buf, int buf_size)
const char * class_name
The name of the class; usually it is the same name as the context structure type to which the AVClass...
int av_bsf_send_packet(AVBSFContext *ctx, AVPacket *pkt)
Submit a packet for filtering.
int avcodec_parameters_copy(AVCodecParameters *dst, const AVCodecParameters *src)
Copy the contents of src to dst.
int eof_reached
true if was unable to read due to error or eof
int64_t avio_skip(AVIOContext *s, int64_t offset)
Skip given number of bytes forward.
enum AVCodecID codec_id
Specific type of the encoded data (the codec used).
This structure stores compressed data.
void av_bsf_free(AVBSFContext **pctx)
Free a bitstream filter context and everything associated with it; write NULL into the supplied point...
#define flags(name, subs,...)
#define AVERROR_BUG
Internal bug, also see AVERROR_BUG2.
uint32_t temporal_unit_size
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
int av_bsf_alloc(const AVBitStreamFilter *filter, AVBSFContext **pctx)
Allocate a context for a given bitstream filter.
int avio_feof(AVIOContext *s)
Similar to feof() but also returns nonzero on read errors.