[vlc-devel] [PATCH 12/24] [demux/dirac] Trying to make dirac demuxing work with --input-slave

Laurent Aimar fenrir at via.ecp.fr
Mon Nov 10 22:01:58 CET 2008


On Fri, Nov 07, 2008, David Flynn wrote:
> > @@ -146,6 +149,9 @@ static int Demux( demux_t *p_demux)
> > +            p_block_out->i_dts += p_sys->i_offset;
> > +            p_block_out->i_pts += p_sys->i_offset;
> > +            p_sys->i_dts = p_block_out->i_dts;
> >              es_out_Control( p_demux->out, ES_OUT_SET_PCR, p_block_out->i_dts );
> >              es_out_Send( p_demux->out, p_sys->p_es, p_block_out );
> >  
> > @@ -160,13 +166,33 @@ static int Demux( demux_t *p_demux)
> >   *****************************************************************************/
> >  static int Control( demux_t *p_demux, int i_query, va_list args )
> >  {
> > -    /* demux_sys_t *p_sys  = p_demux->p_sys; */
> > -    /* FIXME calculate the bitrate */
> > -    if( i_query == DEMUX_SET_TIME )
> > -        return VLC_EGENERIC;
> > +    demux_sys_t *p_sys  = p_demux->p_sys;
> > +    if( DEMUX_SET_TIME == i_query )
> > +    {
> > +        int64_t i64 = (int64_t)va_arg( args, int64_t );
> > +        p_sys->i_offset = i64;
> > +        return VLC_SUCCESS;
> > +    }
> > +    else if( DEMUX_GET_TIME == i_query )
> > +    {
> > +        int64_t *pi64 = (int64_t*)va_arg( args, int64_t * );
> > +        *pi64 = p_sys->i_dts;
> > +        return VLC_SUCCESS;
> > +    }
> [snip]
> 
> Is this all completely bogus?  I think i'm slightly confused as to what
> DEMUX_SET_TIME is for.

* DEMUX_SET_TIME is for seeking by time.
* DEMUX_GET_TIME is for retreiving the current time.
with time expressed in microsecond.

 Of course, when seeking by time, you may not be able to respect the time
asked (eg: with 25 fps, when time%40ms != 0).
 It is fine as long as the value returned by DEMUX_GET_TIME is the real
current time.
 You can implement exact frame seeking by using prerolling if you want.
(ie data are decoded but thrashed until a date you can set by
ES_OUT_SET_NEXT_DISPLAY_TIME).

 When implementing a demux that can work as slave, it is important to have
pcr/pts/dts using the same origin than the value returned by DEMUX_GET_TIME.

 The precision of the value returned by DEMUX_GET_TIME is not critical (you can
dts or pcr). The value will be used to synchronize the speed of all slave inputs
(if any) and the GUI status.

 The value of dts/pts is critical as it will be used to synchronized the ES with the
others.

Regards,

-- 
fenrir




More information about the vlc-devel mailing list