* intf_beos.cpp: beos interface
*****************************************************************************
* Copyright (C) 1999, 2000, 2001 VideoLAN
- * $Id: Interface.cpp,v 1.12 2003/05/03 13:37:21 titer Exp $
+ * $Id: Interface.cpp,v 1.13 2003/05/30 17:30:54 titer Exp $
*
* Authors: Jean-Marc Dressler <polux@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org>
{
while( !p_intf->b_die )
{
- if( p_intf->p_sys->p_wrapper->UpdateInput() )
- {
- /* Manage the slider */
- p_intf->p_sys->p_window->UpdateInterface();
- }
+ /* Update VlcWrapper internals (p_input, etc) */
+ p_intf->p_sys->p_wrapper->UpdateInput();
+
+ /* Manage the slider */
+ p_intf->p_sys->p_window->UpdateInterface();
/* Wait a bit */
msleep( INTF_IDLE_SLEEP );
* InterfaceWindow.cpp: beos interface
*****************************************************************************
* Copyright (C) 1999, 2000, 2001 VideoLAN
- * $Id: InterfaceWindow.cpp,v 1.39 2003/05/27 13:22:45 titer Exp $
+ * $Id: InterfaceWindow.cpp,v 1.40 2003/05/30 17:30:54 titer Exp $
*
* Authors: Jean-Marc Dressler <polux@via.ecp.fr>
* Samuel Hocevar <sam@zoy.org>
/* Add the Speed menu */
fSpeedMenu = new BMenu( _("Speed") );
fSpeedMenu->SetRadioMode( true );
- fSpeedMenu->AddItem( fSlowerMI = new BMenuItem( _("Slower"), new BMessage( SLOWER_PLAY ) ) );
- fNormalMI = new BMenuItem( _("Normal"), new BMessage( NORMAL_PLAY ) );
- fNormalMI->SetMarked(true); // default to normal speed
- fSpeedMenu->AddItem( fNormalMI );
- fSpeedMenu->AddItem( fFasterMI = new BMenuItem( _("Faster"), new BMessage( FASTER_PLAY) ) );
- fSpeedMenu->SetTargetForItems( this );
+ fSpeedMenu->AddItem(
+ fHeighthMI = new BMenuItem( "1/8x", new BMessage( HEIGHTH_PLAY ) ) );
+ fSpeedMenu->AddItem(
+ fQuarterMI = new BMenuItem( "1/4x", new BMessage( QUARTER_PLAY ) ) );
+ fSpeedMenu->AddItem(
+ fHalfMI = new BMenuItem( "1/2x", new BMessage( HALF_PLAY ) ) );
+ fSpeedMenu->AddItem(
+ fNormalMI = new BMenuItem( "1x", new BMessage( NORMAL_PLAY ) ) );
+ fSpeedMenu->AddItem(
+ fTwiceMI = new BMenuItem( "2x", new BMessage( TWICE_PLAY ) ) );
+ fSpeedMenu->AddItem(
+ fFourMI = new BMenuItem( "4x", new BMessage( FOUR_PLAY ) ) );
+ fSpeedMenu->AddItem(
+ fHeightMI = new BMenuItem( "8x", new BMessage( HEIGHT_PLAY ) ) );
fMenuBar->AddItem( fSpeedMenu );
/* Add the Show menu */
}
break;
- case FASTER_PLAY:
- /* cycle the fast playback modes */
- if (playback_status > UNDEF_S)
- {
- p_wrapper->InputFaster();
- }
+ case HEIGHTH_PLAY:
+ p_wrapper->InputSetRate( DEFAULT_RATE * 8 );
break;
-
- case SLOWER_PLAY:
- /* cycle the slow playback modes */
- if (playback_status > UNDEF_S)
- {
- p_wrapper->InputSlower();
- }
+
+ case QUARTER_PLAY:
+ p_wrapper->InputSetRate( DEFAULT_RATE * 4 );
break;
-
+
+ case HALF_PLAY:
+ p_wrapper->InputSetRate( DEFAULT_RATE * 2 );
+ break;
+
case NORMAL_PLAY:
- /* restore speed to normal if already playing */
- if (playback_status > UNDEF_S)
- {
- p_wrapper->PlaylistPlay();
- }
+ p_wrapper->InputSetRate( DEFAULT_RATE );
break;
-
+
+ case TWICE_PLAY:
+ p_wrapper->InputSetRate( DEFAULT_RATE / 2 );
+ break;
+
+ case FOUR_PLAY:
+ p_wrapper->InputSetRate( DEFAULT_RATE / 4 );
+ break;
+
+ case HEIGHT_PLAY:
+ p_wrapper->InputSetRate( DEFAULT_RATE / 8 );
+ break;
+
case SEEK_PLAYBACK:
/* handled by semaphores */
break;
void
InterfaceWindow::_UpdateSpeedMenu( int rate )
{
- if ( rate == DEFAULT_RATE )
- {
- if ( !fNormalMI->IsMarked() )
- fNormalMI->SetMarked( true );
- }
- else if ( rate < DEFAULT_RATE )
- {
- if ( !fFasterMI->IsMarked() )
- fFasterMI->SetMarked( true );
- }
- else
+ BMenuItem * toMark = NULL;
+
+ switch( rate )
{
- if ( !fSlowerMI->IsMarked() )
- fSlowerMI->SetMarked( true );
+ case ( DEFAULT_RATE * 8 ):
+ toMark = fHeighthMI;
+ break;
+
+ case ( DEFAULT_RATE * 4 ):
+ toMark = fQuarterMI;
+ break;
+
+ case ( DEFAULT_RATE * 2 ):
+ toMark = fHalfMI;
+ break;
+
+ case ( DEFAULT_RATE ):
+ toMark = fNormalMI;
+ break;
+
+ case ( DEFAULT_RATE / 2 ):
+ toMark = fTwiceMI;
+ break;
+
+ case ( DEFAULT_RATE / 4 ):
+ toMark = fFourMI;
+ break;
+
+ case ( DEFAULT_RATE / 8 ):
+ toMark = fHeightMI;
+ break;
}
-}
-/*****************************************************************************
- * InterfaceWindow::_InputStreamChanged
- *****************************************************************************/
-void
-InterfaceWindow::_InputStreamChanged()
-{
- // TODO: move more stuff from updateInterface() here!
- snooze( 400000 );
- p_wrapper->SetVolume( p_mediaControl->GetVolume() );
+ if ( !toMark->IsMarked() )
+ toMark->SetMarked( true );
}
/*****************************************************************************
* InterfaceWindow.h: BeOS interface window class prototype
*****************************************************************************
* Copyright (C) 1999, 2000, 2001 VideoLAN
- * $Id: InterfaceWindow.h,v 1.13 2003/02/10 15:23:46 titer Exp $
+ * $Id: InterfaceWindow.h,v 1.14 2003/05/30 17:30:54 titer Exp $
*
* Authors: Jean-Marc Dressler <polux@via.ecp.fr>
* Tony Castley <tcastley@mail.powerup.com.au>
bool hasChapters = false,
bool hasTitles = false );
void _UpdateSpeedMenu( int rate );
- void _InputStreamChanged();
void _ShowFilePanel( uint32 command,
const char* windowTitle );
void _RestoreSettings();
BMenuItem* fNextChapterMI;
BMenuItem* fPrevChapterMI;
BMenuItem* fOnTopMI;
- BMenuItem* fSlowerMI;
+ BMenuItem* fHeighthMI;
+ BMenuItem* fQuarterMI;
+ BMenuItem* fHalfMI;
BMenuItem* fNormalMI;
- BMenuItem* fFasterMI;
+ BMenuItem* fTwiceMI;
+ BMenuItem* fFourMI;
+ BMenuItem* fHeightMI;
BMenu* fAudioMenu;
BMenu* fNavigationMenu;
BMenu* fTitleMenu;
* MediaControlView.cpp: beos interface
*****************************************************************************
* Copyright (C) 1999, 2000, 2001 VideoLAN
- * $Id: MediaControlView.cpp,v 1.17 2003/05/25 23:08:44 titer Exp $
+ * $Id: MediaControlView.cpp,v 1.18 2003/05/30 17:30:54 titer Exp $
*
* Authors: Tony Castley <tony@castley.net>
* Stephan Aßmus <stippi@yellowbites.com>
BRect frame(0.0, 0.0, 10.0, 10.0);
// Seek Slider
- fSeekSlider = new SeekSlider(frame, "seek slider", this,
- 0, SEEKSLIDER_RANGE - 1);
+ fSeekSlider = new SeekSlider( frame, "seek slider", this,
+ 0, SEEKSLIDER_RANGE );
fSeekSlider->SetValue(0);
fSeekSlider->ResizeToPreferred();
AddChild( fSeekSlider );
* MsgVals.h
*****************************************************************************
* Copyright (C) 2001 VideoLAN
- * $Id: MsgVals.h,v 1.8 2003/05/08 10:40:31 titer Exp $
+ * $Id: MsgVals.h,v 1.9 2003/05/30 17:30:54 titer Exp $
*
* Authors: Tony Castley <tcastley@mail.powerup.com.au>
* Stephan Aßmus <stippi@yellowbites.com>
*
- * This program is free software; you can redistribute it and/or modify
+ * 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
+ * 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
+ * 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
+ * along with this program if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
#define PLAYING 0
#define PAUSED 1
-const uint32 OPEN_FILE = 'opfl';
-const uint32 OPEN_DVD = 'opdv';
-const uint32 LOAD_SUBFILE = 'losu';
-const uint32 SUBFILE_RECEIVED = 'sure';
-const uint32 OPEN_PLAYLIST = 'oppl';
-const uint32 STOP_PLAYBACK = 'stpl';
-const uint32 START_PLAYBACK = 'play';
-const uint32 PAUSE_PLAYBACK = 'papl';
-const uint32 FASTER_PLAY = 'fapl';
-const uint32 SLOWER_PLAY = 'slpl';
-const uint32 NORMAL_PLAY = 'nrpl';
-const uint32 SEEK_PLAYBACK = 'seek';
-const uint32 VOLUME_CHG = 'voch';
-const uint32 VOLUME_MUTE = 'mute';
-const uint32 SELECT_CHANNEL = 'chan';
-const uint32 SELECT_SUBTITLE = 'subt';
-const uint32 PREV_TITLE = 'prti';
-const uint32 NEXT_TITLE = 'nxti';
-const uint32 TOGGLE_TITLE = 'tgti';
-const uint32 NAVIGATE_MENU = 'navm';
-const uint32 PREV_CHAPTER = 'prch';
-const uint32 NEXT_CHAPTER = 'nxch';
-const uint32 TOGGLE_CHAPTER = 'tgch';
-const uint32 PREV_FILE = 'prfl';
-const uint32 NEXT_FILE = 'nxfl';
-const uint32 NAVIGATE_PREV = 'navp'; // could be chapter, title or file
-const uint32 NAVIGATE_NEXT = 'navn'; // could be chapter, title or file
-const uint32 OPEN_PREFERENCES = 'pref';
-const uint32 OPEN_MESSAGES = 'mess';
-const uint32 TOGGLE_ON_TOP = 'ontp';
-const uint32 SHOW_INTERFACE = 'shin';
-const uint32 TOGGLE_FULL_SCREEN = 'tgfs';
-const uint32 RESIZE_50 = 'rshl';
-const uint32 RESIZE_100 = 'rsor';
-const uint32 RESIZE_200 = 'rsdb';
-const uint32 RESIZE_TRUE = 'rstr';
-const uint32 ASPECT_CORRECT = 'asco';
-const uint32 VERT_SYNC = 'vsyn';
-const uint32 WINDOW_FEEL = 'wfel';
-const uint32 SCREEN_SHOT = 'scrn';
-const uint32 MSG_UPDATE = 'updt';
-const uint32 MSG_SOUNDPLAY = 'move'; // drag'n'drop from soundplay playlist
-const uint32 INTERFACE_CREATED = 'ifcr'; /* see VlcApplication::MessageReceived()
+#define OPEN_FILE 'opfl'
+#define OPEN_DVD 'opdv'
+#define LOAD_SUBFILE 'losu'
+#define SUBFILE_RECEIVED 'sure'
+#define OPEN_PLAYLIST 'oppl'
+#define STOP_PLAYBACK 'stpl'
+#define START_PLAYBACK 'play'
+#define PAUSE_PLAYBACK 'papl'
+#define HEIGHTH_PLAY 'hhpl'
+#define QUARTER_PLAY 'qupl'
+#define HALF_PLAY 'hapl'
+#define NORMAL_PLAY 'nrpl'
+#define TWICE_PLAY 'twpl'
+#define FOUR_PLAY 'fopl'
+#define HEIGHT_PLAY 'hepl'
+#define SEEK_PLAYBACK 'seek'
+#define VOLUME_CHG 'voch'
+#define VOLUME_MUTE 'mute'
+#define SELECT_CHANNEL 'chan'
+#define SELECT_SUBTITLE 'subt'
+#define PREV_TITLE 'prti'
+#define NEXT_TITLE 'nxti'
+#define TOGGLE_TITLE 'tgti'
+#define NAVIGATE_MENU 'navm'
+#define PREV_CHAPTER 'prch'
+#define NEXT_CHAPTER 'nxch'
+#define TOGGLE_CHAPTER 'tgch'
+#define PREV_FILE 'prfl'
+#define NEXT_FILE 'nxfl'
+#define NAVIGATE_PREV 'navp' // could be chapter, title or file
+#define NAVIGATE_NEXT 'navn' // could be chapter, title or file
+#define OPEN_PREFERENCES 'pref'
+#define OPEN_MESSAGES 'mess'
+#define TOGGLE_ON_TOP 'ontp'
+#define SHOW_INTERFACE 'shin'
+#define TOGGLE_FULL_SCREEN 'tgfs'
+#define RESIZE_50 'rshl'
+#define RESIZE_100 'rsor'
+#define RESIZE_200 'rsdb'
+#define RESIZE_TRUE 'rstr'
+#define ASPECT_CORRECT 'asco'
+#define VERT_SYNC 'vsyn'
+#define WINDOW_FEEL 'wfel'
+#define SCREEN_SHOT 'scrn'
+#define MSG_UPDATE 'updt'
+#define MSG_SOUNDPLAY 'move' // drag'n'drop from soundplay playlist
+#define INTERFACE_CREATED 'ifcr' /* see VlcApplication::MessageReceived()
* in src/misc/beos_specific.cpp */
#endif // BEOS_MESSAGE_VALUES_H
* VlcWrapper.cpp: BeOS plugin for vlc (derived from MacOS X port)
*****************************************************************************
* Copyright (C) 2001 VideoLAN
- * $Id: VlcWrapper.cpp,v 1.30 2003/05/07 14:49:19 titer Exp $
+ * $Id: VlcWrapper.cpp,v 1.31 2003/05/30 17:30:54 titer Exp $
*
* Authors: Florian G. Pflug <fgp@phlo.org>
* Jon Lech Johansen <jon-vl@nanocrew.net>
#include <vlc/vout.h>
extern "C"
{
- #include <input_ext-plugins.h> // needed here when compiling without plugins
+ #include <input_ext-plugins.h> // needed here when compiling without plugins
#include <audio_output.h>
#include <aout_internal.h>
}
VlcWrapper::~VlcWrapper()
{
if( p_input )
- {
vlc_object_release( p_input );
- }
+
if( p_playlist )
- {
vlc_object_release( p_playlist );
- }
}
-/* UpdateInput: updates p_input, returns true if the interface needs to
- be updated */
-bool VlcWrapper::UpdateInput()
+/* UpdateInput: updates p_input */
+void VlcWrapper::UpdateInput()
{
- if( p_input == NULL )
- {
+ if( !p_input )
p_input = (input_thread_t *)vlc_object_find( p_intf, VLC_OBJECT_INPUT,
FIND_ANYWHERE );
- }
- if( p_input != NULL )
- {
+ if( p_input )
if( p_input->b_dead )
{
vlc_object_release( p_input );
p_input = NULL;
}
- return true;
- }
- return false;
}
int VlcWrapper::InputStatus()
{
if( !p_input )
- {
return UNDEF_S;
- }
+
return p_input->stream.control.i_status;
}
int VlcWrapper::InputRate()
{
if( !p_input )
- {
return DEFAULT_RATE;
- }
+
return p_input->stream.control.i_rate;
}
-void VlcWrapper::InputSlower()
+void VlcWrapper::InputSetRate( int rate )
{
- if( p_input != NULL )
+ if( !p_input )
+ return;
+
+ int times = 0;
+ int oldrate = InputRate();
+ switch( ( rate > oldrate ) ? ( rate / oldrate ) : ( oldrate / rate ) )
{
- input_SetStatus( p_input, INPUT_STATUS_SLOWER );
+ case 64:
+ times = 6;
+ break;
+ case 32:
+ times = 5;
+ break;
+ case 16:
+ times = 4;
+ break;
+ case 8:
+ times = 3;
+ break;
+ case 4:
+ times = 2;
+ break;
+ case 2:
+ times = 1;
+ break;
}
-}
-void VlcWrapper::InputFaster()
-{
- if( p_input != NULL )
+ int newrate = oldrate;
+ for( int i = 0; i < times; i++ )
{
- input_SetStatus( p_input, INPUT_STATUS_FASTER );
+ if( rate > oldrate )
+ {
+ input_SetStatus( p_input, INPUT_STATUS_SLOWER );
+ newrate *= 2;
+ }
+ else
+ {
+ input_SetStatus( p_input, INPUT_STATUS_FASTER );
+ newrate /= 2;
+ }
+ /* Wait it's actually done */
+ while( InputRate() != newrate )
+ msleep( 10000 );
}
}
if( p_input != NULL )
{
input_Seek( p_input,
- (long long int)(p_input->stream.p_selected_area->i_size
+ (long long)(p_input->stream.p_selected_area->i_size
* f_position / SEEKSLIDER_RANGE ),
- INPUT_SEEK_SET);
+ INPUT_SEEK_SET );
}
}
* VlcWrapper.h: BeOS plugin for vlc (derived from MacOS X port)
*****************************************************************************
* Copyright (C) 2001 VideoLAN
- * $Id: VlcWrapper.h,v 1.23 2003/05/12 19:59:48 titer Exp $
+ * $Id: VlcWrapper.h,v 1.24 2003/05/30 17:30:54 titer Exp $
*
* Authors: Florian G. Pflug <fgp@phlo.org>
* Jon Lech Johansen <jon-vl@nanocrew.net>
VlcWrapper( intf_thread_t *p_intf );
~VlcWrapper();
- bool UpdateInput();
+ void UpdateInput();
/* Input */
bool HasInput();
int InputStatus();
int InputRate();
- void InputSlower();
- void InputFaster();
+ void InputSetRate( int rate );
BList * GetChannels( int i_cat );
void ToggleLanguage( int i_language );
void ToggleSubtitle( int i_subtitle );