* 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 <fgp@phlo.org>
* Jon Lech Johansen <jon-vl@nanocrew.net>
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;
}
void VlcWrapper::InputSetRate( int rate )
{
if( !p_input )
+ {
return;
+ }
input_SetRate( p_input, rate );
}
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;
}
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;
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 );
}
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;
}
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] );