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 "libavutil/mem.h"
24 #include "libavcodec/bytestream.h"
25 
26 #include "avformat.h"
27 #include "demux.h"
28 #include "internal.h"
29 
30 #define VIDEOI 0
31 #define AUDIOI 1
32 #define ALPHAI 2
33 #define SUBTTI 3
34 
35 typedef struct USMChannel {
36  int index;
37  int used;
38  int type;
39  int codec_id;
41  int nb_frames;
43  int width, height;
44  int64_t duration;
45  int64_t extradata_pos;
46 } USMChannel;
47 
48 typedef struct USMDemuxContext {
49  USMChannel ch[4][256];
50  int nb_channels[4];
51  uint8_t *header;
52  unsigned header_size;
54 
55 static int usm_probe(const AVProbeData *p)
56 {
57  if (AV_RL32(p->buf) != MKTAG('C','R','I','D'))
58  return 0;
59 
60  if (AV_RN32(p->buf + 4) == 0)
61  return 0;
62 
63  return AVPROBE_SCORE_MAX / 3;
64 }
65 
67 {
68  s->ctx_flags |= AVFMTCTX_NOHEADER;
69  return 0;
70 }
71 
73  USMChannel *ch, int ch_type,
74  uint32_t parent_chunk_size)
75 {
76  USMDemuxContext *usm = s->priv_data;
77  GetByteContext gb, ugb, sgb;
78  uint32_t chunk_type, chunk_size, offset;
79  uint32_t unique_offset, string_offset;
80  int nb_items, unique_size, nb_dictionaries;
81  AVRational fps = { 0 };
82  int type;
83 
84  chunk_type = avio_rb32(pb);
85  chunk_size = avio_rb32(pb);
86 
87  if (chunk_type != MKBETAG('@','U','T','F'))
88  return AVERROR_INVALIDDATA;
89 
90  if (!chunk_size || chunk_size >= parent_chunk_size)
91  return AVERROR_INVALIDDATA;
92 
93  av_fast_malloc(&usm->header, &usm->header_size, chunk_size);
94  if (!usm->header)
95  return AVERROR(ENOMEM);
96 
97  if (avio_read(pb, usm->header, chunk_size) != chunk_size)
98  return AVERROR_EOF;
99 
100  bytestream2_init(&gb, usm->header, chunk_size);
101  ugb = gb;
102  sgb = gb;
103  unique_offset = bytestream2_get_be32(&gb);
104  string_offset = bytestream2_get_be32(&gb);
105  /*byte_offset =*/ bytestream2_get_be32(&gb);
106  /*payload_name_offset =*/ bytestream2_get_be32(&gb);
107  nb_items = bytestream2_get_be16(&gb);
108  unique_size = bytestream2_get_be16(&gb);
109  nb_dictionaries = bytestream2_get_be32(&gb);
110  if (nb_dictionaries == 0)
111  return AVERROR_INVALIDDATA;
112 
113  bytestream2_skip(&ugb, unique_offset);
114  if (bytestream2_get_bytes_left(&ugb) < unique_size)
115  return AVERROR_INVALIDDATA;
116  bytestream2_init(&ugb, ugb.buffer, unique_size);
117 
118  bytestream2_skip(&sgb, string_offset);
119 
120  for (int i = 0; i < nb_items; i++) {
121  GetByteContext *xgb;
122  uint8_t key[256];
123  int64_t value;
124  int n = 0;
125 
126  type = bytestream2_get_byte(&gb);
127  offset = bytestream2_get_be32(&gb);
128 
129  bytestream2_seek(&sgb, string_offset + offset, SEEK_SET);
130  while (bytestream2_get_bytes_left(&sgb) > 0) {
131  key[n] = bytestream2_get_byte(&sgb);
132  if (!key[n])
133  break;
134  if (n >= sizeof(key) - 1)
135  break;
136  n++;
137  }
138  key[n] = '\0';
139 
140  if ((type >> 5) == 1)
141  xgb = &gb;
142  else
143  xgb = &ugb;
144 
145  switch (type & 0x1F) {
146  case 0x10:
147  case 0x11:
148  value = bytestream2_get_byte(xgb);
149  break;
150  case 0x12:
151  case 0x13:
152  value = bytestream2_get_be16(xgb);
153  break;
154  case 0x14:
155  case 0x15:
156  value = bytestream2_get_be32(xgb);
157  break;
158  case 0x16:
159  case 0x17:
160  value = bytestream2_get_be64(xgb);
161  break;
162  case 0x18:
163  value = av_int2float(bytestream2_get_be32(xgb));
164  break;
165  case 0x19:
166  value = av_int2double(bytestream2_get_be64(xgb));
167  break;
168  case 0x1A:
169  break;
170  }
171 
172  if (ch_type == AUDIOI) {
173  if (!strcmp(key, "sampling_rate")) {
174  ch->rate.num = value;
175  ch->rate.den = 1;
176  } else if (!strcmp(key, "num_channels")) {
177  ch->nb_channels = value;
178  } else if (!strcmp(key, "total_samples")) {
179  ch->duration = value;
180  } else if (!strcmp(key, "audio_codec")) {
181  switch (value) {
182  case 2:
184  break;
185  case 4:
187  break;
188  default:
189  av_log(s, AV_LOG_ERROR, "unsupported audio: %d\n", (int)value);
190  break;
191  }
192  }
193  } else if (ch_type == VIDEOI || ch_type == ALPHAI) {
194  if (!strcmp(key, "width")) {
195  ch->width = value;
196  } else if (!strcmp(key, "height")) {
197  ch->height = value;
198  } else if (!strcmp(key, "total_frames")) {
199  ch->nb_frames = value;
200  } else if (!strcmp(key, "framerate_n")) {
201  fps.num = value;
202  } else if (!strcmp(key, "framerate_d")) {
203  fps.den = value;
204  } else if (!strcmp(key, "mpeg_codec")) {
205  switch (value) {
206  case 1:
208  break;
209  case 5:
211  break;
212  case 9:
214  break;
215  default:
216  av_log(s, AV_LOG_ERROR, "unsupported video: %d\n", (int)value);
217  break;
218  }
219  }
220  }
221  }
222 
223  if (ch_type == VIDEOI && fps.num && fps.den)
224  ch->rate = fps;
225 
226  return 0;
227 }
228 
230  uint32_t chunk_type, uint32_t chunk_size,
231  AVPacket *pkt)
232 {
233  const int is_audio = chunk_type == MKBETAG('@','S','F','A');
234  const int is_alpha = chunk_type == MKBETAG('@','A','L','P');
235  const int is_subtt = chunk_type == MKBETAG('@','S','B','T');
236  USMDemuxContext *usm = s->priv_data;
237  int padding_size, payload_type, payload_offset;
238  const int ch_type = is_subtt ? SUBTTI : is_audio ? AUDIOI : is_alpha ? ALPHAI : VIDEOI;
239  int stream_index, frame_rate;
240  int64_t chunk_start, ret;
241 
242  ret = avio_tell(pb);
243  if (ret < 0)
244  return ret;
245  chunk_start = ret;
246  avio_skip(pb, 1);
247  payload_offset = avio_r8(pb);
248  padding_size = avio_rb16(pb);
249  stream_index = avio_r8(pb);
250  avio_skip(pb, 2);
251  payload_type = avio_r8(pb);
252  /*frame_time =*/ avio_rb32(pb);
253  frame_rate = avio_rb32(pb);
254  avio_skip(pb, 8);
255  ret = avio_tell(pb);
256  if (ret < 0)
257  return ret;
258  ret = avio_skip(pb, FFMAX(0, (ret - chunk_start) - payload_offset));
259  if (ret < 0)
260  return ret;
261 
262  if (payload_type == 1) {
263  if (usm->ch[ch_type][stream_index].used == 0) {
264  USMChannel *ch = &usm->ch[ch_type][stream_index];
265 
266  switch (ch_type) {
267  case ALPHAI:
268  case VIDEOI:
269  ch->type = AVMEDIA_TYPE_VIDEO;
270  break;
271  case AUDIOI:
272  ch->type = AVMEDIA_TYPE_AUDIO;
273  break;
274  case SUBTTI:
276  break;
277  default:
278  return AVERROR_INVALIDDATA;
279  }
280 
281  ch->used = 1;
282  ch->index = -1;
283  usm->nb_channels[ch_type]++;
284 
285  ret = parse_utf(s, pb, ch, ch_type, chunk_size);
286  if (ret < 0)
287  return ret;
288  }
289  } else if (payload_type == 0) {
290  if (usm->ch[ch_type][stream_index].used == 1) {
291  USMChannel *ch = &usm->ch[ch_type][stream_index];
292  int get_extradata = 0;
293  uint32_t pkt_size;
294  AVStream *st;
295 
296  if (ch->index < 0) {
297  AVCodecParameters *par;
298  st = avformat_new_stream(s, NULL);
299  if (!st)
300  return AVERROR(ENOMEM);
301  par = st->codecpar;
302  par->codec_type = ch->type;
303  par->codec_id = ch->codec_id;
304  st->start_time = 0;
305 
306  switch (ch->type) {
307  case AVMEDIA_TYPE_VIDEO:
308  par->width = ch->width;
309  par->height = ch->height;
310  st->nb_frames = ch->nb_frames;
311  break;
312  case AVMEDIA_TYPE_AUDIO:
313  par->sample_rate = ch->rate.num;
314  par->ch_layout.nb_channels = ch->nb_channels;
315  st->duration = ch->duration;
316  break;
317  }
318 
319  ch->index = st->index;
320  if (!ch->rate.num || !ch->rate.den)
321  ch->rate = av_make_q(frame_rate, 100);
322  avpriv_set_pts_info(st, 64, ch->rate.den, ch->rate.num);
323 
325  get_extradata = ch->codec_id == AV_CODEC_ID_ADPCM_ADX;
326  ch->extradata_pos = avio_tell(pb);
327  }
328 
329  ret = avio_tell(pb);
330  if (ret < 0)
331  return ret;
332 
333  pkt_size = chunk_size - (ret - chunk_start) - padding_size;
334  if (get_extradata) {
335  if ((ret = ff_get_extradata(s, st->codecpar, pb, pkt_size)) < 0)
336  return ret;
337  } else {
338  if (ret == ch->extradata_pos && ch->codec_id == AV_CODEC_ID_ADPCM_ADX) {
339  avio_skip(pb, pkt_size);
340  ret = 0;
341  } else {
342  ret = av_get_packet(pb, pkt, pkt_size);
343  if (ret < 0)
344  return ret;
345 
346  pkt->stream_index = ch->index;
347  }
348  }
349 
350  avio_skip(pb, padding_size);
351 
352  if (ret != pkt_size)
353  return AVERROR_EOF;
354  if (get_extradata == 0)
355  return ret;
356  }
357  }
358 
359  ret = avio_tell(pb);
360  if (ret < 0)
361  return ret;
362  ret = avio_skip(pb, FFMAX(0, chunk_size - (ret - chunk_start)));
363  if (ret < 0)
364  return ret;
365  return FFERROR_REDO;
366 }
367 
369 {
370  AVIOContext *pb = s->pb;
371  int64_t ret = AVERROR_EOF;
372 
373  while (!avio_feof(pb)) {
374  uint32_t chunk_type, chunk_size;
375  int got_packet = 0;
376  int64_t pos;
377 
378  pos = avio_tell(pb);
379  if (pos < 0)
380  return pos;
381  chunk_type = avio_rb32(pb);
382  chunk_size = avio_rb32(pb);
383  if (!chunk_size)
384  return AVERROR_INVALIDDATA;
385 
386  switch (chunk_type) {
387  case MKBETAG('C','R','I','D'):
388  default:
389  ret = avio_skip(pb, chunk_size);
390  break;
391  case MKBETAG('@','A','L','P'):
392  case MKBETAG('@','S','B','T'):
393  case MKBETAG('@','S','F','A'):
394  case MKBETAG('@','S','F','V'):
395  ret = parse_chunk(s, pb, chunk_type, chunk_size, pkt);
396  got_packet = ret > 0;
397  break;
398  }
399 
400  if (got_packet)
401  pkt->pos = pos;
402 
403  if (got_packet || ret < 0)
404  break;
405  }
406 
407  return ret;
408 }
409 
411 {
412  USMDemuxContext *usm = s->priv_data;
413  av_freep(&usm->header);
414  usm->header_size = 0;
415  return 0;
416 }
417 
419  .p.name = "usm",
420  .p.long_name = NULL_IF_CONFIG_SMALL("CRI USM"),
421  .p.extensions = "usm",
423  .priv_data_size = sizeof(USMDemuxContext),
428 };
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:487
chunk_start
static int chunk_start(AVFormatContext *s)
Definition: webm_chunk.c:167
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:48
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:52
USMDemuxContext::nb_channels
int nb_channels[4]
Definition: usmdec.c:50
USMChannel::codec_id
int codec_id
Definition: usmdec.c:39
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:485
AVChannelLayout::nb_channels
int nb_channels
Number of channels in this layout.
Definition: channel_layout.h:321
USMChannel::index
int index
Definition: usmdec.c:36
ALPHAI
#define ALPHAI
Definition: usmdec.c:32
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:335
AVPROBE_SCORE_MAX
#define AVPROBE_SCORE_MAX
maximum score
Definition: avformat.h:463
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:853
ffstream
static av_always_inline FFStream * ffstream(AVStream *st)
Definition: internal.h:417
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:494
AVFMT_GENERIC_INDEX
#define AVFMT_GENERIC_INDEX
Use generic index building code.
Definition: avformat.h:480
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:802
AVRational::num
int num
Numerator.
Definition: rational.h:59
USMChannel::extradata_pos
int64_t extradata_pos
Definition: usmdec.c:45
avio_rb32
unsigned int avio_rb32(AVIOContext *s)
Definition: aviobuf.c:761
pkt
AVPacket * pkt
Definition: movenc.c:60
AV_LOG_ERROR
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition: log.h:180
read_packet
static int read_packet(void *opaque, uint8_t *buf, int buf_size)
Definition: avio_read_callback.c:42
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:553
AVProbeData::buf
unsigned char * buf
Buffer must have AVPROBE_PADDING_SIZE of extra allocated bytes filled with zero.
Definition: avformat.h:453
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:134
GetByteContext::buffer
const uint8_t * buffer
Definition: bytestream.h:34
AUDIOI
#define AUDIOI
Definition: usmdec.c:31
key
const char * key
Definition: hwcontext_opencl.c:189
AV_CODEC_ID_H264
@ AV_CODEC_ID_H264
Definition: codec_id.h:79
USMDemuxContext::ch
USMChannel ch[4][256]
Definition: usmdec.c:49
parse_chunk
static int64_t parse_chunk(AVFormatContext *s, AVIOContext *pb, uint32_t chunk_type, uint32_t chunk_size, AVPacket *pkt)
Definition: usmdec.c:229
FFStream::need_parsing
enum AVStreamParseType need_parsing
Definition: internal.h:386
AVFormatContext
Format I/O context.
Definition: avformat.h:1255
internal.h
AVStream::codecpar
AVCodecParameters * codecpar
Codec parameters associated with this stream.
Definition: avformat.h:766
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:1206
AVRational
Rational number (pair of numerator and denominator).
Definition: rational.h:58
USMChannel::height
int height
Definition: usmdec.c:43
AV_RN32
#define AV_RN32(p)
Definition: intreadwrite.h:358
AVProbeData
This structure contains the data a format has to probe a file.
Definition: avformat.h:451
AVCodecParameters::ch_layout
AVChannelLayout ch_layout
Audio only.
Definition: codec_par.h:180
AVCodecParameters::sample_rate
int sample_rate
Audio only.
Definition: codec_par.h:184
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:804
AVIOContext
Bytestream IO Context.
Definition: avio.h:160
AV_CODEC_ID_ADPCM_ADX
@ AV_CODEC_ID_ADPCM_ADX
Definition: codec_id.h:376
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:94
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:37
FFInputFormat::p
AVInputFormat p
The public AVInputFormat.
Definition: demux.h:41
avio_r8
int avio_r8(AVIOContext *s)
Definition: aviobuf.c:603
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:44
ff_usm_demuxer
const FFInputFormat ff_usm_demuxer
Definition: usmdec.c:418
FFERROR_REDO
#define FFERROR_REDO
Returned by demuxers to indicate that data was consumed but discarded (ignored streams or junk data).
Definition: demux.h:171
i
#define i(width, name, range_min, range_max)
Definition: cbs_h2645.c:256
AVCodecParameters::height
int height
Definition: codec_par.h:135
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:42
demux.h
usm_probe
static int usm_probe(const AVProbeData *p)
Definition: usmdec.c:55
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:91
ret
ret
Definition: filter_design.txt:187
AVStream
Stream structure.
Definition: avformat.h:743
avio_rb16
unsigned int avio_rb16(AVIOContext *s)
Definition: aviobuf.c:746
pos
unsigned int pos
Definition: spdifenc.c:414
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:41
AVStream::index
int index
stream index in AVFormatContext
Definition: avformat.h:749
VIDEOI
#define VIDEOI
Definition: usmdec.c:30
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:612
usm_read_header
static int usm_read_header(AVFormatContext *s)
Definition: usmdec.c:66
USMChannel::nb_channels
int nb_channels
Definition: usmdec.c:40
AVPacket::stream_index
int stream_index
Definition: packet.h:522
parse_utf
static int parse_utf(AVFormatContext *s, AVIOContext *pb, USMChannel *ch, int ch_type, uint32_t parent_chunk_size)
Definition: usmdec.c:72
avio_skip
int64_t avio_skip(AVIOContext *s, int64_t offset)
Skip given number of bytes forward.
Definition: aviobuf.c:318
usm_read_close
static int usm_read_close(AVFormatContext *s)
Definition: usmdec.c:410
AVMEDIA_TYPE_VIDEO
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:201
read_probe
static int read_probe(const AVProbeData *p)
Definition: cdg.c:30
mem.h
USMChannel
Definition: usmdec.c:35
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:497
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:557
AVPacket::pos
int64_t pos
byte position in stream, -1 if unknown
Definition: packet.h:540
usm_read_packet
static int usm_read_packet(AVFormatContext *s, AVPacket *pkt)
Definition: usmdec.c:368
FFInputFormat
Definition: demux.h:37
bytestream.h
bytestream2_init
static av_always_inline void bytestream2_init(GetByteContext *g, const uint8_t *buf, int buf_size)
Definition: bytestream.h:137
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:33
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:792
AVSTREAM_PARSE_TIMESTAMPS
@ AVSTREAM_PARSE_TIMESTAMPS
full parsing and interpolation of timestamps for frames not starting on a packet boundary
Definition: avformat.h:595
USMChannel::type
int type
Definition: usmdec.c:38
USMChannel::width
int width
Definition: usmdec.c:43
USMDemuxContext::header
uint8_t * header
Definition: usmdec.c:51
AV_CODEC_ID_HCA
@ AV_CODEC_ID_HCA
Definition: codec_id.h:533
avio_feof
int avio_feof(AVIOContext *s)
Similar to feof() but also returns nonzero on read errors.
Definition: aviobuf.c:346