48 if (i <= 3 || (i == 4 && bits < (1 << 4)))
49 *len |= bits << (i * 7);
62 int start_pos, temporal_id, spatial_id;
66 type, &temporal_id, &spatial_id);
79 int ret,
type, cnt = 0;
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;
214 len =
leb(s->
pb, &obu_unit_size);
221 if (ret != obu_unit_size)
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 278 .priv_class = &annexb_demuxer_class,
const AVBitStreamFilter * av_bsf_get_by_name(const char *name)
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
#define LIBAVUTIL_VERSION_INT
AVInputFormat ff_av1_demuxer
enum AVCodecID codec_id
Specific type of the encoded data (the codec used).
The bitstream filter state.
const char * av_default_item_name(void *ptr)
Return the context name.
int64_t avio_skip(AVIOContext *s, int64_t offset)
Skip given number of bytes forward.
const char * class_name
The name of the class; usually it is the same name as the context structure type to which the AVClass...
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)
static av_cold int end(AVCodecContext *avctx)
enum AVStreamParseType need_parsing
AVStream * avformat_new_stream(AVFormatContext *s, const AVCodec *c)
Add a new stream to a media file.
static int annexb_read_packet(AVFormatContext *s, AVPacket *pkt)
#define AVERROR_EOF
End of file.
static av_cold int read_close(AVFormatContext *ctx)
int av_bsf_alloc(const AVBitStreamFilter *filter, AVBSFContext **pctx)
Allocate a context for a given bitstream filter.
#define i(width, name, range_min, range_max)
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
static int annexb_read_close(AVFormatContext *s)
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
enum AVMediaType codec_type
General type of the encoded data.
int av_bsf_init(AVBSFContext *ctx)
Prepare the filter for use, after all the parameters and options have been set.
int avio_r8(AVIOContext *s)
int buf_size
Size of buf except extra allocated bytes.
unsigned char * buf
Buffer must have AVPROBE_PADDING_SIZE of extra allocated bytes filled with zero.
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)
static int read_header(FFV1Context *f)
static int read_packet(void *opaque, uint8_t *buf, int buf_size)
int av_bsf_send_packet(AVBSFContext *ctx, AVPacket *pkt)
Submit a packet for filtering.
AVStreamInternal * internal
An opaque field for libavformat internal usage.
static int annexb_read_header(AVFormatContext *s)
AVIOContext * pb
I/O context.
int av_bsf_receive_packet(AVBSFContext *ctx, AVPacket *pkt)
Retrieve a filtered packet.
#define AVERROR_BUG
Internal bug, also see AVERROR_BUG2.
Describe the class of an AVClass context structure.
Rational number (pair of numerator and denominator).
static const AVClass annexb_demuxer_class
offset must point to AVRational
static int leb(AVIOContext *pb, uint32_t *len)
int error
contains the error code or 0 if no error happened
This structure contains the data a format has to probe a file.
#define flags(name, subs,...)
static int read_obu(const uint8_t *buf, int size, int64_t *obu_size, int *type)
common internal and external API header
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))
uint32_t temporal_unit_size
int eof_reached
true if was unable to read due to error or eof
void * priv_data
Format private data.
static const AVOption annexb_options[]
AVCodecContext * avctx
The codec context used by avformat_find_stream_info, the parser, etc.
void av_bsf_free(AVBSFContext **pctx)
Free a bitstream filter context and everything associated with it; write NULL into the supplied point...
AVCodecParameters * codecpar
Codec parameters associated with this stream.
int avio_feof(AVIOContext *s)
Similar to feof() but also returns nonzero on read errors.
static int annexb_probe(const AVProbeData *p)
int avcodec_parameters_copy(AVCodecParameters *dst, const AVCodecParameters *src)
Copy the contents of src to dst.
This structure stores compressed data.
AVCodecParameters * par_in
Parameters of the input stream.