Changeset 13f5cc43d32b8a4a3d208042bf1a514406c97ad4

Show
Ignore:
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
  • modules/demux/avi/avi.c

    r4219568 r13f5cc4  
    33 ***************************************************************************** 
    44 * 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 $ 
    66 * Authors: Laurent Aimar <fenrir@via.ecp.fr> 
    77 * 
     
    101101static int        AVI_TrackStopFinishedStreams( input_thread_t *); 
    102102 
     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 
    103112/***************************************************************************** 
    104113 * Open: check file and initializes AVI structures 
     
    252261        tk->i_idxposb   = 0; 
    253262 
     263        tk->i_blockno   = 0; 
     264        tk->i_blocksize = 0; 
     265 
    254266        p_auds = (void*)p_vids = (void*)AVI_ChunkFind( p_strl, AVIFOURCC_strf, 0 ); 
    255267 
     
    272284                tk->i_codec = AVI_FourccGetCodec( AUDIO_ES, 
    273285                                                  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                } 
    274297                es_format_Init( &fmt, AUDIO_ES, tk->i_codec ); 
    275298 
     
    728751        else 
    729752        { 
     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            } 
    730760            toread[i_track].i_toread--; 
    731             tk->i_idxposc++; 
    732761        } 
    733762 
     
    909938            else 
    910939            { 
     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                } 
    911944                p_stream->i_idxposc++; 
    912945            } 
     
    12071240    else 
    12081241    { 
    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        } 
    12101250    } 
    12111251} 
     
    13771417{ 
    13781418    demux_sys_t  *p_sys = p_input->p_demux_data; 
     1419    avi_track_t  *tk = p_sys->track[i_stream]; 
     1420 
    13791421#define p_stream    p_sys->track[i_stream] 
    13801422    mtime_t i_oldpts; 
     
    13891431        { 
    13901432            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            } 
    13911450        } 
    13921451 
  • modules/demux/avi/avi.h

    re33dbc3 r13f5cc4  
    33 ***************************************************************************** 
    44 * 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 $ 
    66 * Authors: Laurent Aimar <fenrir@via.ecp.fr> 
    77 * 
     
    6565    unsigned int        i_idxposb;  /* byte in the current chunk */ 
    6666 
     67    /* For VBR audio only */ 
     68    unsigned int        i_blockno; 
     69    unsigned int        i_blocksize; 
    6770} avi_track_t; 
    6871