103 for (
int seg = 0; seg <
a->current_segment; seg++)
104 pts += (
a->segments[seg].end -
a->segments[seg].start) /
size;
106 pts += ((
pos -
a->segments[
a->current_segment].start) /
size);
117 int64_t column_offset = 0;
118 int ret, extradata_size;
132 if (
a->nb_segments < 1)
135 a->schema_offset = 0x20;
136 a->strings_size =
a->data_offset -
a->strings_offset;
138 if (
a->rows_offset >
a->table_size ||
139 a->strings_offset >
a->table_size ||
140 a->data_offset >
a->table_size)
142 if (
a->strings_size <= 0 ||
a->name_offset >=
a->strings_size ||
143 a->strings_size > UINT16_MAX)
148 a->segments =
av_calloc(
a->nb_segments,
sizeof(*
a->segments));
152 a->xcolumns =
av_calloc(
a->columns,
sizeof(*
a->xcolumns));
158 a->string_table =
av_calloc(
a->strings_size + 1,
sizeof(*
a->string_table));
159 if (!
a->string_table) {
164 for (
int c = 0;
c <
a->columns;
c++) {
169 if (
offset >=
a->strings_size) {
174 a->xcolumns[
c].flag = info >> 4;
175 a->xcolumns[
c].type = info & 0x0F;
177 switch (
a->xcolumns[
c].type) {
203 a->xcolumns[
c].size = value_size;
206 a->xcolumns[
c].name =
a->string_table +
offset;
210 a->xcolumns[
c].offset =
avio_tell(pb) -
a->schema_offset;
216 a->xcolumns[
c].offset = column_offset;
217 column_offset += value_size;
222 ret =
avio_read(pb,
a->string_table,
a->strings_size);
223 if (ret !=
a->strings_size) {
230 for (
int c = 0;
c <
a->columns;
c++) {
231 int64_t data_offset = 0;
235 if (!
a->xcolumns[
c].name || strcmp(
a->xcolumns[
c].name,
"data"))
238 type =
a->xcolumns[
c].type;
239 flag =
a->xcolumns[
c].flag;
240 col_offset =
a->xcolumns[
c].offset;
242 for (uint64_t
r = 0;
r <
a->nb_segments;
r++) {
244 data_offset =
a->schema_offset + col_offset;
246 data_offset =
a->rows_offset +
r *
a->row_width + col_offset;
258 a->segments[
r].start = start +
a->data_offset;
259 a->segments[
r].end =
a->segments[
r].start +
size;
267 if (!
a->segments[0].end) {
278 par =
s->streams[0]->codecpar;
281 codec =
a->string_table +
a->name_offset;
282 if (!strcmp(codec,
"AAX")) {
284 avio_seek(pb,
a->segments[0].start, SEEK_SET);
290 if (extradata_size < 12) {
329 int ret, extradata_size = 0;
338 for (uint32_t seg = 0; seg <
a->nb_segments; seg++) {
339 int64_t start =
a->segments[seg].start;
340 int64_t end =
a->segments[seg].end;
343 a->current_segment = seg;
345 skip = (end - start) - ((end - start) /
size) *
size;
350 if (
pkt->
pos >=
a->segments[
a->current_segment].end - skip) {
351 if (
a->current_segment + 1 ==
a->nb_segments)
353 a->current_segment++;
354 avio_seek(pb,
a->segments[
a->current_segment].start, SEEK_SET);
361 if (extradata_size < 12)
366 if (
avio_read(pb, extradata, extradata_size) != extradata_size) {
377 return ret < 0 ? ret :
AVERROR(EIO);
AVInputFormat ff_aax_demuxer
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)
static int aax_read_header(AVFormatContext *s)
simple assert() macros that are a bit more flexible than ISO C assert().
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.
int avio_read(AVIOContext *s, unsigned char *buf, int size)
Read size bytes from AVIOContext into buf.
unsigned int avio_rb32(AVIOContext *s)
int avio_r8(AVIOContext *s)
static int read_packet(void *opaque, uint8_t *buf, int buf_size)
#define flags(name, subs,...)
#define MKBETAG(a, b, c, d)
static int read_header(FFV1Context *f)
#define AV_INPUT_BUFFER_PADDING_SIZE
Required number of additionally allocated bytes at the end of the input bitstream for decoding.
FF_ENABLE_DEPRECATION_WARNINGS 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.
@ 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...
AVStream * avformat_new_stream(AVFormatContext *s, const 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.
void * av_calloc(size_t nmemb, size_t size)
Non-inlined equivalent of av_mallocz_array().
common internal API header
#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)
This struct describes the properties of an encoded stream.
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
Audio only.
This structure stores compressed data.
int64_t duration
Duration of this packet in AVStream->time_base units, 0 if unknown.
int64_t pts
Presentation timestamp in AVStream->time_base units; the time at which the decompressed packet will b...
int64_t pos
byte position in stream, -1 if unknown
This structure contains the data a format has to probe a file.
unsigned char * buf
Buffer must have AVPROBE_PADDING_SIZE of extra allocated bytes filled with zero.
int64_t start_time
Decoding: pts of the first frame of the stream in presentation order, in stream time base.
static const uint8_t offset[127][2]