Commit 0d944b49 authored by Tony Castley's avatar Tony Castley

Created a wrapper class for VLC functions and interaction. Improved file

and disk opening.  Fixed drag and drop.  Added right click menu and always
on top mode.
parent 8e1d4438
......@@ -2,7 +2,7 @@
* InterfaceWindow.cpp: beos interface
*****************************************************************************
* Copyright (C) 1999, 2000, 2001 VideoLAN
* $Id: InterfaceWindow.cpp,v 1.16.2.1 2002/06/01 10:12:10 tcastley Exp $
* $Id: InterfaceWindow.cpp,v 1.16.2.2 2002/07/13 11:33:11 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>
......@@ -54,6 +55,7 @@ extern "C"
#include "MsgVals.h"
#include "MediaControlView.h"
#include "PlayListWindow.h"
#include "intf_vlc_wrapper.h"
#include "InterfaceWindow.h"
......@@ -128,11 +130,11 @@ InterfaceWindow::InterfaceWindow( BRect frame, const char *name,
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);
// 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();
......@@ -182,17 +184,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:
......@@ -217,48 +208,24 @@ void InterfaceWindow::MessageReceived( BMessage * p_message )
}
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_main->p_playlist, PLAYLIST_END, (char*)psz_source );
if( p_input_bank->pp_input[0] != NULL )
{
p_input_bank->pp_input[0]->b_eof = 1;
}
intf_PlaylistJumpto( p_main->p_playlist,
p_main->p_playlist->i_size - 1 );
BString device(psz_device);
Intf_VLCWrapper::openDisc(type, device, 0,0);
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 );
Intf_VLCWrapper::volume_mute();
snooze( 400000 );
/* end playing item */
p_input_bank->pp_input[0]->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 );
}
Intf_VLCWrapper::playlistStop();
p_mediaControl->SetStatus(NOT_STARTED_S,DEFAULT_RATE);
break;
......@@ -270,109 +237,37 @@ void InterfaceWindow::MessageReceived( BMessage * p_message )
if( p_input_bank->pp_input[0] != NULL )
{
/* pause if currently playing */
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++ )
if ( playback_status == PLAYING_S )
{
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 );
Intf_VLCWrapper::volume_mute();
snooze( 400000 );
/* pause the movie */
input_SetStatus( p_input_bank->pp_input[0], 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 );
Intf_VLCWrapper::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_main->p_playlist->b_stopped = 0;
Intf_VLCWrapper::volume_restore();
Intf_VLCWrapper::playlistPlay();
}
}
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 );
p_main->p_playlist->b_stopped = 0;
}
else
{
vlc_mutex_unlock( &p_main->p_playlist->change_lock );
}
}
Intf_VLCWrapper::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 );
Intf_VLCWrapper::volume_mute();
snooze( 400000 );
/* change the fast play mode */
input_SetStatus( p_input_bank->pp_input[0], 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 );
}
Intf_VLCWrapper::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 );
Intf_VLCWrapper::volume_mute();
snooze( 400000 );
/* change the slower play */
input_SetStatus( p_input_bank->pp_input[0], 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 );
}
Intf_VLCWrapper::playSlower();
break;
case SEEK_PLAYBACK:
......@@ -398,23 +293,7 @@ void InterfaceWindow::MessageReceived( BMessage * p_message )
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 );
Intf_VLCWrapper::toggle_mute();
break;
case SELECT_CHANNEL:
......@@ -448,60 +327,49 @@ void InterfaceWindow::MessageReceived( BMessage * p_message )
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;
/* 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 );
Intf_VLCWrapper::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;
if( i_id < p_input_bank->pp_input[0]->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 );
Intf_VLCWrapper::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_input_bank->pp_input[0]->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 );
Intf_VLCWrapper::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_input_bank->pp_input[0]->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 );
Intf_VLCWrapper::toggleChapter(i_id);
}
}
break;
......@@ -509,19 +377,16 @@ 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_main->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_main->p_playlist,
p_main->p_playlist->i_size - 1 );
files->AddItem(new BString((char*)path.Path()) );
i++;
}
Intf_VLCWrapper::openFiles(files);
delete files;
}
break;
......
......@@ -2,7 +2,7 @@
* InterfaceWindow.h: BeOS interface window class prototype
*****************************************************************************
* Copyright (C) 1999, 2000, 2001 VideoLAN
* $Id: InterfaceWindow.h,v 1.12.2.1 2002/06/01 10:12:10 tcastley Exp $
* $Id: InterfaceWindow.h,v 1.12.2.2 2002/07/13 11:33:11 tcastley Exp $
*
* Authors: Jean-Marc Dressler <polux@via.ecp.fr>
* Tony Castley <tcastley@mail.powerup.com.au>
......@@ -25,6 +25,7 @@
class MediaControlView;
class PlayListWindow;
class CDMenu : public BMenu
{
public:
......
beos_SOURCES = beos.cpp aout_beos.cpp vout_beos.cpp intf_beos.cpp InterfaceWindow.cpp DrawingTidbits.cpp TransportButton.cpp PlayListWindow.cpp MediaControlView.cpp
beos_SOURCES = beos.cpp aout_beos.cpp vout_beos.cpp intf_beos.cpp InterfaceWindow.cpp DrawingTidbits.cpp TransportButton.cpp PlayListWindow.cpp MediaControlView.cpp intf_vlc_wrapper.cpp
......@@ -2,7 +2,7 @@
* MediaControlView.cpp: beos interface
*****************************************************************************
* Copyright (C) 1999, 2000, 2001 VideoLAN
* $Id: MediaControlView.cpp,v 1.7 2001/12/30 07:09:54 sam Exp $
* $Id: MediaControlView.cpp,v 1.7.2.1 2002/07/13 11:33:11 tcastley Exp $
*
* Authors: Tony Castley <tony@castley.net>
*
......@@ -141,6 +141,7 @@ MediaControlView::~MediaControlView()
void MediaControlView::MessageReceived(BMessage *message)
{
BView::MessageReceived(message);
}
void MediaControlView::SetProgress(uint64 seek, uint64 size)
......
......@@ -2,7 +2,7 @@
* MsgVals.h
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: MsgVals.h,v 1.9.2.1 2002/07/11 07:21:57 tcastley Exp $
* $Id: MsgVals.h,v 1.9.2.2 2002/07/13 11:33:11 tcastley Exp $
*
* Authors: Tony Castley <tcastley@mail.powerup.com.au>
*
......@@ -48,4 +48,5 @@ const uint32 RESIZE_100 = 'RSOR';
const uint32 RESIZE_200 = 'RSDB';
const uint32 ASPECT_CORRECT = 'ASCO';
const uint32 VERT_SYNC = 'VSYN';
const uint32 WINDOW_FEEL = 'WFEL';
......@@ -2,7 +2,7 @@
* intf_beos.cpp: beos interface
*****************************************************************************
* Copyright (C) 1999, 2000, 2001 VideoLAN
* $Id: intf_beos.cpp,v 1.38 2002/02/15 13:32:52 sam Exp $
* $Id: intf_beos.cpp,v 1.38.2.1 2002/07/13 11:33:11 tcastley Exp $
*
* Authors: Jean-Marc Dressler <polux@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org>
......@@ -43,16 +43,7 @@ extern "C"
}
#include "InterfaceWindow.h"
/*****************************************************************************
* intf_sys_t: description and status of FB interface
*****************************************************************************/
typedef struct intf_sys_s
{
InterfaceWindow * p_window;
char i_key;
} intf_sys_t;
#include "intf_vlc_wrapper.h"
extern "C"
{
......@@ -108,6 +99,10 @@ static int intf_Open( intf_thread_t *p_intf )
intf_ErrMsg( "error: cannot allocate memory for InterfaceWindow" );
return( 1 );
}
p_intf->p_sys->b_disabled_menus = 0;
p_intf->p_sys->i_saved_volume = VOLUME_DEFAULT;
p_intf->p_sys->b_loop = 0;
p_intf->p_sys->b_mute = 0;
return( 0 );
}
......
/*****************************************************************************
* intf_vlc_wrapper.h: BeOS plugin for vlc (derived from MacOS X port )
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: intf_vlc_wrapper.cpp,v 1.1.2.1 2002/07/13 11:33:11 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>
extern "C"
{
#include <videolan/vlc.h>
#include "stream_control.h"
#include "input_ext-intf.h"
#include "interface.h"
#include "intf_playlist.h"
#include "audio_output.h"
#include "video.h"
#include "video_output.h"
}
#include "intf_vlc_wrapper.h"
bool Intf_VLCWrapper::manage()
{
p_main->p_intf->pf_manage( p_main->p_intf );
if ( p_main->p_intf->b_die )
{
// exit the lot
return( 1 );
}
if ( p_input_bank->pp_input[0] != NULL )
{
vlc_mutex_lock( &p_input_bank->pp_input[0]->stream.stream_lock );
if( !p_input_bank->pp_input[0]->b_die )
{
/* New input or stream map change */
if( p_input_bank->pp_input[0]->stream.b_changed ||
p_main->p_intf->p_sys->i_part !=
p_input_bank->pp_input[0]->stream.p_selected_area->i_part )
{
setupMenus();
p_main->p_intf->p_sys->b_disabled_menus = 0;
}
}
vlc_mutex_unlock( &p_input_bank->pp_input[0]->stream.stream_lock );
}
else if ( !p_main->p_intf->p_sys->b_disabled_menus )
{
setupMenus();
p_main->p_intf->p_sys->b_disabled_menus = 1;
}
return( 0 );
}
void Intf_VLCWrapper::quit()
{
p_main->p_intf->b_die = 1;
}
/* playlist control */
bool Intf_VLCWrapper::playlistPlay()
{
if( p_input_bank->pp_input[0] != NULL )
{
input_SetStatus( p_input_bank->pp_input[0], INPUT_STATUS_PLAY );
p_main->p_playlist->b_stopped = 0;
}
else
{
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 );
}
else
{
vlc_mutex_unlock( &p_main->p_playlist->change_lock );
}
}
else
{
vlc_mutex_unlock( &p_main->p_playlist->change_lock );
}
}
return( true );
}
void Intf_VLCWrapper::playlistPause()
{
if ( p_input_bank->pp_input[0] != NULL )
{
input_SetStatus( p_input_bank->pp_input[0], 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 );
}
}
void Intf_VLCWrapper::playlistStop()
{
if( p_input_bank->pp_input[0] != NULL )
{
/* end playing item */
p_input_bank->pp_input[0]->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 );
}
}
void Intf_VLCWrapper::playlistNext()
{
if( p_input_bank->pp_input[0] != NULL )
{
p_input_bank->pp_input[0]->b_eof = 1;
}
}
void Intf_VLCWrapper::playlistPrev()
{
if( p_input_bank->pp_input[0] != NULL )
{
/* FIXME: temporary hack */
intf_PlaylistPrev( p_main->p_playlist );
intf_PlaylistPrev( p_main->p_playlist );
p_input_bank->pp_input[0]->b_eof = 1;
}
}
//void Intf_VLCWrapper::channelNext()
//{
// intf_thread_t * p_intf = p_main->p_intf;
//
// p_intf->p_sys->i_channel++;
//
// intf_WarnMsg( 3, "intf info: joining channel %d", p_intf->p_sys->i_channel );
//
// vlc_mutex_lock( &p_intf->change_lock );
//
// network_ChannelJoin( p_intf->p_sys->i_channel );
// p_intf->pf_manage( p_intf );
//
// vlc_mutex_unlock( &p_intf->change_lock );
//}
//
//void Intf_VLCWrapper::channelPrev()
//{
// intf_thread_t * p_intf = p_main->p_intf;
//
// if ( p_intf->p_sys->i_channel )
// {
// p_intf->p_sys->i_channel--;
// }
//
// intf_WarnMsg( 3, "intf info: joining channel %d", p_intf->p_sys->i_channel );
//
// vlc_mutex_lock( &p_intf->change_lock );
//
// network_ChannelJoin( p_intf->p_sys->i_channel );
// p_intf->pf_manage( p_intf );
//
// vlc_mutex_unlock( &p_intf->change_lock );
//
//}
void Intf_VLCWrapper::loop()
{
intf_thread_t * p_intf = p_main->p_intf;
if ( p_intf->p_sys->b_loop )
{
intf_PlaylistDelete( p_main->p_playlist,
p_main->p_playlist->i_size - 1 );
}
else
{
intf_PlaylistAdd( p_main->p_playlist, PLAYLIST_END,
"vlc:loop" );
}
p_intf->p_sys->b_loop = !p_intf->p_sys->b_loop;
}
/* playback control */
void Intf_VLCWrapper::playSlower()
{
if( p_input_bank->pp_input[0] != NULL )
{
input_SetStatus( p_input_bank->pp_input[0], 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 );
}
}
void Intf_VLCWrapper::playFaster()
{
if( p_input_bank->pp_input[0] != NULL )
{
input_SetStatus( p_input_bank->pp_input[0], 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 );
}
}
void Intf_VLCWrapper::volume_mute()
{
if( p_aout_bank->pp_aout[0] == NULL ) return;
if( p_main->p_intf->p_sys->b_mute ) return;
p_main->p_intf->p_sys->i_saved_volume =
p_aout_bank->pp_aout[0]->i_volume;
p_aout_bank->pp_aout[0]->i_volume = 0;
p_main->p_intf->p_sys->b_mute = 1;
}
void Intf_VLCWrapper::volume_restore()
{
if( p_aout_bank->pp_aout[0] == NULL ) return;
p_aout_bank->pp_aout[0]->i_volume =
p_main->p_intf->p_sys->i_saved_volume;
p_main->p_intf->p_sys->b_mute = 0;
}
void Intf_VLCWrapper::toggle_mute()
{
if( p_aout_bank->pp_aout[0] == NULL ) return;
if ( p_main->p_intf->p_sys->b_mute )
{
Intf_VLCWrapper::volume_restore();
}
else
{
Intf_VLCWrapper::volume_mute();
}
p_main->p_intf->p_sys->b_mute = !p_main->p_intf->p_sys->b_mute;
}
void Intf_VLCWrapper::maxvolume()
{
if( p_aout_bank->pp_aout[0] == NULL ) return;
if( p_main->p_intf->p_sys->b_mute )
{
p_main->p_intf->p_sys->i_saved_volume = VOLUME_MAX;
}
else
{
p_aout_bank->pp_aout[0]->i_volume = VOLUME_MAX;
}
}
//void Intf_VLCWrapper::fullscreen()
//{
// if( p_vout_bank->pp_vout[0] != NULL )
// {
// p_vout_bank->pp_vout[0]->i_changes |= VOUT_FULLSCREEN_CHANGE;
// }
//}
void Intf_VLCWrapper::eject(){}
/* playback info */
BString* Intf_VLCWrapper::getTimeAsString()
{
static char psz_currenttime[ OFFSETTOTIME_MAX_SIZE ];
if( p_input_bank->pp_input[0] == NULL )
{
return (new BString("00:00:00"));
}
input_OffsetToTime( p_input_bank->pp_input[0],
psz_currenttime,
p_input_bank->pp_input[0]->stream.p_selected_area->i_tell );
return(new BString(psz_currenttime));
}
float Intf_VLCWrapper::getTimeAsFloat()
{
float f_time = 0.0;
if( p_input_bank->pp_input[0] != NULL )
{
f_time = (float)p_input_bank->pp_input[0]->stream.p_selected_area->i_tell /
(float)p_input_bank->pp_input[0]->stream.p_selected_area->i_size;
}
return( f_time );
}
void Intf_VLCWrapper::setTimeAsFloat(float f_position)
{
if( p_input_bank->pp_input[0] != NULL )
{
input_Seek( p_input_bank->pp_input[0],
(long long int)(p_input_bank->pp_input[0]->stream.p_selected_area->i_size * f_position) );
}
}
bool Intf_VLCWrapper::playlistPlaying()
{
return( !p_main->p_playlist->b_stopped );
}
BList *Intf_VLCWrapper::playlistAsArray()
{
int i;
BList* p_list = new BList(p_main->p_playlist->i_size);
vlc_mutex_lock( &p_main->p_playlist->change_lock );
for( i = 0; i < p_main->p_playlist->i_size; i++ )
{
p_list->AddItem(new BString(p_main->p_playlist->p_item[i].psz_name));
}
vlc_mutex_unlock( &p_main->p_playlist->change_lock );
return( p_list );
}
/* open file/disc/network */
void Intf_VLCWrapper::openFiles(BList *o_files)
{
BString *o_file;
int i_end = p_main->p_playlist->i_size;
intf_thread_t * p_intf = p_main->p_intf;
if ( p_intf->p_sys->b_loop )
{
intf_PlaylistDelete( p_main->p_playlist,
p_main->p_playlist->i_size - 1 );
}
while( ( o_file = (BString *)o_files->LastItem() ) )
{
o_files->RemoveItem(o_files->CountItems() - 1);
intf_PlaylistAdd( p_main->p_playlist, PLAYLIST_END,
o_file->String() );
delete o_file;
}
/* end current item, select first added item */
if( p_input_bank->pp_input[0] != NULL )
{
p_input_bank->pp_input[0]->b_eof = 1;
}
intf_PlaylistJumpto( p_main->p_playlist, i_end - 1 );
if ( p_intf->p_sys->b_loop )
{
intf_PlaylistAdd( p_main->p_playlist, PLAYLIST_END,
"vlc:loop" );
}
}
void Intf_VLCWrapper::openDisc(BString o_type, BString o_device, int i_title, int i_chapter)
{
BString o_source("");
int i_end = p_main->p_playlist->i_size;
intf_thread_t * p_intf = p_main->p_intf;
o_source << o_type << ":" << o_device ;
//i_title, i_chapter;
if ( p_intf->p_sys->b_loop )
{
intf_PlaylistDelete( p_main->p_playlist,
p_main->p_playlist->i_size - 1 );
}
intf_PlaylistAdd( p_main->p_playlist, PLAYLIST_END,
o_source.String() );
/* stop current item, select added item */
if( p_input_bank->pp_input[0] != NULL )
{
p_input_bank->pp_input[0]->b_eof = 1;
}
intf_PlaylistJumpto( p_main->p_playlist, i_end - 1 );
if ( p_intf->p_sys->b_loop )
{
intf_PlaylistAdd( p_main->p_playlist, PLAYLIST_END,
"vlc:loop" );
}
}
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)
{
}
/* menus management */
void Intf_VLCWrapper::toggleProgram(int i_program){}
void Intf_VLCWrapper::toggleTitle(int i_title)
{
input_thread_t * p_input = p_input_bank->pp_input[0];
input_ChangeArea( p_input,
p_input->stream.pp_areas[i_title] );
vlc_mutex_lock( &p_input->stream.stream_lock );
setupMenus();
vlc_mutex_unlock( &p_input->stream.stream_lock );
input_SetStatus( p_input, INPUT_STATUS_PLAY );
}
void Intf_VLCWrapper::toggleChapter(int i_chapter)
{
input_thread_t * p_input = p_input_bank->pp_input[0];
p_input->stream.p_selected_area->i_part = i_chapter;
input_ChangeArea( p_input,
p_input->stream.p_selected_area );
vlc_mutex_lock( &p_input->stream.stream_lock );
setupMenus();
vlc_mutex_unlock( &p_input->stream.stream_lock );
input_SetStatus( p_input, INPUT_STATUS_PLAY );
}
void Intf_VLCWrapper::toggleLanguage(int i_language){}
void Intf_VLCWrapper::toggleSubtitle(int i_subtitle){}
void Intf_VLCWrapper::setupMenus(){}
/*****************************************************************************
* intf_vlc_wrapper.h: BeOS plugin for vlc (derived from MacOS X port )
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: intf_vlc_wrapper.h,v 1.1.2.1 2002/07/13 11:33:11 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
*****************************************************************************/
typedef struct intf_sys_s
{
InterfaceWindow * p_window;
char i_key;
int b_disabled_menus;
int i_part;
int i_saved_volume;
int b_loop;
int i_channel;
int b_mute;
} intf_sys_t;
/* Intf_VLCWrapper is a singleton class
(only one instance at any time) */
class Intf_VLCWrapper
{
public:
static bool manage();
static void quit();
/* playlist control */
static bool playlistPlay();
static void playlistPause();
static void playlistStop();
static void playlistNext();
static void playlistPrev();
// static void channelNext();
// static void channelPrev();
static void loop();
/* playback control */
static void playSlower();
static void playFaster();
static void volume_mute();
static void volume_restore();
static void toggle_mute();
static void maxvolume();
// static void fullscreen();
static void eject();
/* playback info */
static BString* getTimeAsString();
static float getTimeAsFloat();
static void setTimeAsFloat(float i_offset);
static bool playlistPlaying();
static BList* playlistAsArray();
/* open file/disc/network */
static void openFiles(BList *o_files);
static void openDisc(BString o_type, BString o_device, int i_title, int i_chapter);
static void openNet(BString o_addr, int i_port);
static void openNetChannel(BString o_addr, int i_port);
static void openNetHTTP(BString o_addr);
/* menus management */
static void toggleProgram(int i_program);
static void toggleTitle(int i_title);
static void toggleChapter(int i_chapter);
static void toggleLanguage(int i_language);
static void toggleSubtitle(int i_subtitle);
static void setupMenus();
};
......@@ -2,7 +2,7 @@
* vout_beos.cpp: beos video output display method
*****************************************************************************
* Copyright (C) 2000, 2001 VideoLAN
* $Id: vout_beos.cpp,v 1.58.2.3 2002/07/11 12:24:45 tcastley Exp $
* $Id: vout_beos.cpp,v 1.58.2.4 2002/07/13 11:33:11 tcastley Exp $
*
* Authors: Jean-Marc Dressler <polux@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org>
......@@ -192,6 +192,15 @@ void VideoWindow::MessageReceived( BMessage *p_message )
case VERT_SYNC:
vsync = !vsync;
break;
case WINDOW_FEEL:
{
int16 winFeel;
if (p_message->FindInt16("WinFeel", &winFeel) == B_OK)
{
SetFeel((window_feel)winFeel);
}
}
break;
default:
BWindow::MessageReceived( p_message );
break;
......@@ -409,7 +418,6 @@ void VLCView::MouseDown(BPoint point)
{
if (mouseButtons & B_SECONDARY_MOUSE_BUTTON)
{
//if (!menu) delete menu;
BPopUpMenu *menu = new BPopUpMenu("context menu");
menu->SetRadioMode(false);
// Toggle FullScreen
......@@ -427,6 +435,26 @@ void VLCView::MouseDown(BPoint point)
BMenuItem *vsyncItem = new BMenuItem("Vertical Sync", new BMessage(VERT_SYNC));
vsyncItem->SetMarked(vWindow->vsync);
menu->AddItem(vsyncItem);
menu->AddSeparatorItem();
// Windwo Feel Items
BMessage *winNormFeel = new BMessage(WINDOW_FEEL);
winNormFeel->AddInt16("WinFeel", (int16)B_NORMAL_WINDOW_FEEL);
BMenuItem *normWindItem = new BMenuItem("Normal Window", winNormFeel);
normWindItem->SetMarked(vWindow->Feel() == B_NORMAL_WINDOW_FEEL);
menu->AddItem(normWindItem);
BMessage *winFloatFeel = new BMessage(WINDOW_FEEL);
winFloatFeel->AddInt16("WinFeel", (int16)B_FLOATING_APP_WINDOW_FEEL);
BMenuItem *onTopWindItem = new BMenuItem("App Top", winFloatFeel);
onTopWindItem->SetMarked(vWindow->Feel() == B_FLOATING_APP_WINDOW_FEEL);
menu->AddItem(onTopWindItem);
BMessage *winAllFeel = new BMessage(WINDOW_FEEL);
winAllFeel->AddInt16("WinFeel", (int16)B_FLOATING_ALL_WINDOW_FEEL);
BMenuItem *allSpacesWindItem = new BMenuItem("On Top All Workspaces", winAllFeel);
allSpacesWindItem->SetMarked(vWindow->Feel() == B_FLOATING_ALL_WINDOW_FEEL);
menu->AddItem(allSpacesWindItem);
menu->SetTargetForItems(this);
ConvertToScreen(&where);
......
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