Changeset 13f5cc43d32b8a4a3d208042bf1a514406c97ad4
- Timestamp:
- 01/04/04 18:35:02
(5 years ago)
- Author:
- Laurent Aimar <fenrir@videolan.org>
- git-committer:
- Laurent Aimar <fenrir@videolan.org> 1073237702 +0000
- git-parent:
[f78730a8cc6ad974444fb08e52ad9648d79c5115]
- git-author:
- Laurent Aimar <fenrir@videolan.org> 1073237702 +0000
- Message:
- avi: May fix #1545
(From mplayer:
"count blocks by rounded-up chunksizes instead of chunks -
we need full emulation of dshow avi demuxer bugs :(
fixes silly nandub-style a-v delaying in avi with vbr mp3..." )
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| r4219568 |
r13f5cc4 |
|
| 3 | 3 | ***************************************************************************** |
|---|
| 4 | 4 | * Copyright (C) 2001 VideoLAN |
|---|
| 5 | | * $Id: avi.c,v 1.82 2003/12/22 02:24:52 sam Exp $ |
|---|
| | 5 | * $Id: avi.c,v 1.83 2004/01/04 17:35:01 fenrir Exp $ |
|---|
| 6 | 6 | * Authors: Laurent Aimar <fenrir@via.ecp.fr> |
|---|
| 7 | 7 | * |
|---|
| … | … | |
| 101 | 101 | static int AVI_TrackStopFinishedStreams( input_thread_t *); |
|---|
| 102 | 102 | |
|---|
| | 103 | /* Remarks: |
|---|
| | 104 | - For VBR mp3 stream: |
|---|
| | 105 | count blocks by rounded-up chunksizes instead of chunks |
|---|
| | 106 | we need full emulation of dshow avi demuxer bugs :( |
|---|
| | 107 | fixes silly nandub-style a-v delaying in avi with vbr mp3... |
|---|
| | 108 | (from mplayer 2002/08/02) |
|---|
| | 109 | - to complete.... |
|---|
| | 110 | */ |
|---|
| | 111 | |
|---|
| 103 | 112 | /***************************************************************************** |
|---|
| 104 | 113 | * Open: check file and initializes AVI structures |
|---|
| … | … | |
| 252 | 261 | tk->i_idxposb = 0; |
|---|
| 253 | 262 | |
|---|
| | 263 | tk->i_blockno = 0; |
|---|
| | 264 | tk->i_blocksize = 0; |
|---|
| | 265 | |
|---|
| 254 | 266 | p_auds = (void*)p_vids = (void*)AVI_ChunkFind( p_strl, AVIFOURCC_strf, 0 ); |
|---|
| 255 | 267 | |
|---|
| … | … | |
| 272 | 284 | tk->i_codec = AVI_FourccGetCodec( AUDIO_ES, |
|---|
| 273 | 285 | p_auds->p_wf->wFormatTag ); |
|---|
| | 286 | if( ( tk->i_blocksize = p_auds->p_wf->nBlockAlign ) == 0 ) |
|---|
| | 287 | { |
|---|
| | 288 | if( p_auds->p_wf->wFormatTag == 1 ) |
|---|
| | 289 | { |
|---|
| | 290 | tk->i_blocksize = p_auds->p_wf->nChannels * (p_auds->p_wf->wBitsPerSample/8); |
|---|
| | 291 | } |
|---|
| | 292 | else |
|---|
| | 293 | { |
|---|
| | 294 | tk->i_blocksize = 1; |
|---|
| | 295 | } |
|---|
| | 296 | } |
|---|
| 274 | 297 | es_format_Init( &fmt, AUDIO_ES, tk->i_codec ); |
|---|
| 275 | 298 | |
|---|
| … | … | |
| 728 | 751 | else |
|---|
| 729 | 752 | { |
|---|
| | 753 | int i_length = tk->p_index[tk->i_idxposc].i_length; |
|---|
| | 754 | |
|---|
| | 755 | tk->i_idxposc++; |
|---|
| | 756 | if( tk->i_cat == AUDIO_ES ) |
|---|
| | 757 | { |
|---|
| | 758 | tk->i_blockno += tk->i_blocksize > 0 ? ( i_length + tk->i_blocksize - 1 ) / tk->i_blocksize : 1; |
|---|
| | 759 | } |
|---|
| 730 | 760 | toread[i_track].i_toread--; |
|---|
| 731 | | tk->i_idxposc++; |
|---|
| 732 | 761 | } |
|---|
| 733 | 762 | |
|---|
| … | … | |
| 909 | 938 | else |
|---|
| 910 | 939 | { |
|---|
| | 940 | if( p_stream->i_cat == AUDIO_ES ) |
|---|
| | 941 | { |
|---|
| | 942 | p_stream->i_blockno += p_stream->i_blocksize > 0 ? ( avi_pk.i_size + p_stream->i_blocksize - 1 ) / p_stream->i_blocksize : 1; |
|---|
| | 943 | } |
|---|
| 911 | 944 | p_stream->i_idxposc++; |
|---|
| 912 | 945 | } |
|---|
| … | … | |
| 1207 | 1240 | else |
|---|
| 1208 | 1241 | { |
|---|
| 1209 | | return AVI_GetDPTS( tk, tk->i_idxposc ); |
|---|
| | 1242 | if( tk->i_cat == AUDIO_ES ) |
|---|
| | 1243 | { |
|---|
| | 1244 | return AVI_GetDPTS( tk, tk->i_blockno ); |
|---|
| | 1245 | } |
|---|
| | 1246 | else |
|---|
| | 1247 | { |
|---|
| | 1248 | return AVI_GetDPTS( tk, tk->i_idxposc ); |
|---|
| | 1249 | } |
|---|
| 1210 | 1250 | } |
|---|
| 1211 | 1251 | } |
|---|
| … | … | |
| 1377 | 1417 | { |
|---|
| 1378 | 1418 | demux_sys_t *p_sys = p_input->p_demux_data; |
|---|
| | 1419 | avi_track_t *tk = p_sys->track[i_stream]; |
|---|
| | 1420 | |
|---|
| 1379 | 1421 | #define p_stream p_sys->track[i_stream] |
|---|
| 1380 | 1422 | mtime_t i_oldpts; |
|---|
| … | … | |
| 1389 | 1431 | { |
|---|
| 1390 | 1432 | return VLC_EGENERIC; |
|---|
| | 1433 | } |
|---|
| | 1434 | |
|---|
| | 1435 | if( p_stream->i_cat == AUDIO_ES ) |
|---|
| | 1436 | { |
|---|
| | 1437 | unsigned int i; |
|---|
| | 1438 | tk->i_blockno = 0; |
|---|
| | 1439 | for( i = 0; i < tk->i_idxposc; i++ ) |
|---|
| | 1440 | { |
|---|
| | 1441 | if( tk->i_blocksize > 0 ) |
|---|
| | 1442 | { |
|---|
| | 1443 | tk->i_blockno += ( tk->p_index[i].i_length + tk->i_blocksize - 1 ) / tk->i_blocksize; |
|---|
| | 1444 | } |
|---|
| | 1445 | else |
|---|
| | 1446 | { |
|---|
| | 1447 | tk->i_blockno++; |
|---|
| | 1448 | } |
|---|
| | 1449 | } |
|---|
| 1391 | 1450 | } |
|---|
| 1392 | 1451 | |
|---|
| re33dbc3 |
r13f5cc4 |
|
| 3 | 3 | ***************************************************************************** |
|---|
| 4 | 4 | * Copyright (C) 2001 VideoLAN |
|---|
| 5 | | * $Id: avi.h,v 1.17 2003/11/13 11:49:27 fenrir Exp $ |
|---|
| | 5 | * $Id: avi.h,v 1.18 2004/01/04 17:35:02 fenrir Exp $ |
|---|
| 6 | 6 | * Authors: Laurent Aimar <fenrir@via.ecp.fr> |
|---|
| 7 | 7 | * |
|---|
| … | … | |
| 65 | 65 | unsigned int i_idxposb; /* byte in the current chunk */ |
|---|
| 66 | 66 | |
|---|
| | 67 | /* For VBR audio only */ |
|---|
| | 68 | unsigned int i_blockno; |
|---|
| | 69 | unsigned int i_blocksize; |
|---|
| 67 | 70 | } avi_track_t; |
|---|
| 68 | 71 | |
|---|