Lines Matching defs:ast

137 static inline int get_duration(AVIStream *ast, int len)
139 if (ast->sample_size)
141 else if (ast->dshow_block_align)
142 return (len + (int64_t)ast->dshow_block_align - 1) / ast->dshow_block_align;
185 AVIStream *ast;
203 ast = st->priv_data;
247 av_add_index_entry(st, pos, ast->cum_len, len, 0,
250 ast->cum_len += get_duration(ast, len);
299 AVIStream *ast = st->priv_data;
301 int max = ast->sample_size;
304 if (n != 1 || ast->sample_size == 0)
504 AVIStream *ast = NULL;
605 ast = av_mallocz(sizeof(AVIStream));
606 if (!ast)
608 st->priv_data = ast;
633 ast = s->streams[0]->priv_data;
639 av_free(ast);
643 s->streams[0]->priv_data = ast;
645 ast->scale = avio_rl32(pb);
646 ast->rate = avio_rl32(pb);
650 if (ast->scale > 0 && ast->rate > 0 && dv_dur > 0) {
652 s->duration = av_rescale(dv_dur, ast->scale, ast->rate);
663 ast->handler = handler;
669 ast->scale = avio_rl32(pb);
670 ast->rate = avio_rl32(pb);
671 if (!(ast->scale && ast->rate)) {
675 ast->scale,
676 ast->rate);
678 ast->rate = 1000000;
679 ast->scale = frame_period;
681 ast->rate = 25;
682 ast->scale = 1;
685 avpriv_set_pts_info(st, 64, ast->scale, ast->rate);
687 ast->cum_len = avio_rl32(pb); /* start */
693 if (ast->cum_len > 3600LL * ast->rate / ast->scale) {
695 ast->cum_len = 0;
697 ast->sample_size = avio_rl32(pb);
698 ast->cum_len *= FFMAX(1, ast->sample_size);
700 ast->rate, ast->scale, ast->sample_size);
706 ast->sample_size = 0;
722 if (ast->sample_size < 0) {
726 ast->sample_size,
733 ast->sample_size,
735 ast->sample_size = 0;
738 if (ast->sample_size == 0) {
745 ast->frame_offset = ast->cum_len;
822 ast->pal[i] = 0xFFU<<24 | AV_RL32(pal_src + 4 * i);
823 ast->has_pal = 1;
849 ast->handler == MKTAG('X', 'V', 'I', 'D'))
888 ast->dshow_block_align = st->codecpar->block_align;
889 if (ast->sample_size && st->codecpar->block_align &&
890 ast->sample_size != st->codecpar->block_align) {
894 ast->sample_size,
896 ast->sample_size = st->codecpar->block_align;
916 if (ast->handler == AV_RL32("Axan")) {
919 ast->dshow_block_align = 0;
923 ast->dshow_block_align = 0;
927 st->codecpar->codec_id == AV_CODEC_ID_MP2 ) && ast->dshow_block_align <= 4 && ast->dshow_block_align) {
928 av_log(s, AV_LOG_DEBUG, "overriding invalid dshow_block_align of %d\n", ast->dshow_block_align);
929 ast->dshow_block_align = 0;
931 if (st->codecpar->codec_id == AV_CODEC_ID_AAC && ast->dshow_block_align == 1024 && ast->sample_size == 1024 ||
932 st->codecpar->codec_id == AV_CODEC_ID_AAC && ast->dshow_block_align == 4096 && ast->sample_size == 4096 ||
933 st->codecpar->codec_id == AV_CODEC_ID_MP3 && ast->dshow_block_align == 1152 && ast->sample_size == 1152) {
935 ast->sample_size = 0;
1111 AVIStream *ast = st->priv_data;
1150 if (!(ast->sub_pkt = av_packet_alloc()))
1153 if (!(ast->sub_ctx = avformat_alloc_context()))
1156 ast->sub_ctx->pb = pb;
1158 if (ff_copy_whiteblacklists(ast->sub_ctx, s) < 0)
1161 if (!avformat_open_input(&ast->sub_ctx, "", sub_demuxer, NULL)) {
1162 if (ast->sub_ctx->nb_streams != 1)
1164 ff_read_packet(ast->sub_ctx, ast->sub_pkt);
1165 avcodec_parameters_copy(st->codecpar, ast->sub_ctx->streams[0]->codecpar);
1166 time_base = ast->sub_ctx->streams[0]->time_base;
1169 ast->sub_buffer = pkt->buf;
1175 av_packet_free(&ast->sub_pkt);
1176 av_freep(&ast->sub_ctx);
1185 AVIStream *ast, *next_ast = next_st->priv_data;
1195 ast = st->priv_data;
1196 if (st->discard < AVDISCARD_ALL && ast && ast->sub_pkt && ast->sub_pkt->data) {
1197 ts = av_rescale_q(ast->sub_pkt->dts, st->time_base, AV_TIME_BASE_Q);
1206 ast = sub_st->priv_data;
1207 av_packet_move_ref(pkt, ast->sub_pkt);
1210 if (ff_read_packet(ast->sub_ctx, ast->sub_pkt) < 0)
1211 ast->sub_pkt->data = NULL;
1295 AVIStream *ast;
1297 ast = st->priv_data;
1299 if (!ast) {
1312 && ast->prefix == 'd'*256+'c'
1317 ast = ast1;
1331 ast->pal[k] = 0xFFU<<24 | avio_rb32(pb)>>8;
1333 ast->has_pal = 1;
1335 } else if (((ast->prefix_count < 5 || sync + 9 > i) &&
1337 d[2] * 256 + d[3] == ast->prefix /* ||
1342 if (d[2] * 256 + d[3] == ast->prefix)
1343 ast->prefix_count++;
1345 ast->prefix = d[2] * 256 + d[3];
1346 ast->prefix_count = 0;
1356 ast->frame_offset += get_duration(ast, size);
1362 ast->packet_size = size + 8;
1363 ast->remaining = size;
1370 av_add_index_entry(st, pos, ast->frame_offset, size,
1397 AVIStream *ast = st->priv_data;
1398 int64_t ts = ast->frame_offset;
1405 if (!ast->remaining && ts > last_ts)
1409 (AVRational) { FFMAX(1, ast->sample_size),
1413 st->time_base.num, st->time_base.den, ast->frame_offset);
1480 AVIStream *ast = st->priv_data;
1488 if (ast->sample_size <= 1)
1490 else if (ast->sample_size < 32)
1492 size = 1024 * ast->sample_size;
1494 size = ast->sample_size;
1496 if (size > ast->remaining)
1497 size = ast->remaining;
1504 if (ast->has_pal && pkt->size < (unsigned)INT_MAX / 2 && !dv_demux) {
1513 memcpy(pal, ast->pal, AVPALETTE_SIZE);
1514 ast->has_pal = 0;
1526 ast->frame_offset++;
1528 ast->remaining = 0;
1532 pkt->dts = ast->frame_offset;
1533 // pkt->dts += ast->start;
1534 if (ast->sample_size)
1535 pkt->dts /= ast->sample_size;
1542 index = av_index_search_timestamp(st, ast->frame_offset, AVSEEK_FLAG_ANY);
1545 if (index >= 0 && e->timestamp == ast->frame_offset) {
1568 ast->frame_offset += get_duration(ast, pkt->size);
1570 ast->remaining -= err;
1571 if (!ast->remaining) {
1573 ast->packet_size = 0;
1576 if (!avi->non_interleaved && pkt->pos >= 0 && ast->seek_pos > pkt->pos) {
1580 ast->seek_pos= 0;
1609 AVIStream *ast;
1650 ast = st->priv_data;
1664 av_log(s, AV_LOG_TRACE, "%d cum_len=%"PRId64"\n", len, ast->cum_len);
1671 av_add_index_entry(st, pos, ast->cum_len, len, 0,
1675 ast->cum_len += get_duration(ast, len);
1707 AVIStream *ast = st->priv_data;
1715 FFMAX(ast->sample_size, 1),
1724 AVIStream *ast = st->priv_data;
1729 FFMAX(ast->sample_size, 1),
1853 AVIStream *ast;
1870 ast = st->priv_data;
1872 timestamp * FFMAX(ast->sample_size, 1),
1877 timestamp * FFMAX(ast->sample_size, 1),
1885 timestamp = sti->index_entries[index].timestamp / FFMAX(ast->sample_size, 1);
1973 AVIStream *ast = st->priv_data;
1974 if (ast) {
1975 if (ast->sub_ctx) {
1976 av_freep(&ast->sub_ctx->pb);
1977 avformat_close_input(&ast->sub_ctx);
1979 av_buffer_unref(&ast->sub_buffer);
1980 av_packet_free(&ast->sub_pkt);