FFmpeg
usmdec.c
Go to the documentation of this file.
1 /*
2  * USM demuxer
3  * Copyright (c) 2023 Paul B Mahol
4  *
5  * This file is part of FFmpeg.
6  *
7  * FFmpeg is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or (at your option) any later version.
11  *
12  * FFmpeg is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with FFmpeg; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20  */
21 
22 #include "libavutil/intreadwrite.h"
23 #include "libavcodec/bytestream.h"
24 
25 #include "avformat.h"
26 #include "demux.h"
27 #include "internal.h"
28 
29 #define VIDEOI 0
30 #define AUDIOI 1
31 #define ALPHAI 2
32 #define SUBTTI 3
33 
34 typedef struct USMChannel {
35  int index;
36  int used;
37  int type;
38  int codec_id;
40  int nb_frames;
42  int width, height;
43  int64_t duration;
44  int64_t extradata_pos;
45 } USMChannel;
46 
47 typedef struct USMDemuxContext {
48  USMChannel ch[4][256];
49  int nb_channels[4];
50  uint8_t *header;
51  unsigned header_size;
53 
54 static int usm_probe(const AVProbeData *p)
55 {
56  if (AV_RL32(p->buf) != MKTAG('C','R','I','D'))
57  return 0;
58 
59  if (AV_RN32(p->buf + 4) == 0)
60  return 0;
61 
62  return AVPROBE_SCORE_MAX / 3;
63 }
64 
66 {
67  s->ctx_flags |= AVFMTCTX_NOHEADER;
68  return 0;
69 }
70 
72  USMChannel *ch, int ch_type,
73  uint32_t parent_chunk_size)
74 {
75  USMDemuxContext *usm = s->priv_data;
76  GetByteContext gb, ugb, sgb;
77  uint32_t chunk_type, chunk_size, offset;
78  uint32_t unique_offset, string_offset;
79  int nb_items, unique_size, nb_dictionaries;
80  AVRational fps = { 0 };
81  int type;
82 
83  chunk_type = avio_rb32(pb);
84  chunk_size = avio_rb32(pb);
85 
86  if (chunk_type != MKBETAG('@','U','T','F'))
87  return AVERROR_INVALIDDATA;
88 
89  if (!chunk_size || chunk_size >= parent_chunk_size)
90  return AVERROR_INVALIDDATA;
91 
92  av_fast_malloc(&usm->header, &usm->header_size, chunk_size);
93  if (!usm->header)
94  return AVERROR(ENOMEM);
95 
96  if (avio_read(pb, usm->header, chunk_size) != chunk_size)
97  return AVERROR_EOF;
98 
99  bytestream2_init(&gb, usm->header, chunk_size);
100  ugb = gb;
101  sgb = gb;
102  unique_offset = bytestream2_get_be32(&gb);
103  string_offset = bytestream2_get_be32(&gb);
104  /*byte_offset =*/ bytestream2_get_be32(&gb);
105  /*payload_name_offset =*/ 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)
110  return AVERROR_INVALIDDATA;
111 
112  bytestream2_skip(&ugb, unique_offset);
113  if (bytestream2_get_bytes_left(&ugb) < unique_size)
114  return AVERROR_INVALIDDATA;
115  bytestream2_init(&ugb, ugb.buffer, unique_size);
116 
117  bytestream2_skip(&sgb, string_offset);
118 
119  for (int i = 0; i < nb_items; i++) {
120  GetByteContext *xgb;
121  uint8_t key[256];
122  int64_t value;
123  int n = 0;
124 
125  type = bytestream2_get_byte(&gb);
126  offset = bytestream2_get_be32(&gb);
127 
128  bytestream2_seek(&sgb, string_offset + offset, SEEK_SET);
129  while (bytestream2_get_bytes_left(&sgb) > 0) {
130  key[n] = bytestream2_get_byte(&sgb);
131  if (!key[n])
132  break;
133  if (n >= sizeof(key) - 1)
134  break;
135  n++;
136  }
137  key[n] = '\0';
138 
139  if ((type >> 5) == 1)
140  xgb = &gb;
141  else
142  xgb = &ugb;
143 
144  switch (type & 0x1F) {
145  case 0x10:
146  case 0x11:
147  value = bytestream2_get_byte(xgb);
148  break;
149  case 0x12:
150  case 0x13:
151  value = bytestream2_get_be16(xgb);
152  break;
153  case 0x14:
154  case 0x15:
155  value = bytestream2_get_be32(xgb);
156  break;
157  case 0x16:
158  case 0x17:
159  value = bytestream2_get_be64(xgb);
160  break;
161  case 0x18:
162  value = av_int2float(bytestream2_get_be32(xgb));
163  break;
164  case 0x19:
165  value = av_int2double(bytestream2_get_be64(xgb));
166  break;
167  case 0x1A:
168  break;
169  }
170 
171  if (ch_type == AUDIOI) {
172  if (!strcmp(key, "sampling_rate")) {
173  ch->rate.num = value;
174  ch->rate.den = 1;
175  } else if (!strcmp(key, "num_channels")) {
176  ch->nb_channels = value;
177  } else if (!strcmp(key, "total_samples")) {
178  ch->duration = value;
179  } else if (!strcmp(key, "audio_codec")) {
180  switch (value) {
181  case 2:
183  break;
184  case 4:
186  break;
187  default:
188  av_log(s, AV_LOG_ERROR, "unsupported audio: %d\n", (int)value);
189  break;
190  }
191  }
192  } else if (ch_type == VIDEOI || ch_type == ALPHAI) {
193  if (!strcmp(key, "width")) {
194  ch->width = value;
195  } else if (!strcmp(key, "height")) {
196  ch->height = value;
197  } else if (!strcmp(key, "total_frames")) {
198  ch->nb_frames = value;
199  } else if (!strcmp(key, "framerate_n")) {
200  fps.num = value;
201  } else if (!strcmp(key, "framerate_d")) {
202  fps.den = value;
203  } else if (!strcmp(key, "mpeg_codec")) {
204  switch (value) {
205  case 1:
207  break;
208  case 5:
210  break;
211  case 9:
213  break;
214  default:
215  av_log(s, AV_LOG_ERROR, "unsupported video: %d\n", (int)value);
216  break;
217  }
218  }
219  }
220  }
221 
222  if (ch_type == VIDEOI && fps.num && fps.den)
223  ch->rate = fps;
224 
225  return 0;
226 }
227 
229  uint32_t chunk_type, uint32_t chunk_size,
230  AVPacket *pkt)
231 {
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');
235  USMDemuxContext *usm = s->priv_data;
236  int padding_size, payload_type, payload_offset;
237  const int ch_type = is_subtt ? SUBTTI : is_audio ? AUDIOI : is_alpha ? ALPHAI : VIDEOI;
238  int stream_index, frame_rate;
239  int64_t chunk_start, ret;
240 
241  ret = avio_tell(pb);
242  if (ret < 0)
243  return ret;
244  chunk_start = ret;
245  avio_skip(pb, 1);
246  payload_offset = avio_r8(pb);
247  padding_size = avio_rb16(pb);
248  stream_index = avio_r8(pb);
249  avio_skip(pb, 2);
250  payload_type = avio_r8(pb);
251  /*frame_time =*/ avio_rb32(pb);
252  frame_rate = avio_rb32(pb);
253  avio_skip(pb, 8);
254  ret = avio_tell(pb);
255  if (ret < 0)
256  return ret;
257  ret = avio_skip(pb, FFMAX(0, (ret - chunk_start) - payload_offset));
258  if (ret < 0)
259  return ret;
260 
261  if (payload_type == 1) {
262  if (usm->ch[ch_type][stream_index].used == 0) {
263  USMChannel *ch = &usm->ch[ch_type][stream_index];
264 
265  switch (ch_type) {
266  case ALPHAI:
267  case VIDEOI:
268  ch->type = AVMEDIA_TYPE_VIDEO;
269  break;
270  case AUDIOI:
271  ch->type = AVMEDIA_TYPE_AUDIO;
272  break;
273  case SUBTTI:
275  break;
276  default:
277  return AVERROR_INVALIDDATA;
278  }
279 
280  ch->used = 1;
281  ch->index = -1;
282  usm->nb_channels[ch_type]++;
283 
284  ret = parse_utf(s, pb, ch, ch_type, chunk_size);
285  if (ret < 0)
286  return ret;
287  }
288  } else if (payload_type == 0) {
289  if (usm->ch[ch_type][stream_index].used == 1) {
290  USMChannel *ch = &usm->ch[ch_type][stream_index];
291  int get_extradata = 0;
292  uint32_t pkt_size;
293  AVStream *st;
294 
295  if (ch->index < 0) {
296  AVCodecParameters *par;
297  st = avformat_new_stream(s, NULL);
298  if (!st)
299  return AVERROR(ENOMEM);
300  par = st->codecpar;
301  par->codec_type = ch->type;
302  par->codec_id = ch->codec_id;
303  st->start_time = 0;
304 
305  switch (ch->type) {
306  case AVMEDIA_TYPE_VIDEO:
307  par->width = ch->width;
308  par->height = ch->height;
309  st->nb_frames = ch->nb_frames;
310  break;
311  case AVMEDIA_TYPE_AUDIO:
312  par->sample_rate = ch->rate.num;
313  par->ch_layout.nb_channels = ch->nb_channels;
314  st->duration = ch->duration;
315  break;
316  }
317 
318  ch->index = st->index;
319  if (!ch->rate.num || !ch->rate.den)
320  ch->rate = av_make_q(frame_rate, 100);
321  avpriv_set_pts_info(st, 64, ch->rate.den, ch->rate.num);
322 
324  get_extradata = ch->codec_id == AV_CODEC_ID_ADPCM_ADX;
325  ch->extradata_pos = avio_tell(pb);
326  }
327 
328  ret = avio_tell(pb);
329  if (ret < 0)
330  return ret;
331 
332  pkt_size = chunk_size - (ret - chunk_start) - padding_size;
333  if (get_extradata) {
334  if ((ret = ff_get_extradata(s, st->codecpar, pb, pkt_size)) < 0)
335  return ret;
336  } else {
337  if (ret == ch->extradata_pos && ch->codec_id == AV_CODEC_ID_ADPCM_ADX) {
338  avio_skip(pb, pkt_size);
339  ret = 0;
340  } else {
341  ret = av_get_packet(pb, pkt, pkt_size);
342  if (ret < 0)
343  return ret;
344 
345  pkt->stream_index = ch->index;
346  }
347  }
348 
349  avio_skip(pb, padding_size);
350 
351  if (ret != pkt_size)
352  return AVERROR_EOF;
353  if (get_extradata == 0)
354  return ret;
355  }
356  }
357 
358  ret = avio_tell(pb);
359  if (ret < 0)
360  return ret;
361  ret = avio_skip(pb, FFMAX(0, chunk_size - (ret - chunk_start)));
362  if (ret < 0)
363  return ret;
364  return FFERROR_REDO;
365 }
366 
368 {
369  AVIOContext *pb = s->pb;
370  int64_t ret = AVERROR_EOF;
371 
372  while (!avio_feof(pb)) {
373  uint32_t chunk_type, chunk_size;
374  int got_packet = 0;
375  int64_t pos;
376 
377  pos = avio_tell(pb);
378  if (pos < 0)
379  return pos;
380  chunk_type = avio_rb32(pb);
381  chunk_size = avio_rb32(pb);
382  if (!chunk_size)
383  return AVERROR_INVALIDDATA;
384 
385  switch (chunk_type) {
386  case MKBETAG('C','R','I','D'):
387  default:
388  ret = avio_skip(pb, chunk_size);
389  break;
390  case MKBETAG('@','A','L','P'):
391  case MKBETAG('@','S','B','T'):
392  case MKBETAG('@','S','F','A'):
393  case MKBETAG('@','S','F','V'):
394  ret = parse_chunk(s, pb, chunk_type, chunk_size, pkt);
395  got_packet = ret > 0;
396  break;
397  }
398 
399  if (got_packet)
400  pkt->pos = pos;
401 
402  if (got_packet || ret < 0)
403  break;
404  }
405 
406  return ret;
407 }
408 
410 {
411  USMDemuxContext *usm = s->priv_data;
412  av_freep(&usm->header);
413  usm->header_size = 0;
414  return 0;
415 }
416 
418  .name = "usm",
419  .long_name = NULL_IF_CONFIG_SMALL("CRI USM"),
420  .priv_data_size = sizeof(USMDemuxContext),
425  .extensions = "usm",
427 };
AVMEDIA_TYPE_SUBTITLE
@ AVMEDIA_TYPE_SUBTITLE
Definition: avutil.h:204
AVFMT_NO_BYTE_SEEK
#define AVFMT_NO_BYTE_SEEK
Format does not allow seeking by bytes.
Definition: avformat.h:488
chunk_start
static int chunk_start(AVFormatContext *s)
Definition: webm_chunk.c:166
AVERROR
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
AVCodecParameters::codec_type
enum AVMediaType codec_type
General type of the encoded data.
Definition: codec_par.h:51
USMDemuxContext
Definition: usmdec.c:47
GetByteContext
Definition: bytestream.h:33
AVCodecParameters
This struct describes the properties of an encoded stream.
Definition: codec_par.h:47
avformat_new_stream
AVStream * avformat_new_stream(AVFormatContext *s, const struct AVCodec *c)
Add a new stream to a media file.
AVERROR_EOF
#define AVERROR_EOF
End of file.
Definition: error.h:57
av_int2double
static av_always_inline double av_int2double(uint64_t i)
Reinterpret a 64-bit integer as a double.
Definition: intfloat.h:60
bytestream2_seek
static av_always_inline int bytestream2_seek(GetByteContext *g, int offset, int whence)
Definition: bytestream.h:212
USMDemuxContext::header_size
unsigned header_size
Definition: usmdec.c:51
USMDemuxContext::nb_channels
int nb_channels[4]
Definition: usmdec.c:49
USMChannel::codec_id
int codec_id
Definition: usmdec.c:38
FFMAX
#define FFMAX(a, b)
Definition: macros.h:47
AVFMT_NOBINSEARCH
#define AVFMT_NOBINSEARCH
Format does not allow to fall back on binary search via read_timestamp.
Definition: avformat.h:486
AVChannelLayout::nb_channels
int nb_channels
Number of channels in this layout.
Definition: channel_layout.h:317
USMChannel::index
int index
Definition: usmdec.c:35
ALPHAI
#define ALPHAI
Definition: usmdec.c:31
ff_get_extradata
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...
Definition: demux_utils.c:355
AVPROBE_SCORE_MAX
#define AVPROBE_SCORE_MAX
maximum score
Definition: avformat.h:464
bytestream2_skip
static av_always_inline void bytestream2_skip(GetByteContext *g, unsigned int size)
Definition: bytestream.h:168
avpriv_set_pts_info
void avpriv_set_pts_info(AVStream *st, int pts_wrap_bits, unsigned int pts_num, unsigned int pts_den)
Set the time base and wrapping info for a given stream.
Definition: avformat.c:761
ffstream
static av_always_inline FFStream * ffstream(AVStream *st)
Definition: internal.h:420
av_int2float
static av_always_inline float av_int2float(uint32_t i)
Reinterpret a 32-bit integer as a float.
Definition: intfloat.h:40
read_close
static av_cold int read_close(AVFormatContext *ctx)
Definition: libcdio.c:143
avio_tell
static av_always_inline int64_t avio_tell(AVIOContext *s)
ftell() equivalent for AVIOContext.
Definition: avio.h:513
AVFMT_GENERIC_INDEX
#define AVFMT_GENERIC_INDEX
Use generic index building code.
Definition: avformat.h:481
type
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
Definition: writing_filters.txt:86
AVStream::duration
int64_t duration
Decoding: duration of the stream, in stream time base.
Definition: avformat.h:900
AVRational::num
int num
Numerator.
Definition: rational.h:59
USMChannel::extradata_pos
int64_t extradata_pos
Definition: usmdec.c:44
avio_rb32
unsigned int avio_rb32(AVIOContext *s)
Definition: aviobuf.c:808
pkt
AVPacket * pkt
Definition: movenc.c:59
AV_LOG_ERROR
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition: log.h:180
AVInputFormat
Definition: avformat.h:549
ff_usm_demuxer
const AVInputFormat ff_usm_demuxer
Definition: usmdec.c:417
read_packet
static int read_packet(void *opaque, uint8_t *buf, int buf_size)
Definition: avio_read_callback.c:41
intreadwrite.h
s
#define s(width, name)
Definition: cbs_vp9.c:198
AVInputFormat::name
const char * name
A comma separated list of short names for the format.
Definition: avformat.h:554
AVProbeData::buf
unsigned char * buf
Buffer must have AVPROBE_PADDING_SIZE of extra allocated bytes filled with zero.
Definition: avformat.h:454
AVMEDIA_TYPE_AUDIO
@ AVMEDIA_TYPE_AUDIO
Definition: avutil.h:202
AV_CODEC_ID_VP9
@ AV_CODEC_ID_VP9
Definition: codec_id.h:220
AVCodecParameters::width
int width
Video only.
Definition: codec_par.h:121
GetByteContext::buffer
const uint8_t * buffer
Definition: bytestream.h:34
AUDIOI
#define AUDIOI
Definition: usmdec.c:30
key
const char * key
Definition: hwcontext_opencl.c:174
AV_CODEC_ID_H264
@ AV_CODEC_ID_H264
Definition: codec_id.h:79
USMDemuxContext::ch
USMChannel ch[4][256]
Definition: usmdec.c:48
parse_chunk
static int64_t parse_chunk(AVFormatContext *s, AVIOContext *pb, uint32_t chunk_type, uint32_t chunk_size, AVPacket *pkt)
Definition: usmdec.c:228
FFStream::need_parsing
enum AVStreamParseType need_parsing
Definition: internal.h:391
AVFormatContext
Format I/O context.
Definition: avformat.h:1115
internal.h
AVStream::codecpar
AVCodecParameters * codecpar
Codec parameters associated with this stream.
Definition: avformat.h:864
read_header
static int read_header(FFV1Context *f)
Definition: ffv1dec.c:550
NULL
#define NULL
Definition: coverity.c:32
AVFMTCTX_NOHEADER
#define AVFMTCTX_NOHEADER
signal that no header is present (streams are added dynamically)
Definition: avformat.h:1066
AVRational
Rational number (pair of numerator and denominator).
Definition: rational.h:58
USMChannel::height
int height
Definition: usmdec.c:42
AV_RN32
#define AV_RN32(p)
Definition: intreadwrite.h:362
AVProbeData
This structure contains the data a format has to probe a file.
Definition: avformat.h:452
AVCodecParameters::ch_layout
AVChannelLayout ch_layout
Audio only.
Definition: codec_par.h:206
AVCodecParameters::sample_rate
int sample_rate
Audio only.
Definition: codec_par.h:171
AV_CODEC_ID_MPEG1VIDEO
@ AV_CODEC_ID_MPEG1VIDEO
Definition: codec_id.h:53
bytestream2_get_bytes_left
static av_always_inline int bytestream2_get_bytes_left(GetByteContext *g)
Definition: bytestream.h:158
AVStream::nb_frames
int64_t nb_frames
number of frames in this stream if known or 0
Definition: avformat.h:902
AVIOContext
Bytestream IO Context.
Definition: avio.h:166
AV_CODEC_ID_ADPCM_ADX
@ AV_CODEC_ID_ADPCM_ADX
Definition: codec_id.h:378
NULL_IF_CONFIG_SMALL
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
Definition: internal.h:106
av_make_q
static AVRational av_make_q(int num, int den)
Create an AVRational.
Definition: rational.h:71
MKBETAG
#define MKBETAG(a, b, c, d)
Definition: macros.h:56
USMChannel::used
int used
Definition: usmdec.c:36
avio_r8
int avio_r8(AVIOContext *s)
Definition: aviobuf.c:650
offset
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
Definition: writing_filters.txt:86
USMChannel::duration
int64_t duration
Definition: usmdec.c:43
FFERROR_REDO
#define FFERROR_REDO
Returned by demuxers to indicate that data was consumed but discarded (ignored streams or junk data).
Definition: demux.h:62
i
#define i(width, name, range_min, range_max)
Definition: cbs_h2645.c:255
AVCodecParameters::height
int height
Definition: codec_par.h:122
value
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
Definition: writing_filters.txt:86
USMChannel::rate
AVRational rate
Definition: usmdec.c:41
demux.h
usm_probe
static int usm_probe(const AVProbeData *p)
Definition: usmdec.c:54
av_get_packet
int av_get_packet(AVIOContext *s, AVPacket *pkt, int size)
Allocate and read the payload of a packet and initialize its fields with default values.
Definition: utils.c:103
ret
ret
Definition: filter_design.txt:187
AVStream
Stream structure.
Definition: avformat.h:841
avio_rb16
unsigned int avio_rb16(AVIOContext *s)
Definition: aviobuf.c:793
pos
unsigned int pos
Definition: spdifenc.c:413
avformat.h
AV_RL32
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_RL32
Definition: bytestream.h:92
USMChannel::nb_frames
int nb_frames
Definition: usmdec.c:40
AVStream::index
int index
stream index in AVFormatContext
Definition: avformat.h:847
VIDEOI
#define VIDEOI
Definition: usmdec.c:29
AVRational::den
int den
Denominator.
Definition: rational.h:60
avio_read
int avio_read(AVIOContext *s, unsigned char *buf, int size)
Read size bytes from AVIOContext into buf.
Definition: aviobuf.c:659
usm_read_header
static int usm_read_header(AVFormatContext *s)
Definition: usmdec.c:65
USMChannel::nb_channels
int nb_channels
Definition: usmdec.c:39
AVPacket::stream_index
int stream_index
Definition: packet.h:493
parse_utf
static int parse_utf(AVFormatContext *s, AVIOContext *pb, USMChannel *ch, int ch_type, uint32_t parent_chunk_size)
Definition: usmdec.c:71
avio_skip
int64_t avio_skip(AVIOContext *s, int64_t offset)
Skip given number of bytes forward.
Definition: aviobuf.c:365
usm_read_close
static int usm_read_close(AVFormatContext *s)
Definition: usmdec.c:409
AVMEDIA_TYPE_VIDEO
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:201
read_probe
static int read_probe(const AVProbeData *p)
Definition: cdg.c:29
USMChannel
Definition: usmdec.c:34
AVCodecParameters::codec_id
enum AVCodecID codec_id
Specific type of the encoded data (the codec used).
Definition: codec_par.h:55
AVPacket
This structure stores compressed data.
Definition: packet.h:468
av_freep
#define av_freep(p)
Definition: tableprint_vlc.h:34
av_fast_malloc
void av_fast_malloc(void *ptr, unsigned int *size, size_t min_size)
Allocate a buffer, reusing the given one if large enough.
Definition: mem.c:555
AVPacket::pos
int64_t pos
byte position in stream, -1 if unknown
Definition: packet.h:511
usm_read_packet
static int usm_read_packet(AVFormatContext *s, AVPacket *pkt)
Definition: usmdec.c:367
bytestream.h
bytestream2_init
static av_always_inline void bytestream2_init(GetByteContext *g, const uint8_t *buf, int buf_size)
Definition: bytestream.h:137
flags
#define flags(name, subs,...)
Definition: cbs_av1.c:474
av_log
#define av_log(a,...)
Definition: tableprint_vlc.h:27
AVERROR_INVALIDDATA
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
Definition: error.h:61
SUBTTI
#define SUBTTI
Definition: usmdec.c:32
MKTAG
#define MKTAG(a, b, c, d)
Definition: macros.h:55
AVStream::start_time
int64_t start_time
Decoding: pts of the first frame of the stream in presentation order, in stream time base.
Definition: avformat.h:890
AVSTREAM_PARSE_TIMESTAMPS
@ AVSTREAM_PARSE_TIMESTAMPS
full parsing and interpolation of timestamps for frames not starting on a packet boundary
Definition: avformat.h:693
USMChannel::type
int type
Definition: usmdec.c:37
USMChannel::width
int width
Definition: usmdec.c:42
USMDemuxContext::header
uint8_t * header
Definition: usmdec.c:50
AV_CODEC_ID_HCA
@ AV_CODEC_ID_HCA
Definition: codec_id.h:535
avio_feof
int avio_feof(AVIOContext *s)
Similar to feof() but also returns nonzero on read errors.
Definition: aviobuf.c:393