GUI questions

Tony Castley tony at castley.net
Sun Feb 25 16:38:52 CET 2001


>On Sun, Feb 25, 2001, Tony Castley wrote:
>> I have just started a GUI for BeOS,  and I cannot seem to figure out 
how 
>> to tell long the video is, and how much is played.  I want to know 
this 
>> to display a duration or progress bar, and maybe allow the user to 
seek 
>> to a different spot in the movie.
>
>   This code, taken from plugins/gnome/gnome_callbacks.c, is used to
>seek to an arbitrary spot. p_adj->value is the requested postition 
(from
>0 to 100) within the stream:
>
>    vlc_mutex_lock( &p_intf->p_sys->change_lock );
>    if( p_intf->p_input != NULL )
>    {
>        i_seek = (p_adj->value *
>                  p_intf->p_input->stream.p_selected_area->i_size) / 
100;
>        input_Seek( p_intf->p_input, i_seek );
>    }
>    vlc_mutex_unlock( &p_intf->p_sys->change_lock );
>
>   And this code, taken from plugins/gnome/intf_gnome.c, is used to 
update
>the progress bar:
>
>    vlc_mutex_lock( &p_intf->p_sys->change_lock );
>    if( p_intf->p_input != NULL )
>    {
>        p_adj->value = ( 100. *
>                         
p_intf->p_input->stream.p_selected_area->i_tell ) /
>                         
p_intf->p_input->stream.p_selected_area->i_size;
>    }
>    vlc_mutex_lock( &p_intf->p_sys->change_lock );
>
>   Note that the p_input->stream structure has been recently updated so
>that it will be easy to display a duration instead of a percentage, but
>I haven't had a look at it yet. Also, the locks aren't probably needed,
>but I heard BeOS applications are massively multithreaded so mind your
>data access.
>
>-- 
>Sam.


Thanks very much working on that now...

Tony



-----------------------------------
This message was sent with the demo version of Postmaster, a BeOS mail client.
For more information, please visit http://kennyc.com/postmaster





More information about the vlc-devel mailing list