mirror of
https://github.com/videolan/vlc.git
synced 2025-01-08 16:58:09 +08:00
Updated with new changes for playlist management
This commit is contained in:
parent
ab1d602499
commit
31e42cb1b1
@ -2,7 +2,7 @@
|
|||||||
* intf_beos.cpp: beos interface
|
* intf_beos.cpp: beos interface
|
||||||
*****************************************************************************
|
*****************************************************************************
|
||||||
* Copyright (C) 1999, 2000, 2001 VideoLAN
|
* Copyright (C) 1999, 2000, 2001 VideoLAN
|
||||||
* $Id: intf_beos.cpp,v 1.29 2001/05/10 06:47:31 sam Exp $
|
* $Id: intf_beos.cpp,v 1.30 2001/05/21 12:44:23 tcastley Exp $
|
||||||
*
|
*
|
||||||
* Authors: Jean-Marc Dressler <polux@via.ecp.fr>
|
* Authors: Jean-Marc Dressler <polux@via.ecp.fr>
|
||||||
* Samuel Hocevar <sam@zoy.org>
|
* Samuel Hocevar <sam@zoy.org>
|
||||||
@ -180,7 +180,7 @@ InterfaceWindow::InterfaceWindow( BRect frame, const char *name,
|
|||||||
new BMessage(START_PLAYBACK));
|
new BMessage(START_PLAYBACK));
|
||||||
|
|
||||||
p_view->AddChild( p_play );
|
p_view->AddChild( p_play );
|
||||||
p_play->SetPlaying();
|
/* p_play->SetPlaying(); */
|
||||||
|
|
||||||
/* Fast Foward */
|
/* Fast Foward */
|
||||||
ButtonRect.SetLeftTop(BPoint(xStart, yStart));
|
ButtonRect.SetLeftTop(BPoint(xStart, yStart));
|
||||||
@ -255,10 +255,10 @@ void InterfaceWindow::MessageReceived( BMessage * p_message )
|
|||||||
|
|
||||||
switch( p_message->what )
|
switch( p_message->what )
|
||||||
{
|
{
|
||||||
// case B_ABOUT_REQUESTED:
|
case B_ABOUT_REQUESTED:
|
||||||
// alert = new BAlert(VOUT_TITLE, "BeOS " VOUT_TITLE "\n\n<www.videolan.org>", "Ok");
|
alert = new BAlert(VOUT_TITLE, "BeOS " VOUT_TITLE "\n\n<www.videolan.org>", "Ok");
|
||||||
// alert->Go();
|
alert->Go();
|
||||||
// break;
|
break;
|
||||||
|
|
||||||
case OPEN_FILE:
|
case OPEN_FILE:
|
||||||
if( file_panel )
|
if( file_panel )
|
||||||
@ -273,13 +273,13 @@ void InterfaceWindow::MessageReceived( BMessage * p_message )
|
|||||||
|
|
||||||
case OPEN_DVD:
|
case OPEN_DVD:
|
||||||
const char *psz_device;
|
const char *psz_device;
|
||||||
char psz_method[ B_FILE_NAME_LENGTH + 4 ];
|
char psz_source[ B_FILE_NAME_LENGTH + 4 ];
|
||||||
if( p_message->FindString("device", &psz_device) != B_ERROR )
|
if( p_message->FindString("device", &psz_device) != B_ERROR )
|
||||||
{
|
{
|
||||||
snprintf( psz_method, B_FILE_NAME_LENGTH + 4,
|
snprintf( psz_source, B_FILE_NAME_LENGTH + 4,
|
||||||
"dvd:%s", psz_device );
|
"dvd:%s", psz_device );
|
||||||
psz_method[ strlen(psz_method) ] = '\0';
|
psz_source[ strlen(psz_source) ] = '\0';
|
||||||
intf_PlaylistAdd( p_main->p_playlist, PLAYLIST_END, psz_method );
|
intf_PlaylistAdd( p_main->p_playlist, PLAYLIST_END, (char*)psz_source );
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -295,33 +295,42 @@ void InterfaceWindow::MessageReceived( BMessage * p_message )
|
|||||||
p_aout_bank->pp_aout[i_index]->i_volume = 0;
|
p_aout_bank->pp_aout[i_index]->i_volume = 0;
|
||||||
}
|
}
|
||||||
vlc_mutex_unlock( &p_aout_bank->lock );
|
vlc_mutex_unlock( &p_aout_bank->lock );
|
||||||
|
|
||||||
snooze( 400000 );
|
snooze( 400000 );
|
||||||
input_SetStatus( p_intf->p_input, INPUT_STATUS_END );
|
|
||||||
|
/* end playing item */
|
||||||
|
p_intf->p_input->b_eof = 1;
|
||||||
|
|
||||||
|
/* update playlist */
|
||||||
|
vlc_mutex_lock( &p_main->p_playlist->change_lock );
|
||||||
|
p_main->p_playlist->i_index--;
|
||||||
|
p_main->p_playlist->b_stopped = 1;
|
||||||
|
vlc_mutex_unlock( &p_main->p_playlist->change_lock );
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case START_PLAYBACK:
|
case START_PLAYBACK:
|
||||||
// starts playing in normal mode
|
/* starts playing in normal mode */
|
||||||
// if (p_intf->p_input != NULL )
|
/* if (p_intf->p_input != NULL )
|
||||||
//
|
|
||||||
// if (p_main->p_aout != NULL)
|
if (p_main->p_aout != NULL)
|
||||||
// {
|
{
|
||||||
// p_main->p_aout->i_vol = vol_val;
|
p_main->p_aout->i_vol = vol_val;
|
||||||
// }
|
}
|
||||||
// snooze(400000);
|
snooze(400000);
|
||||||
// input_SetStatus(p_intf->p_input, INPUT_STATUS_PLAY);
|
input_SetStatus(p_intf->p_input, INPUT_STATUS_PLAY);
|
||||||
// playback_status = PLAYING;
|
playback_status = PLAYING;
|
||||||
// }
|
}
|
||||||
// break;
|
break;
|
||||||
|
*/
|
||||||
|
|
||||||
case PAUSE_PLAYBACK:
|
case PAUSE_PLAYBACK:
|
||||||
// pause the playback
|
/* toggle between pause and play */
|
||||||
if( p_intf->p_input != NULL )
|
if( p_intf->p_input != NULL )
|
||||||
{
|
{
|
||||||
// mute the volume if currently playing
|
/* pause if currently playing */
|
||||||
if( playback_status == PLAYING )
|
if( playback_status == PLAYING )
|
||||||
{
|
{
|
||||||
|
/* mute the sound */
|
||||||
vlc_mutex_lock( &p_aout_bank->lock );
|
vlc_mutex_lock( &p_aout_bank->lock );
|
||||||
for( i_index = 0 ; i_index < p_aout_bank->i_count ; i_index++ )
|
for( i_index = 0 ; i_index < p_aout_bank->i_count ; i_index++ )
|
||||||
{
|
{
|
||||||
@ -330,11 +339,18 @@ void InterfaceWindow::MessageReceived( BMessage * p_message )
|
|||||||
p_aout_bank->pp_aout[i_index]->i_volume = 0;
|
p_aout_bank->pp_aout[i_index]->i_volume = 0;
|
||||||
}
|
}
|
||||||
vlc_mutex_unlock( &p_aout_bank->lock );
|
vlc_mutex_unlock( &p_aout_bank->lock );
|
||||||
|
|
||||||
|
/* pause the movie */
|
||||||
|
input_SetStatus( p_intf->p_input, INPUT_STATUS_PAUSE );
|
||||||
|
vlc_mutex_lock( &p_main->p_playlist->change_lock );
|
||||||
|
p_main->p_playlist->b_stopped = 0;
|
||||||
|
vlc_mutex_unlock( &p_main->p_playlist->change_lock );
|
||||||
playback_status = PAUSED;
|
playback_status = PAUSED;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
// restore the volume
|
|
||||||
{
|
{
|
||||||
|
/* Play after pausing */
|
||||||
|
/* Restore the volume */
|
||||||
vlc_mutex_lock( &p_aout_bank->lock );
|
vlc_mutex_lock( &p_aout_bank->lock );
|
||||||
for( i_index = 0 ; i_index < p_aout_bank->i_count ; i_index++ )
|
for( i_index = 0 ; i_index < p_aout_bank->i_count ; i_index++ )
|
||||||
{
|
{
|
||||||
@ -343,18 +359,40 @@ void InterfaceWindow::MessageReceived( BMessage * p_message )
|
|||||||
p_aout_bank->pp_aout[i_index]->i_savedvolume = 0;
|
p_aout_bank->pp_aout[i_index]->i_savedvolume = 0;
|
||||||
}
|
}
|
||||||
vlc_mutex_unlock( &p_aout_bank->lock );
|
vlc_mutex_unlock( &p_aout_bank->lock );
|
||||||
|
snooze( 400000 );
|
||||||
|
|
||||||
|
/* Start playing */
|
||||||
|
input_SetStatus( p_intf->p_input, INPUT_STATUS_PLAY );
|
||||||
|
p_main->p_playlist->b_stopped = 0;
|
||||||
playback_status = PLAYING;
|
playback_status = PLAYING;
|
||||||
}
|
}
|
||||||
|
|
||||||
snooze( 400000 );
|
|
||||||
input_SetStatus( p_intf->p_input, INPUT_STATUS_PAUSE );
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* Play a new file */
|
||||||
|
vlc_mutex_lock( &p_main->p_playlist->change_lock );
|
||||||
|
if( p_main->p_playlist->b_stopped )
|
||||||
|
{
|
||||||
|
if( p_main->p_playlist->i_size )
|
||||||
|
{
|
||||||
|
vlc_mutex_unlock( &p_main->p_playlist->change_lock );
|
||||||
|
intf_PlaylistJumpto( p_main->p_playlist,
|
||||||
|
p_main->p_playlist->i_index );
|
||||||
|
playback_status = PLAYING;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
vlc_mutex_unlock( &p_main->p_playlist->change_lock );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case FASTER_PLAY:
|
case FASTER_PLAY:
|
||||||
// cycle the fast playback modes
|
/* cycle the fast playback modes */
|
||||||
if( p_intf->p_input != NULL )
|
if( p_intf->p_input != NULL )
|
||||||
{
|
{
|
||||||
|
/* mute the sound */
|
||||||
vlc_mutex_lock( &p_aout_bank->lock );
|
vlc_mutex_lock( &p_aout_bank->lock );
|
||||||
for( i_index = 0 ; i_index < p_aout_bank->i_count ; i_index++ )
|
for( i_index = 0 ; i_index < p_aout_bank->i_count ; i_index++ )
|
||||||
{
|
{
|
||||||
@ -363,16 +401,21 @@ void InterfaceWindow::MessageReceived( BMessage * p_message )
|
|||||||
p_aout_bank->pp_aout[i_index]->i_volume = 0;
|
p_aout_bank->pp_aout[i_index]->i_volume = 0;
|
||||||
}
|
}
|
||||||
vlc_mutex_unlock( &p_aout_bank->lock );
|
vlc_mutex_unlock( &p_aout_bank->lock );
|
||||||
|
|
||||||
snooze( 400000 );
|
snooze( 400000 );
|
||||||
|
|
||||||
|
/* change the fast play mode */
|
||||||
input_SetStatus( p_intf->p_input, INPUT_STATUS_FASTER );
|
input_SetStatus( p_intf->p_input, INPUT_STATUS_FASTER );
|
||||||
|
vlc_mutex_lock( &p_main->p_playlist->change_lock );
|
||||||
|
p_main->p_playlist->b_stopped = 0;
|
||||||
|
vlc_mutex_unlock( &p_main->p_playlist->change_lock );
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SLOWER_PLAY:
|
case SLOWER_PLAY:
|
||||||
// cycle the slow playback modes
|
/* cycle the slow playback modes */
|
||||||
if (p_intf->p_input != NULL )
|
if (p_intf->p_input != NULL )
|
||||||
{
|
{
|
||||||
|
/* mute the sound */
|
||||||
vlc_mutex_lock( &p_aout_bank->lock );
|
vlc_mutex_lock( &p_aout_bank->lock );
|
||||||
for( i_index = 0 ; i_index < p_aout_bank->i_count ; i_index++ )
|
for( i_index = 0 ; i_index < p_aout_bank->i_count ; i_index++ )
|
||||||
{
|
{
|
||||||
@ -381,18 +424,22 @@ void InterfaceWindow::MessageReceived( BMessage * p_message )
|
|||||||
p_aout_bank->pp_aout[i_index]->i_volume = 0;
|
p_aout_bank->pp_aout[i_index]->i_volume = 0;
|
||||||
}
|
}
|
||||||
vlc_mutex_unlock( &p_aout_bank->lock );
|
vlc_mutex_unlock( &p_aout_bank->lock );
|
||||||
|
|
||||||
snooze( 400000 );
|
snooze( 400000 );
|
||||||
|
|
||||||
|
/* change the slower play */
|
||||||
input_SetStatus( p_intf->p_input, INPUT_STATUS_SLOWER );
|
input_SetStatus( p_intf->p_input, INPUT_STATUS_SLOWER );
|
||||||
|
vlc_mutex_lock( &p_main->p_playlist->change_lock );
|
||||||
|
p_main->p_playlist->b_stopped = 0;
|
||||||
|
vlc_mutex_unlock( &p_main->p_playlist->change_lock );
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SEEK_PLAYBACK:
|
case SEEK_PLAYBACK:
|
||||||
// handled by semaphores;
|
/* handled by semaphores */
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case VOLUME_CHG:
|
case VOLUME_CHG:
|
||||||
// adjust the volume
|
/* adjust the volume */
|
||||||
vlc_mutex_lock( &p_aout_bank->lock );
|
vlc_mutex_lock( &p_aout_bank->lock );
|
||||||
for( i_index = 0 ; i_index < p_aout_bank->i_count ; i_index++ )
|
for( i_index = 0 ; i_index < p_aout_bank->i_count ; i_index++ )
|
||||||
{
|
{
|
||||||
@ -409,7 +456,7 @@ void InterfaceWindow::MessageReceived( BMessage * p_message )
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case VOLUME_MUTE:
|
case VOLUME_MUTE:
|
||||||
// mute
|
/* toggle muting */
|
||||||
vlc_mutex_lock( &p_aout_bank->lock );
|
vlc_mutex_lock( &p_aout_bank->lock );
|
||||||
for( i_index = 0 ; i_index < p_aout_bank->i_count ; i_index++ )
|
for( i_index = 0 ; i_index < p_aout_bank->i_count ; i_index++ )
|
||||||
{
|
{
|
||||||
@ -432,16 +479,30 @@ void InterfaceWindow::MessageReceived( BMessage * p_message )
|
|||||||
case SELECT_CHANNEL:
|
case SELECT_CHANNEL:
|
||||||
{
|
{
|
||||||
int32 i = p_message->FindInt32( "channel" );
|
int32 i = p_message->FindInt32( "channel" );
|
||||||
input_ChangeES( p_intf->p_input,
|
if ( i == -1 )
|
||||||
p_intf->p_input->stream.pp_es[i], 1 );
|
{
|
||||||
|
input_ChangeES( p_intf->p_input, NULL, AUDIO_ES );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
input_ChangeES( p_intf->p_input,
|
||||||
|
p_intf->p_input->stream.pp_es[i], AUDIO_ES );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SELECT_SUBTITLE:
|
case SELECT_SUBTITLE:
|
||||||
{
|
{
|
||||||
int32 i = p_message->FindInt32( "subtitle" );
|
int32 i = p_message->FindInt32( "subtitle" );
|
||||||
input_ChangeES( p_intf->p_input,
|
if ( i == -1 )
|
||||||
p_intf->p_input->stream.pp_es[i], 2 );
|
{
|
||||||
|
input_ChangeES( p_intf->p_input, NULL, SPU_ES);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
input_ChangeES( p_intf->p_input,
|
||||||
|
p_intf->p_input->stream.pp_es[i], SPU_ES );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -453,9 +514,8 @@ void InterfaceWindow::MessageReceived( BMessage * p_message )
|
|||||||
{
|
{
|
||||||
BPath path( &ref );
|
BPath path( &ref );
|
||||||
intf_PlaylistAdd( p_main->p_playlist,
|
intf_PlaylistAdd( p_main->p_playlist,
|
||||||
PLAYLIST_END, path.Path() );
|
PLAYLIST_END, (char*)path.Path() );
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -630,15 +690,33 @@ int LanguageMenu::GetChannels()
|
|||||||
{
|
{
|
||||||
char *psz_name;
|
char *psz_name;
|
||||||
bool b_active;
|
bool b_active;
|
||||||
bool b_found;
|
BMessage *msg;
|
||||||
int i;
|
int i;
|
||||||
es_descriptor_t *p_es;
|
es_descriptor_t *p_es = NULL;
|
||||||
|
|
||||||
|
/* Insert the null */
|
||||||
|
if( kind == AUDIO_ES ) //audio
|
||||||
|
{
|
||||||
|
msg = new BMessage(SELECT_CHANNEL);
|
||||||
|
msg->AddInt32("channel", -1);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
msg = new BMessage(SELECT_SUBTITLE);
|
||||||
|
msg->AddInt32("subtitle", -1);
|
||||||
|
}
|
||||||
|
BMenuItem *menu_item;
|
||||||
|
menu_item = new BMenuItem("None", msg);
|
||||||
|
AddItem(menu_item);
|
||||||
|
menu_item->SetMarked(TRUE);
|
||||||
|
|
||||||
if( p_intf->p_input == NULL )
|
if( p_intf->p_input == NULL )
|
||||||
{
|
{
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
vlc_mutex_lock( &p_intf->p_input->stream.stream_lock );
|
||||||
for( i = 0; i < p_intf->p_input->stream.i_selected_es_number; i++ )
|
for( i = 0; i < p_intf->p_input->stream.i_selected_es_number; i++ )
|
||||||
{
|
{
|
||||||
if( kind == p_intf->p_input->stream.pp_selected_es[i]->i_cat )
|
if( kind == p_intf->p_input->stream.pp_selected_es[i]->i_cat )
|
||||||
@ -652,7 +730,6 @@ int LanguageMenu::GetChannels()
|
|||||||
if( kind == p_intf->p_input->stream.pp_es[i]->i_cat )
|
if( kind == p_intf->p_input->stream.pp_es[i]->i_cat )
|
||||||
{
|
{
|
||||||
psz_name = p_intf->p_input->stream.pp_es[i]->psz_desc;
|
psz_name = p_intf->p_input->stream.pp_es[i]->psz_desc;
|
||||||
BMessage *msg;
|
|
||||||
if( kind == AUDIO_ES ) //audio
|
if( kind == AUDIO_ES ) //audio
|
||||||
{
|
{
|
||||||
msg = new BMessage(SELECT_CHANNEL);
|
msg = new BMessage(SELECT_CHANNEL);
|
||||||
@ -670,6 +747,8 @@ int LanguageMenu::GetChannels()
|
|||||||
menu_item->SetMarked(b_active);
|
menu_item->SetMarked(b_active);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
vlc_mutex_unlock( &p_intf->p_input->stream.stream_lock );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
|
Loading…
Reference in New Issue
Block a user