Show
Ignore:
Timestamp:
22/08/08 17:57:59 (3 months ago)
Author:
Laurent Aimar <fenrir@videolan.org>
git-committer:
Laurent Aimar <fenrir@videolan.org> 1219420679 +0200
git-parent:

[b1cea0a301d6bc450edc0b8ec03c4af54f5d9e35]

git-author:
Laurent Aimar <fenrir@videolan.org> 1219420679 +0200
Message:

Fixed input slave reading of a52/dts/flac/m4a/mpga (close #1818).

Input slave method needs that PCR of master and slave input use the same origin.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • modules/demux/dts.c

    re81f6fc r069f260  
    6363    decoder_t *p_packetizer; 
    6464 
     65    mtime_t i_pts; 
     66    mtime_t i_time_offset; 
     67 
    6568    int i_mux_rate; 
    6669}; 
     
    157160 
    158161    DEMUX_INIT_COMMON(); p_sys = p_demux->p_sys; 
     162    p_sys->i_mux_rate = 0; 
     163    p_sys->i_pts = 0; 
     164    p_sys->i_time_offset = 0; 
    159165  
    160166    INIT_APACKETIZER( p_sys->p_packetizer, 'd','t','s',' ' ); 
     
    215221            } 
    216222 
     223            /* Correct timestamp */ 
     224            p_block_out->i_pts += p_sys->i_time_offset; 
     225            p_block_out->i_dts += p_sys->i_time_offset; 
     226 
    217227            /* set PCR */ 
    218228            es_out_Control( p_demux->out, ES_OUT_SET_PCR, p_block_out->i_dts ); 
     
    233243{ 
    234244    demux_sys_t *p_sys  = p_demux->p_sys; 
    235     if( i_query == DEMUX_SET_TIME ) 
    236         return VLC_EGENERIC; 
    237     else 
    238         return demux_vaControlHelper( p_demux->s, 
     245    bool *pb_bool; 
     246    int64_t *pi64; 
     247    int i_ret; 
     248 
     249    switch( i_query ) 
     250    { 
     251    case DEMUX_HAS_UNSUPPORTED_META: 
     252        pb_bool = (bool*)va_arg( args, bool* ); 
     253        *pb_bool = true; 
     254        return VLC_SUCCESS; 
     255 
     256    case DEMUX_GET_TIME: 
     257        pi64 = (int64_t*)va_arg( args, int64_t * ); 
     258        *pi64 = p_sys->i_pts + p_sys->i_time_offset; 
     259        return VLC_SUCCESS; 
     260 
     261    case DEMUX_SET_TIME: /* TODO implement a high precicsion seek */ 
     262    default: 
     263        i_ret = demux_vaControlHelper( p_demux->s, 
    239264                                       0, -1, 
    240265                                       8*p_sys->i_mux_rate, 1, i_query, args ); 
     266        if( !i_ret && p_sys->i_mux_rate > 0 && 
     267            ( i_query == DEMUX_SET_POSITION || i_query == DEMUX_SET_TIME ) ) 
     268        { 
     269 
     270            const int64_t i_time = INT64_C(1000000) * stream_Tell(p_demux->s) / 
     271                                        p_sys->i_mux_rate; 
     272 
     273            /* Fix time_offset */ 
     274            if( i_time >= 0 ) 
     275                p_sys->i_time_offset = i_time - p_sys->i_pts; 
     276        } 
     277        return i_ret; 
     278    } 
    241279} 
    242280