* AudioOutput.cpp: BeOS audio output
*****************************************************************************
* Copyright (C) 1999, 2000, 2001 VideoLAN
- * $Id: AudioOutput.cpp,v 1.18 2002/11/27 06:27:52 titer Exp $
+ * $Id: AudioOutput.cpp,v 1.19 2002/12/09 07:57:04 titer Exp $
*
* Authors: Jean-Marc Dressler <polux@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org>
if( p_aout_buffer != NULL )
{
- memcpy( (float*)p_buffer,
- p_aout_buffer->p_buffer,
- MIN( BUFFER_SIZE, p_aout_buffer->i_nb_bytes ) );
- aout_BufferFree( p_aout_buffer );
+ memcpy( (float*)p_buffer,
+ p_aout_buffer->p_buffer,
+ MIN( BUFFER_SIZE, p_aout_buffer->i_nb_bytes ) );
+ if( p_aout_buffer->i_nb_bytes < BUFFER_SIZE )
+ {
+ memset( (float*)p_buffer + p_aout_buffer->i_nb_bytes,
+ 0, BUFFER_SIZE - p_aout_buffer->i_nb_bytes );
+ }
+ aout_BufferFree( p_aout_buffer );
+ }
+ else
+ {
+ memset( (float*)p_buffer, 0, BUFFER_SIZE );
}
}
* InterfaceWindow.cpp: beos interface
*****************************************************************************
* Copyright (C) 1999, 2000, 2001 VideoLAN
- * $Id: InterfaceWindow.cpp,v 1.11 2002/12/04 02:16:23 titer Exp $
+ * $Id: InterfaceWindow.cpp,v 1.12 2002/12/09 07:57:04 titer Exp $
*
* Authors: Jean-Marc Dressler <polux@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org>
// this currently stops playback not nicely
if (playback_status > UNDEF_S)
{
- p_wrapper->volume_mute();
snooze( 400000 );
p_wrapper->PlaylistStop();
p_mediaControl->SetStatus(NOT_STARTED_S, DEFAULT_RATE);
/* pause if currently playing */
if ( playback_status == PLAYING_S )
{
- p_wrapper->volume_mute();
- snooze( 400000 );
p_wrapper->PlaylistPause();
}
else
{
- p_wrapper->volume_restore();
p_wrapper->PlaylistPlay();
}
}
/* cycle the fast playback modes */
if (playback_status > UNDEF_S)
{
- p_wrapper->volume_mute();
- snooze( 400000 );
p_wrapper->InputFaster();
}
break;
/* cycle the slow playback modes */
if (playback_status > UNDEF_S)
{
- p_wrapper->volume_mute();
- snooze( 400000 );
p_wrapper->InputSlower();
}
break;
/* restore speed to normal if already playing */
if (playback_status > UNDEF_S)
{
- p_wrapper->volume_restore();
p_wrapper->PlaylistPlay();
}
break;
/* adjust the volume */
if (playback_status > UNDEF_S)
{
- p_wrapper->set_volume( p_mediaControl->GetVolume() );
- p_mediaControl->SetMuted( p_wrapper->is_muted() );
+ p_wrapper->SetVolume( p_mediaControl->GetVolume() );
+ p_mediaControl->SetMuted( p_wrapper->IsMuted() );
}
break;
case VOLUME_MUTE:
// toggle muting
- p_wrapper->toggle_mute();
- p_mediaControl->SetMuted( p_wrapper->is_muted() );
+ if( p_wrapper->IsMuted() )
+ p_wrapper->VolumeRestore();
+ else
+ p_wrapper->VolumeMute();
+ p_mediaControl->SetMuted( p_wrapper->IsMuted() );
break;
case SELECT_CHANNEL:
if ( p_message->FindInt32( "channel", &channel ) == B_OK )
{
p_wrapper->toggleLanguage( channel );
- // vlc seems to remember the volume for every channel,
- // but I would assume that to be somewhat annoying to the user
- // the next call will also unmute the volume, which is probably
- // desired as well, because if the user selects another language,
- // he probably wants to hear the change as well
- snooze( 400000 ); // we have to wait a bit, or the change will be reverted
- p_wrapper->set_volume( p_mediaControl->GetVolume() );
}
}
break;
p_wrapper->getNavCapabilities( &canSkipPrev, &canSkipNext );
p_mediaControl->SetSkippable( canSkipPrev, canSkipNext );
- if ( p_wrapper->has_audio() )
+ if ( p_wrapper->HasAudio() )
{
p_mediaControl->SetAudioEnabled( true );
- p_mediaControl->SetMuted( p_wrapper->is_muted() );
+ p_mediaControl->SetMuted( p_wrapper->IsMuted() );
} else
p_mediaControl->SetAudioEnabled( false );
//printf("InterfaceWindow::_InputStreamChanged()\n");
// TODO: move more stuff from updateInterface() here!
snooze( 400000 );
- p_wrapper->set_volume( p_mediaControl->GetVolume() );
+ p_wrapper->SetVolume( p_mediaControl->GetVolume() );
}
/*****************************************************************************
* PlayListWindow.cpp: beos interface
*****************************************************************************
* Copyright (C) 1999, 2000, 2001 VideoLAN
- * $Id: PlayListWindow.cpp,v 1.4 2002/11/26 01:06:08 titer Exp $
+ * $Id: PlayListWindow.cpp,v 1.5 2002/12/09 07:57:04 titer Exp $
*
* Authors: Jean-Marc Dressler <polux@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org>
fListView->AddItem( new PlaylistItem( p_wrapper->PlaylistItemName( i ) ) );
}
fListView->SetCurrent( p_wrapper->PlaylistCurrent() );
- fListView->SetPlaying( p_wrapper->is_playing() );
+ fListView->SetPlaying( p_wrapper->IsPlaying() );
}
* VlcWrapper.cpp: BeOS plugin for vlc (derived from MacOS X port)
*****************************************************************************
* Copyright (C) 2001 VideoLAN
- * $Id: VlcWrapper.cpp,v 1.12 2002/11/27 05:36:41 titer Exp $
+ * $Id: VlcWrapper.cpp,v 1.13 2002/12/09 07:57:04 titer Exp $
*
* Authors: Florian G. Pflug <fgp@phlo.org>
* Jon Lech Johansen <jon-vl@nanocrew.net>
{
input_SetStatus( p_input, INPUT_STATUS_SLOWER );
}
- if( p_input->stream.control.i_rate == DEFAULT_RATE)
- {
- toggle_mute();
- }
- else
- {
- toggle_mute();
- }
+ //VolumeMute();
}
void VlcWrapper::InputFaster()
{
input_SetStatus( p_input, INPUT_STATUS_FASTER );
}
- if( p_input->stream.control.i_rate == DEFAULT_RATE)
- {
- toggle_mute();
- }
- else
- {
- toggle_mute();
- }
+ //VolumeMute();
}
void VlcWrapper::openFiles( BList* o_files, bool replace )
int i_cat = AUDIO_ES;
vlc_mutex_lock( &p_input->stream.stream_lock );
- for( int i = 0; i < p_input->stream.i_selected_es_number ; i++ )
+ for( unsigned int i = 0; i < p_input->stream.i_selected_es_number ; i++ )
{
if( p_input->stream.pp_selected_es[i]->i_cat == i_cat )
{
int i_cat = SPU_ES;
vlc_mutex_lock( &p_input->stream.stream_lock );
- for( int i = 0; i < p_input->stream.i_selected_es_number ; i++ )
+ for( unsigned int i = 0; i < p_input->stream.i_selected_es_number ; i++ )
{
if( p_input->stream.pp_selected_es[i]->i_cat == i_cat )
{
}
}
+bool VlcWrapper::IsPlaying()
+{
+
+ bool playing = false;
+ if ( p_input )
+ {
+ 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;
+ }
+ }
+ return playing;
+
+}
/******************************
* playlist infos and control *
if( PlaylistSize() )
{
playlist_Play( p_playlist );
+ //VolumeRestore();
}
return( true );
}
void VlcWrapper::PlaylistPause()
{
- toggle_mute();
if( p_input )
{
input_SetStatus( p_input, INPUT_STATUS_PAUSE );
void VlcWrapper::PlaylistStop()
{
- volume_mute();
playlist_Stop( p_playlist );
}
* audio infos and control *
***************************/
-void VlcWrapper::volume_mute()
-{
- if( p_aout != NULL )
- {
- if( !p_intf->p_sys->b_mute )
- {
- p_intf->p_sys->i_saved_volume = p_aout->output.i_volume;
- p_aout->output.i_volume = 0;
- p_intf->p_sys->b_mute = 1;
- }
- }
-
-}
-
-void VlcWrapper::volume_restore()
+void VlcWrapper::SetVolume(int value)
{
if( p_aout != NULL )
{
- p_aout->output.i_volume = p_intf->p_sys->i_saved_volume;
- p_intf->p_sys->i_saved_volume = 0;
- p_intf->p_sys->b_mute = 0;
- }
-
-}
-
-void VlcWrapper::set_volume(int value)
-{
- if( p_aout != NULL )
- {
- // make sure value is within bounds
- if (value < 0)
- value = 0;
- if (value > AOUT_VOLUME_MAX)
- value = AOUT_VOLUME_MAX;
- vlc_mutex_lock( &p_aout->mixer_lock );
- // unmute volume if muted
if ( p_intf->p_sys->b_mute )
{
p_intf->p_sys->b_mute = 0;
- p_aout->output.i_volume = value;
}
- vlc_mutex_unlock( &p_aout->mixer_lock );
+ aout_VolumeSet( p_aout, value );
}
}
-void VlcWrapper::toggle_mute()
+void VlcWrapper::VolumeMute()
{
if( p_aout != NULL )
{
- if ( p_intf->p_sys->b_mute )
- {
- volume_restore();
- }
- else
- {
- volume_mute();
- }
- }
+ aout_VolumeGet( p_aout, &p_intf->p_sys->i_saved_volume );
+ aout_VolumeMute( p_aout, NULL );
+ p_intf->p_sys->b_mute = 1;
+ }
}
-bool VlcWrapper::is_muted()
+void VlcWrapper::VolumeRestore()
{
- bool muted = true;
-
if( p_aout != NULL )
- {
- vlc_mutex_lock( &p_aout->mixer_lock );
- if( p_aout->output.i_volume > 0 )
- {
- muted = false;
- }
- vlc_mutex_unlock( &p_aout->mixer_lock );
-// unfortunately, this is not reliable!
-// return p_main->p_intf->p_sys->b_mute;
- }
- return muted;
-}
-
-bool VlcWrapper::is_playing()
-{
-
- bool playing = false;
- if ( p_input )
- {
- 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;
- }
+ {
+ aout_VolumeSet( p_aout, p_intf->p_sys->i_saved_volume );
+ p_intf->p_sys->b_mute = 0;
}
- return playing;
-
}
-void VlcWrapper::maxvolume()
+bool VlcWrapper::IsMuted()
{
- if( p_aout != NULL )
- {
- if( p_intf->p_sys->b_mute )
- {
- p_intf->p_sys->i_saved_volume = AOUT_VOLUME_MAX;
- }
- else
- {
- p_aout->output.i_volume = AOUT_VOLUME_MAX;
- }
- }
+ return p_intf->p_sys->b_mute;
}
-bool VlcWrapper::has_audio()
+bool VlcWrapper::HasAudio()
{
return( p_aout != NULL );
}
void VlcWrapper::NextTitle()
{
- int i_id;
+ unsigned int i_id;
i_id = p_input->stream.p_selected_area->i_id + 1;
if( i_id < p_input->stream.i_area_nb )
{
* VlcWrapper.h: BeOS plugin for vlc (derived from MacOS X port)
*****************************************************************************
* Copyright (C) 2001 VideoLAN
- * $Id: VlcWrapper.h,v 1.8 2002/11/27 05:36:41 titer Exp $
+ * $Id: VlcWrapper.h,v 1.9 2002/12/09 07:57:04 titer Exp $
*
* Authors: Florian G. Pflug <fgp@phlo.org>
* Jon Lech Johansen <jon-vl@nanocrew.net>
vlc_bool_t b_loop;
vlc_bool_t b_mute;
int i_part;
- int i_saved_volume;
+ audio_volume_t i_saved_volume;
int i_channel;
VlcWrapper * p_wrapper;
const char* getTimeAsString();
float getTimeAsFloat();
void setTimeAsFloat( float i_offset );
-
+ bool IsPlaying();
/* Playlist */
int PlaylistSize();
void navigateNext();
/* audio */
- void volume_mute();
- void volume_restore();
- void set_volume(int value);
- void toggle_mute( );
- bool is_muted();
- bool is_playing();
- void maxvolume();
- bool has_audio();
+ void SetVolume( int value );
+ void VolumeMute();
+ void VolumeRestore();
+ bool IsMuted();
+ bool HasAudio();
/* DVD */
bool HasTitles();