X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=modules%2Fgui%2Fbeos%2FVlcWrapper.cpp;h=191048aed01202a70986383029c5a1d5b50f613b;hb=c3638c4d8731baea8d505925a41c760afb13ade6;hp=3356be16e12ff736e9dc9ac67486800afdf8fb32;hpb=4d7eeeb126e849ee202bed07690b3c752f22edc2;p=vlc diff --git a/modules/gui/beos/VlcWrapper.cpp b/modules/gui/beos/VlcWrapper.cpp index 3356be16e1..191048aed0 100644 --- a/modules/gui/beos/VlcWrapper.cpp +++ b/modules/gui/beos/VlcWrapper.cpp @@ -2,7 +2,7 @@ * VlcWrapper.cpp: BeOS plugin for vlc (derived from MacOS X port) ***************************************************************************** * Copyright (C) 2001 VideoLAN - * $Id: VlcWrapper.cpp,v 1.34 2003/06/08 16:04:30 titer Exp $ + * $Id: VlcWrapper.cpp,v 1.40 2003/12/04 10:25:47 gbazin Exp $ * * Authors: Florian G. Pflug * Jon Lech Johansen @@ -96,15 +96,21 @@ bool VlcWrapper::HasInput() int VlcWrapper::InputStatus() { if( !p_input ) + { return UNDEF_S; + } - return p_input->stream.control.i_status; + vlc_value_t state; + var_Get( p_input, "state", &state ); + return state.i_int; } int VlcWrapper::InputRate() { if( !p_input ) + { return DEFAULT_RATE; + } return p_input->stream.control.i_rate; } @@ -112,7 +118,9 @@ int VlcWrapper::InputRate() void VlcWrapper::InputSetRate( int rate ) { if( !p_input ) + { return; + } input_SetRate( p_input, rate ); } @@ -262,64 +270,63 @@ void VlcWrapper::ToggleSubtitle( int i_subtitle ) const char * VlcWrapper::GetTimeAsString() { - static char psz_currenttime[ OFFSETTOTIME_MAX_SIZE ]; + static char psz_time[ MSTRTIME_MAX_SIZE ]; - if( p_input == NULL ) + if( !p_input ) { return ("-:--:--"); } - input_OffsetToTime( p_input, - psz_currenttime, - p_input->stream.p_selected_area->i_tell ); + vlc_value_t time; + var_Get( p_input, "time", &time ); + + mtime_t seconds = time.i_time / 1000000; + sprintf( psz_time, "%d:%02d:%02d", + (int) ( seconds / (60 * 60 ) ), + (int) ( ( seconds / 60 ) % 60 ), + (int) ( seconds % 60 ) ); - return(psz_currenttime); + return psz_time; } float VlcWrapper::GetTimeAsFloat() { - float f_time = 0.0; - - if( p_input != NULL ) - { - f_time = (float)p_input->stream.p_selected_area->i_tell / - (float)p_input->stream.p_selected_area->i_size; - } - else + if( !p_input ) { - f_time = 0.0; + return 0.0; } - return( f_time ); + + vlc_value_t pos; + var_Get( p_input, "position", &pos ); + return pos.f_float; } void VlcWrapper::SetTimeAsFloat( float f_position ) { - if( p_input != NULL ) + if( !p_input ) { - input_Seek( p_input, - (long long)(p_input->stream.p_selected_area->i_size - * f_position / SEEKSLIDER_RANGE ), - INPUT_SEEK_SET ); + return; } + + vlc_value_t pos; + pos.f_float = f_position / SEEKSLIDER_RANGE; + var_Set( p_input, "position", pos ); } bool VlcWrapper::IsPlaying() { - bool playing = false; - if ( p_input ) + if( p_input ) { - switch ( p_input->stream.control.i_status ) + switch( p_input->stream.control.i_status ) { case PLAYING_S: case FORWARD_S: case BACKWARD_S: - case START_S: playing = true; break; case PAUSE_S: case UNDEF_S: - case NOT_STARTED_S: default: break; } @@ -358,7 +365,7 @@ void VlcWrapper::OpenFiles( BList* o_files, bool replace, int32 index ) if ( BString* o_file = (BString *)o_files->RemoveItem( i ) ) { playlist_Add( p_playlist, o_file->String(), - mode, index ); + 0, 0, mode, index ); if ( mode == PLAYLIST_INSERT ) index++; delete o_file; @@ -381,7 +388,7 @@ void VlcWrapper::OpenDisc(BString o_type, BString o_device, int i_title, int i_c o_device.Prepend( "dvdplay:" ); else o_device.Prepend( "dvdold:" ); - playlist_Add( p_playlist, o_device.String(), + playlist_Add( p_playlist, o_device.String(), 0, 0, PLAYLIST_APPEND | PLAYLIST_GO, PLAYLIST_END ); } @@ -749,14 +756,14 @@ void VlcWrapper::SetVolume( int value ) void VlcWrapper::VolumeMute() { - aout_VolumeGet( p_intf, &p_intf->p_sys->i_saved_volume ); aout_VolumeMute( p_intf, NULL ); p_intf->p_sys->b_mute = 1; } void VlcWrapper::VolumeRestore() { - aout_VolumeSet( p_intf, p_intf->p_sys->i_saved_volume ); + audio_volume_t dummy; + aout_VolumeMute( p_intf, &dummy ); p_intf->p_sys->b_mute = 0; } @@ -998,7 +1005,7 @@ void VlcWrapper::FilterChange() for( unsigned int i = 0; i < p_input->stream.i_es_number; i++ ) { if( ( p_input->stream.pp_es[i]->i_cat == VIDEO_ES ) && - ( p_input->stream.pp_es[i]->p_decoder_fifo != NULL ) ) + ( p_input->stream.pp_es[i]->p_dec != NULL ) ) { input_UnselectES( p_input, p_input->stream.pp_es[i] ); input_SelectES( p_input, p_input->stream.pp_es[i] );