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 #define SMACKER_FLAG_Y_INTERLACE (1 << 1)
38 #define SMACKER_FLAG_Y_DOUBLE (1 << 2)
39 
40 enum SAudFlags {
46 };
47 
48 typedef struct SmackerContext {
49  uint32_t frames;
50  /* frame info */
51  uint32_t *frm_size;
52  uint8_t *frm_flags;
53  /* internal variables */
55  int cur_frame;
57  int indexes[7];
58  int duration_size[7];
59  /* current frame for demuxing */
60  uint32_t frame_size;
61  int flags;
64  uint8_t pal[768];
67 
68 /* palette used in Smacker */
69 static const uint8_t smk_pal[64] = {
70  0x00, 0x04, 0x08, 0x0C, 0x10, 0x14, 0x18, 0x1C,
71  0x20, 0x24, 0x28, 0x2C, 0x30, 0x34, 0x38, 0x3C,
72  0x41, 0x45, 0x49, 0x4D, 0x51, 0x55, 0x59, 0x5D,
73  0x61, 0x65, 0x69, 0x6D, 0x71, 0x75, 0x79, 0x7D,
74  0x82, 0x86, 0x8A, 0x8E, 0x92, 0x96, 0x9A, 0x9E,
75  0xA2, 0xA6, 0xAA, 0xAE, 0xB2, 0xB6, 0xBA, 0xBE,
76  0xC3, 0xC7, 0xCB, 0xCF, 0xD3, 0xD7, 0xDB, 0xDF,
77  0xE3, 0xE7, 0xEB, 0xEF, 0xF3, 0xF7, 0xFB, 0xFF
78 };
79 
80 
81 static int smacker_probe(const AVProbeData *p)
82 {
83  if ( AV_RL32(p->buf) != MKTAG('S', 'M', 'K', '2')
84  && AV_RL32(p->buf) != MKTAG('S', 'M', 'K', '4'))
85  return 0;
86 
87  if (AV_RL32(p->buf+4) > 32768U || AV_RL32(p->buf+8) > 32768U)
88  return AVPROBE_SCORE_MAX/4;
89 
90  return AVPROBE_SCORE_MAX;
91 }
92 
94 {
95  AVIOContext *pb = s->pb;
96  SmackerContext *smk = s->priv_data;
97  AVStream *st;
98  AVCodecParameters *par;
99  uint32_t magic, width, height, flags, treesize;
100  int64_t pos;
101  int i, ret, pts_inc;
102  int tbase;
103 
104  /* read and check header */
105  magic = avio_rl32(pb);
106  if (magic != MKTAG('S', 'M', 'K', '2') && magic != MKTAG('S', 'M', 'K', '4'))
107  return AVERROR_INVALIDDATA;
108  width = avio_rl32(pb);
109  height = avio_rl32(pb);
110  smk->frames = avio_rl32(pb);
111  pts_inc = avio_rl32(pb);
112  if (pts_inc > INT_MAX / 100 || pts_inc == INT_MIN) {
113  av_log(s, AV_LOG_ERROR, "pts_inc %d is invalid\n", pts_inc);
114  return AVERROR_INVALIDDATA;
115  }
116 
117  flags = avio_rl32(pb);
119  smk->frames++;
120  if (smk->frames > 0xFFFFFF) {
121  av_log(s, AV_LOG_ERROR, "Too many frames: %"PRIu32"\n", smk->frames);
122  return AVERROR_INVALIDDATA;
123  }
124 
125  avio_skip(pb, 28); /* Unused audio related data */
126 
127  treesize = avio_rl32(pb);
128  if (treesize >= UINT_MAX/4) {
129  // treesize + 16 must not overflow (this check is probably redundant)
130  av_log(s, AV_LOG_ERROR, "treesize too large\n");
131  return AVERROR_INVALIDDATA;
132  }
133 
134  st = avformat_new_stream(s, NULL);
135  if (!st)
136  return AVERROR(ENOMEM);
137 
138  smk->videoindex = st->index;
139  /* Smacker uses 100000 as internal timebase */
140  if (pts_inc < 0)
141  pts_inc = -pts_inc;
142  else
143  pts_inc *= 100;
144  tbase = 100000;
145  av_reduce(&tbase, &pts_inc, tbase, pts_inc, (1UL << 31) - 1);
146  avpriv_set_pts_info(st, 33, pts_inc, tbase);
147  st->duration = smk->frames;
148 
149  st->sample_aspect_ratio = (AVRational){ 1, 1 +
151 
152  /* init video codec */
153  par = st->codecpar;
154  par->width = width;
155  par->height = height;
156  par->format = AV_PIX_FMT_PAL8;
159  par->codec_tag = magic;
160 
161  if ((ret = ff_alloc_extradata(par, treesize + 16)) < 0) {
163  "Cannot allocate %"PRIu32" bytes of extradata\n",
164  treesize + 16);
165  return ret;
166  }
167  if ((ret = ffio_read_size(pb, par->extradata, 16)) < 0)
168  return ret;
169 
170  /* handle possible audio streams */
171  for (i = 0; i < 7; i++) {
172  uint32_t rate = avio_rl24(pb);
173  uint8_t aflag = avio_r8(pb);
174 
175  smk->indexes[i] = -1;
176 
177  if (rate) {
179  AVCodecParameters *par;
180  if (!ast)
181  return AVERROR(ENOMEM);
182 
183  smk->indexes[i] = ast->index;
184  par = ast->codecpar;
186  if (aflag & SMK_AUD_BINKAUD) {
188  } else if (aflag & SMK_AUD_USEDCT) {
190  } else if (aflag & SMK_AUD_PACKED) {
192  par->codec_tag = MKTAG('S', 'M', 'K', 'A');
193  } else {
195  }
197  !!(aflag & SMK_AUD_STEREO) + 1);
198  par->sample_rate = rate;
199  par->bits_per_coded_sample = (aflag & SMK_AUD_16BITS) ? 16 : 8;
200  if (par->bits_per_coded_sample == 16 &&
203  else
204  smk->duration_size[i] = 4;
205  avpriv_set_pts_info(ast, 64, 1, par->sample_rate * par->ch_layout.nb_channels
206  * par->bits_per_coded_sample / 8);
207  }
208  }
209 
210  avio_rl32(pb); /* padding */
211 
212  /* setup data */
213  st->priv_data = av_malloc_array(smk->frames, sizeof(*smk->frm_size) +
214  sizeof(*smk->frm_flags));
215  if (!st->priv_data)
216  return AVERROR(ENOMEM);
217  smk->frm_size = st->priv_data;
218  smk->frm_flags = (void*)(smk->frm_size + smk->frames);
219 
220  /* read frame info */
221  pos = 0;
222  for (i = 0; i < smk->frames; i++) {
223  smk->frm_size[i] = avio_rl32(pb);
224  if ((ret = av_add_index_entry(st, pos, i, smk->frm_size[i], 0,
225  (i == 0 || (smk->frm_size[i] & 1)) ? AVINDEX_KEYFRAME : 0)) < 0)
226  return ret;
227  pos += smk->frm_size[i];
228  }
229  if ((ret = ffio_read_size(pb, smk->frm_flags, smk->frames)) < 0 ||
230  /* load trees to extradata, they will be unpacked by decoder */
231  (ret = ffio_read_size(pb, par->extradata + 16,
232  par->extradata_size - 16)) < 0) {
233  return ret;
234  }
235 
236  return 0;
237 }
238 
240 {
241  SmackerContext *smk = s->priv_data;
242  int flags;
243  int ret;
244 
245  if (avio_feof(s->pb) || smk->cur_frame >= smk->frames)
246  return AVERROR_EOF;
247 
248  /* if we demuxed all streams, pass another frame */
249  if (!smk->next_audio_index) {
250  smk->frame_size = smk->frm_size[smk->cur_frame] & (~3);
251  smk->next_frame_pos = avio_tell(s->pb) + smk->frame_size;
252  flags = smk->frm_flags[smk->cur_frame];
253  smk->flags = flags >> 1;
254  /* handle palette change event */
255  if (flags & SMACKER_PAL) {
256  int size, sz, t, off, j, pos;
257  uint8_t *pal = smk->pal;
258  uint8_t oldpal[768];
259 
260  memcpy(oldpal, pal, 768);
261  size = avio_r8(s->pb);
262  size = size * 4;
263  if (size > smk->frame_size) {
265  goto next_frame;
266  }
267  smk->frame_size -= size--;
268  sz = 0;
269  pos = avio_tell(s->pb) + size;
270  while (sz < 256) {
271  t = avio_r8(s->pb);
272  if (t & 0x80) { /* skip palette entries */
273  sz += (t & 0x7F) + 1;
274  pal += ((t & 0x7F) + 1) * 3;
275  } else if (t & 0x40) { /* copy with offset */
276  off = avio_r8(s->pb);
277  j = (t & 0x3F) + 1;
278  if (off + j > 0x100) {
280  "Invalid palette update, offset=%d length=%d extends beyond palette size\n",
281  off, j);
283  goto next_frame;
284  }
285  off *= 3;
286  while (j-- && sz < 256) {
287  *pal++ = oldpal[off + 0];
288  *pal++ = oldpal[off + 1];
289  *pal++ = oldpal[off + 2];
290  sz++;
291  off += 3;
292  }
293  } else { /* new entries */
294  *pal++ = smk_pal[t];
295  *pal++ = smk_pal[avio_r8(s->pb) & 0x3F];
296  *pal++ = smk_pal[avio_r8(s->pb) & 0x3F];
297  sz++;
298  }
299  }
300  avio_seek(s->pb, pos, 0);
301  smk->new_palette = 1;
302  }
303  }
304 
305  for (int i = smk->next_audio_index; i < 7; i++) {
306  if (smk->flags & (1 << i)) {
307  uint32_t size;
308 
309  size = avio_rl32(s->pb);
310  if ((int)size < 4 + smk->duration_size[i] || size > smk->frame_size) {
311  av_log(s, AV_LOG_ERROR, "Invalid audio part size\n");
313  goto next_frame;
314  }
315  smk->frame_size -= size;
316  size -= 4;
317 
318  if (smk->indexes[i] < 0 ||
319  s->streams[smk->indexes[i]]->discard >= AVDISCARD_ALL) {
320  smk->aud_pts[i] += smk->duration_size[i] ? avio_rl32(s->pb)
321  : size;
322  avio_skip(s->pb, size - smk->duration_size[i]);
323  continue;
324  }
325  if ((ret = av_get_packet(s->pb, pkt, size)) != size) {
326  ret = ret < 0 ? ret : AVERROR_INVALIDDATA;
327  goto next_frame;
328  }
329  pkt->stream_index = smk->indexes[i];
330  pkt->pts = smk->aud_pts[i];
331  pkt->duration = smk->duration_size[i] ? AV_RL32(pkt->data)
332  : size;
333  smk->aud_pts[i] += pkt->duration;
334  smk->next_audio_index = i + 1;
335  return 0;
336  }
337  }
338 
339  if (s->streams[smk->videoindex]->discard >= AVDISCARD_ALL) {
340  ret = FFERROR_REDO;
341  goto next_frame;
342  }
343  if (smk->frame_size >= INT_MAX/2) {
345  goto next_frame;
346  }
347  if ((ret = av_new_packet(pkt, smk->frame_size + 769)) < 0)
348  goto next_frame;
349  flags = smk->new_palette;
350  if ((smk->frm_size[smk->cur_frame] & 1) || smk->cur_frame == 0)
351  flags |= 2;
352  pkt->data[0] = flags;
353  memcpy(pkt->data + 1, smk->pal, 768);
354  ret = ffio_read_size(s->pb, pkt->data + 769, smk->frame_size);
355  if (ret < 0)
356  goto next_frame;
357  pkt->stream_index = smk->videoindex;
358  pkt->pts = smk->cur_frame;
359  pkt->duration = 1;
360  if (flags & 2)
362  smk->next_audio_index = 0;
363  smk->new_palette = 0;
364  smk->cur_frame++;
365 
366  return 0;
367 next_frame:
368  avio_seek(s->pb, smk->next_frame_pos, SEEK_SET);
369  smk->next_audio_index = 0;
370  smk->cur_frame++;
371  return ret;
372 }
373 
374 static int smacker_read_seek(AVFormatContext *s, int stream_index,
375  int64_t timestamp, int flags)
376 {
377  AVStream *st = s->streams[stream_index];
378  SmackerContext *smk = s->priv_data;
379  int64_t pos;
380  int ret;
381 
382  if (!(s->pb->seekable & AVIO_SEEKABLE_NORMAL))
383  return -1;
384 
385  if (timestamp < 0 || timestamp >= smk->frames)
386  return AVERROR(EINVAL);
387 
388  ret = av_index_search_timestamp(st, timestamp, flags);
389  if (ret < 0)
390  return ret;
391 
393  pos += ffstream(st)->index_entries[ret].pos;
394  pos = avio_seek(s->pb, pos, SEEK_SET);
395  if (pos < 0)
396  return pos;
397 
398  smk->cur_frame = ret;
399  smk->next_audio_index = 0;
400  smk->new_palette = 0;
401  memset(smk->pal, 0, sizeof(smk->pal));
402  memset(smk->aud_pts, 0, sizeof(smk->aud_pts));
403 
404  return 0;
405 }
406 
408  .p.name = "smk",
409  .p.long_name = NULL_IF_CONFIG_SMALL("Smacker"),
410  .priv_data_size = sizeof(SmackerContext),
415 };
AV_CODEC_ID_PCM_S16LE
@ AV_CODEC_ID_PCM_S16LE
Definition: codec_id.h:328
SMK_AUD_BINKAUD
@ SMK_AUD_BINKAUD
Definition: smacker.c:44
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: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
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:56
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:768
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:522
SMK_AUD_PACKED
@ SMK_AUD_PACKED
Definition: smacker.c:41
AVPacket::duration
int64_t duration
Duration of this packet in AVStream->time_base units, 0 if unknown.
Definition: packet.h:540
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:313
AV_PKT_FLAG_KEY
#define AV_PKT_FLAG_KEY
The packet contains a keyframe.
Definition: packet.h:577
AVINDEX_KEYFRAME
#define AVINDEX_KEYFRAME
Definition: avformat.h:610
SMK_AUD_STEREO
@ SMK_AUD_STEREO
Definition: smacker.c:43
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:853
ffstream
static av_always_inline FFStream * ffstream(AVStream *st)
Definition: internal.h:417
SmackerContext::frm_flags
uint8_t * frm_flags
Definition: smacker.c:52
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:120
SmackerContext::aud_pts
int64_t aud_pts[7]
Definition: smacker.c:65
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:81
AVStream::duration
int64_t duration
Decoding: duration of the stream, in stream time base.
Definition: avformat.h:802
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
read_packet
static int read_packet(void *opaque, uint8_t *buf, int buf_size)
Definition: avio_read_callback.c:41
SmackerContext::next_frame_pos
int64_t next_frame_pos
Definition: smacker.c:54
width
#define width
intreadwrite.h
s
#define s(width, name)
Definition: cbs_vp9.c:198
SmackerContext::new_palette
int new_palette
Definition: smacker.c:63
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:98
SMK_AUD_16BITS
@ SMK_AUD_16BITS
Definition: smacker.c:42
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:38
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:219
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
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:48
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:36
SmackerContext::indexes
int indexes[7]
Definition: smacker.c:57
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:729
SmackerContext::pal
uint8_t pal[768]
Definition: smacker.c:64
smacker_read_packet
static int smacker_read_packet(AVFormatContext *s, AVPacket *pkt)
Definition: smacker.c:239
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:106
SmackerContext::duration_size
int duration_size[7]
Definition: smacker.c:58
SMACKER_FLAG_Y_INTERLACE
#define SMACKER_FLAG_Y_INTERLACE
Definition: smacker.c:37
SmackerContext::frame_size
uint32_t frame_size
Definition: smacker.c:60
size
int size
Definition: twinvq_data.h:10344
smk_pal
static const uint8_t smk_pal[64]
Definition: smacker.c:69
AVStream::sample_aspect_ratio
AVRational sample_aspect_ratio
sample aspect ratio (0 if unknown)
Definition: avformat.h:821
FFInputFormat::p
AVInputFormat p
The public AVInputFormat.
Definition: demux.h:41
avio_r8
int avio_r8(AVIOContext *s)
Definition: aviobuf.c:602
height
#define height
AVPacket::flags
int flags
A combination of AV_PKT_FLAG values.
Definition: packet.h:528
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:830
i
#define i(width, name, range_min, range_max)
Definition: cbs_h2645.c:255
AVPacket::pts
int64_t pts
Presentation timestamp in AVStream->time_base units; the time at which the decompressed packet will b...
Definition: packet.h:515
avio_rl24
unsigned int avio_rl24(AVIOContext *s)
Definition: aviobuf.c:721
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:45
demux.h
smacker_read_header
static int smacker_read_header(AVFormatContext *s)
Definition: smacker.c:93
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
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:743
avio_seek
int64_t avio_seek(AVIOContext *s, int64_t offset, int whence)
fseek() equivalent for AVIOContext.
Definition: aviobuf.c:230
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
U
#define U(x)
Definition: vpx_arith.h:37
AVStream::index
int index
stream index in AVFormatContext
Definition: avformat.h:749
channel_layout.h
SmackerContext::frames
uint32_t frames
Definition: smacker.c:49
smacker_read_seek
static int smacker_read_seek(AVFormatContext *s, int stream_index, int64_t timestamp, int flags)
Definition: smacker.c:374
SmackerContext::frm_size
uint32_t * frm_size
Definition: smacker.c:51
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:62
AVPacket::stream_index
int stream_index
Definition: packet.h:524
avio_skip
int64_t avio_skip(AVIOContext *s, int64_t offset)
Skip given number of bytes forward.
Definition: aviobuf.c:317
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
AV_CODEC_ID_PCM_U8
@ AV_CODEC_ID_PCM_U8
Definition: codec_id.h:333
SAudFlags
SAudFlags
Definition: smacker.c:40
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:499
FFInputFormat
Definition: demux.h:37
SmackerContext::flags
int flags
Definition: smacker.c:61
flags
#define flags(name, subs,...)
Definition: cbs_av1.c:482
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:661
ff_smacker_demuxer
const FFInputFormat ff_smacker_demuxer
Definition: smacker.c:407
AV_CODEC_ID_BINKAUDIO_RDFT
@ AV_CODEC_ID_BINKAUDIO_RDFT
Definition: codec_id.h:487
SmackerContext::cur_frame
int cur_frame
Definition: smacker.c:55
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:243
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:239
avio_feof
int avio_feof(AVIOContext *s)
Similar to feof() but also returns nonzero on read errors.
Definition: aviobuf.c:345