switch(tag1) {
case MKTAG('v', 'i', 'd', 's'):
- codec_type = CODEC_TYPE_VIDEO;
+ codec_type = AVMEDIA_TYPE_VIDEO;
ast->sample_size = 0;
break;
case MKTAG('a', 'u', 'd', 's'):
- codec_type = CODEC_TYPE_AUDIO;
+ codec_type = AVMEDIA_TYPE_AUDIO;
break;
case MKTAG('t', 'x', 't', 's'):
//FIXME
- codec_type = CODEC_TYPE_DATA; //CODEC_TYPE_SUB ? FIXME
+ codec_type = AVMEDIA_TYPE_DATA; //AVMEDIA_TYPE_SUB ? FIXME
break;
case MKTAG('d', 'a', 't', 's'):
- codec_type = CODEC_TYPE_DATA;
+ codec_type = AVMEDIA_TYPE_DATA;
break;
default:
av_log(s, AV_LOG_ERROR, "unknown stream type %X\n", tag1);
size = FFMIN(size, list_end - cur_pos);
st = s->streams[stream_index];
switch(codec_type) {
- case CODEC_TYPE_VIDEO:
+ case AVMEDIA_TYPE_VIDEO:
if(amv_file_format){
st->codec->width=avih_width;
st->codec->height=avih_height;
- st->codec->codec_type = CODEC_TYPE_VIDEO;
+ st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
st->codec->codec_id = CODEC_ID_AMV;
url_fskip(pb, size);
break;
get_le32(pb); /* ClrImportant */
if (tag1 == MKTAG('D', 'X', 'S', 'B') || tag1 == MKTAG('D','X','S','A')) {
- st->codec->codec_type = CODEC_TYPE_SUBTITLE;
+ st->codec->codec_type = AVMEDIA_TYPE_SUBTITLE;
st->codec->codec_tag = tag1;
st->codec->codec_id = CODEC_ID_XSUB;
break;
#ifdef DEBUG
print_tag("video", tag1, 0);
#endif
- st->codec->codec_type = CODEC_TYPE_VIDEO;
+ st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
st->codec->codec_tag = tag1;
st->codec->codec_id = ff_codec_get_id(ff_codec_bmp_tags, tag1);
st->need_parsing = AVSTREAM_PARSE_HEADERS; // This is needed to get the pict type which is necessary for generating correct pts.
// url_fskip(pb, size - 5 * 4);
break;
- case CODEC_TYPE_AUDIO:
+ case AVMEDIA_TYPE_AUDIO:
ff_get_wav_header(pb, st->codec, size);
if(ast->sample_size && st->codec->block_align && ast->sample_size != st->codec->block_align){
av_log(s, AV_LOG_WARNING, "sample size (%d) != block align (%d)\n", ast->sample_size, st->codec->block_align);
ast->sample_size= st->codec->block_align;
}
- if (size%2) /* 2-aligned (fix for Stargate SG-1 - 3x18 - Shades of Grey.avi) */
+ if (size&1) /* 2-aligned (fix for Stargate SG-1 - 3x18 - Shades of Grey.avi) */
url_fskip(pb, 1);
/* Force parsing as several audio frames can be in
* one packet and timestamps refer to packet start. */
st->codec->codec_id = CODEC_ID_ADPCM_IMA_AMV;
break;
default:
- st->codec->codec_type = CODEC_TYPE_DATA;
+ st->codec->codec_type = AVMEDIA_TYPE_DATA;
st->codec->codec_id= CODEC_ID_NONE;
st->codec->codec_tag= 0;
url_fskip(pb, size);
avi_load_index(s);
avi->index_loaded = 1;
avi->non_interleaved |= guess_ni_flag(s);
+ for(i=0; i<s->nb_streams; i++){
+ AVStream *st = s->streams[i];
+ if(st->nb_index_entries)
+ break;
+ }
+ if(i==s->nb_streams && avi->non_interleaved) {
+ av_log(s, AV_LOG_WARNING, "non-interleaved AVI without index, switching to interleaved\n");
+ avi->non_interleaved=0;
+ }
+
if(avi->non_interleaved) {
av_log(s, AV_LOG_INFO, "non-interleaved AVI\n");
clean_index(s);
if(ast->sample_size <= 1) // minorityreport.AVI block_align=1024 sample_size=1 IMA-ADPCM
size= INT_MAX;
else if(ast->sample_size < 32)
- size= 64*ast->sample_size;
+ // arbitrary multiplier to avoid tiny packets for raw PCM data
+ size= 1024*ast->sample_size;
else
size= ast->sample_size;
size = dv_produce_packet(avi->dv_demux, pkt,
pkt->data, pkt->size);
pkt->destruct = dstr;
- pkt->flags |= PKT_FLAG_KEY;
+ pkt->flags |= AV_PKT_FLAG_KEY;
} else {
/* XXX: How to handle B-frames in AVI? */
pkt->dts = ast->frame_offset;
//av_log(s, AV_LOG_DEBUG, "dts:%"PRId64" offset:%"PRId64" %d/%d smpl_siz:%d base:%d st:%d size:%d\n", pkt->dts, ast->frame_offset, ast->scale, ast->rate, ast->sample_size, AV_TIME_BASE, avi->stream_index, size);
pkt->stream_index = avi->stream_index;
- if (st->codec->codec_type == CODEC_TYPE_VIDEO) {
+ if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO) {
AVIndexEntry *e;
int index;
assert(st->index_entries);
if(index >= 0 && e->timestamp == ast->frame_offset){
if (e->flags & AVINDEX_KEYFRAME)
- pkt->flags |= PKT_FLAG_KEY;
+ pkt->flags |= AV_PKT_FLAG_KEY;
}
} else {
- pkt->flags |= PKT_FLAG_KEY;
+ pkt->flags |= AV_PKT_FLAG_KEY;
}
if(ast->sample_size)
ast->frame_offset += pkt->size;
//workaround for broken small-file-bug402.avi
if( d[2] == 'w' && d[3] == 'b'
&& n==0
- && st ->codec->codec_type == CODEC_TYPE_VIDEO
- && st1->codec->codec_type == CODEC_TYPE_AUDIO
+ && st ->codec->codec_type == AVMEDIA_TYPE_VIDEO
+ && st1->codec->codec_type == AVMEDIA_TYPE_AUDIO
&& ast->prefix == 'd'*256+'c'
&& (d[2]*256+d[3] == ast1->prefix || !ast1->prefix_count)
){
if( (st->discard >= AVDISCARD_DEFAULT && size==0)
- /*|| (st->discard >= AVDISCARD_NONKEY && !(pkt->flags & PKT_FLAG_KEY))*/ //FIXME needs a little reordering
+ /*|| (st->discard >= AVDISCARD_NONKEY && !(pkt->flags & AV_PKT_FLAG_KEY))*/ //FIXME needs a little reordering
|| st->discard >= AVDISCARD_ALL){
- if(ast->sample_size) ast->frame_offset += pkt->size;
+ if(ast->sample_size) ast->frame_offset += size;
else ast->frame_offset++;
url_fskip(pb, size);
goto resync;