Mercurial > libavformat.hg
changeset 5736:9a98bc214731 libavformat
Support demuxing of streamed Bink files
author | pross |
---|---|
date | Wed, 03 Mar 2010 09:44:30 +0000 |
parents | 0f6f55a8e878 |
children | 192d6ebe32ff |
files | bink.c |
diffstat | 1 files changed, 8 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/bink.c Tue Mar 02 21:32:56 2010 +0000 +++ b/bink.c Wed Mar 03 09:44:30 2010 +0000 @@ -211,18 +211,17 @@ bink->remain_packet_size -= 4 + audio_size; bink->current_track++; if (audio_size > 0) { - /* Each audio packet reports the number of decompressed samples - (in bytes). We use this value to calcuate the audio PTS */ - int reported_size = get_le32(pb) / (2 * s->streams[bink->current_track]->codec->channels); - url_fseek(pb, -4, SEEK_CUR); - /* get one audio packet per track */ if ((ret = av_get_packet(pb, pkt, audio_size)) != audio_size) return ret; pkt->stream_index = bink->current_track; pkt->pts = bink->audio_pts[bink->current_track - 1]; - bink->audio_pts[bink->current_track -1] += reported_size; + + /* Each audio packet reports the number of decompressed samples + (in bytes). We use this value to calcuate the audio PTS */ + bink->audio_pts[bink->current_track -1] += + AV_RL32(pkt->data) / (2 * s->streams[bink->current_track]->codec->channels); return 0; } } @@ -246,6 +245,9 @@ BinkDemuxContext *bink = s->priv_data; AVStream *vst = s->streams[0]; + if (url_is_streamed(s->pb)) + return -1; + /* seek to the first frame */ url_fseek(s->pb, vst->index_entries[0].pos, SEEK_SET); bink->video_pts = 0;