Commit 2a2cf8b1 authored by Tony Castley's avatar Tony Castley

Changes to ensure BeOS plugins compile and function

Implemented a intf_vlc_wrapper to "shield" the BeOS code from the underlying
vlc structurs, yet to be completed.
Attempted to fix subtitle and audio selection, currently not working.
parent 64d33dc9
......@@ -2,7 +2,7 @@
* InterfaceWindow.cpp: beos interface
*****************************************************************************
* Copyright (C) 1999, 2000, 2001 VideoLAN
* $Id: InterfaceWindow.cpp,v 1.20 2002/07/23 00:39:16 sam Exp $
* $Id: InterfaceWindow.cpp,v 1.21 2002/07/23 12:42:17 tcastley Exp $
*
* Authors: Jean-Marc Dressler <polux@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org>
......@@ -29,6 +29,7 @@
#include <InterfaceKit.h>
#include <AppKit.h>
#include <StorageKit.h>
#include <SupportKit.h>
#include <malloc.h>
#include <scsi.h>
#include <scsiprobe_driver.h>
......@@ -45,6 +46,7 @@
#include "MsgVals.h"
#include "MediaControlView.h"
#include "PlayListWindow.h"
#include "intf_vlc_wrapper.h"
#include "InterfaceWindow.h"
......@@ -61,8 +63,13 @@ InterfaceWindow::InterfaceWindow( BRect frame, const char *name,
file_panel = NULL;
playlist_window = NULL;
p_intf = p_interface;
p_vlc_wrapper = Intf_VLCWrapper::getVLCWrapper(p_intf);
BRect controlRect(0,0,0,0);
b_empty_playlist = (p_intf->p_vlc->p_playlist->i_size < 0);
playlist_t *p_playlist = (playlist_t *)vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
FIND_ANYWHERE );
b_empty_playlist = (p_playlist->i_size < 0);
b_mute = false;
/* set the title bar */
SetName( "interface" );
......@@ -77,7 +84,6 @@ InterfaceWindow::InterfaceWindow( BRect frame, const char *name,
BMenu *mAudio;
CDMenu *cd_menu;
BMenu *mNavigation;
BMenu *mConfig;
/* Add the file Menu */
BMenuItem *mItem;
......@@ -118,13 +124,6 @@ InterfaceWindow::InterfaceWindow( BRect frame, const char *name,
mNavigation->AddItem( new BMenuItem( "Next Chapter",
new BMessage(NEXT_CHAPTER)) );
/* Add the Config menu */
menu_bar->AddItem( mConfig = new BMenu( "Config" ) );
menu_bar->ResizeToPreferred();
mConfig->AddItem( miOnTop = new BMenuItem( "Always on Top",
new BMessage(TOGGLE_ON_TOP)) );
miOnTop->SetMarked(false);
ResizeTo(260,50 + menu_bar->Bounds().IntegerHeight()+1);
controlRect = Bounds();
controlRect.top += menu_bar->Bounds().IntegerHeight() + 1;
......@@ -154,18 +153,9 @@ void InterfaceWindow::MessageReceived( BMessage * p_message )
int playback_status; // remember playback state
int i_index;
BAlert *alert;
aout_bank_t *p_aout_bank = p_intf->p_vlc->p_aout_bank;
input_bank_t *p_input_bank = p_intf->p_vlc->p_input_bank;
Activate();
if (p_input_bank->pp_input[0])
{
playback_status = p_input_bank->pp_input[0]->stream.control.i_status;
}
else
{
playback_status = UNDEF_S;
}
playback_status = p_vlc_wrapper->inputGetStatus();
switch( p_message->what )
{
......@@ -175,17 +165,6 @@ void InterfaceWindow::MessageReceived( BMessage * p_message )
break;
case TOGGLE_ON_TOP:
miOnTop->SetMarked(! miOnTop->IsMarked() );
if ( miOnTop->IsMarked() )
{
SetFeel(B_FLOATING_ALL_WINDOW_FEEL);
SetWorkspaces(B_CURRENT_WORKSPACE);
}
else
{
SetFeel(B_NORMAL_WINDOW_FEEL);
SetWorkspaces(B_CURRENT_WORKSPACE);
}
break;
case OPEN_FILE:
......@@ -204,54 +183,31 @@ void InterfaceWindow::MessageReceived( BMessage * p_message )
case OPEN_PLAYLIST:
{
BRect rect(20,20,320,420);
playlist_t *p_playlist = (playlist_t *)vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
FIND_ANYWHERE );
playlist_window = PlayListWindow::getPlayList(rect,
"Playlist", (playlist_t *)p_main->p_playlist);
"Playlist", p_playlist);
playlist_window->Show();
}
break;
case OPEN_DVD:
{
const char *psz_device;
char psz_source[ B_FILE_NAME_LENGTH + 4 ];
BString type("dvd");
if( p_message->FindString("device", &psz_device) != B_ERROR )
{
snprintf( psz_source, B_FILE_NAME_LENGTH + 4,
"dvd:%s", psz_device );
psz_source[ strlen(psz_source) ] = '\0';
intf_PlaylistAdd( p_intf->p_vlc->p_playlist, PLAYLIST_END, (char*)psz_source );
if( p_input_bank->pp_input[0] != NULL )
{
p_input_bank->pp_input[0]->b_eof = 1;
BString device(psz_device);
p_vlc_wrapper->openDisc(type, device, 0,0);
}
intf_PlaylistJumpto( p_intf->p_vlc->p_playlist,
p_intf->p_vlc->p_playlist->i_size - 1 );
b_empty_playlist = false;
p_mediaControl->SetEnabled( !b_empty_playlist );
}
break;
case STOP_PLAYBACK:
// this currently stops playback not nicely
if( p_input_bank->pp_input[0] != NULL )
{
// silence the sound, otherwise very horrible
vlc_mutex_lock( &p_aout_bank->lock );
for( i_index = 0 ; i_index < p_aout_bank->i_count ; i_index++ )
{
p_aout_bank->pp_aout[i_index]->i_savedvolume = p_aout_bank->pp_aout[i_index]->i_volume;
p_aout_bank->pp_aout[i_index]->i_volume = 0;
}
vlc_mutex_unlock( &p_aout_bank->lock );
snooze( 400000 );
/* end playing item */
p_input_bank->pp_input[0]->b_eof = 1;
/* update playlist */
vlc_mutex_lock( &p_intf->p_vlc->p_playlist->change_lock );
p_intf->p_vlc->p_playlist->i_index--;
p_intf->p_vlc->p_playlist->b_stopped = 1;
vlc_mutex_unlock( &p_intf->p_vlc->p_playlist->change_lock );
}
//p_vlc_wrapper->volume_mute();
//snooze( 400000 );
p_vlc_wrapper->playlistStop();
p_mediaControl->SetStatus(NOT_STARTED_S,DEFAULT_RATE);
break;
......@@ -260,112 +216,40 @@ void InterfaceWindow::MessageReceived( BMessage * p_message )
case PAUSE_PLAYBACK:
/* toggle between pause and play */
if( p_input_bank->pp_input[0] != NULL )
if( p_intf->p_sys->p_input != NULL )
{
/* pause if currently playing */
if( playback_status == PLAYING_S )
if ( playback_status == PLAYING_S )
{
/* mute the sound */
vlc_mutex_lock( &p_aout_bank->lock );
for( i_index = 0 ; i_index < p_aout_bank->i_count ; i_index++ )
{
p_aout_bank->pp_aout[i_index]->i_savedvolume =
p_aout_bank->pp_aout[i_index]->i_volume;
p_aout_bank->pp_aout[i_index]->i_volume = 0;
}
vlc_mutex_unlock( &p_aout_bank->lock );
snooze( 400000 );
/* pause the movie */
input_SetStatus( p_input_bank->pp_input[0], INPUT_STATUS_PAUSE );
vlc_mutex_lock( &p_intf->p_vlc->p_playlist->change_lock );
p_intf->p_vlc->p_playlist->b_stopped = 0;
vlc_mutex_unlock( &p_intf->p_vlc->p_playlist->change_lock );
//p_vlc_wrapper->volume_mute();
//snooze( 400000 );
p_vlc_wrapper->playlistPause();
}
else
{
/* Play after pausing */
/* Restore the volume */
vlc_mutex_lock( &p_aout_bank->lock );
for( i_index = 0 ; i_index < p_aout_bank->i_count ; i_index++ )
{
p_aout_bank->pp_aout[i_index]->i_volume =
p_aout_bank->pp_aout[i_index]->i_savedvolume;
p_aout_bank->pp_aout[i_index]->i_savedvolume = 0;
}
vlc_mutex_unlock( &p_aout_bank->lock );
snooze( 400000 );
/* Start playing */
input_SetStatus( p_input_bank->pp_input[0], INPUT_STATUS_PLAY );
p_intf->p_vlc->p_playlist->b_stopped = 0;
//p_vlc_wrapper->volume_restore();
p_vlc_wrapper->playlistPlay();
}
}
else
{
/* Play a new file */
vlc_mutex_lock( &p_intf->p_vlc->p_playlist->change_lock );
if( p_intf->p_vlc->p_playlist->b_stopped )
{
if( p_intf->p_vlc->p_playlist->i_size )
{
vlc_mutex_unlock( &p_intf->p_vlc->p_playlist->change_lock );
intf_PlaylistJumpto( p_intf->p_vlc->p_playlist,
p_intf->p_vlc->p_playlist->i_index );
p_intf->p_vlc->p_playlist->b_stopped = 0;
}
else
{
vlc_mutex_unlock( &p_intf->p_vlc->p_playlist->change_lock );
}
}
p_vlc_wrapper->playlistPlay();
}
break;
case FASTER_PLAY:
/* cycle the fast playback modes */
if( p_input_bank->pp_input[0] != NULL )
{
/* mute the sound */
vlc_mutex_lock( &p_aout_bank->lock );
for( i_index = 0 ; i_index < p_aout_bank->i_count ; i_index++ )
{
p_aout_bank->pp_aout[i_index]->i_savedvolume =
p_aout_bank->pp_aout[i_index]->i_volume;
p_aout_bank->pp_aout[i_index]->i_volume = 0;
}
vlc_mutex_unlock( &p_aout_bank->lock );
snooze( 400000 );
/* change the fast play mode */
input_SetStatus( p_input_bank->pp_input[0], INPUT_STATUS_FASTER );
vlc_mutex_lock( &p_intf->p_vlc->p_playlist->change_lock );
p_intf->p_vlc->p_playlist->b_stopped = 0;
vlc_mutex_unlock( &p_intf->p_vlc->p_playlist->change_lock );
}
//p_vlc_wrapper->volume_mute();
//snooze( 400000 );
p_vlc_wrapper->playFaster();
break;
case SLOWER_PLAY:
/* cycle the slow playback modes */
if (p_input_bank->pp_input[0] != NULL )
{
/* mute the sound */
vlc_mutex_lock( &p_aout_bank->lock );
for( i_index = 0 ; i_index < p_aout_bank->i_count ; i_index++ )
{
p_aout_bank->pp_aout[i_index]->i_savedvolume =
p_aout_bank->pp_aout[i_index]->i_volume;
p_aout_bank->pp_aout[i_index]->i_volume = 0;
}
vlc_mutex_unlock( &p_aout_bank->lock );
snooze( 400000 );
/* change the slower play */
input_SetStatus( p_input_bank->pp_input[0], INPUT_STATUS_SLOWER );
vlc_mutex_lock( &p_intf->p_vlc->p_playlist->change_lock );
p_intf->p_vlc->p_playlist->b_stopped = 0;
vlc_mutex_unlock( &p_intf->p_vlc->p_playlist->change_lock );
}
//p_vlc_wrapper->volume_mute();
//snooze( 400000 );
p_vlc_wrapper->playSlower();
break;
case SEEK_PLAYBACK:
......@@ -374,137 +258,85 @@ void InterfaceWindow::MessageReceived( BMessage * p_message )
case VOLUME_CHG:
/* adjust the volume */
vlc_mutex_lock( &p_aout_bank->lock );
for( i_index = 0 ; i_index < p_aout_bank->i_count ; i_index++ )
{
if( p_aout_bank->pp_aout[i_index]->i_savedvolume )
{
p_aout_bank->pp_aout[i_index]->i_savedvolume = vol_val;
}
else
{
p_aout_bank->pp_aout[i_index]->i_volume = vol_val;
}
}
vlc_mutex_unlock( &p_aout_bank->lock );
// vlc_mutex_lock( &p_intf->p_sys->p_input->lock );
// for( i_index = 0 ; i_index < p_aout_bank->i_count ; i_index++ )
// {
// if( p_aout_bank->pp_aout[i_index]->i_savedvolume )
// {
// p_aout_bank->pp_aout[i_index]->i_savedvolume = vol_val;
// }
// else
// {
// p_aout_bank->pp_aout[i_index]->i_volume = vol_val;
// }
// }
// vlc_mutex_unlock( &p_aout_bank->lock );
break;
case VOLUME_MUTE:
/* toggle muting */
vlc_mutex_lock( &p_aout_bank->lock );
for( i_index = 0 ; i_index < p_aout_bank->i_count ; i_index++ )
{
if( p_aout_bank->pp_aout[i_index]->i_savedvolume )
{
p_aout_bank->pp_aout[i_index]->i_volume =
p_aout_bank->pp_aout[i_index]->i_savedvolume;
p_aout_bank->pp_aout[i_index]->i_savedvolume = 0;
}
else
{
p_aout_bank->pp_aout[i_index]->i_savedvolume =
p_aout_bank->pp_aout[i_index]->i_volume;
p_aout_bank->pp_aout[i_index]->i_volume = 0;
}
}
vlc_mutex_unlock( &p_aout_bank->lock );
b_mute != b_mute;
p_vlc_wrapper->volumeMute( b_mute );
break;
case SELECT_CHANNEL:
case SELECT_SUBTITLE:
case SELECT_AUDIO:
{
int32 i_new, i_old = -1;
if( p_message->what == SELECT_CHANNEL )
{
i_new = p_message->FindInt32( "channel" );
i_cat = AUDIO_ES;
int32 i = p_message->FindInt32( "audio" );
p_vlc_wrapper->toggleLanguage( i );
}
else
{
i_new = p_message->FindInt32( "subtitle" );
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++ )
{
if( p_input->stream.pp_selected_es[i]->i_cat == i_cat )
{
i_old = i;
break;
}
}
vlc_mutex_unlock( &p_input->stream.stream_lock );
if( i_new != -1 )
{
input_ToggleES( p_input, p_input->stream.pp_selected_es[i_new],
VLC_TRUE );
}
if( i_old != -1 )
case SELECT_SUBTITLE:
{
input_ToggleES( p_input, p_input->stream.pp_selected_es[i_old],
VLC_FALSE );
}
int32 i = p_message->FindInt32( "subtitle" );
p_vlc_wrapper->toggleSubtitle( i );
}
break;
case PREV_TITLE:
{
input_area_t * p_area;
int i_id;
i_id = p_input_bank->pp_input[0]->stream.p_selected_area->i_id - 1;
i_id = p_intf->p_sys->p_input->stream.p_selected_area->i_id - 1;
/* Disallow area 0 since it is used for video_ts.vob */
if( i_id > 0 )
{
p_area = p_input_bank->pp_input[0]->stream.pp_areas[i_id];
input_ChangeArea( p_input_bank->pp_input[0], (input_area_t*)p_area );
input_SetStatus( p_input_bank->pp_input[0], INPUT_STATUS_PLAY );
p_vlc_wrapper->toggleTitle(i_id);
}
break;
}
case NEXT_TITLE:
{
input_area_t * p_area;
int i_id;
i_id = p_input_bank->pp_input[0]->stream.p_selected_area->i_id + 1;
i_id = p_intf->p_sys->p_input->stream.p_selected_area->i_id + 1;
if( i_id < p_input_bank->pp_input[0]->stream.i_area_nb )
if( i_id < p_intf->p_sys->p_input->stream.i_area_nb )
{
p_area = p_input_bank->pp_input[0]->stream.pp_areas[i_id];
input_ChangeArea( p_input_bank->pp_input[0], (input_area_t*)p_area );
input_SetStatus( p_input_bank->pp_input[0], INPUT_STATUS_PLAY );
p_vlc_wrapper->toggleTitle(i_id);
}
}
break;
case PREV_CHAPTER:
{
input_area_t * p_area;
int i_id;
p_area = p_input_bank->pp_input[0]->stream.p_selected_area;
i_id = p_intf->p_sys->p_input->stream.p_selected_area->i_part - 1;
if( p_area->i_part > 0 )
if( i_id >= 0 )
{
p_area->i_part--;
input_ChangeArea( p_input_bank->pp_input[0], (input_area_t*)p_area );
input_SetStatus( p_input_bank->pp_input[0], INPUT_STATUS_PLAY );
p_vlc_wrapper->toggleChapter(i_id);
}
}
break;
case NEXT_CHAPTER:
{
input_area_t * p_area;
int i_id;
p_area = p_input_bank->pp_input[0]->stream.p_selected_area;
i_id = p_intf->p_sys->p_input->stream.p_selected_area->i_part + 1;
if( p_area->i_part > 0 )
if( i_id >= 0 )
{
p_area->i_part++;
input_ChangeArea( p_input_bank->pp_input[0], (input_area_t*)p_area );
input_SetStatus( p_input_bank->pp_input[0], INPUT_STATUS_PLAY );
p_vlc_wrapper->toggleChapter(i_id);
}
}
break;
......@@ -512,19 +344,18 @@ void InterfaceWindow::MessageReceived( BMessage * p_message )
case B_SIMPLE_DATA:
{
entry_ref ref;
if( p_message->FindRef( "refs", &ref ) == B_OK )
BList* files = new BList();
int i = 0;
while( p_message->FindRef( "refs", i, &ref ) == B_OK )
{
BPath path( &ref );
intf_PlaylistAdd( p_intf->p_vlc->p_playlist,
PLAYLIST_END, (char*)path.Path() );
if( p_input_bank->pp_input[0] != NULL )
{
p_input_bank->pp_input[0]->b_eof = 1;
}
intf_PlaylistJumpto( p_intf->p_vlc->p_playlist,
p_intf->p_vlc->p_playlist->i_size - 1 );
files->AddItem(new BString((char*)path.Path()) );
i++;
}
p_vlc_wrapper->openFiles(files);
delete files;
}
break;
......@@ -540,26 +371,27 @@ void InterfaceWindow::MessageReceived( BMessage * p_message )
*****************************************************************************/
void InterfaceWindow::updateInterface()
{
input_bank_t *p_input_bank = p_intf->p_vlc->p_input_bank;
if ( p_input_bank->pp_input[0] )
if ( p_intf->p_sys->p_input != NULL )
{
if ( acquire_sem(p_mediaControl->fScrubSem) == B_OK )
{
uint64 seekTo = (p_mediaControl->GetSeekTo() *
p_input_bank->pp_input[0]->stream.p_selected_area->i_size) / 100;
input_Seek( p_input_bank->pp_input[0]->p_this, seekTo, INPUT_SEEK_SET );
p_vlc_wrapper->setTimeAsFloat(p_mediaControl->GetSeekTo());
}
else if( Lock() )
{
p_mediaControl->SetStatus(p_input_bank->pp_input[0]->stream.control.i_status,
p_input_bank->pp_input[0]->stream.control.i_rate);
p_mediaControl->SetProgress(p_input_bank->pp_input[0]->stream.p_selected_area->i_tell,
p_input_bank->pp_input[0]->stream.p_selected_area->i_size);
p_mediaControl->SetStatus(p_intf->p_sys->p_input->stream.control.i_status,
p_intf->p_sys->p_input->stream.control.i_rate);
p_mediaControl->SetProgress(p_intf->p_sys->p_input->stream.p_selected_area->i_tell,
p_intf->p_sys->p_input->stream.p_selected_area->i_size);
Unlock();
}
}
if ( b_empty_playlist != (p_intf->p_vlc->p_playlist->i_size < 1) )
playlist_t *p_playlist = (playlist_t *)vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
FIND_ANYWHERE );
if ( b_empty_playlist != (p_playlist->i_size < 1) )
{
if (Lock())
{
......@@ -702,47 +534,46 @@ int LanguageMenu::GetChannels()
BMessage *msg;
int i;
es_descriptor_t *p_es = NULL;
input_bank_t *p_input_bank = p_intf->p_vlc->p_input_bank;
/* Insert the null */
if( kind == AUDIO_ES ) //audio
{
msg = new BMessage(SELECT_CHANNEL);
msg->AddInt32("channel", -1);
}
else
if( kind == SPU_ES ) //audio
{
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_input_bank->pp_input[0] == NULL )
}
if( p_intf->p_sys->p_input == NULL )
{
return 1;
}
vlc_mutex_lock( &p_input_bank->pp_input[0]->stream.stream_lock );
for( i = 0; i < p_input_bank->pp_input[0]->stream.i_selected_es_number; i++ )
vlc_mutex_lock( &p_intf->p_sys->p_input->stream.stream_lock );
for( i = 0; i < p_intf->p_sys->p_input->stream.i_selected_es_number; i++ )
{
if( kind == p_input_bank->pp_input[0]->stream.pp_selected_es[i]->i_cat )
if( kind == p_intf->p_sys->p_input->stream.pp_selected_es[i]->i_cat )
{
p_es = p_input_bank->pp_input[0]->stream.pp_selected_es[i];
p_es = p_intf->p_sys->p_input->stream.pp_selected_es[i];
}
}
for( i = 0; i < p_input_bank->pp_input[0]->stream.i_es_number; i++ )
for( i = 0; i < p_intf->p_sys->p_input->stream.i_es_number; i++ )
{
if( kind == p_input_bank->pp_input[0]->stream.pp_es[i]->i_cat )
if( kind == p_intf->p_sys->p_input->stream.pp_es[i]->i_cat )
{
psz_name = p_input_bank->pp_input[0]->stream.pp_es[i]->psz_desc;
psz_name = p_intf->p_sys->p_input->stream.pp_es[i]->psz_desc;
if ( strlen(psz_name) == 0 )
{
// change to default etc
}
if( kind == AUDIO_ES ) //audio
{
msg = new BMessage(SELECT_CHANNEL);
msg = new BMessage(SELECT_AUDIO);
msg->AddInt32("channel", i);
}
else
......@@ -753,11 +584,11 @@ int LanguageMenu::GetChannels()
BMenuItem *menu_item;
menu_item = new BMenuItem(psz_name, msg);
AddItem(menu_item);
b_active = (p_es == p_input_bank->pp_input[0]->stream.pp_es[i]);
b_active = (p_es == p_intf->p_sys->p_input->stream.pp_es[i]);
menu_item->SetMarked(b_active);
}
}
vlc_mutex_unlock( &p_input_bank->pp_input[0]->stream.stream_lock );
vlc_mutex_unlock( &p_intf->p_sys->p_input->stream.stream_lock );
}
......
......@@ -2,7 +2,7 @@
* InterfaceWindow.h: BeOS interface window class prototype
*****************************************************************************
* Copyright (C) 1999, 2000, 2001 VideoLAN
* $Id: InterfaceWindow.h,v 1.14 2002/07/23 00:39:16 sam Exp $
* $Id: InterfaceWindow.h,v 1.15 2002/07/23 12:42:17 tcastley Exp $
*
* Authors: Jean-Marc Dressler <polux@via.ecp.fr>
* Tony Castley <tcastley@mail.powerup.com.au>
......@@ -22,6 +22,9 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
/*****************************************************************************
* intf_sys_t: description and status of FB interface
*****************************************************************************/
class MediaControlView;
class PlayListWindow;
......@@ -65,8 +68,10 @@ public:
private:
intf_thread_t *p_intf;
bool b_empty_playlist;
bool b_mute;
BFilePanel *file_panel;
PlayListWindow* playlist_window;
BMenuItem *miOnTop;
Intf_VLCWrapper * p_vlc_wrapper;
};
......@@ -2,7 +2,7 @@
* MsgVals.h
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: MsgVals.h,v 1.10 2002/07/22 11:39:56 tcastley Exp $
* $Id: MsgVals.h,v 1.11 2002/07/23 12:42:17 tcastley Exp $
*
* Authors: Tony Castley <tcastley@mail.powerup.com.au>
*
......@@ -36,7 +36,7 @@ const uint32 SLOWER_PLAY = 'SLPL';
const uint32 SEEK_PLAYBACK = 'SEEK';
const uint32 VOLUME_CHG = 'VOCH';
const uint32 VOLUME_MUTE = 'MUTE';
const uint32 SELECT_CHANNEL = 'CHAN';
const uint32 SELECT_AUDIO = 'AUDI';
const uint32 SELECT_SUBTITLE = 'SUBT';
const uint32 PREV_TITLE = 'PRTI';
const uint32 NEXT_TITLE = 'NXTI';
......
......@@ -2,7 +2,7 @@
* VideoWindow.h: BeOS video window class prototype
*****************************************************************************
* Copyright (C) 1999, 2000, 2001 VideoLAN
* $Id: VideoWindow.h,v 1.22 2002/07/23 00:39:16 sam Exp $
* $Id: VideoWindow.h,v 1.23 2002/07/23 12:42:17 tcastley Exp $
*
* Authors: Jean-Marc Dressler <polux@via.ecp.fr>
* Tony Castley <tcastley@mail.powerup.com.au>
......@@ -45,7 +45,7 @@ colorcombo colspace[]=
};
#define COLOR_COUNT 5
#define DEFAULT_COL 3
#define DEFAULT_COL 4
class VLCView : public BView
......@@ -74,7 +74,7 @@ public:
void drawBuffer(int bufferIndex);
void WindowActivated(bool active);
int SelectDrawingMode(int width, int height);
bool QuitRequested();
void MessageReceived(BMessage *message);
// this is the hook controling direct screen connection
int32 i_width; // incomming bitmap size
......@@ -82,7 +82,6 @@ public:
BRect winSize; // current window size
bool is_zoomed, vsync;
BBitmap *bitmap[3];
BBitmap *overlaybitmap;
VLCView *view;
int i_buffer;
bool teardownwindow;
......
......@@ -2,7 +2,7 @@
* intf_beos.cpp: beos interface
*****************************************************************************
* Copyright (C) 1999, 2000, 2001 VideoLAN
* $Id: intf_beos.cpp,v 1.42 2002/07/20 18:01:42 sam Exp $
* $Id: intf_beos.cpp,v 1.43 2002/07/23 12:42:17 tcastley Exp $
*
* Authors: Jean-Marc Dressler <polux@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org>
......@@ -35,18 +35,9 @@
#include <vlc/vlc.h>
#include <vlc/intf.h>
#include "intf_vlc_wrapper.h"
#include "InterfaceWindow.h"
/*****************************************************************************
* intf_sys_t: description and status of FB interface
*****************************************************************************/
struct intf_sys_t
{
InterfaceWindow * p_window;
char i_key;
};
extern "C"
{
......@@ -89,7 +80,9 @@ static int intf_Open( intf_thread_t *p_intf )
msg_Err( p_intf, "out of memory" );
return( 1 );
}
p_intf->p_sys->i_key = -1;
// p_intf->p_sys->p_sub = msg_Subscribe( p_intf );
p_intf->p_sys->p_input = NULL;
/* Create the interface window */
p_intf->p_sys->p_window =
......@@ -110,6 +103,13 @@ static int intf_Open( intf_thread_t *p_intf )
*****************************************************************************/
static void intf_Close( intf_thread_t *p_intf )
{
if( p_intf->p_sys->p_input )
{
vlc_object_release( p_intf->p_sys->p_input );
}
// msg_Unsubscribe( p_intf, p_intf->p_sys->p_sub );
/* Destroy the interface window */
p_intf->p_sys->p_window->Lock();
p_intf->p_sys->p_window->Quit();
......@@ -126,16 +126,31 @@ static void intf_Run( intf_thread_t *p_intf )
{
while( !p_intf->b_die )
{
/* Manage the slider */
if( p_intf->p_vlc->p_input_bank->pp_input[0] != NULL
&& p_intf->p_sys->p_window != NULL)
/* Update the input */
if( p_intf->p_sys->p_input != NULL )
{
if( p_intf->p_sys->p_input->b_dead )
{
vlc_object_release( p_intf->p_sys->p_input );
p_intf->p_sys->p_input = NULL;
}
/* Manage the slider */
p_intf->p_sys->p_window->updateInterface();
}
if( p_intf->p_sys->p_input == NULL )
{
p_intf->p_sys->p_input =
(input_thread_t *)vlc_object_find( p_intf, VLC_OBJECT_INPUT,
FIND_ANYWHERE );
}
/* Wait a bit */
msleep( INTF_IDLE_SLEEP );
}
}
} /* extern "C" */
......
/*****************************************************************************
* intf_vlc_wrapper.h: BeOS plugin for vlc (derived from MacOS X port )
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: intf_vlc_wrapper.cpp,v 1.2 2002/07/23 12:42:17 tcastley Exp $
*
* Authors: Florian G. Pflug <fgp@phlo.org>
* Jon Lech Johansen <jon-vl@nanocrew.net>
* Tony Casltey <tony@castley.net>
*
* This program is free software{} you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation{} either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY{} without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program{} if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
/* VLC headers */
#include <SupportKit.h>
#include <vlc/vlc.h>
#include <vlc/intf.h>
#include "intf_vlc_wrapper.h"
Intf_VLCWrapper *Intf_VLCWrapper::getVLCWrapper(intf_thread_t *p_if)
{
static Intf_VLCWrapper *one_wrapper;
if (one_wrapper == NULL )
{
one_wrapper = new Intf_VLCWrapper(p_if);
}
return one_wrapper;
}
Intf_VLCWrapper::Intf_VLCWrapper(intf_thread_t *p_if)
{
p_intf = p_if;
}
Intf_VLCWrapper::~Intf_VLCWrapper()
{
}
//bool Intf_VLCWrapper::manage()
//{
//
// p_intf->pf_manage( p_intf );
//
// if ( p_intf->b_die )
// {
// // exit the lot
// return( 1 );
// }
/* Update the input */
// if( p_intf->p_sys->p_input != NULL )
// {
// if( p_intf->p_sys->p_input->b_dead )
// {
// vlc_object_release( p_intf->p_sys->p_input );
// p_intf->p_sys->p_input = NULL;
// }
// }
//
// p_intf->p_sys->p_input = vlc_object_find( p_intf, VLC_OBJECT_INPUT,
// FIND_ANYWHERE );
// if ( p_intf->p_sys->p_input != NULL )
// {
// vlc_mutex_lock( &p_intf->p_sys->p_input->stream.stream_lock );
// if( !p_intf->p_sys->p_input->b_die )
// {
// /* New input or stream map change */
// if( p_intf->p_sys->p_input->stream.b_changed ||
// p_intf->p_sys->i_part !=
// p_intf->p_sys->p_input->stream.p_selected_area->i_part )
// {
// setupMenus();
// p_intf->p_sys->b_disabled_menus = 0;
// }
// }
// vlc_mutex_unlock( &p_intf->p_sys->p_input->stream.stream_lock );
// }
// else if ( !p_intf->p_sys->b_disabled_menus )
// {
// setupMenus();
// p_intf->p_sys->b_disabled_menus = 1;
// }
// return( 0 );
//}
void Intf_VLCWrapper::quit()
{
p_intf->b_die = 1;
}
/* playlist control */
int Intf_VLCWrapper::inputGetStatus()
{
if( p_intf->p_sys->p_input != NULL )
{
return( p_intf->p_sys->p_input->stream.control.i_status );
}
else
{
return( UNDEF_S );
}
}
bool Intf_VLCWrapper::playlistPlay()
{
playlist_t *p_playlist =
(playlist_t *)vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
FIND_ANYWHERE );
vlc_mutex_lock( &p_playlist->object_lock );
if( p_playlist->i_size )
{
vlc_mutex_unlock( &p_playlist->object_lock );
playlist_Play( p_playlist );
vlc_object_release( p_playlist );
}
else
{
vlc_mutex_unlock( &p_playlist->object_lock );
vlc_object_release( p_playlist );
}
return( true );
}
void Intf_VLCWrapper::playlistPause()
{
volumeMute( true );
playlist_t *p_playlist =
(playlist_t *)vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
FIND_ANYWHERE );
playlist_Pause( p_playlist );
vlc_object_release( p_playlist );
}
void Intf_VLCWrapper::playlistStop()
{
playlist_t *p_playlist =
(playlist_t *)vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
FIND_ANYWHERE );
playlist_Stop( p_playlist );
vlc_object_release( p_playlist );
}
void Intf_VLCWrapper::playlistNext()
{
playlist_t *p_playlist =
(playlist_t *)vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
FIND_ANYWHERE );
playlist_Next( p_playlist );
vlc_object_release( p_playlist );
}
void Intf_VLCWrapper::playlistPrev()
{
playlist_t *p_playlist =
(playlist_t *)vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
FIND_ANYWHERE );
playlist_Prev( p_playlist );
vlc_object_release( p_playlist );
}
void Intf_VLCWrapper::playlistSkip(int i)
{
playlist_t *p_playlist =
(playlist_t *)vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
FIND_ANYWHERE );
playlist_Skip( p_playlist, i );
vlc_object_release( p_playlist );
}
void Intf_VLCWrapper::playlistGoto(int i)
{
playlist_t *p_playlist =
(playlist_t *)vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
FIND_ANYWHERE );
playlist_Goto( p_playlist, i );
vlc_object_release( p_playlist );
}
/* playback control */
void Intf_VLCWrapper::playSlower()
{
if( p_intf->p_sys->p_input != NULL )
{
input_SetStatus( p_intf->p_sys->p_input, INPUT_STATUS_SLOWER );
}
if (p_intf->p_sys->p_input->stream.control.i_rate == DEFAULT_RATE)
{
volumeMute( false );
}
else
{
volumeMute (true );
}
}
void Intf_VLCWrapper::playFaster()
{
if( p_intf->p_sys->p_input != NULL )
{
input_SetStatus( p_intf->p_sys->p_input, INPUT_STATUS_FASTER );
}
if (p_intf->p_sys->p_input->stream.control.i_rate == DEFAULT_RATE)
{
volumeMute( false );
}
else
{
volumeMute (true );
}
}
void Intf_VLCWrapper::toggleProgram(int i_program){}
void Intf_VLCWrapper::toggleTitle(int i_title)
{
if( p_intf->p_sys->p_input != NULL )
{
input_ChangeArea( p_intf->p_sys->p_input,
p_intf->p_sys->p_input->stream.pp_areas[i_title] );
vlc_mutex_lock( &p_intf->p_sys->p_input->stream.stream_lock );
//setupMenus();
vlc_mutex_unlock( &p_intf->p_sys->p_input->stream.stream_lock );
}
}
void Intf_VLCWrapper::toggleChapter(int i_chapter)
{
if( p_intf->p_sys->p_input != NULL )
{
p_intf->p_sys->p_input->stream.p_selected_area->i_part = i_chapter;
input_ChangeArea( p_intf->p_sys->p_input,
p_intf->p_sys->p_input->stream.p_selected_area );
vlc_mutex_lock( &p_intf->p_sys->p_input->stream.stream_lock );
// setupMenus();
vlc_mutex_unlock( &p_intf->p_sys->p_input->stream.stream_lock );
}
}
void Intf_VLCWrapper::toggleLanguage(int i_language)
{
int32 i_old = -1;
int i_cat = AUDIO_ES;
vlc_mutex_lock( &p_intf->p_sys->p_input->stream.stream_lock );
for( int i = 0; i < p_intf->p_sys->p_input->stream.i_selected_es_number ; i++ )
{
if( p_intf->p_sys->p_input->stream.pp_selected_es[i]->i_cat == i_cat )
{
i_old = i;
break;
}
}
vlc_mutex_unlock( &p_intf->p_sys->p_input->stream.stream_lock );
if( i_language != -1 )
{
input_ToggleES( p_intf->p_sys->p_input,
p_intf->p_sys->p_input->stream.pp_selected_es[i_language],
VLC_TRUE );
}
if( i_old != -1 )
{
input_ToggleES( p_intf->p_sys->p_input,
p_intf->p_sys->p_input->stream.pp_selected_es[i_old],
VLC_FALSE );
}
}
void Intf_VLCWrapper::toggleSubtitle(int i_subtitle)
{
int32 i_old = -1;
int i_cat = SPU_ES;
vlc_mutex_lock( &p_intf->p_sys->p_input->stream.stream_lock );
for( int i = 0; i < p_intf->p_sys->p_input->stream.i_selected_es_number ; i++ )
{
if( p_intf->p_sys->p_input->stream.pp_selected_es[i]->i_cat == i_cat )
{
i_old = i;
break;
}
}
vlc_mutex_unlock( &p_intf->p_sys->p_input->stream.stream_lock );
if( i_subtitle != -1 )
{
input_ToggleES( p_intf->p_sys->p_input,
p_intf->p_sys->p_input->stream.pp_selected_es[i_subtitle],
VLC_TRUE );
}
if( i_old != -1 )
{
input_ToggleES( p_intf->p_sys->p_input,
p_intf->p_sys->p_input->stream.pp_selected_es[i_old],
VLC_FALSE );
}
}
void Intf_VLCWrapper::channelNext()
{
}
void Intf_VLCWrapper::channelPrev()
{
}
void Intf_VLCWrapper::eject(){}
/* playback info */
BString* Intf_VLCWrapper::getTimeAsString()
{
static char psz_currenttime[ OFFSETTOTIME_MAX_SIZE ];
if( p_intf->p_sys->p_input == NULL )
{
return (new BString("00:00:00"));
}
input_OffsetToTime( p_intf->p_sys->p_input,
psz_currenttime,
p_intf->p_sys->p_input->stream.p_selected_area->i_tell );
return(new BString(psz_currenttime));
}
float Intf_VLCWrapper::getTimeAsFloat()
{
float f_time = 0.0;
if( p_intf->p_sys->p_input != NULL )
{
f_time = (float)p_intf->p_sys->p_input->stream.p_selected_area->i_tell /
(float)p_intf->p_sys->p_input->stream.p_selected_area->i_size;
}
else
{
f_time = 0.0;
}
return( f_time );
}
void Intf_VLCWrapper::setTimeAsFloat(float f_position)
{
if( p_intf->p_sys->p_input != NULL )
{
input_Seek( p_intf->p_sys->p_input,
(long long int)(p_intf->p_sys->p_input->stream.p_selected_area->i_size * f_position / 100),
INPUT_SEEK_SET);
}
}
BList *Intf_VLCWrapper::playlistAsArray()
{
int i;
playlist_t *p_playlist =
(playlist_t *)vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
FIND_ANYWHERE );
BList* p_list = new BList(p_playlist->i_size);
vlc_mutex_lock( &p_playlist->object_lock );
for( i = 0; i < p_playlist->i_size; i++ )
{
p_list->AddItem(new BString(p_playlist->pp_items[i]->psz_name));
}
vlc_mutex_unlock( &p_playlist->object_lock );
vlc_object_release( p_playlist );
return( p_list );
}
/* open file/disc/network */
void Intf_VLCWrapper::openFiles(BList *o_files)
{
BString *o_file;
playlist_t *p_playlist =
(playlist_t *)vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
FIND_ANYWHERE );
while( ( o_file = (BString *)o_files->LastItem() ) )
{
o_files->RemoveItem(o_files->CountItems() - 1);
playlist_Add( p_playlist, o_file->String(),
PLAYLIST_APPEND | PLAYLIST_GO, PLAYLIST_END );
delete o_file;
}
vlc_object_release( p_playlist );
}
void Intf_VLCWrapper::openDisc(BString o_type, BString o_device, int i_title, int i_chapter)
{
BString o_source("");
o_source << o_type << ":" << o_device ;
playlist_t *p_playlist =
(playlist_t *)vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
FIND_ANYWHERE );
playlist_Add( p_playlist, o_source.String(),
PLAYLIST_APPEND | PLAYLIST_GO, PLAYLIST_END );
vlc_object_release( p_playlist );
}
void Intf_VLCWrapper::openNet(BString o_addr, int i_port)
{
}
void Intf_VLCWrapper::openNetChannel(BString o_addr, int i_port)
{
}
void Intf_VLCWrapper::openNetHTTP(BString o_addr)
{
}
void Intf_VLCWrapper::volumeMute( bool mute )
{
if ( mute )
{
}
else
{
}
}
/* menus management */
/*****************************************************************************
* intf_vlc_wrapper.h: BeOS plugin for vlc (derived from MacOS X port )
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: intf_vlc_wrapper.h,v 1.2 2002/07/23 12:42:17 tcastley Exp $
*
* Authors: Florian G. Pflug <fgp@phlo.org>
* Jon Lech Johansen <jon-vl@nanocrew.net>
* Tony Casltey <tony@castley.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
class InterfaceWindow;
/*****************************************************************************
* intf_sys_t: description and status of FB interface
*****************************************************************************/
struct intf_sys_t
{
InterfaceWindow *p_window;
char i_key;
/* The input thread */
input_thread_t * p_input;
/* The messages window */
// msg_subscription_t * p_sub;
/* DVD mode */
vlc_bool_t b_disabled_menus;
vlc_bool_t b_loop;
vlc_bool_t b_mute;
int i_part;
int i_saved_volume;
int i_channel;
};
/* Intf_VLCWrapper is a singleton class
(only one instance at any time) */
class Intf_VLCWrapper
{
public:
static Intf_VLCWrapper *getVLCWrapper(intf_thread_t *p_if);
~Intf_VLCWrapper();
// bool manage();
void quit();
int inputGetStatus();
/* playlist control */
bool playlistPlay();
void playlistPause();
void playlistStop();
void playlistNext();
void playlistPrev();
void playlistSkip(int i);
void playlistGoto(int i);
/* Playback Modes
PLAYLIST_REPEAT_CURRENT
PLAYLIST_FORWARD
PLAYLIST_BACKWARD
PLAYLIST_FORWARD_LOOP
PLAYLIST_BACKWARD_LOOP
PLAYLIST_RANDOM
PLAYLIST_REVERSE_RANDOM
*/
/* Stream Control */
void playSlower();
void playFaster();
/* input control */
int getStatus();
void setStatus(int status);
void inputSeek();
void toggleProgram(int i_program);
void toggleTitle(int i_title);
void toggleChapter(int i_chapter);
void toggleLanguage(int i_language);
void toggleSubtitle(int i_subtitle);
void channelNext();
void channelPrev();
void eject();
/* playback info */
BString* getTimeAsString();
float getTimeAsFloat();
void setTimeAsFloat(float i_offset);
BList* playlistAsArray();
/* open file/disc/network */
void openFiles(BList *o_files);
void openDisc(BString o_type, BString o_device, int i_title, int i_chapter);
void openNet(BString o_addr, int i_port);
void openNetChannel(BString o_addr, int i_port);
void openNetHTTP(BString o_addr);
/* audio stuff */
void volumeMute( bool mute );
/* menus management */
void setupMenus();
private:
Intf_VLCWrapper( intf_thread_t *p_if );
es_descriptor_t * p_audio_es;
intf_thread_t *p_intf;
};
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment