[vlc-devel] [PATCH 00/17] Fixing normal_time handling

Thomas Guillem thomas at gllm.fr
Thu Mar 11 10:38:00 UTC 2021



On Wed, Mar 10, 2021, at 15:19, Rémi Denis-Courmont wrote:
> Le mercredi 10 mars 2021, 15:33:55 EET Thomas Guillem a écrit :
> > FYI, GET_TIME is stil used by the player timer to report the time when the
> > demux doesn't have any programs/PCR/ES (so no valid data).
> 
> You can't have it both ways. Either the value is polled or it's reported via 
> asynchronous events.
> 
> It made no sense to have separate GET_TIME and GET_NORMAL_TIME, and it would 
> make no sense to have separate GET_TIME polled and NPT as an event. They are 
> by definition one and the same thing: the time to show to the user.
> 
> And it does not seem to belong in SetPCR either way.

In practice, implementing GET_NORMAL_TIME is way harder to just send the matching time of the PCR.

Let's see dvdnav for example:

static int Control( demux_t *p_demux, int i_query, va_list args )                
{
....
        case DEMUX_GET_TIME:                                                     
            if( p_sys->i_pgc_length > 0 )                                         
            {                                                                    
                *va_arg( args, vlc_tick_t * ) =                                  
                        dvdnav_get_current_time( p_sys->dvdnav ) * 100 / 9;      
                return VLC_SUCCESS;                                              
            }                                                                    
            break; 
...
}

static int DemuxBlock( demux_t *p_demux, const uint8_t *p, int len )             
{
...
        case 0x1ba:                                                              
        {                                                                        
            vlc_tick_t i_scr;                                                    
            int i_mux_rate;                                                      
            if( !ps_pkt_parse_pack( p_pkt->p_buffer, p_pkt->i_buffer,            
                                    &i_scr, &i_mux_rate ) )                      
            {                                                                    
                es_out_SetPCR( p_sys->p_tf_out, i_scr );                         
                if( i_mux_rate > 0 ) p_sys->i_mux_rate = i_mux_rate;             
            }                                                                    
            block_Release( p_pkt );                                              
            break;                                                               
        }  
...
}

Here, DEMUX_GET_NORMAL_TIME = DEMUX_GET_TIME - i_scr.

The i_scr is not known from Control(), so it needs to be saved in an intermediate variable.
And it will be the same for all modules.

I can do as you say, but I prefer my way. Francois, what do you think ?

> 
> -- 
> Rémi Denis-Courmont
> 
> 
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel


More information about the vlc-devel mailing list