Go to the documentation of this file.
73 uint32_t parent_chunk_size)
77 uint32_t chunk_type, chunk_size,
offset;
78 uint32_t unique_offset, string_offset;
79 int nb_items, unique_size, nb_dictionaries;
86 if (chunk_type !=
MKBETAG(
'@',
'U',
'T',
'F'))
89 if (!chunk_size || chunk_size >= parent_chunk_size)
102 unique_offset = bytestream2_get_be32(&gb);
103 string_offset = bytestream2_get_be32(&gb);
104 bytestream2_get_be32(&gb);
105 bytestream2_get_be32(&gb);
106 nb_items = bytestream2_get_be16(&gb);
107 unique_size = bytestream2_get_be16(&gb);
108 nb_dictionaries = bytestream2_get_be32(&gb);
109 if (nb_dictionaries == 0)
119 for (
int i = 0;
i < nb_items;
i++) {
125 type = bytestream2_get_byte(&gb);
126 offset = bytestream2_get_be32(&gb);
130 key[n] = bytestream2_get_byte(&sgb);
133 if (n >=
sizeof(
key) - 1)
139 if ((
type >> 5) == 1)
144 switch (
type & 0x1F) {
147 value = bytestream2_get_byte(xgb);
151 value = bytestream2_get_be16(xgb);
155 value = bytestream2_get_be32(xgb);
159 value = bytestream2_get_be64(xgb);
172 if (!strcmp(
key,
"sampling_rate")) {
175 }
else if (!strcmp(
key,
"num_channels")) {
177 }
else if (!strcmp(
key,
"total_samples")) {
179 }
else if (!strcmp(
key,
"audio_codec")) {
193 if (!strcmp(
key,
"width")) {
195 }
else if (!strcmp(
key,
"height")) {
197 }
else if (!strcmp(
key,
"total_frames")) {
199 }
else if (!strcmp(
key,
"framerate_n")) {
201 }
else if (!strcmp(
key,
"framerate_d")) {
203 }
else if (!strcmp(
key,
"mpeg_codec")) {
229 uint32_t chunk_type, uint32_t chunk_size,
232 const int is_audio = chunk_type ==
MKBETAG(
'@',
'S',
'F',
'A');
233 const int is_alpha = chunk_type ==
MKBETAG(
'@',
'A',
'L',
'P');
234 const int is_subtt = chunk_type ==
MKBETAG(
'@',
'S',
'B',
'T');
236 int padding_size, payload_type, payload_offset;
238 int stream_index, frame_rate;
261 if (payload_type == 1) {
262 if (usm->
ch[ch_type][stream_index].
used == 0) {
288 }
else if (payload_type == 0) {
289 if (usm->
ch[ch_type][stream_index].
used == 1) {
291 int get_extradata = 0;
353 if (get_extradata == 0)
373 uint32_t chunk_type, chunk_size;
385 switch (chunk_type) {
395 got_packet =
ret > 0;
402 if (got_packet ||
ret < 0)
420 .p.extensions =
"usm",
static int chunk_start(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
enum AVMediaType codec_type
General type of the encoded data.
This struct describes the properties of an encoded stream.
AVStream * avformat_new_stream(AVFormatContext *s, const struct AVCodec *c)
Add a new stream to a media file.
#define AVERROR_EOF
End of file.
static av_always_inline double av_int2double(uint64_t i)
Reinterpret a 64-bit integer as a double.
static av_always_inline int bytestream2_seek(GetByteContext *g, int offset, int whence)
int nb_channels
Number of channels in this layout.
int ff_get_extradata(void *logctx, AVCodecParameters *par, AVIOContext *pb, int size)
Allocate extradata with additional AV_INPUT_BUFFER_PADDING_SIZE at end which is always set to 0 and f...
static av_always_inline void bytestream2_skip(GetByteContext *g, unsigned int size)
static av_always_inline float av_int2float(uint32_t i)
Reinterpret a 32-bit integer as a float.
static av_cold int read_close(AVFormatContext *ctx)
static av_always_inline int64_t avio_tell(AVIOContext *s)
ftell() equivalent for AVIOContext.
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
int64_t duration
Decoding: duration of the stream, in stream time base.
unsigned int avio_rb32(AVIOContext *s)
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
static int read_packet(void *opaque, uint8_t *buf, int buf_size)
unsigned char * buf
Buffer must have AVPROBE_PADDING_SIZE of extra allocated bytes filled with zero.
static int64_t parse_chunk(AVFormatContext *s, AVIOContext *pb, uint32_t chunk_type, uint32_t chunk_size, AVPacket *pkt)
enum AVStreamParseType need_parsing
AVCodecParameters * codecpar
Codec parameters associated with this stream.
static int read_header(FFV1Context *f)
Rational number (pair of numerator and denominator).
This structure contains the data a format has to probe a file.
AVChannelLayout ch_layout
Audio only.
int sample_rate
Audio only.
static av_always_inline int bytestream2_get_bytes_left(GetByteContext *g)
int64_t nb_frames
number of frames in this stream if known or 0
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
static AVRational av_make_q(int num, int den)
Create an AVRational.
#define MKBETAG(a, b, c, d)
int avio_r8(AVIOContext *s)
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 offset
const FFInputFormat ff_usm_demuxer
#define FFERROR_REDO
Returned by demuxers to indicate that data was consumed but discarded (ignored streams or junk data).
#define i(width, name, range_min, range_max)
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 default value
static int usm_probe(const AVProbeData *p)
unsigned int avio_rb16(AVIOContext *s)
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_RL32
int index
stream index in AVFormatContext
int avio_read(AVIOContext *s, unsigned char *buf, int size)
Read size bytes from AVIOContext into buf.
static int usm_read_header(AVFormatContext *s)
static int parse_utf(AVFormatContext *s, AVIOContext *pb, USMChannel *ch, int ch_type, uint32_t parent_chunk_size)
int64_t avio_skip(AVIOContext *s, int64_t offset)
Skip given number of bytes forward.
static int usm_read_close(AVFormatContext *s)
static int read_probe(const AVProbeData *p)
enum AVCodecID codec_id
Specific type of the encoded data (the codec used).
This structure stores compressed data.
void av_fast_malloc(void *ptr, unsigned int *size, size_t min_size)
Allocate a buffer, reusing the given one if large enough.
int64_t pos
byte position in stream, -1 if unknown
static int usm_read_packet(AVFormatContext *s, AVPacket *pkt)
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.
#define MKTAG(a, b, c, d)
int64_t start_time
Decoding: pts of the first frame of the stream in presentation order, in stream time base.
int avio_feof(AVIOContext *s)
Similar to feof() but also returns nonzero on read errors.