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;
133 if (
a->nb_segments < 1)
136 a->schema_offset = 0x20;
137 a->strings_size =
a->data_offset -
a->strings_offset;
139 if (
a->rows_offset >
a->table_size ||
140 a->strings_offset >
a->table_size ||
141 a->data_offset >
a->table_size)
143 if (
a->strings_size <= 0 ||
a->name_offset >=
a->strings_size ||
144 a->strings_size > UINT16_MAX)
149 a->segments =
av_calloc(
a->nb_segments,
sizeof(*
a->segments));
153 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) {
165 for (
int c = 0;
c <
a->columns;
c++) {
170 if (
offset >=
a->strings_size) {
175 a->xcolumns[
c].flag = info >> 4;
176 a->xcolumns[
c].type = info & 0x0F;
178 switch (
a->xcolumns[
c].type) {
204 a->xcolumns[
c].size = value_size;
207 a->xcolumns[
c].name =
a->string_table +
offset;
211 a->xcolumns[
c].offset =
avio_tell(pb) -
a->schema_offset;
217 a->xcolumns[
c].offset = column_offset;
218 column_offset += value_size;
222 ret = ret64 =
avio_seek(pb,
a->strings_offset, SEEK_SET);
226 ret =
avio_read(pb,
a->string_table,
a->strings_size);
227 if (ret !=
a->strings_size) {
234 for (
int c = 0;
c <
a->columns;
c++) {
235 int64_t data_offset = 0;
239 if (!
a->xcolumns[
c].name || strcmp(
a->xcolumns[
c].name,
"data"))
242 type =
a->xcolumns[
c].type;
243 flag =
a->xcolumns[
c].flag;
244 col_offset =
a->xcolumns[
c].offset;
246 for (uint64_t
r = 0;
r <
a->nb_segments;
r++) {
248 data_offset =
a->schema_offset + col_offset;
250 data_offset =
a->rows_offset +
r *
a->row_width + col_offset;
256 ret = ret64 =
avio_seek(pb, data_offset, SEEK_SET);
267 a->segments[
r].start = start +
a->data_offset;
268 a->segments[
r].end =
a->segments[
r].start +
size;
276 if (!
a->segments[0].end) {
287 par =
s->streams[0]->codecpar;
290 codec =
a->string_table +
a->name_offset;
291 if (!strcmp(codec,
"AAX")) {
293 ret64 =
avio_seek(pb,
a->segments[0].start, SEEK_SET);
294 if (ret64 < 0 ||
avio_rb16(pb) != 0x8000) {
299 if (extradata_size < 12) {
338 int ret, extradata_size = 0;
347 for (uint32_t seg = 0; seg <
a->nb_segments; seg++) {
348 int64_t start =
a->segments[seg].start;
349 int64_t end =
a->segments[seg].end;
352 a->current_segment = seg;
354 skip = (end - start) - ((end - start) /
size) *
size;
359 if (
pkt->
pos >=
a->segments[
a->current_segment].end - skip) {
360 if (
a->current_segment + 1 ==
a->nb_segments)
362 a->current_segment++;
363 avio_seek(pb,
a->segments[
a->current_segment].start, SEEK_SET);
370 if (extradata_size < 12)
375 if (
avio_read(pb, extradata, extradata_size) != extradata_size) {
386 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]