FFmpeg
smacker.c
Go to the documentation of this file.
1 /*
2  * Smacker demuxer
3  * Copyright (c) 2006 Konstantin Shishkov
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 /*
23  * Based on http://wiki.multimedia.cx/index.php?title=Smacker
24  */
25 
26 #include <inttypes.h>
27 
29 #include "libavutil/intreadwrite.h"
30 #include "avformat.h"
31 #include "avio_internal.h"
32 #include "demux.h"
33 #include "internal.h"
34 
35 #define SMACKER_PAL 0x01
36 #define SMACKER_FLAG_RING_FRAME 0x01
37 
38 enum SAudFlags {
44 };
45 
46 typedef struct SmackerContext {
47  uint32_t frames;
48  /* frame info */
49  uint32_t *frm_size;
50  uint8_t *frm_flags;
51  /* internal variables */
52  int64_t next_frame_pos;
53  int cur_frame;
55  int indexes[7];
56  int duration_size[7];
57  /* current frame for demuxing */
58  uint32_t frame_size;
59  int flags;
62  uint8_t pal[768];
63  int64_t aud_pts[7];
65 
66 /* palette used in Smacker */
67 static const uint8_t smk_pal[64] = {
68  0x00, 0x04, 0x08, 0x0C, 0x10, 0x14, 0x18, 0x1C,
69  0x20, 0x24, 0x28, 0x2C, 0x30, 0x34, 0x38, 0x3C,
70  0x41, 0x45, 0x49, 0x4D, 0x51, 0x55, 0x59, 0x5D,
71  0x61, 0x65, 0x69, 0x6D, 0x71, 0x75, 0x79, 0x7D,
72  0x82, 0x86, 0x8A, 0x8E, 0x92, 0x96, 0x9A, 0x9E,
73  0xA2, 0xA6, 0xAA, 0xAE, 0xB2, 0xB6, 0xBA, 0xBE,
74  0xC3, 0xC7, 0xCB, 0xCF, 0xD3, 0xD7, 0xDB, 0xDF,
75  0xE3, 0xE7, 0xEB, 0xEF, 0xF3, 0xF7, 0xFB, 0xFF
76 };
77 
78 
79 static int smacker_probe(const AVProbeData *p)
80 {
81  if ( AV_RL32(p->buf) != MKTAG('S', 'M', 'K', '2')
82  && AV_RL32(p->buf) != MKTAG('S', 'M', 'K', '4'))
83  return 0;
84 
85  if (AV_RL32(p->buf+4) > 32768U || AV_RL32(p->buf+8) > 32768U)
86  return AVPROBE_SCORE_MAX/4;
87 
88  return AVPROBE_SCORE_MAX;
89 }
90 
92 {
93  AVIOContext *pb = s->pb;
94  SmackerContext *smk = s->priv_data;
95  AVStream *st;
96  AVCodecParameters *par;
97  uint32_t magic, width, height, flags, treesize;
98  int64_t pos;
99  int i, ret, pts_inc;
100  int tbase;
101 
102  /* read and check header */
103  magic = avio_rl32(pb);
104  if (magic != MKTAG('S', 'M', 'K', '2') && magic != MKTAG('S', 'M', 'K', '4'))
105  return AVERROR_INVALIDDATA;
106  width = avio_rl32(pb);
107  height = avio_rl32(pb);
108  smk->frames = avio_rl32(pb);
109  pts_inc = avio_rl32(pb);
110  if (pts_inc > INT_MAX / 100 || pts_inc == INT_MIN) {
111  av_log(s, AV_LOG_ERROR, "pts_inc %d is invalid\n", pts_inc);
112  return AVERROR_INVALIDDATA;
113  }
114 
115  flags = avio_rl32(pb);
117  smk->frames++;
118  if (smk->frames > 0xFFFFFF) {
119  av_log(s, AV_LOG_ERROR, "Too many frames: %"PRIu32"\n", smk->frames);
120  return AVERROR_INVALIDDATA;
121  }
122 
123  avio_skip(pb, 28); /* Unused audio related data */
124 
125  treesize = avio_rl32(pb);
126  if (treesize >= UINT_MAX/4) {
127  // treesize + 16 must not overflow (this check is probably redundant)
128  av_log(s, AV_LOG_ERROR, "treesize too large\n");
129  return AVERROR_INVALIDDATA;
130  }
131 
132  st = avformat_new_stream(s, NULL);
133  if (!st)
134  return AVERROR(ENOMEM);
135 
136  smk->videoindex = st->index;
137  /* Smacker uses 100000 as internal timebase */
138  if (pts_inc < 0)
139  pts_inc = -pts_inc;
140  else
141  pts_inc *= 100;
142  tbase = 100000;
143  av_reduce(&tbase, &pts_inc, tbase, pts_inc, (1UL << 31) - 1);
144  avpriv_set_pts_info(st, 33, pts_inc, tbase);
145  st->duration = smk->frames;
146 
147  /* init video codec */
148  par = st->codecpar;
149  par->width = width;
150  par->height = height;
151  par->format = AV_PIX_FMT_PAL8;
154  par->codec_tag = magic;
155 
156  if ((ret = ff_alloc_extradata(par, treesize + 16)) < 0) {
158  "Cannot allocate %"PRIu32" bytes of extradata\n",
159  treesize + 16);
160  return ret;
161  }
162  if ((ret = ffio_read_size(pb, par->extradata, 16)) < 0)
163  return ret;
164 
165  /* handle possible audio streams */
166  for (i = 0; i < 7; i++) {
167  uint32_t rate = avio_rl24(pb);
168  uint8_t aflag = avio_r8(pb);
169 
170  smk->indexes[i] = -1;
171 
172  if (rate) {
174  AVCodecParameters *par;
175  if (!ast)
176  return AVERROR(ENOMEM);
177 
178  smk->indexes[i] = ast->index;
179  par = ast->codecpar;
181  if (aflag & SMK_AUD_BINKAUD) {
183  } else if (aflag & SMK_AUD_USEDCT) {
185  } else if (aflag & SMK_AUD_PACKED) {
187  par->codec_tag = MKTAG('S', 'M', 'K', 'A');
188  } else {
190  }
192  !!(aflag & SMK_AUD_STEREO) + 1);
193  par->sample_rate = rate;
194  par->bits_per_coded_sample = (aflag & SMK_AUD_16BITS) ? 16 : 8;
195  if (par->bits_per_coded_sample == 16 &&
198  else
199  smk->duration_size[i] = 4;
200  avpriv_set_pts_info(ast, 64, 1, par->sample_rate * par->ch_layout.nb_channels
201  * par->bits_per_coded_sample / 8);
202  }
203  }
204 
205  avio_rl32(pb); /* padding */
206 
207  /* setup data */
208  st->priv_data = av_malloc_array(smk->frames, sizeof(*smk->frm_size) +
209  sizeof(*smk->frm_flags));
210  if (!st->priv_data)
211  return AVERROR(ENOMEM);
212  smk->frm_size = st->priv_data;
213  smk->frm_flags = (void*)(smk->frm_size + smk->frames);
214 
215  /* read frame info */
216  pos = 0;
217  for (i = 0; i < smk->frames; i++) {
218  smk->frm_size[i] = avio_rl32(pb);
219  if ((ret = av_add_index_entry(st, pos, i, smk->frm_size[i], 0,
220  (i == 0 || (smk->frm_size[i] & 1)) ? AVINDEX_KEYFRAME : 0)) < 0)
221  return ret;
222  pos += smk->frm_size[i];
223  }
224  if ((ret = ffio_read_size(pb, smk->frm_flags, smk->frames)) < 0 ||
225  /* load trees to extradata, they will be unpacked by decoder */
226  (ret = ffio_read_size(pb, par->extradata + 16,
227  par->extradata_size - 16)) < 0) {
228  return ret;
229  }
230 
231  return 0;
232 }
233 
235 {
236  SmackerContext *smk = s->priv_data;
237  int flags;
238  int ret;
239 
240  if (avio_feof(s->pb) || smk->cur_frame >= smk->frames)
241  return AVERROR_EOF;
242 
243  /* if we demuxed all streams, pass another frame */
244  if (!smk->next_audio_index) {
245  smk->frame_size = smk->frm_size[smk->cur_frame] & (~3);
246  smk->next_frame_pos = avio_tell(s->pb) + smk->frame_size;
247  flags = smk->frm_flags[smk->cur_frame];
248  smk->flags = flags >> 1;
249  /* handle palette change event */
250  if (flags & SMACKER_PAL) {
251  int size, sz, t, off, j, pos;
252  uint8_t *pal = smk->pal;
253  uint8_t oldpal[768];
254 
255  memcpy(oldpal, pal, 768);
256  size = avio_r8(s->pb);
257  size = size * 4;
258  if (size > smk->frame_size) {
260  goto next_frame;
261  }
262  smk->frame_size -= size--;
263  sz = 0;
264  pos = avio_tell(s->pb) + size;
265  while (sz < 256) {
266  t = avio_r8(s->pb);
267  if (t & 0x80) { /* skip palette entries */
268  sz += (t & 0x7F) + 1;
269  pal += ((t & 0x7F) + 1) * 3;
270  } else if (t & 0x40) { /* copy with offset */
271  off = avio_r8(s->pb);
272  j = (t & 0x3F) + 1;
273  if (off + j > 0x100) {
275  "Invalid palette update, offset=%d length=%d extends beyond palette size\n",
276  off, j);
278  goto next_frame;
279  }
280  off *= 3;
281  while (j-- && sz < 256) {
282  *pal++ = oldpal[off + 0];
283  *pal++ = oldpal[off + 1];
284  *pal++ = oldpal[off + 2];
285  sz++;
286  off += 3;
287  }
288  } else { /* new entries */
289  *pal++ = smk_pal[t];
290  *pal++ = smk_pal[avio_r8(s->pb) & 0x3F];
291  *pal++ = smk_pal[avio_r8(s->pb) & 0x3F];
292  sz++;
293  }
294  }
295  avio_seek(s->pb, pos, 0);
296  smk->new_palette = 1;
297  }
298  }
299 
300  for (int i = smk->next_audio_index; i < 7; i++) {
301  if (smk->flags & (1 << i)) {
302  uint32_t size;
303 
304  size = avio_rl32(s->pb);
305  if ((int)size < 4 + smk->duration_size[i] || size > smk->frame_size) {
306  av_log(s, AV_LOG_ERROR, "Invalid audio part size\n");
308  goto next_frame;
309  }
310  smk->frame_size -= size;
311  size -= 4;
312 
313  if (smk->indexes[i] < 0 ||
314  s->streams[smk->indexes[i]]->discard >= AVDISCARD_ALL) {
315  smk->aud_pts[i] += smk->duration_size[i] ? avio_rl32(s->pb)
316  : size;
317  avio_skip(s->pb, size - smk->duration_size[i]);
318  continue;
319  }
320  if ((ret = av_get_packet(s->pb, pkt, size)) != size) {
321  ret = ret < 0 ? ret : AVERROR_INVALIDDATA;
322  goto next_frame;
323  }
324  pkt->stream_index = smk->indexes[i];
325  pkt->pts = smk->aud_pts[i];
326  pkt->duration = smk->duration_size[i] ? AV_RL32(pkt->data)
327  : size;
328  smk->aud_pts[i] += pkt->duration;
329  smk->next_audio_index = i + 1;
330  return 0;
331  }
332  }
333 
334  if (s->streams[smk->videoindex]->discard >= AVDISCARD_ALL) {
335  ret = FFERROR_REDO;
336  goto next_frame;
337  }
338  if (smk->frame_size >= INT_MAX/2) {
340  goto next_frame;
341  }
342  if ((ret = av_new_packet(pkt, smk->frame_size + 769)) < 0)
343  goto next_frame;
344  flags = smk->new_palette;
345  if ((smk->frm_size[smk->cur_frame] & 1) || smk->cur_frame == 0)
346  flags |= 2;
347  pkt->data[0] = flags;
348  memcpy(pkt->data + 1, smk->pal, 768);
349  ret = ffio_read_size(s->pb, pkt->data + 769, smk->frame_size);
350  if (ret < 0)
351  goto next_frame;
352  pkt->stream_index = smk->videoindex;
353  pkt->pts = smk->cur_frame;
354  pkt->duration = 1;
355  if (flags & 2)
357  smk->next_audio_index = 0;
358  smk->new_palette = 0;
359  smk->cur_frame++;
360 
361  return 0;
362 next_frame:
363  avio_seek(s->pb, smk->next_frame_pos, SEEK_SET);
364  smk->next_audio_index = 0;
365  smk->cur_frame++;
366  return ret;
367 }
368 
369 static int smacker_read_seek(AVFormatContext *s, int stream_index,
370  int64_t timestamp, int flags)
371 {
372  AVStream *st = s->streams[stream_index];
373  SmackerContext *smk = s->priv_data;
374  int64_t pos;
375  int ret;
376 
377  if (!(s->pb->seekable & AVIO_SEEKABLE_NORMAL))
378  return -1;
379 
380  if (timestamp < 0 || timestamp >= smk->frames)
381  return AVERROR(EINVAL);
382 
383  ret = av_index_search_timestamp(st, timestamp, flags);
384  if (ret < 0)
385  return ret;
386 
388  pos += ffstream(st)->index_entries[ret].pos;
389  pos = avio_seek(s->pb, pos, SEEK_SET);
390  if (pos < 0)
391  return pos;
392 
393  smk->cur_frame = ret;
394  smk->next_audio_index = 0;
395  smk->new_palette = 0;
396  memset(smk->pal, 0, sizeof(smk->pal));
397  memset(smk->aud_pts, 0, sizeof(smk->aud_pts));
398 
399  return 0;
400 }
401 
403  .name = "smk",
404  .long_name = NULL_IF_CONFIG_SMALL("Smacker"),
405  .priv_data_size = sizeof(SmackerContext),
410 };
AV_CODEC_ID_PCM_S16LE
@ AV_CODEC_ID_PCM_S16LE
Definition: codec_id.h:318
SMK_AUD_BINKAUD
@ SMK_AUD_BINKAUD
Definition: smacker.c:42
AVCodecParameters::extradata
uint8_t * extradata
Extra binary data needed for initializing the decoder, codec-dependent.
Definition: codec_par.h:75
SMACKER_PAL
#define SMACKER_PAL
Definition: smacker.c:35
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
avformat_new_stream
AVStream * avformat_new_stream(AVFormatContext *s, const AVCodec *c)
Add a new stream to a media file.
Definition: options.c:237
AVCodecParameters::codec_type
enum AVMediaType codec_type
General type of the encoded data.
Definition: codec_par.h:57
SmackerContext::videoindex
int videoindex
Definition: smacker.c:54
AVCodecParameters
This struct describes the properties of an encoded stream.
Definition: codec_par.h:53
ffformatcontext
static av_always_inline FFFormatContext * ffformatcontext(AVFormatContext *s)
Definition: internal.h:192
AVStream::priv_data
void * priv_data
Definition: avformat.h:964
AVERROR_EOF
#define AVERROR_EOF
End of file.
Definition: error.h:57
AVPacket::data
uint8_t * data
Definition: packet.h:374
SMK_AUD_PACKED
@ SMK_AUD_PACKED
Definition: smacker.c:39
AVPacket::duration
int64_t duration
Duration of this packet in AVStream->time_base units, 0 if unknown.
Definition: packet.h:392
AVCodecParameters::codec_tag
uint32_t codec_tag
Additional information about the codec (corresponds to the AVI FOURCC).
Definition: codec_par.h:65
AVChannelLayout::nb_channels
int nb_channels
Number of channels in this layout.
Definition: channel_layout.h:300
AV_PKT_FLAG_KEY
#define AV_PKT_FLAG_KEY
The packet contains a keyframe.
Definition: packet.h:429
AVINDEX_KEYFRAME
#define AVINDEX_KEYFRAME
Definition: avformat.h:815
SMK_AUD_STEREO
@ SMK_AUD_STEREO
Definition: smacker.c:41
AVPROBE_SCORE_MAX
#define AVPROBE_SCORE_MAX
maximum score
Definition: avformat.h:465
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:697
ffstream
static av_always_inline FFStream * ffstream(AVStream *st)
Definition: internal.h:407
U
#define U(x)
Definition: vp56_arith.h:37
SmackerContext::frm_flags
uint8_t * frm_flags
Definition: smacker.c:50
read_seek
static int read_seek(AVFormatContext *ctx, int stream_index, int64_t timestamp, int flags)
Definition: libcdio.c:151
av_add_index_entry
int av_add_index_entry(AVStream *st, int64_t pos, int64_t timestamp, int size, int distance, int flags)
Add an index entry into a sorted list.
Definition: seek.c:118
SmackerContext::aud_pts
int64_t aud_pts[7]
Definition: smacker.c:63
AV_CODEC_ID_SMACKAUDIO
@ AV_CODEC_ID_SMACKAUDIO
Definition: codec_id.h:450
avio_tell
static av_always_inline int64_t avio_tell(AVIOContext *s)
ftell() equivalent for AVIOContext.
Definition: avio.h:505
smacker_probe
static int smacker_probe(const AVProbeData *p)
Definition: smacker.c:79
AVStream::duration
int64_t duration
Decoding: duration of the stream, in stream time base.
Definition: avformat.h:998
av_reduce
int av_reduce(int *dst_num, int *dst_den, int64_t num, int64_t den, int64_t max)
Reduce a fraction.
Definition: rational.c:35
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:656
SmackerContext::next_frame_pos
int64_t next_frame_pos
Definition: smacker.c:52
width
#define width
intreadwrite.h
s
#define s(width, name)
Definition: cbs_vp9.c:256
SmackerContext::new_palette
int new_palette
Definition: smacker.c:61
av_new_packet
int av_new_packet(AVPacket *pkt, int size)
Allocate the payload of a packet and initialize its fields with default values.
Definition: avpacket.c:97
SMK_AUD_16BITS
@ SMK_AUD_16BITS
Definition: smacker.c:40
AVInputFormat::name
const char * name
A comma separated list of short names for the format.
Definition: avformat.h:661
AVProbeData::buf
unsigned char * buf
Buffer must have AVPROBE_PADDING_SIZE of extra allocated bytes filled with zero.
Definition: avformat.h:455
AVMEDIA_TYPE_AUDIO
@ AVMEDIA_TYPE_AUDIO
Definition: avutil.h:202
AVCodecParameters::width
int width
Video only.
Definition: codec_par.h:127
FFFormatContext::data_offset
int64_t data_offset
offset of the first packet
Definition: internal.h:109
AV_CODEC_ID_BINKAUDIO_DCT
@ AV_CODEC_ID_BINKAUDIO_DCT
Definition: codec_id.h:475
AVDISCARD_ALL
@ AVDISCARD_ALL
discard all
Definition: defs.h:54
AVFormatContext
Format I/O context.
Definition: avformat.h:1213
internal.h
AVStream::codecpar
AVCodecParameters * codecpar
Codec parameters associated with this stream.
Definition: avformat.h:1108
read_header
static int read_header(FFV1Context *f)
Definition: ffv1dec.c:532
NULL
#define NULL
Definition: coverity.c:32
read_probe
static int read_probe(const AVProbeData *pd)
Definition: jvdec.c:55
AVProbeData
This structure contains the data a format has to probe a file.
Definition: avformat.h:453
av_channel_layout_default
void av_channel_layout_default(AVChannelLayout *ch_layout, int nb_channels)
Get the default channel layout for a given number of channels.
Definition: channel_layout.c:960
AVCodecParameters::ch_layout
AVChannelLayout ch_layout
Audio only.
Definition: codec_par.h:212
SmackerContext
Definition: smacker.c:46
AVCodecParameters::sample_rate
int sample_rate
Audio only.
Definition: codec_par.h:177
SMACKER_FLAG_RING_FRAME
#define SMACKER_FLAG_RING_FRAME
Definition: smacker.c:36
SmackerContext::indexes
int indexes[7]
Definition: smacker.c:55
AVCodecParameters::extradata_size
int extradata_size
Size of the extradata content in bytes.
Definition: codec_par.h:79
avio_rl32
unsigned int avio_rl32(AVIOContext *s)
Definition: aviobuf.c:759
SmackerContext::pal
uint8_t pal[768]
Definition: smacker.c:62
smacker_read_packet
static int smacker_read_packet(AVFormatContext *s, AVPacket *pkt)
Definition: smacker.c:234
AVIOContext
Bytestream IO Context.
Definition: avio.h:162
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:117
SmackerContext::duration_size
int duration_size[7]
Definition: smacker.c:56
SmackerContext::frame_size
uint32_t frame_size
Definition: smacker.c:58
size
int size
Definition: twinvq_data.h:10344
smk_pal
static const uint8_t smk_pal[64]
Definition: smacker.c:67
avio_r8
int avio_r8(AVIOContext *s)
Definition: aviobuf.c:632
height
#define height
AVPacket::flags
int flags
A combination of AV_PKT_FLAG values.
Definition: packet.h:380
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:269
AVPacket::pts
int64_t pts
Presentation timestamp in AVStream->time_base units; the time at which the decompressed packet will b...
Definition: packet.h:367
avio_rl24
unsigned int avio_rl24(AVIOContext *s)
Definition: aviobuf.c:751
avio_internal.h
AVCodecParameters::height
int height
Definition: codec_par.h:128
av_malloc_array
#define av_malloc_array(a, b)
Definition: tableprint_vlc.h:31
SMK_AUD_USEDCT
@ SMK_AUD_USEDCT
Definition: smacker.c:43
demux.h
smacker_read_header
static int smacker_read_header(AVFormatContext *s)
Definition: smacker.c:91
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:102
AV_PIX_FMT_PAL8
@ AV_PIX_FMT_PAL8
8 bits with AV_PIX_FMT_RGB32 palette
Definition: pixfmt.h:77
AV_CODEC_ID_SMACKVIDEO
@ AV_CODEC_ID_SMACKVIDEO
Definition: codec_id.h:133
ret
ret
Definition: filter_design.txt:187
read_packet
static int read_packet(void *opaque, uint8_t *buf, int buf_size)
Definition: avio_reading.c:42
AVStream
Stream structure.
Definition: avformat.h:948
avio_seek
int64_t avio_seek(AVIOContext *s, int64_t offset, int whence)
fseek() equivalent for AVIOContext.
Definition: aviobuf.c:260
pos
unsigned int pos
Definition: spdifenc.c:412
avformat.h
AV_RL32
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_RL32
Definition: bytestream.h:92
AVStream::index
int index
stream index in AVFormatContext
Definition: avformat.h:956
channel_layout.h
SmackerContext::frames
uint32_t frames
Definition: smacker.c:47
smacker_read_seek
static int smacker_read_seek(AVFormatContext *s, int stream_index, int64_t timestamp, int flags)
Definition: smacker.c:369
SmackerContext::frm_size
uint32_t * frm_size
Definition: smacker.c:49
AVIO_SEEKABLE_NORMAL
#define AVIO_SEEKABLE_NORMAL
Seeking works like for a local file.
Definition: avio.h:41
AVIndexEntry::pos
int64_t pos
Definition: avformat.h:808
SmackerContext::next_audio_index
int next_audio_index
Definition: smacker.c:60
AVPacket::stream_index
int stream_index
Definition: packet.h:376
ff_smacker_demuxer
const AVInputFormat ff_smacker_demuxer
Definition: smacker.c:402
avio_skip
int64_t avio_skip(AVIOContext *s, int64_t offset)
Skip given number of bytes forward.
Definition: aviobuf.c:347
FFStream::index_entries
AVIndexEntry * index_entries
Only used if the format does not support seeking natively.
Definition: internal.h:252
AVMEDIA_TYPE_VIDEO
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:201
AVCodecParameters::bits_per_coded_sample
int bits_per_coded_sample
The number of bits per sample in the codedwords.
Definition: codec_par.h:103
AV_CODEC_ID_PCM_U8
@ AV_CODEC_ID_PCM_U8
Definition: codec_id.h:323
SAudFlags
SAudFlags
Definition: smacker.c:38
AVCodecParameters::format
int format
Definition: codec_par.h:85
AVCodecParameters::codec_id
enum AVCodecID codec_id
Specific type of the encoded data (the codec used).
Definition: codec_par.h:61
AVPacket
This structure stores compressed data.
Definition: packet.h:351
SmackerContext::flags
int flags
Definition: smacker.c:59
flags
#define flags(name, subs,...)
Definition: cbs_av1.c:561
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
MKTAG
#define MKTAG(a, b, c, d)
Definition: macros.h:55
ffio_read_size
int ffio_read_size(AVIOContext *s, unsigned char *buf, int size)
Read size bytes from AVIOContext into buf.
Definition: aviobuf.c:691
AV_CODEC_ID_BINKAUDIO_RDFT
@ AV_CODEC_ID_BINKAUDIO_RDFT
Definition: codec_id.h:474
SmackerContext::cur_frame
int cur_frame
Definition: smacker.c:53
av_index_search_timestamp
int av_index_search_timestamp(AVStream *st, int64_t timestamp, int flags)
Get the index for a specific timestamp.
Definition: seek.c:238
ff_alloc_extradata
int ff_alloc_extradata(AVCodecParameters *par, int size)
Allocate extradata with additional AV_INPUT_BUFFER_PADDING_SIZE at end which is always set to 0.
Definition: utils.c:238
avio_feof
int avio_feof(AVIOContext *s)
Similar to feof() but also returns nonzero on read errors.
Definition: aviobuf.c:375