Changeset 209a5a3a3dcbc313142c9781c12e438cb2d949b2
- Timestamp:
- 27/06/04 21:56:03
(4 years ago)
- Author:
- Laurent Aimar <fenrir@videolan.org>
- git-committer:
- Laurent Aimar <fenrir@videolan.org> 1088366163 +0000
- git-parent:
[c84f881e16b7e1b172d231a2e27cb4f007429e56]
- git-author:
- Laurent Aimar <fenrir@videolan.org> 1088366163 +0000
- Message:
- mpga: improved DEMUX_GET_TIME. It has now a perfect precision until
the first seek. (A good DEMUX_SET_TIME has to be implemented with high
precision).
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| r2d109a7 |
r209a5a3 |
|
| 59 | 59 | { |
|---|
| 60 | 60 | mtime_t i_time; |
|---|
| | 61 | mtime_t i_time_offset; |
|---|
| 61 | 62 | |
|---|
| 62 | 63 | int i_bitrate_avg; /* extracted from Xing header */ |
|---|
| … | … | |
| 172 | 173 | p_demux->p_sys = p_sys = malloc( sizeof( demux_sys_t ) ); |
|---|
| 173 | 174 | p_sys->i_time = 1; |
|---|
| | 175 | p_sys->i_time_offset = 0; |
|---|
| 174 | 176 | p_sys->i_bitrate_avg = 0; |
|---|
| 175 | 177 | p_sys->meta = NULL; |
|---|
| … | … | |
| 400 | 402 | { |
|---|
| 401 | 403 | demux_sys_t *p_sys = p_demux->p_sys; |
|---|
| 402 | | |
|---|
| | 404 | int64_t *pi64; |
|---|
| 403 | 405 | vlc_meta_t **pp_meta; |
|---|
| | 406 | int i_ret; |
|---|
| 404 | 407 | |
|---|
| 405 | 408 | switch( i_query ) |
|---|
| … | … | |
| 410 | 413 | return VLC_SUCCESS; |
|---|
| 411 | 414 | |
|---|
| | 415 | case DEMUX_GET_TIME: |
|---|
| | 416 | pi64 = (int64_t*)va_arg( args, int64_t * ); |
|---|
| | 417 | *pi64 = p_sys->i_time + p_sys->i_time_offset; |
|---|
| | 418 | return VLC_SUCCESS; |
|---|
| | 419 | |
|---|
| | 420 | case DEMUX_SET_TIME: |
|---|
| | 421 | /* FIXME TODO: implement a high precision seek (with mp3 parsing) |
|---|
| | 422 | * needed for multi-input */ |
|---|
| 412 | 423 | default: |
|---|
| 413 | | return demux2_vaControlHelper( p_demux->s, |
|---|
| 414 | | 0, -1, |
|---|
| 415 | | p_sys->i_bitrate_avg, 1, i_query, |
|---|
| 416 | | args ); |
|---|
| 417 | | } |
|---|
| 418 | | } |
|---|
| 419 | | |
|---|
| | 424 | i_ret = demux2_vaControlHelper( p_demux->s, |
|---|
| | 425 | 0, -1, |
|---|
| | 426 | p_sys->i_bitrate_avg, 1, i_query, |
|---|
| | 427 | args ); |
|---|
| | 428 | if( !i_ret && p_sys->i_bitrate_avg > 0 && |
|---|
| | 429 | ( i_query == DEMUX_SET_POSITION || i_query == DEMUX_SET_TIME ) ) |
|---|
| | 430 | { |
|---|
| | 431 | int64_t i_time = I64C(8000000) * stream_Tell(p_demux->s) / p_sys->i_bitrate_avg; |
|---|
| | 432 | |
|---|
| | 433 | /* fix time_offset */ |
|---|
| | 434 | if( i_time >= 0 ) |
|---|
| | 435 | p_sys->i_time_offset = i_time - p_sys->i_time; |
|---|
| | 436 | } |
|---|
| | 437 | return i_ret; |
|---|
| | 438 | } |
|---|
| | 439 | } |
|---|
| | 440 | |
|---|