Mercurial > mplayer.hg
comparison libmpdemux/demuxer.c @ 29486:a373af1e3b24
Handle demuxers that never set filepos by using stream_tell.
author | reimar |
---|---|
date | Mon, 17 Aug 2009 05:55:40 +0000 |
parents | fa9ca1188c50 |
children | 940fb22fd9dd |
comparison
equal
deleted
inserted
replaced
29485:d252912eaf5b | 29486:a373af1e3b24 |
---|---|
240 d->reference_clock = MP_NOPTS_VALUE; | 240 d->reference_clock = MP_NOPTS_VALUE; |
241 d->movi_start = stream->start_pos; | 241 d->movi_start = stream->start_pos; |
242 d->movi_end = stream->end_pos; | 242 d->movi_end = stream->end_pos; |
243 d->seekable = 1; | 243 d->seekable = 1; |
244 d->synced = 0; | 244 d->synced = 0; |
245 d->filepos = 0; | 245 d->filepos = -1; |
246 d->audio = new_demuxer_stream(d, a_id); | 246 d->audio = new_demuxer_stream(d, a_id); |
247 d->video = new_demuxer_stream(d, v_id); | 247 d->video = new_demuxer_stream(d, v_id); |
248 d->sub = new_demuxer_stream(d, s_id); | 248 d->sub = new_demuxer_stream(d, s_id); |
249 d->type = type; | 249 d->type = type; |
250 if (type) | 250 if (type) |
1260 { | 1260 { |
1261 int ans = 0; | 1261 int ans = 0; |
1262 int res = demux_control(demuxer, DEMUXER_CTRL_GET_PERCENT_POS, &ans); | 1262 int res = demux_control(demuxer, DEMUXER_CTRL_GET_PERCENT_POS, &ans); |
1263 int len = (demuxer->movi_end - demuxer->movi_start) / 100; | 1263 int len = (demuxer->movi_end - demuxer->movi_start) / 100; |
1264 if (res <= 0) { | 1264 if (res <= 0) { |
1265 off_t pos = demuxer->filepos > 0 ? demuxer->filepos : stream_tell(demuxer->stream); | |
1265 if (len > 0) | 1266 if (len > 0) |
1266 ans = (demuxer->filepos - demuxer->movi_start) / len; | 1267 ans = (pos - demuxer->movi_start) / len; |
1267 else | 1268 else |
1268 ans = 0; | 1269 ans = 0; |
1269 } | 1270 } |
1270 if (ans < 0) | 1271 if (ans < 0) |
1271 ans = 0; | 1272 ans = 0; |