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 "libavutil/mem.h"
31 #include "avformat.h"
32 #include "avio_internal.h"
33 #include "demux.h"
34 #include "internal.h"
35 
36 #define SMACKER_PAL 0x01
37 #define SMACKER_FLAG_RING_FRAME 0x01
38 #define SMACKER_FLAG_Y_INTERLACE (1 << 1)
39 #define SMACKER_FLAG_Y_DOUBLE (1 << 2)
40 
41 enum SAudFlags {
47 };
48 
49 typedef struct SmackerContext {
50  uint32_t frames;
51  /* frame info */
52  uint32_t *frm_size;
53  uint8_t *frm_flags;
54  /* internal variables */
56  int cur_frame;
58  int indexes[7];
59  int duration_size[7];
60  /* current frame for demuxing */
61  uint32_t frame_size;
62  int flags;
65  uint8_t pal[768];
68 
69 /* palette used in Smacker */
70 static const uint8_t smk_pal[64] = {
71  0x00, 0x04, 0x08, 0x0C, 0x10, 0x14, 0x18, 0x1C,
72  0x20, 0x24, 0x28, 0x2C, 0x30, 0x34, 0x38, 0x3C,
73  0x41, 0x45, 0x49, 0x4D, 0x51, 0x55, 0x59, 0x5D,
74  0x61, 0x65, 0x69, 0x6D, 0x71, 0x75, 0x79, 0x7D,
75  0x82, 0x86, 0x8A, 0x8E, 0x92, 0x96, 0x9A, 0x9E,
76  0xA2, 0xA6, 0xAA, 0xAE, 0xB2, 0xB6, 0xBA, 0xBE,
77  0xC3, 0xC7, 0xCB, 0xCF, 0xD3, 0xD7, 0xDB, 0xDF,
78  0xE3, 0xE7, 0xEB, 0xEF, 0xF3, 0xF7, 0xFB, 0xFF
79 };
80 
81 
82 static int smacker_probe(const AVProbeData *p)
83 {
84  if ( AV_RL32(p->buf) != MKTAG('S', 'M', 'K', '2')
85  && AV_RL32(p->buf) != MKTAG('S', 'M', 'K', '4'))
86  return 0;
87 
88  if (AV_RL32(p->buf+4) > 32768U || AV_RL32(p->buf+8) > 32768U)
89  return AVPROBE_SCORE_MAX/4;
90 
91  return AVPROBE_SCORE_MAX;
92 }
93 
95 {
96  AVIOContext *pb = s->pb;
97  SmackerContext *smk = s->priv_data;
98  AVStream *st;
99  AVCodecParameters *par;
100  uint32_t magic, width, height, flags, treesize;
101  int64_t pos;
102  int i, ret, pts_inc;
103  int tbase;
104 
105  /* read and check header */
106  magic = avio_rl32(pb);
107  if (magic != MKTAG('S', 'M', 'K', '2') && magic != MKTAG('S', 'M', 'K', '4'))
108  return AVERROR_INVALIDDATA;
109  width = avio_rl32(pb);
110  height = avio_rl32(pb);
111  smk->frames = avio_rl32(pb);
112  pts_inc = avio_rl32(pb);
113  if (pts_inc > INT_MAX / 100 || pts_inc == INT_MIN) {
114  av_log(s, AV_LOG_ERROR, "pts_inc %d is invalid\n", pts_inc);
115  return AVERROR_INVALIDDATA;
116  }
117 
118  flags = avio_rl32(pb);
120  smk->frames++;
121  if (smk->frames > 0xFFFFFF) {
122  av_log(s, AV_LOG_ERROR, "Too many frames: %"PRIu32"\n", smk->frames);
123  return AVERROR_INVALIDDATA;
124  }
125 
126  avio_skip(pb, 28); /* Unused audio related data */
127 
128  treesize = avio_rl32(pb);
129  if (treesize >= UINT_MAX/4) {
130  // treesize + 16 must not overflow (this check is probably redundant)
131  av_log(s, AV_LOG_ERROR, "treesize too large\n");
132  return AVERROR_INVALIDDATA;
133  }
134 
135  st = avformat_new_stream(s, NULL);
136  if (!st)
137  return AVERROR(ENOMEM);
138 
139  smk->videoindex = st->index;
140  /* Smacker uses 100000 as internal timebase */
141  if (pts_inc < 0)
142  pts_inc = -pts_inc;
143  else
144  pts_inc *= 100;
145  tbase = 100000;
146  av_reduce(&tbase, &pts_inc, tbase, pts_inc, (1UL << 31) - 1);
147  avpriv_set_pts_info(st, 33, pts_inc, tbase);
148  st->duration = smk->frames;
149 
150  st->sample_aspect_ratio = (AVRational){ 1, 1 +
152 
153  /* init video codec */
154  par = st->codecpar;
155  par->width = width;
156  par->height = height;
157  par->format = AV_PIX_FMT_PAL8;
160  par->codec_tag = magic;
161 
162  if ((ret = ff_alloc_extradata(par, treesize + 16)) < 0) {
164  "Cannot allocate %"PRIu32" bytes of extradata\n",
165  treesize + 16);
166  return ret;
167  }
168  if ((ret = ffio_read_size(pb, par->extradata, 16)) < 0)
169  return ret;
170 
171  /* handle possible audio streams */
172  for (i = 0; i < 7; i++) {
173  uint32_t rate = avio_rl24(pb);
174  uint8_t aflag = avio_r8(pb);
175 
176  smk->indexes[i] = -1;
177 
178  if (rate) {
180  AVCodecParameters *par;
181  if (!ast)
182  return AVERROR(ENOMEM);
183 
184  smk->indexes[i] = ast->index;
185  par = ast->codecpar;
187  if (aflag & SMK_AUD_BINKAUD) {
189  } else if (aflag & SMK_AUD_USEDCT) {
191  } else if (aflag & SMK_AUD_PACKED) {
193  par->codec_tag = MKTAG('S', 'M', 'K', 'A');
194  } else {
196  }
198  !!(aflag & SMK_AUD_STEREO) + 1);
199  par->sample_rate = rate;
200  par->bits_per_coded_sample = (aflag & SMK_AUD_16BITS) ? 16 : 8;
201  if (par->bits_per_coded_sample == 16 &&
204  else
205  smk->duration_size[i] = 4;
206  avpriv_set_pts_info(ast, 64, 1, par->sample_rate * par->ch_layout.nb_channels
207  * par->bits_per_coded_sample / 8);
208  }
209  }
210 
211  avio_rl32(pb); /* padding */
212 
213  /* setup data */
214  st->priv_data = av_malloc_array(smk->frames, sizeof(*smk->frm_size) +
215  sizeof(*smk->frm_flags));
216  if (!st->priv_data)
217  return AVERROR(ENOMEM);
218  smk->frm_size = st->priv_data;
219  smk->frm_flags = (void*)(smk->frm_size + smk->frames);
220 
221  /* read frame info */
222  pos = 0;
223  for (i = 0; i < smk->frames; i++) {
224  smk->frm_size[i] = avio_rl32(pb);
225  if ((ret = av_add_index_entry(st, pos, i, smk->frm_size[i], 0,
226  (i == 0 || (smk->frm_size[i] & 1)) ? AVINDEX_KEYFRAME : 0)) < 0)
227  return ret;
228  pos += smk->frm_size[i];
229  }
230  if ((ret = ffio_read_size(pb, smk->frm_flags, smk->frames)) < 0 ||
231  /* load trees to extradata, they will be unpacked by decoder */
232  (ret = ffio_read_size(pb, par->extradata + 16,
233  par->extradata_size - 16)) < 0) {
234  return ret;
235  }
236 
237  return 0;
238 }
239 
241 {
242  SmackerContext *smk = s->priv_data;
243  int flags;
244  int ret;
245 
246  if (avio_feof(s->pb) || smk->cur_frame >= smk->frames)
247  return AVERROR_EOF;
248 
249  /* if we demuxed all streams, pass another frame */
250  if (!smk->next_audio_index) {
251  smk->frame_size = smk->frm_size[smk->cur_frame] & (~3);
252  smk->next_frame_pos = avio_tell(s->pb) + smk->frame_size;
253  flags = smk->frm_flags[smk->cur_frame];
254  smk->flags = flags >> 1;
255  /* handle palette change event */
256  if (flags & SMACKER_PAL) {
257  int size, sz, t, off, j, pos;
258  uint8_t *pal = smk->pal;
259  uint8_t oldpal[768];
260 
261  memcpy(oldpal, pal, 768);
262  size = avio_r8(s->pb);
263  size = size * 4;
264  if (size > smk->frame_size) {
266  goto next_frame;
267  }
268  smk->frame_size -= size--;
269  sz = 0;
270  pos = avio_tell(s->pb) + size;
271  while (sz < 256) {
272  t = avio_r8(s->pb);
273  if (t & 0x80) { /* skip palette entries */
274  sz += (t & 0x7F) + 1;
275  pal += ((t & 0x7F) + 1) * 3;
276  } else if (t & 0x40) { /* copy with offset */
277  off = avio_r8(s->pb);
278  j = (t & 0x3F) + 1;
279  if (off + j > 0x100) {
281  "Invalid palette update, offset=%d length=%d extends beyond palette size\n",
282  off, j);
284  goto next_frame;
285  }
286  off *= 3;
287  while (j-- && sz < 256) {
288  *pal++ = oldpal[off + 0];
289  *pal++ = oldpal[off + 1];
290  *pal++ = oldpal[off + 2];
291  sz++;
292  off += 3;
293  }
294  } else { /* new entries */
295  *pal++ = smk_pal[t];
296  *pal++ = smk_pal[avio_r8(s->pb) & 0x3F];
297  *pal++ = smk_pal[avio_r8(s->pb) & 0x3F];
298  sz++;
299  }
300  }
301  avio_seek(s->pb, pos, 0);
302  smk->new_palette = 1;
303  }
304  }
305 
306  for (int i = smk->next_audio_index; i < 7; i++) {
307  if (smk->flags & (1 << i)) {
308  uint32_t size;
309 
310  size = avio_rl32(s->pb);
311  if ((int)size < 4 + smk->duration_size[i] || size > smk->frame_size) {
312  av_log(s, AV_LOG_ERROR, "Invalid audio part size\n");
314  goto next_frame;
315  }
316  smk->frame_size -= size;
317  size -= 4;
318 
319  if (smk->indexes[i] < 0 ||
320  s->streams[smk->indexes[i]]->discard >= AVDISCARD_ALL) {
321  smk->aud_pts[i] += smk->duration_size[i] ? avio_rl32(s->pb)
322  : size;
323  avio_skip(s->pb, size - smk->duration_size[i]);
324  continue;
325  }
326  if ((ret = av_get_packet(s->pb, pkt, size)) != size) {
327  ret = ret < 0 ? ret : AVERROR_INVALIDDATA;
328  goto next_frame;
329  }
330  pkt->stream_index = smk->indexes[i];
331  pkt->pts = smk->aud_pts[i];
332  pkt->duration = smk->duration_size[i] ? AV_RL32(pkt->data)
333  : size;
334  smk->aud_pts[i] += pkt->duration;
335  smk->next_audio_index = i + 1;
336  return 0;
337  }
338  }
339 
340  if (s->streams[smk->videoindex]->discard >= AVDISCARD_ALL) {
341  ret = FFERROR_REDO;
342  goto next_frame;
343  }
344  if (smk->frame_size >= INT_MAX/2) {
346  goto next_frame;
347  }
348  if ((ret = av_new_packet(pkt, smk->frame_size + 769)) < 0)
349  goto next_frame;
350  flags = smk->new_palette;
351  if ((smk->frm_size[smk->cur_frame] & 1) || smk->cur_frame == 0)
352  flags |= 2;
353  pkt->data[0] = flags;
354  memcpy(pkt->data + 1, smk->pal, 768);
355  ret = ffio_read_size(s->pb, pkt->data + 769, smk->frame_size);
356  if (ret < 0)
357  goto next_frame;
358  pkt->stream_index = smk->videoindex;
359  pkt->pts = smk->cur_frame;
360  pkt->duration = 1;
361  if (flags & 2)
363  smk->next_audio_index = 0;
364  smk->new_palette = 0;
365  smk->cur_frame++;
366 
367  return 0;
368 next_frame:
369  avio_seek(s->pb, smk->next_frame_pos, SEEK_SET);
370  smk->next_audio_index = 0;
371  smk->cur_frame++;
372  return ret;
373 }
374 
375 static int smacker_read_seek(AVFormatContext *s, int stream_index,
376  int64_t timestamp, int flags)
377 {
378  AVStream *st = s->streams[stream_index];
379  SmackerContext *smk = s->priv_data;
380  int64_t pos;
381  int ret;
382 
383  if (!(s->pb->seekable & AVIO_SEEKABLE_NORMAL))
384  return -1;
385 
386  if (timestamp < 0 || timestamp >= smk->frames)
387  return AVERROR(EINVAL);
388 
389  ret = av_index_search_timestamp(st, timestamp, flags);
390  if (ret < 0)
391  return ret;
392 
394  pos += ffstream(st)->index_entries[ret].pos;
395  pos = avio_seek(s->pb, pos, SEEK_SET);
396  if (pos < 0)
397  return pos;
398 
399  smk->cur_frame = ret;
400  smk->next_audio_index = 0;
401  smk->new_palette = 0;
402  memset(smk->pal, 0, sizeof(smk->pal));
403  memset(smk->aud_pts, 0, sizeof(smk->aud_pts));
404 
405  return 0;
406 }
407 
409  .p.name = "smk",
410  .p.long_name = NULL_IF_CONFIG_SMALL("Smacker"),
411  .priv_data_size = sizeof(SmackerContext),
416 };
AV_CODEC_ID_PCM_S16LE
@ AV_CODEC_ID_PCM_S16LE
Definition: codec_id.h:328
SMK_AUD_BINKAUD
@ SMK_AUD_BINKAUD
Definition: smacker.c:45
AVCodecParameters::extradata
uint8_t * extradata
Extra binary data needed for initializing the decoder, codec-dependent.
Definition: codec_par.h:69
SMACKER_PAL
#define SMACKER_PAL
Definition: smacker.c:36
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
SmackerContext::videoindex
int videoindex
Definition: smacker.c:57
AVCodecParameters
This struct describes the properties of an encoded stream.
Definition: codec_par.h:47
ffformatcontext
static av_always_inline FFFormatContext * ffformatcontext(AVFormatContext *s)
Definition: internal.h:188
avformat_new_stream
AVStream * avformat_new_stream(AVFormatContext *s, const struct AVCodec *c)
Add a new stream to a media file.
AVStream::priv_data
void * priv_data
Definition: avformat.h:773
AVERROR_EOF
#define AVERROR_EOF
End of file.
Definition: error.h:57
int64_t
long long int64_t
Definition: coverity.c:34
AVPacket::data
uint8_t * data
Definition: packet.h:533
SMK_AUD_PACKED
@ SMK_AUD_PACKED
Definition: smacker.c:42
AVPacket::duration
int64_t duration
Duration of this packet in AVStream->time_base units, 0 if unknown.
Definition: packet.h:551
AVCodecParameters::codec_tag
uint32_t codec_tag
Additional information about the codec (corresponds to the AVI FOURCC).
Definition: codec_par.h:59
AVChannelLayout::nb_channels
int nb_channels
Number of channels in this layout.
Definition: channel_layout.h:321
AV_PKT_FLAG_KEY
#define AV_PKT_FLAG_KEY
The packet contains a keyframe.
Definition: packet.h:588
AVINDEX_KEYFRAME
#define AVINDEX_KEYFRAME
Definition: avformat.h:610
SMK_AUD_STEREO
@ SMK_AUD_STEREO
Definition: smacker.c:44
AVPROBE_SCORE_MAX
#define AVPROBE_SCORE_MAX
maximum score
Definition: avformat.h:463
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:855
ffstream
static av_always_inline FFStream * ffstream(AVStream *st)
Definition: internal.h:419
SmackerContext::frm_flags
uint8_t * frm_flags
Definition: smacker.c:53
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:121
SmackerContext::aud_pts
int64_t aud_pts[7]
Definition: smacker.c:66
AV_CODEC_ID_SMACKAUDIO
@ AV_CODEC_ID_SMACKAUDIO
Definition: codec_id.h:463
avio_tell
static av_always_inline int64_t avio_tell(AVIOContext *s)
ftell() equivalent for AVIOContext.
Definition: avio.h:494
smacker_probe
static int smacker_probe(const AVProbeData *p)
Definition: smacker.c:82
AVStream::duration
int64_t duration
Decoding: duration of the stream, in stream time base.
Definition: avformat.h:807
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: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
SmackerContext::next_frame_pos
int64_t next_frame_pos
Definition: smacker.c:55
width
#define width
intreadwrite.h
s
#define s(width, name)
Definition: cbs_vp9.c:198
SmackerContext::new_palette
int new_palette
Definition: smacker.c:64
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: packet.c:98
SMK_AUD_16BITS
@ SMK_AUD_16BITS
Definition: smacker.c:43
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
AVCodecParameters::width
int width
Video only.
Definition: codec_par.h:134
SMACKER_FLAG_Y_DOUBLE
#define SMACKER_FLAG_Y_DOUBLE
Definition: smacker.c:39
FFFormatContext::data_offset
int64_t data_offset
offset of the first packet
Definition: internal.h:101
AV_CODEC_ID_BINKAUDIO_DCT
@ AV_CODEC_ID_BINKAUDIO_DCT
Definition: codec_id.h:488
AVDISCARD_ALL
@ AVDISCARD_ALL
discard all
Definition: defs.h:220
AVFormatContext
Format I/O context.
Definition: avformat.h:1260
internal.h
AVStream::codecpar
AVCodecParameters * codecpar
Codec parameters associated with this stream.
Definition: avformat.h:771
read_header
static int read_header(FFV1Context *f)
Definition: ffv1dec.c:550
NULL
#define NULL
Definition: coverity.c:32
AVRational
Rational number (pair of numerator and denominator).
Definition: rational.h:58
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
SmackerContext
Definition: smacker.c:49
AVCodecParameters::sample_rate
int sample_rate
Audio only.
Definition: codec_par.h:184
SMACKER_FLAG_RING_FRAME
#define SMACKER_FLAG_RING_FRAME
Definition: smacker.c:37
SmackerContext::indexes
int indexes[7]
Definition: smacker.c:58
AVCodecParameters::extradata_size
int extradata_size
Size of the extradata content in bytes.
Definition: codec_par.h:73
avio_rl32
unsigned int avio_rl32(AVIOContext *s)
Definition: aviobuf.c:730
SmackerContext::pal
uint8_t pal[768]
Definition: smacker.c:65
smacker_read_packet
static int smacker_read_packet(AVFormatContext *s, AVPacket *pkt)
Definition: smacker.c:240
AVIOContext
Bytestream IO Context.
Definition: avio.h:160
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
SmackerContext::duration_size
int duration_size[7]
Definition: smacker.c:59
SMACKER_FLAG_Y_INTERLACE
#define SMACKER_FLAG_Y_INTERLACE
Definition: smacker.c:38
SmackerContext::frame_size
uint32_t frame_size
Definition: smacker.c:61
size
int size
Definition: twinvq_data.h:10344
smk_pal
static const uint8_t smk_pal[64]
Definition: smacker.c:70
AVStream::sample_aspect_ratio
AVRational sample_aspect_ratio
sample aspect ratio (0 if unknown)
Definition: avformat.h:826
FFInputFormat::p
AVInputFormat p
The public AVInputFormat.
Definition: demux.h:41
avio_r8
int avio_r8(AVIOContext *s)
Definition: aviobuf.c:603
height
#define height
AVPacket::flags
int flags
A combination of AV_PKT_FLAG values.
Definition: packet.h:539
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
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:834
i
#define i(width, name, range_min, range_max)
Definition: cbs_h2645.c:256
AVPacket::pts
int64_t pts
Presentation timestamp in AVStream->time_base units; the time at which the decompressed packet will b...
Definition: packet.h:526
avio_rl24
unsigned int avio_rl24(AVIOContext *s)
Definition: aviobuf.c:722
avio_internal.h
AVCodecParameters::height
int height
Definition: codec_par.h:135
av_malloc_array
#define av_malloc_array(a, b)
Definition: tableprint_vlc.h:31
SMK_AUD_USEDCT
@ SMK_AUD_USEDCT
Definition: smacker.c:46
demux.h
smacker_read_header
static int smacker_read_header(AVFormatContext *s)
Definition: smacker.c:94
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
AV_PIX_FMT_PAL8
@ AV_PIX_FMT_PAL8
8 bits with AV_PIX_FMT_RGB32 palette
Definition: pixfmt.h:84
AV_CODEC_ID_SMACKVIDEO
@ AV_CODEC_ID_SMACKVIDEO
Definition: codec_id.h:135
ret
ret
Definition: filter_design.txt:187
AVStream
Stream structure.
Definition: avformat.h:748
avio_seek
int64_t avio_seek(AVIOContext *s, int64_t offset, int whence)
fseek() equivalent for AVIOContext.
Definition: aviobuf.c:231
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
U
#define U(x)
Definition: vpx_arith.h:37
AVStream::index
int index
stream index in AVFormatContext
Definition: avformat.h:754
channel_layout.h
SmackerContext::frames
uint32_t frames
Definition: smacker.c:50
smacker_read_seek
static int smacker_read_seek(AVFormatContext *s, int stream_index, int64_t timestamp, int flags)
Definition: smacker.c:375
SmackerContext::frm_size
uint32_t * frm_size
Definition: smacker.c:52
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:603
SmackerContext::next_audio_index
int next_audio_index
Definition: smacker.c:63
AVPacket::stream_index
int stream_index
Definition: packet.h:535
avio_skip
int64_t avio_skip(AVIOContext *s, int64_t offset)
Skip given number of bytes forward.
Definition: aviobuf.c:318
FFStream::index_entries
AVIndexEntry * index_entries
Only used if the format does not support seeking natively.
Definition: internal.h:249
AVMEDIA_TYPE_VIDEO
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:201
read_probe
static int read_probe(const AVProbeData *p)
Definition: cdg.c:30
AVCodecParameters::bits_per_coded_sample
int bits_per_coded_sample
The number of bits per sample in the codedwords.
Definition: codec_par.h:110
mem.h
AV_CODEC_ID_PCM_U8
@ AV_CODEC_ID_PCM_U8
Definition: codec_id.h:333
SAudFlags
SAudFlags
Definition: smacker.c:41
AVCodecParameters::format
int format
Definition: codec_par.h:92
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:510
FFInputFormat
Definition: demux.h:37
SmackerContext::flags
int flags
Definition: smacker.c:62
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
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:662
ff_smacker_demuxer
const FFInputFormat ff_smacker_demuxer
Definition: smacker.c:408
AV_CODEC_ID_BINKAUDIO_RDFT
@ AV_CODEC_ID_BINKAUDIO_RDFT
Definition: codec_id.h:487
SmackerContext::cur_frame
int cur_frame
Definition: smacker.c:56
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:244
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:227
avio_feof
int avio_feof(AVIOContext *s)
Similar to feof() but also returns nonzero on read errors.
Definition: aviobuf.c:346