FFmpeg
scd.c
Go to the documentation of this file.
1 /*
2  * Square Enix SCD demuxer
3  * Copyright (C) 2021 Zane van Iperen (zane@zanevaniperen.com)
4  *
5  * Based off documentation:
6  * http://ffxivexplorer.fragmenterworks.com/research/scd%20files.txt
7  *
8  * This file is part of FFmpeg.
9  *
10  * FFmpeg is free software; you can redistribute it and/or
11  * modify it under the terms of the GNU Lesser General Public
12  * License as published by the Free Software Foundation; either
13  * version 2.1 of the License, or (at your option) any later version.
14  *
15  * FFmpeg is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18  * Lesser General Public License for more details.
19  *
20  * You should have received a copy of the GNU Lesser General Public
21  * License along with FFmpeg; if not, write to the Free Software
22  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
23  */
24 #include "libavutil/avstring.h"
25 #include "libavutil/intreadwrite.h"
26 #include "libavutil/internal.h"
27 #include "libavutil/macros.h"
28 #include "libavutil/avassert.h"
29 #include "libavformat/internal.h"
30 #include "avformat.h"
31 #include "demux.h"
32 
33 #define SCD_MAGIC ((uint64_t)MKBETAG('S', 'E', 'D', 'B') << 32 | \
34  MKBETAG('S', 'S', 'C', 'F'))
35 #define SCD_MIN_HEADER_SIZE 20
36 #define SCD_OFFSET_HEADER_SIZE 28
37 #define SCD_TRACK_HEADER_SIZE 32
38 
39 #define SCD_TRACK_ID_PCM 0
40 #define SCD_TRACK_ID_OGG 6
41 #define SCD_TRACK_ID_MP3 7
42 #define SCD_TRACK_ID_MS_ADPCM 12
43 
44 typedef struct SCDOffsetTable {
45  uint16_t count;
46  uint32_t offset;
47  uint32_t *entries;
49 
50 typedef struct SCDHeader {
51  uint64_t magic; /* SEDBSSCF */
52  uint32_t version; /* Verison number. We only know about 3. */
53  uint16_t unk1; /* Unknown, 260 in Drakengard 3, 1024 in FFXIV. */
54  uint16_t header_size; /* Total size of this header. */
55  uint32_t file_size; /* Is often 0, just ignore it. */
56 
57  SCDOffsetTable table0; /* Table 0, no idea. 56 uint32's/entry. */
58  SCDOffsetTable table1; /* Table 1, contains the track info. */
59  SCDOffsetTable table2; /* Table 2, no idea. 40 uint32's/entry. */
60  uint16_t unk2; /* Unknown, not a count. */
61  uint32_t unk3; /* Unknown, not an offset. */
62  uint32_t unk4; /* Unknown, offset to offset. */
63 } SCDHeader;
64 
65 typedef struct SCDTrackHeader {
66  uint32_t length;
67  uint32_t num_channels;
68  uint32_t sample_rate;
69  uint32_t data_type;
70  uint32_t loop_start;
71  uint32_t loop_end;
72  uint32_t data_offset; /* Offset to data + this header. */
73  uint32_t aux_count;
74 
75  uint32_t absolute_offset;
76  uint32_t bytes_read;
78 
79 typedef struct SCDDemuxContext {
84 
85 static int scd_probe(const AVProbeData *p)
86 {
87  if (AV_RB64(p->buf) != SCD_MAGIC)
88  return 0;
89 
90  return AVPROBE_SCORE_MAX;
91 }
92 
94 {
95  int64_t ret;
96 
97  if ((ret = avio_seek(s->pb, table->offset, SEEK_SET)) < 0)
98  return ret;
99 
100  if ((table->entries = av_calloc(table->count, sizeof(uint32_t))) == NULL)
101  return ret;
102 
103  if ((ret = avio_read(s->pb, (unsigned char*)table->entries, table->count * sizeof(uint32_t))) < 0)
104  return ret;
105 
106  for (size_t i = 0; i < table->count; i++)
107  table->entries[i] = AV_RB32(table->entries + i);
108 
109  av_log(s, AV_LOG_TRACE, "Table, size = %u, offset = %u\n", table->count, table->offset);
110  for (size_t i = 0; i < table->count; i++)
111  av_log(s, AV_LOG_TRACE, " [%02zu]: %u\n", i, table->entries[i]);
112 
113  return 0;
114 }
115 
117 {
118  int64_t ret;
119  SCDDemuxContext *ctx = s->priv_data;
120  uint8_t buf[SCD_OFFSET_HEADER_SIZE];
121 
122  if ((ret = avio_read(s->pb, buf, SCD_OFFSET_HEADER_SIZE)) < 0)
123  return ret;
124 
125  ctx->hdr.table0.count = AV_RB16(buf + 0);
126  ctx->hdr.table1.count = AV_RB16(buf + 2);
127  ctx->hdr.table2.count = AV_RB16(buf + 4);
128  ctx->hdr.unk2 = AV_RB16(buf + 6);
129  ctx->hdr.table0.offset = AV_RB32(buf + 8);
130  ctx->hdr.table1.offset = AV_RB32(buf + 12);
131  ctx->hdr.table2.offset = AV_RB32(buf + 16);
132  ctx->hdr.unk3 = AV_RB32(buf + 20);
133  ctx->hdr.unk4 = AV_RB32(buf + 24);
134 
135  if ((ret = scd_read_table(s, &ctx->hdr.table0)) < 0)
136  return ret;
137 
138  if ((ret = scd_read_table(s, &ctx->hdr.table1)) < 0)
139  return ret;
140 
141  if ((ret = scd_read_table(s, &ctx->hdr.table2)) < 0)
142  return ret;
143 
144  return 0;
145 }
146 
148 {
149  int64_t ret;
150  uint32_t hoffset;
151  AVStream *st;
152  AVCodecParameters *par;
153  SCDDemuxContext *ctx = s->priv_data;
154  uint8_t buf[SCD_TRACK_HEADER_SIZE];
155 
156  /* Mark as experimental until I find more files from more than just one game. */
157  if (s->strict_std_compliance > FF_COMPLIANCE_EXPERIMENTAL) {
158  av_log(s, AV_LOG_ERROR, "SCD demuxing is experimental, "
159  "add '-strict %d' if you want to use it.\n",
161  return AVERROR_EXPERIMENTAL;
162  }
163 
164  hoffset = ctx->hdr.table1.entries[index];
165 
166  if ((ret = avio_seek(s->pb, hoffset, SEEK_SET)) < 0)
167  return ret;
168 
169  if ((ret = avio_read(s->pb, buf, SCD_TRACK_HEADER_SIZE)) < 0)
170  return ret;
171 
172  track->length = AV_RB32(buf + 0);
173  track->num_channels = AV_RB32(buf + 4);
174  track->sample_rate = AV_RB32(buf + 8);
175  track->data_type = AV_RB32(buf + 12);
176  track->loop_start = AV_RB32(buf + 16);
177  track->loop_end = AV_RB32(buf + 20);
178  track->data_offset = AV_RB32(buf + 24);
179  track->aux_count = AV_RB32(buf + 28);
180 
181  /* Sanity checks */
182  if (track->num_channels > 8 || track->sample_rate >= 192000 ||
183  track->loop_start > track->loop_end)
184  return AVERROR_INVALIDDATA;
185 
186  track->absolute_offset = hoffset + SCD_TRACK_HEADER_SIZE + track->data_offset;
187  track->bytes_read = 0;
188 
189  /* Not sure what to do with these, it seems to be fine to ignore them. */
190  if (track->aux_count != 0)
191  av_log(s, AV_LOG_DEBUG, "[%d] Track has %u auxiliary chunk(s).\n", index, track->aux_count);
192 
193  if ((st = avformat_new_stream(s, NULL)) == NULL)
194  return AVERROR(ENOMEM);
195 
196  par = st->codecpar;
198  par->ch_layout.nb_channels = (int)track->num_channels;
199  par->sample_rate = (int)track->sample_rate;
200  st->index = index;
201  st->start_time = 0;
202 
203  /* TODO: Check this with other types. Drakengard 3 MP3s have 47999 instead of 48000. */
204  if (track->data_type == SCD_TRACK_ID_MP3)
205  par->sample_rate += 1;
206 
207  avpriv_set_pts_info(st, 64, 1, par->sample_rate);
208 
209  if (av_dict_set_int(&st->metadata, "start", track->absolute_offset, 0) < 0)
210  return AVERROR(ENOMEM);
211 
212  if (av_dict_set_int(&st->metadata, "loop_start", track->loop_start, 0) < 0)
213  return AVERROR(ENOMEM);
214 
215  if (av_dict_set_int(&st->metadata, "loop_end", track->loop_end, 0) < 0)
216  return AVERROR(ENOMEM);
217 
218  switch(track->data_type) {
219  case SCD_TRACK_ID_PCM:
221  par->bits_per_coded_sample = 16;
223  break;
224  case SCD_TRACK_ID_MP3:
225  par->codec_id = AV_CODEC_ID_MP3;
227  break;
228  case SCD_TRACK_ID_OGG:
230  default:
231  par->codec_id = AV_CODEC_ID_NONE;
232  avpriv_request_sample(s, "data type %u", track->data_type);
233  }
234 
235  return 0;
236 }
237 
239 {
240  int64_t ret;
241  SCDDemuxContext *ctx = s->priv_data;
242  uint8_t buf[SCD_MIN_HEADER_SIZE];
243 
244  if ((ret = avio_read(s->pb, buf, SCD_MIN_HEADER_SIZE)) < 0)
245  return ret;
246 
247  ctx->hdr.magic = AV_RB64(buf + 0);
248  ctx->hdr.version = AV_RB32(buf + 8);
249  ctx->hdr.unk1 = AV_RB16(buf + 12);
250  ctx->hdr.header_size = AV_RB16(buf + 14);
251  ctx->hdr.file_size = AV_RB32(buf + 16);
252 
253  if (ctx->hdr.magic != SCD_MAGIC)
254  return AVERROR_INVALIDDATA;
255 
256  if (ctx->hdr.version != 3) {
257  avpriv_request_sample(s, "SCD version %u", ctx->hdr.version);
258  return AVERROR_PATCHWELCOME;
259  }
260 
261  if (ctx->hdr.header_size < SCD_MIN_HEADER_SIZE)
262  return AVERROR_INVALIDDATA;
263 
264  if ((ret = avio_skip(s->pb, ctx->hdr.header_size - SCD_MIN_HEADER_SIZE)) < 0)
265  return ret;
266 
267  if ((ret = scd_read_offsets(s)) < 0)
268  return ret;
269 
270  ctx->tracks = av_calloc(ctx->hdr.table1.count, sizeof(SCDTrackHeader));
271  if (ctx->tracks == NULL)
272  return AVERROR(ENOMEM);
273 
274  for (int i = 0; i < ctx->hdr.table1.count; i++) {
275  if ((ret = scd_read_track(s, ctx->tracks + i, i)) < 0)
276  return ret;
277  }
278 
279  if (ctx->hdr.table1.count == 0)
280  return 0;
281 
282  if ((ret = avio_seek(s->pb, ctx->tracks[0].absolute_offset, SEEK_SET)) < 0)
283  return ret;
284 
285  return 0;
286 }
287 
289 {
290  SCDDemuxContext *ctx = s->priv_data;
291  AVCodecParameters *par;
292 
293  /* Streams aren't interleaved, round-robin them. */
294  for (int i = 0; i < ctx->hdr.table1.count; i++) {
295  int64_t ret;
296  int size;
297  SCDTrackHeader *trk;
298 
299  ctx->current_track %= ctx->hdr.table1.count;
300 
301  trk = ctx->tracks + ctx->current_track;
302  par = s->streams[ctx->current_track]->codecpar;
303 
304  if (trk->bytes_read >= trk->length)
305  continue;
306 
307  if ((ret = avio_seek(s->pb, trk->absolute_offset + trk->bytes_read, SEEK_SET)) < 0)
308  return ret;
309 
310  switch(trk->data_type) {
311  case SCD_TRACK_ID_PCM:
312  size = par->block_align;
313  break;
314  case SCD_TRACK_ID_MP3:
315  default:
316  size = FFMIN(trk->length - trk->bytes_read, 4096);
317  break;
318  }
319 
320  ret = av_get_packet(s->pb, pkt, size);
321  if (ret == AVERROR_EOF) {
322  trk->length = trk->bytes_read;
323  continue;
324  } else if (ret < 0) {
325  return ret;
326  }
327 
328  if (trk->data_type == SCD_TRACK_ID_PCM) {
329  pkt->pts = trk->bytes_read / (par->ch_layout.nb_channels * sizeof(uint16_t));
330  pkt->duration = size / (par->ch_layout.nb_channels * sizeof(int16_t));
331  }
332 
333  trk->bytes_read += ret;
335  pkt->stream_index = ctx->current_track;
336 
337  ctx->current_track++;
338  return 0;
339  }
340 
341  return AVERROR_EOF;
342 }
343 
344 static int scd_seek(AVFormatContext *s, int stream_index,
345  int64_t pts, int flags)
346 {
347  SCDDemuxContext *ctx = s->priv_data;
348 
349  if (pts != 0)
350  return AVERROR(EINVAL);
351 
352  for(int i = 0; i < ctx->hdr.table1.count; ++i)
353  ctx->tracks[i].bytes_read = 0;
354 
355  return 0;
356 }
357 
359 {
360  SCDDemuxContext *ctx = s->priv_data;
361 
362  av_freep(&ctx->hdr.table0.entries);
363  av_freep(&ctx->hdr.table1.entries);
364  av_freep(&ctx->hdr.table2.entries);
365  av_freep(&ctx->tracks);
366  return 0;
367 }
368 
370  .p.name = "scd",
371  .p.long_name = NULL_IF_CONFIG_SMALL("Square Enix SCD"),
372  .priv_data_size = sizeof(SCDDemuxContext),
373  .flags_internal = FF_INFMT_FLAG_INIT_CLEANUP,
377  .read_seek = scd_seek,
379 };
SCDDemuxContext
Definition: scd.c:79
AVERROR_EXPERIMENTAL
#define AVERROR_EXPERIMENTAL
Requested feature is flagged experimental. Set strict_std_compliance if you really want to use it.
Definition: error.h:74
SCD_MAGIC
#define SCD_MAGIC
Definition: scd.c:33
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
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
SCDHeader
Definition: scd.c:50
SCDHeader::table2
SCDOffsetTable table2
Definition: scd.c:59
table
static const uint16_t table[]
Definition: prosumer.c:205
SCD_TRACK_ID_MS_ADPCM
#define SCD_TRACK_ID_MS_ADPCM
Definition: scd.c:42
AVPacket::duration
int64_t duration
Duration of this packet in AVStream->time_base units, 0 if unknown.
Definition: packet.h:540
SCDTrackHeader::loop_end
uint32_t loop_end
Definition: scd.c:71
FF_COMPLIANCE_EXPERIMENTAL
#define FF_COMPLIANCE_EXPERIMENTAL
Allow nonstandardized experimental things.
Definition: defs.h:62
SCDHeader::unk2
uint16_t unk2
Definition: scd.c:60
SCDHeader::table1
SCDOffsetTable table1
Definition: scd.c:58
AVChannelLayout::nb_channels
int nb_channels
Number of channels in this layout.
Definition: channel_layout.h:313
SCDDemuxContext::hdr
SCDHeader hdr
Definition: scd.c:80
AVPROBE_SCORE_MAX
#define AVPROBE_SCORE_MAX
maximum score
Definition: avformat.h:463
SCDHeader::header_size
uint16_t header_size
Definition: scd.c:54
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_CODEC_ID_PCM_S16BE
@ AV_CODEC_ID_PCM_S16BE
Definition: codec_id.h:329
macros.h
read_seek
static int read_seek(AVFormatContext *ctx, int stream_index, int64_t timestamp, int flags)
Definition: libcdio.c:151
read_close
static av_cold int read_close(AVFormatContext *ctx)
Definition: libcdio.c:143
SCDTrackHeader
Definition: scd.c:65
pts
static int64_t pts
Definition: transcode_aac.c:643
AV_CODEC_ID_MP3
@ AV_CODEC_ID_MP3
preferred ID for decoding MPEG audio layer 1, 2 or 3
Definition: codec_id.h:441
SCDOffsetTable::count
uint16_t count
Definition: scd.c:45
SCDDemuxContext::tracks
SCDTrackHeader * tracks
Definition: scd.c:81
avassert.h
AV_LOG_TRACE
#define AV_LOG_TRACE
Extremely verbose debugging, useful for libav* development.
Definition: log.h:206
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
SCD_TRACK_ID_MP3
#define SCD_TRACK_ID_MP3
Definition: scd.c:41
AV_PKT_FLAG_CORRUPT
#define AV_PKT_FLAG_CORRUPT
The packet content is corrupted.
Definition: packet.h:578
read_packet
static int read_packet(void *opaque, uint8_t *buf, int buf_size)
Definition: avio_read_callback.c:41
intreadwrite.h
s
#define s(width, name)
Definition: cbs_vp9.c:198
AVInputFormat::name
const char * name
A comma separated list of short names for the format.
Definition: avformat.h: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
SCDHeader::magic
uint64_t magic
Definition: scd.c:51
AV_LOG_DEBUG
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
Definition: log.h:201
ctx
AVFormatContext * ctx
Definition: movenc.c:48
SCDHeader::file_size
uint32_t file_size
Definition: scd.c:55
FF_INFMT_FLAG_INIT_CLEANUP
#define FF_INFMT_FLAG_INIT_CLEANUP
For an FFInputFormat with this flag set read_close() needs to be called by the caller upon read_heade...
Definition: demux.h:35
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
AVERROR_PATCHWELCOME
#define AVERROR_PATCHWELCOME
Not yet implemented in FFmpeg, patches welcome.
Definition: error.h:64
SCD_MIN_HEADER_SIZE
#define SCD_MIN_HEADER_SIZE
Definition: scd.c:35
scd_read_close
static int scd_read_close(AVFormatContext *s)
Definition: scd.c:358
SCDHeader::unk3
uint32_t unk3
Definition: scd.c:61
SCDOffsetTable
Definition: scd.c:44
AVProbeData
This structure contains the data a format has to probe a file.
Definition: avformat.h:451
SCDTrackHeader::aux_count
uint32_t aux_count
Definition: scd.c:73
SCDHeader::table0
SCDOffsetTable table0
Definition: scd.c:57
AVStream::metadata
AVDictionary * metadata
Definition: avformat.h:823
SCDHeader::unk1
uint16_t unk1
Definition: scd.c:53
SCDHeader::unk4
uint32_t unk4
Definition: scd.c:62
AVCodecParameters::ch_layout
AVChannelLayout ch_layout
Audio only.
Definition: codec_par.h:180
index
int index
Definition: gxfenc.c:89
AVCodecParameters::sample_rate
int sample_rate
Audio only.
Definition: codec_par.h:184
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
SCDTrackHeader::absolute_offset
uint32_t absolute_offset
Definition: scd.c:75
SCDOffsetTable::offset
uint32_t offset
Definition: scd.c:46
size
int size
Definition: twinvq_data.h:10344
AV_RB32
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_WL32 unsigned int_TMPL AV_WL24 unsigned int_TMPL AV_WL16 uint64_t_TMPL AV_WB64 unsigned int_TMPL AV_RB32
Definition: bytestream.h:96
SCD_TRACK_ID_PCM
#define SCD_TRACK_ID_PCM
Definition: scd.c:39
SCDTrackHeader::num_channels
uint32_t num_channels
Definition: scd.c:67
FFInputFormat::p
AVInputFormat p
The public AVInputFormat.
Definition: demux.h:41
SCDHeader::version
uint32_t version
Definition: scd.c:52
SCDTrackHeader::bytes_read
uint32_t bytes_read
Definition: scd.c:76
SCDTrackHeader::data_type
uint32_t data_type
Definition: scd.c:69
AVPacket::flags
int flags
A combination of AV_PKT_FLAG values.
Definition: packet.h:528
SCDTrackHeader::length
uint32_t length
Definition: scd.c:66
scd_read_offsets
static int scd_read_offsets(AVFormatContext *s)
Definition: scd.c:116
scd_read_table
static int scd_read_table(AVFormatContext *s, SCDOffsetTable *table)
Definition: scd.c:93
AV_CODEC_ID_NONE
@ AV_CODEC_ID_NONE
Definition: codec_id.h:50
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
internal.h
AVCodecParameters::block_align
int block_align
Audio only.
Definition: codec_par.h:191
FFMIN
#define FFMIN(a, b)
Definition: macros.h:49
demux.h
SCDTrackHeader::data_offset
uint32_t data_offset
Definition: scd.c:72
scd_read_header
static int scd_read_header(AVFormatContext *s)
Definition: scd.c:238
av_calloc
void * av_calloc(size_t nmemb, size_t size)
Definition: mem.c:262
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
SCDTrackHeader::sample_rate
uint32_t sample_rate
Definition: scd.c:68
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
SCDTrackHeader::loop_start
uint32_t loop_start
Definition: scd.c:70
avformat.h
SCDDemuxContext::current_track
int current_track
Definition: scd.c:82
AVStream::index
int index
stream index in AVFormatContext
Definition: avformat.h:749
avio_read
int avio_read(AVIOContext *s, unsigned char *buf, int size)
Read size bytes from AVIOContext into buf.
Definition: aviobuf.c:611
ff_scd_demuxer
const FFInputFormat ff_scd_demuxer
Definition: scd.c:369
AVSTREAM_PARSE_FULL_RAW
@ AVSTREAM_PARSE_FULL_RAW
full parsing and repack with timestamp and position generation by parser for raw this assumes that ea...
Definition: avformat.h:597
SCDOffsetTable::entries
uint32_t * entries
Definition: scd.c:47
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
av_dict_set_int
int av_dict_set_int(AVDictionary **pm, const char *key, int64_t value, int flags)
Convenience wrapper for av_dict_set() that converts the value to a string and stores it.
Definition: dict.c:167
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
scd_probe
static int scd_probe(const AVProbeData *p)
Definition: scd.c:85
avpriv_request_sample
#define avpriv_request_sample(...)
Definition: tableprint_vlc.h:36
SCD_TRACK_HEADER_SIZE
#define SCD_TRACK_HEADER_SIZE
Definition: scd.c:37
SCD_TRACK_ID_OGG
#define SCD_TRACK_ID_OGG
Definition: scd.c:40
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
av_freep
#define av_freep(p)
Definition: tableprint_vlc.h:34
FFInputFormat
Definition: demux.h:37
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
SCD_OFFSET_HEADER_SIZE
#define SCD_OFFSET_HEADER_SIZE
Definition: scd.c:36
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
avstring.h
scd_seek
static int scd_seek(AVFormatContext *s, int stream_index, int64_t pts, int flags)
Definition: scd.c:344
scd_read_packet
static int scd_read_packet(AVFormatContext *s, AVPacket *pkt)
Definition: scd.c:288
int
int
Definition: ffmpeg_filter.c:409
AV_RB64
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_WL32 unsigned int_TMPL AV_WL24 unsigned int_TMPL AV_WL16 uint64_t_TMPL AV_RB64
Definition: bytestream.h:95
scd_read_track
static int scd_read_track(AVFormatContext *s, SCDTrackHeader *track, int index)
Definition: scd.c:147
AV_RB16
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_WL32 unsigned int_TMPL AV_WL24 unsigned int_TMPL AV_WL16 uint64_t_TMPL AV_WB64 unsigned int_TMPL AV_WB32 unsigned int_TMPL AV_WB24 unsigned int_TMPL AV_RB16
Definition: bytestream.h:98