105 for (
int seg = 0; seg <
a->current_segment; seg++)
106 pts += (
a->segments[seg].end -
a->segments[seg].start) /
size;
108 pts += ((
pos -
a->segments[
a->current_segment].start) /
size);
120 int ret, extradata_size;
135 if (
a->nb_segments < 1)
138 a->schema_offset = 0x20;
139 a->strings_size =
a->data_offset -
a->strings_offset;
141 if (
a->rows_offset >
a->table_size ||
142 a->strings_offset >
a->table_size ||
143 a->data_offset >
a->table_size)
145 if (
a->strings_size <= 0 ||
a->name_offset >=
a->strings_size ||
146 a->strings_size > UINT16_MAX)
151 a->segments =
av_calloc(
a->nb_segments,
sizeof(*
a->segments));
155 a->xcolumns =
av_calloc(
a->columns,
sizeof(*
a->xcolumns));
159 a->string_table =
av_calloc(
a->strings_size + 1,
sizeof(*
a->string_table));
160 if (!
a->string_table)
163 for (
int c = 0;
c <
a->columns;
c++) {
171 a->xcolumns[
c].flag = info >> 4;
172 a->xcolumns[
c].type = info & 0x0F;
174 switch (
a->xcolumns[
c].type) {
199 a->xcolumns[
c].size = value_size;
202 a->xcolumns[
c].name =
a->string_table +
offset;
206 a->xcolumns[
c].offset =
avio_tell(pb) -
a->schema_offset;
212 a->xcolumns[
c].offset = column_offset;
213 column_offset += value_size;
217 ret = ret64 =
avio_seek(pb,
a->strings_offset, SEEK_SET);
225 for (
int c = 0;
c <
a->columns;
c++) {
230 if (!
a->xcolumns[
c].name || strcmp(
a->xcolumns[
c].name,
"data"))
233 type =
a->xcolumns[
c].type;
234 flag =
a->xcolumns[
c].flag;
235 col_offset =
a->xcolumns[
c].offset;
237 for (uint64_t
r = 0;
r <
a->nb_segments;
r++) {
239 data_offset =
a->schema_offset + col_offset;
241 data_offset =
a->rows_offset +
r *
a->row_width + col_offset;
245 ret = ret64 =
avio_seek(pb, data_offset, SEEK_SET);
256 a->segments[
r].start = start +
a->data_offset;
257 a->segments[
r].end =
a->segments[
r].start +
size;
259 a->segments[
r].start <
a->segments[
r-1].end &&
260 a->segments[
r].end >
a->segments[
r-1].start)
267 if (!
a->segments[0].end)
274 par =
s->streams[0]->codecpar;
277 codec =
a->string_table +
a->name_offset;
278 if (!strcmp(codec,
"AAX")) {
280 ret64 =
avio_seek(pb,
a->segments[0].start, SEEK_SET);
281 if (ret64 < 0 ||
avio_rb16(pb) != 0x8000)
284 if (extradata_size < 12)
311 int ret, extradata_size = 0;
312 uint8_t *extradata =
NULL;
320 for (uint32_t seg = 0; seg <
a->nb_segments; seg++) {
321 int64_t start =
a->segments[seg].start;
324 if (
pkt->pos >= start &&
pkt->pos <= end) {
325 a->current_segment = seg;
332 if (
pkt->pos >=
a->segments[
a->current_segment].end -
skip) {
333 if (
a->current_segment + 1 ==
a->nb_segments)
335 a->current_segment++;
336 avio_seek(pb,
a->segments[
a->current_segment].start, SEEK_SET);
343 if (extradata_size < 12)
363 pkt->stream_index = 0;
391 .p.extensions =
"aax",
static int aax_read_packet(AVFormatContext *s, AVPacket *pkt)
static int aax_read_close(AVFormatContext *s)
static int aax_probe(const AVProbeData *p)
static int64_t get_pts(AVFormatContext *s, int64_t pos, int size)
const FFInputFormat ff_aax_demuxer
static int aax_read_header(AVFormatContext *s)
int64_t avio_seek(AVIOContext *s, int64_t offset, int whence)
fseek() equivalent for AVIOContext.
unsigned int avio_rb16(AVIOContext *s)
int avio_feof(AVIOContext *s)
Similar to feof() but also returns nonzero on read errors.
static av_always_inline int64_t avio_tell(AVIOContext *s)
ftell() equivalent for AVIOContext.
int64_t avio_skip(AVIOContext *s, int64_t offset)
Skip given number of bytes forward.
unsigned int avio_rb32(AVIOContext *s)
int avio_r8(AVIOContext *s)
int ffio_read_size(AVIOContext *s, unsigned char *buf, int size)
Read size bytes from AVIOContext into buf.
static int read_packet(void *opaque, uint8_t *buf, int buf_size)
static void BS_FUNC skip(BSCTX *bc, unsigned int n)
Skip n bits in the buffer.
static int read_probe(const AVProbeData *p)
#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...
int ff_get_extradata(void *logctx, AVCodecParameters *par, AVIOContext *pb, int size)
Allocate extradata with additional AV_INPUT_BUFFER_PADDING_SIZE at end which is always set to 0 and f...
static int read_header(FFV1Context *f, RangeCoder *c)
#define AV_INPUT_BUFFER_PADDING_SIZE
Required number of additionally allocated bytes at the end of the input bitstream for decoding.
@ AV_PKT_DATA_NEW_EXTRADATA
The AV_PKT_DATA_NEW_EXTRADATA is used to notify the codec or the format that the extradata buffer was...
int av_packet_add_side_data(AVPacket *pkt, enum AVPacketSideDataType type, uint8_t *data, size_t size)
Wrap an existing array as a packet side data.
AVStream * avformat_new_stream(AVFormatContext *s, const struct AVCodec *c)
Add a new stream to a media file.
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
#define AVERROR_EOF
End of file.
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
static av_cold int read_close(AVFormatContext *ctx)
#define MKBETAG(a, b, c, d)
void * av_calloc(size_t nmemb, size_t size)
Memory handling functions.
int nb_channels
Number of channels in this layout.
This struct describes the properties of an encoded stream.
AVChannelLayout ch_layout
The channel layout and number of channels.
enum AVMediaType codec_type
General type of the encoded data.
uint8_t * extradata
Extra binary data needed for initializing the decoder, codec-dependent.
enum AVCodecID codec_id
Specific type of the encoded data (the codec used).
int sample_rate
The number of audio samples per second.
This structure stores compressed data.
This structure contains the data a format has to probe a file.
int64_t start_time
Decoding: pts of the first frame of the stream in presentation order, in stream time base.