]> git.sesse.net Git - vlc/commitdiff
improved title and chapter navigation in BeOS GUI, added LCD type info view displayin...
authorStephan Assmus <stippi@videolan.org>
Wed, 9 Oct 2002 15:29:52 +0000 (15:29 +0000)
committerStephan Assmus <stippi@videolan.org>
Wed, 9 Oct 2002 15:29:52 +0000 (15:29 +0000)
plugins/beos/InterfaceWindow.cpp
plugins/beos/InterfaceWindow.h
plugins/beos/MediaControlView.cpp
plugins/beos/MediaControlView.h
plugins/beos/intf_vlc_wrapper.cpp
plugins/beos/intf_vlc_wrapper.h
plugins/spudec/spu_decoder.c
share/vlc_beos.rsrc
src/misc/beos_specific.cpp

index 9af26a1c17d9aaf8f90c89d824fba2c174e34c35..dc6836781fbedbd65644d53c173c9b4c4c2b1ac8 100644 (file)
@@ -2,7 +2,7 @@
  * InterfaceWindow.cpp: beos interface
  *****************************************************************************
  * Copyright (C) 1999, 2000, 2001 VideoLAN
- * $Id: InterfaceWindow.cpp,v 1.16.2.4 2002/09/29 12:04:27 titer Exp $
+ * $Id: InterfaceWindow.cpp,v 1.16.2.5 2002/10/09 15:29:51 stippi Exp $
  *
  * Authors: Jean-Marc Dressler <polux@via.ecp.fr>
  *          Samuel Hocevar <sam@zoy.org>
@@ -76,7 +76,8 @@ InterfaceWindow::InterfaceWindow( BRect frame, const char *name,
          fFilePanel( NULL ),
          fPlaylistWindow( new PlayListWindow( BRect( 20.0, 20.0, 170.0, 320.0 ),
                                                                                   "Playlist", (playlist_t*)p_main->p_playlist, this ) ),
-         fLastUpdateTime( system_time() ),
+         fLastInterfaceUpdate( system_time() ),
+         fLastSoundUpdate( fLastInterfaceUpdate ),
          fSettings( new BMessage( 'sett' ) )
 {
        // set the title bar
@@ -494,6 +495,8 @@ bool InterfaceWindow::QuitRequested()
  *****************************************************************************/
 void InterfaceWindow::updateInterface()
 {
+       fLastInterfaceUpdate = system_time();
+
        input_thread_s* input = p_input_bank->pp_input[0];
        if ( input )
        {
@@ -511,6 +514,9 @@ void InterfaceWindow::updateInterface()
                                                                           input->stream.control.i_rate );
                        p_mediaControl->SetProgress( input->stream.p_selected_area->i_tell,
                                                                                 input->stream.p_selected_area->i_size );
+
+//printf( "current time: '%s'\n", Intf_VLCWrapper::getTimeAsString() );
+
                        _SetMenusEnabled( true, hasChapters, hasTitles );
 
                        _UpdateSpeedMenu( input->stream.control.i_rate );
@@ -524,11 +530,23 @@ void InterfaceWindow::updateInterface()
                        if ( Intf_VLCWrapper::has_audio() )
                        {
                                p_mediaControl->SetAudioEnabled( true );
-                               p_mediaControl->SetMuted( Intf_VLCWrapper::is_muted() );
+                               if ( Intf_VLCWrapper::is_muted() )
+                                       p_mediaControl->SetMuted( true );
+                               else
+                               {
+                                       p_mediaControl->SetMuted( false );
+                                       // take care to update vlc's volume
+                                       // (it might have changed without us knowing)
+                                       if ( fLastInterfaceUpdate - fLastSoundUpdate > 1000000 )
+                                       {
+                                               Intf_VLCWrapper::set_volume( p_mediaControl->GetVolume() );
+                                               fLastSoundUpdate = fLastInterfaceUpdate;
+                                       }
+                               }
                        } else
                                p_mediaControl->SetAudioEnabled( false );
 
-                       if ( input != fInputThread )
+                       if ( input != fInputThread ) // unreliable!!!
                        {
                                fInputThread = input;
                                _InputStreamChanged();
@@ -557,8 +575,6 @@ void InterfaceWindow::updateInterface()
        }
        if ( input != fInputThread )
                fInputThread = input;
-
-       fLastUpdateTime = system_time();
 }
 
 /*****************************************************************************
@@ -567,7 +583,7 @@ void InterfaceWindow::updateInterface()
 bool
 InterfaceWindow::IsStopped() const
 {
-       return (system_time() - fLastUpdateTime > INTERFACE_UPDATE_TIMEOUT);
+       return (system_time() - fLastInterfaceUpdate > INTERFACE_UPDATE_TIMEOUT);
 }
 
 /*****************************************************************************
@@ -1117,17 +1133,17 @@ void ChapterMenu::AttachedToWindow()
                // lock stream access
                vlc_mutex_lock( &input->stream.stream_lock );
                // populate menu according to current stream
-               int32 numChapters = input->stream.p_selected_area->i_part_nb;
+               int32 numChapters = input->stream.p_selected_area->i_part_nb - 1;
                if ( numChapters > 1 )
                {
                        for ( int32 i = 0; i < numChapters; i++ )
                        {
                                BMessage* message = new BMessage( TOGGLE_CHAPTER );
-                               message->AddInt32( "index", i );
+                               message->AddInt32( "index", i + 1 );
                                BString helper( "" );
                                helper << i + 1;
                                BMenuItem* item = new BMenuItem( helper.String(), message );
-                               item->SetMarked( input->stream.p_selected_area->i_part == i );
+                               item->SetMarked( input->stream.p_selected_area->i_part - 1 == i );
                                AddItem( item );
                        }
                }
index d3aa1bef671cbf43c596b9b89246a2ca076abdf9..e11db8cae7d62ab65fe3f6418f96b54e919f3a6f 100644 (file)
@@ -2,7 +2,7 @@
  * InterfaceWindow.h: BeOS interface window class prototype
  *****************************************************************************
  * Copyright (C) 1999, 2000, 2001 VideoLAN
- * $Id: InterfaceWindow.h,v 1.12.2.4 2002/09/29 12:04:27 titer Exp $
+ * $Id: InterfaceWindow.h,v 1.12.2.5 2002/10/09 15:29:51 stippi Exp $
  *
  * Authors: Jean-Marc Dressler <polux@via.ecp.fr>
  *          Tony Castley <tcastley@mail.powerup.com.au>
@@ -142,7 +142,8 @@ class InterfaceWindow : public BWindow
        BMenu*                                  fLanguageMenu;
        BMenu*                                  fSubtitlesMenu;
        BMenu*                                  fSpeedMenu;
-       bigtime_t                               fLastUpdateTime;
+       bigtime_t                               fLastInterfaceUpdate;
+       bigtime_t                               fLastSoundUpdate;
        BMessage*                               fSettings;      // we keep the message arround
                                                                                // for forward compatibility
 };
index b75ef3a94e1217a4e79d6c052cc724ca99b6beac..bae2bb3cf572f3d92aeee1bb780a6adccfc13d0f 100644 (file)
@@ -2,7 +2,7 @@
  * MediaControlView.cpp: beos interface
  *****************************************************************************
  * Copyright (C) 1999, 2000, 2001 VideoLAN
- * $Id: MediaControlView.cpp,v 1.7.2.3 2002/09/29 12:04:27 titer Exp $
+ * $Id: MediaControlView.cpp,v 1.7.2.4 2002/10/09 15:29:51 stippi Exp $
  *
  * Authors: Tony Castley <tony@castley.net>
  *          Stephan Aßmus <stippi@yellowbites.com>
  *****************************************************************************/
 
 /* System headers */
-#include <InterfaceKit.h>
-#include <AppKit.h>
+#include <stdio.h>
 #include <string.h>
 
+#include <InterfaceKit.h>
+#include <AppKit.h>
+#include <String.h>
 /* VLC headers */
 extern "C"
 {
@@ -40,6 +42,8 @@ extern "C"
 }
 
 /* BeOS interface headers */
+#include "intf_vlc_wrapper.h"
+
 #include "Bitmaps.h"
 #include "DrawingTidbits.h"
 #include "InterfaceWindow.h"
@@ -176,6 +180,11 @@ MediaControlView::MediaControlView(BRect frame)
                                                                         new BMessage(VOLUME_CHG));
        fVolumeSlider->SetValue(VOLUME_DEFAULT);
        AddChild( fVolumeSlider );
+
+       // Position Info View
+       fPositionInfo = new PositionInfoView(BRect(0.0, 0.0, 10.0, 10.0), "led");
+       fPositionInfo->ResizeToPreferred();
+       AddChild( fPositionInfo );
 }
 
 // destructor
@@ -198,7 +207,7 @@ MediaControlView::AttachedToWindow()
        if (BMenuBar* menuBar = Window()->KeyMenuBar())
                r.bottom += menuBar->Bounds().Height();
 
-       Window()->SetSizeLimits(r.Width(), r.Width() * 2.0, r.Height(), r.Height() * 2.0);
+       Window()->SetSizeLimits(r.Width(), r.Width() * 1.8, r.Height(), r.Height() * 1.3);
        if (!Window()->Bounds().Contains(r))
                Window()->ResizeTo(r.Width(), r.Height());
        else
@@ -375,9 +384,7 @@ void
 MediaControlView::_LayoutControls(BRect frame) const
 {
        // seek slider
-       BRect r(frame);
-       r.bottom = r.top + r.Height() / 2.0 - MIN_SPACE / 2.0;
-       _LayoutControl(fSeekSlider, r, true);
+       BRect r( frame );
        // calculate absolutly minimal width
        float minWidth = fSkipBack->Bounds().Width();
 //     minWidth += fRewind->Bounds().Width();
@@ -387,11 +394,42 @@ MediaControlView::_LayoutControls(BRect frame) const
        minWidth += fSkipForward->Bounds().Width();
        minWidth += fMute->Bounds().Width();
        minWidth += VOLUME_MIN_WIDTH;
+       // layout time slider and info view
+       float width, height;
+       fPositionInfo->GetBigPreferredSize( &width, &height );
+       float ratio = width / height;
+       width = r.Height() * ratio;
+       if (frame.Width() - minWidth - MIN_SPACE >= width
+               && frame.Height() >= height)
+       {
+               r.right = r.left + width;
+               fPositionInfo->SetMode(PositionInfoView::MODE_BIG);
+               _LayoutControl(fPositionInfo, r, true, true);
+               frame.left = r.right + MIN_SPACE;
+               r.left = frame.left;
+               r.right = frame.right;
+//             r.bottom = r.top + r.Height() / 2.0 - MIN_SPACE / 2.0;
+               r.bottom = r.top + fSeekSlider->Bounds().Height();
+               _LayoutControl(fSeekSlider, r, true);
+       }
+       else
+       {
+               fPositionInfo->GetPreferredSize( &width, &height );
+               fPositionInfo->SetMode(PositionInfoView::MODE_SMALL);
+               fPositionInfo->ResizeTo(width, height);
+               r.bottom = r.top + r.Height() / 2.0 - MIN_SPACE / 2.0;
+               r.right = r.left + fPositionInfo->Bounds().Width();
+               _LayoutControl(fPositionInfo, r, true );
+               r.left = r.right + MIN_SPACE;
+               r.right = frame.right;
+               _LayoutControl(fSeekSlider, r, true);
+       }
        float currentWidth = frame.Width();
        float space = (currentWidth - minWidth) / 6.0;//8.0;
        // apply weighting
        space = MIN_SPACE + (space - MIN_SPACE) / VOLUME_SLIDER_LAYOUT_WEIGHT;
        // layout controls with "space" inbetween
+       r.left = frame.left;
        r.top = r.bottom + MIN_SPACE + 1.0;
        r.bottom = frame.bottom;
        // skip back
@@ -451,15 +489,20 @@ MediaControlView::_MinFrame() const
 
 // _LayoutControl
 void
-MediaControlView::_LayoutControl(BView* view, BRect frame, bool resize) const
+MediaControlView::_LayoutControl(BView* view, BRect frame,
+                                                                bool resizeWidth, bool resizeHeight) const
 {
-       // center vertically
-       frame.top = (frame.top + frame.bottom) / 2.0 - view->Bounds().Height() / 2.0;
-       if (!resize)
+       if (!resizeHeight)
+               // center vertically
+               frame.top = (frame.top + frame.bottom) / 2.0 - view->Bounds().Height() / 2.0;
+       if (!resizeWidth)
+               // center horizontally
                frame.left = (frame.left + frame.right) / 2.0 - view->Bounds().Width() / 2.0;
        view->MoveTo(frame.LeftTop());
-       if (resize)
-               view->ResizeTo(frame.Width(), view->Bounds().Height());
+       float width = resizeWidth ? frame.Width() : view->Bounds().Width();
+       float height = resizeHeight ? frame.Height() : view->Bounds().Height();
+       if (resizeWidth || resizeHeight)
+               view->ResizeTo(width, height);
 }
 
 
@@ -1105,6 +1148,308 @@ VolumeSlider::_ValueFor(float xPos) const
 }
 
 
+/*****************************************************************************
+ * PositionInfoView::PositionInfoView
+ *****************************************************************************/
+PositionInfoView::PositionInfoView( BRect frame, const char* name )
+       : BView( frame, name, B_FOLLOW_NONE,
+                        B_WILL_DRAW | B_PULSE_NEEDED | B_FULL_UPDATE_ON_RESIZE ),
+         fMode( MODE_SMALL ),
+         fCurrentFileIndex( -1 ),
+         fCurrentFileSize( -1 ),
+         fCurrentTitleIndex( -1 ),
+         fCurrentTitleSize( -1 ),
+         fCurrentChapterIndex( -1 ),
+         fCurrentChapterSize( -1 ),
+         fSeconds( -1 ),
+         fTimeString( "-:--:--" ),
+         fLastPulseUpdate( system_time() ),
+         fStackedWidthCache( 0.0 ),
+         fStackedHeightCache( 0.0 )
+{
+       SetViewColor( B_TRANSPARENT_32_BIT );
+       SetLowColor( kBlack );
+       SetHighColor( 0, 255, 0, 255 );
+       SetFontSize( 11.0 );
+}
+
+/*****************************************************************************
+ * PositionInfoView::~PositionInfoView
+ *****************************************************************************/
+PositionInfoView::~PositionInfoView()
+{
+}
+
+/*****************************************************************************
+ * PositionInfoView::Draw
+ *****************************************************************************/
+void
+PositionInfoView::Draw( BRect updateRect )
+{
+       rgb_color background = ui_color( B_PANEL_BACKGROUND_COLOR );
+       rgb_color shadow = tint_color( background, B_DARKEN_1_TINT );
+       rgb_color darkShadow = tint_color( background, B_DARKEN_4_TINT );
+       rgb_color light = tint_color( background, B_LIGHTEN_MAX_TINT );
+       rgb_color softLight = tint_color( background, B_LIGHTEN_1_TINT );
+       // frame
+       BRect r( Bounds() );
+       BeginLineArray( 8 );
+               AddLine( BPoint( r.left, r.bottom ),
+                                BPoint( r.left, r.top ), shadow );
+               AddLine( BPoint( r.left + 1.0, r.top ),
+                                BPoint( r.right, r.top ), shadow );
+               AddLine( BPoint( r.right, r.top + 1.0 ),
+                                BPoint( r.right, r.bottom ), softLight );
+               AddLine( BPoint( r.right - 1.0, r.bottom ),
+                                BPoint( r.left + 1.0, r.bottom ), softLight );
+               r.InsetBy( 1.0, 1.0 );
+               AddLine( BPoint( r.left, r.bottom ),
+                                BPoint( r.left, r.top ), darkShadow );
+               AddLine( BPoint( r.left + 1.0, r.top ),
+                                BPoint( r.right, r.top ), darkShadow );
+               AddLine( BPoint( r.right, r.top + 1.0 ),
+                                BPoint( r.right, r.bottom ), light );
+               AddLine( BPoint( r.right - 1.0, r.bottom ),
+                                BPoint( r.left + 1.0, r.bottom ), light );
+       EndLineArray();
+       // background
+       r.InsetBy( 1.0, 1.0 );
+       FillRect( r, B_SOLID_LOW );
+       // contents
+       font_height fh;
+       GetFontHeight( &fh );
+       switch ( fMode )
+       {
+               case MODE_SMALL:
+               {
+                       float width = StringWidth( fTimeString.String() );
+                       DrawString( fTimeString.String(),
+                                               BPoint( r.left + r.Width() / 2.0 - width / 2.0,
+                                                               r.top + r.Height() / 2.0 + fh.ascent / 2.0 - 1.0 ) );
+                       break;
+               }
+               case MODE_BIG:
+               {
+                       BFont font;
+                       GetFont( &font );
+                       BFont smallFont = font;
+                       BFont bigFont = font;
+                       BFont tinyFont = font;
+                       smallFont.SetSize( r.Height() / 5.0 );
+                       bigFont.SetSize( r.Height() / 3.0 );
+                       tinyFont.SetSize( r.Height() / 7.0 );
+                       float timeHeight = r.Height() / 2.5;
+                       float height = ( r.Height() - timeHeight ) / 3.0;
+                       SetFont( &tinyFont );
+                       SetHighColor( 0, 180, 0, 255 );
+                       DrawString( "File", BPoint( r.left + 3.0, r.top + height ) );
+                       DrawString( "Title", BPoint( r.left + 3.0, r.top + 2.0 * height ) );
+                       DrawString( "Chapter", BPoint( r.left + 3.0, r.top + 3.0 * height ) );
+                       SetFont( &smallFont );
+                       BString helper;
+                       SetHighColor( 0, 255, 0, 255 );
+                       // file
+                       _MakeString( helper, fCurrentFileIndex, fCurrentFileSize );
+                       float width = StringWidth( helper.String() );
+                       DrawString( helper.String(), BPoint( r.right - 3.0 - width, r.top + height ) );
+                       // title
+                       _MakeString( helper, fCurrentTitleIndex, fCurrentTitleSize );
+                       width = StringWidth( helper.String() );
+                       DrawString( helper.String(), BPoint( r.right - 3.0 - width, r.top + 2.0 * height ) );
+                       // chapter
+                       _MakeString( helper, fCurrentChapterIndex, fCurrentChapterSize );
+                       width = StringWidth( helper.String() );
+                       DrawString( helper.String(), BPoint( r.right - 3.0 - width, r.top + 3.0 * height ) );
+                       // time
+                       SetFont( &bigFont );
+                       width = StringWidth( fTimeString.String() );
+                       DrawString( fTimeString.String(),
+                                               BPoint( r.left + r.Width() / 2.0 - width / 2.0,
+                                                               r.bottom - 3.0 ) );
+                       break;
+               }
+       }
+}
+
+/*****************************************************************************
+ * PositionInfoView::ResizeToPreferred
+ *****************************************************************************/
+void
+PositionInfoView::ResizeToPreferred()
+{
+       float width, height;
+       GetPreferredSize( &width, &height );
+       ResizeTo( width, height );
+}
+
+/*****************************************************************************
+ * PositionInfoView::GetPreferredSize
+ *****************************************************************************/
+void
+PositionInfoView::GetPreferredSize( float* width, float* height )
+{
+       if ( width && height )
+       {
+               *width = 5.0 + ceilf( StringWidth( "0:00:00" ) ) + 5.0;
+               font_height fh;
+               GetFontHeight( &fh );
+               *height = 3.0 + ceilf( fh.ascent ) + 3.0;
+               fStackedWidthCache = *width * 1.2;
+               fStackedHeightCache = *height * 2.7;
+       }
+}
 
+/*****************************************************************************
+ * PositionInfoView::Pulse
+ *****************************************************************************/
+void
+PositionInfoView::Pulse()
+{
+       // allow for Pulse frequency to be higher, MediaControlView needs it
+       bigtime_t now = system_time();
+       if ( now - fLastPulseUpdate > 900000 )
+       {
+               int32 index, size;
+               Intf_VLCWrapper::getPlaylistInfo( index, size );
+               SetFile( index, size );
+               Intf_VLCWrapper::getTitleInfo( index, size );
+               SetTitle( index, size );
+               Intf_VLCWrapper::getChapterInfo( index, size );
+               SetChapter( index, size );
+               SetTime( Intf_VLCWrapper::getTimeAsString() );
+               fLastPulseUpdate = now;
+       }
+}
 
+/*****************************************************************************
+ * PositionInfoView::GetBigPreferredSize
+ *****************************************************************************/
+void
+PositionInfoView::GetBigPreferredSize( float* width, float* height )
+{
+       if ( width && height )
+       {
+               *width = fStackedWidthCache;
+               *height = fStackedHeightCache;
+       }
+}
+
+/*****************************************************************************
+ * PositionInfoView::SetMode
+ *****************************************************************************/
+void
+PositionInfoView::SetMode( uint32 mode )
+{
+       if ( fMode != mode )
+       {
+               fMode = mode;
+               _InvalidateContents();
+       }
+}
+
+/*****************************************************************************
+ * PositionInfoView::SetFile
+ *****************************************************************************/
+void
+PositionInfoView::SetFile( int32 index, int32 size )
+{
+       if ( fCurrentFileIndex != index || fCurrentFileSize != size )
+       {
+               fCurrentFileIndex = index;
+               fCurrentFileSize = size;
+               _InvalidateContents();
+       }
+}
+
+/*****************************************************************************
+ * PositionInfoView::SetTitle
+ *****************************************************************************/
+void
+PositionInfoView::SetTitle( int32 index, int32 size )
+{
+       if ( fCurrentTitleIndex != index || fCurrentFileSize != size )
+       {
+               fCurrentTitleIndex = index;
+               fCurrentTitleSize = size;
+               _InvalidateContents();
+       }
+}
+
+/*****************************************************************************
+ * PositionInfoView::SetChapter
+ *****************************************************************************/
+void
+PositionInfoView::SetChapter( int32 index, int32 size )
+{
+       if ( fCurrentChapterIndex != index || fCurrentFileSize != size )
+       {
+               fCurrentChapterIndex = index;
+               fCurrentChapterSize = size;
+               _InvalidateContents();
+       }
+}
+
+/*****************************************************************************
+ * PositionInfoView::SetTime
+ *****************************************************************************/
+void
+PositionInfoView::SetTime( int32 seconds )
+{
+       if ( fSeconds != seconds )
+       {
+               if ( seconds >= 0 )
+               {
+                       int32 minutes = seconds / 60;
+                       int32 hours = minutes / 60;
+                       seconds -= minutes * 60 - hours * 60 * 60;
+                       minutes -= hours * 60;
+                       fTimeString.SetTo( "" );
+                       fTimeString << hours << ":" << minutes << ":" << seconds;
+               }
+               else
+                       fTimeString.SetTo( "-:--:--" );
+
+               fSeconds = seconds;
+               _InvalidateContents();
+       }
+}
+
+/*****************************************************************************
+ * PositionInfoView::SetTime
+ *****************************************************************************/
+void
+PositionInfoView::SetTime( const char* string )
+{
+       fTimeString.SetTo( string );
+       _InvalidateContents();
+}
+
+/*****************************************************************************
+ * PositionInfoView::_InvalidateContents
+ *****************************************************************************/
+void
+PositionInfoView::_InvalidateContents( uint32 which )
+{
+       BRect r( Bounds() );
+       r.InsetBy( 2.0, 2.0 );
+       Invalidate( r );
+}
+
+/*****************************************************************************
+ * PositionInfoView::_InvalidateContents
+ *****************************************************************************/
+void
+PositionInfoView::_MakeString( BString& into, int32 index, int32 maxIndex ) const
+{
+       into = "";
+       if ( index >= 0)
+               into << index;
+       else
+               into << "-";
+       into << "/";
+       if ( maxIndex >= 0)
+               into << maxIndex;
+       else
+               into << "-";
+}
 
index 9649992da1d85a725fd58cfea4ae77db1eb84dee..90e4e3e3aaf3d556624d64c2a69a493df3fe53c9 100644 (file)
@@ -2,7 +2,7 @@
  * MediaControlView.h: beos interface
  *****************************************************************************
  * Copyright (C) 1999, 2000, 2001 VideoLAN
- * $Id: MediaControlView.h,v 1.2.4.2 2002/09/29 12:04:27 titer Exp $
+ * $Id: MediaControlView.h,v 1.2.4.3 2002/10/09 15:29:51 stippi Exp $
  *
  * Authors: Tony Castley <tony@castley.net>
  *          Stephan Aßmus <stippi@yellowbites.com>
@@ -30,6 +30,7 @@
 
 class BBitmap;
 class PlayPauseButton;
+class PositionInfoView;
 class SeekSlider;
 class TransportButton;
 class VolumeSlider;
@@ -66,7 +67,8 @@ class MediaControlView : public BBox
                        BRect                           _MinFrame() const;
                        void                            _LayoutControl(BView* view,
                                                                                           BRect frame,
-                                                                                          bool resize = false) const;
+                                                                                          bool resizeWidth = false,
+                                                                                          bool resizeHeight = false) const;
 
 
                        VolumeSlider*           fVolumeSlider;
@@ -78,6 +80,7 @@ class MediaControlView : public BBox
                        PlayPauseButton*        fPlayPause;
                        TransportButton*        fStop;
                        TransportButton*        fMute;
+                       PositionInfoView*       fPositionInfo;
 
                        int                                     fCurrentRate;
                        int                                     fCurrentStatus;
@@ -165,4 +168,58 @@ class VolumeSlider : public BControl
                        int32                           fMaxValue;
 };
 
+class PositionInfoView : public BView
+{
+ public:
+                                                               PositionInfoView( BRect frame,
+                                                                                                 const char* name );
+       virtual                                         ~PositionInfoView();
+
+                                                               // BView
+       virtual void                            Draw( BRect updateRect );
+       virtual void                            ResizeToPreferred();
+       virtual void                            GetPreferredSize( float* width,
+                                                                                                 float* height );
+       virtual void                            Pulse();
+
+                                                               // PositionInfoView
+       enum
+       {
+               MODE_SMALL,
+               MODE_BIG,
+       };
+
+                       void                            SetMode( uint32 mode );
+                       void                            GetBigPreferredSize( float* width,
+                                                                                                        float* height );
+
+                       void                            SetFile( int32 index, int32 size );
+                       void                            SetTitle( int32 index, int32 size );
+                       void                            SetChapter( int32 index, int32 size );
+                       void                            SetTime( int32 seconds );
+                       void                            SetTime( const char* string );
+ private:
+                       void                            _InvalidateContents( uint32 which = 0 );
+                       void                            _MakeString( BString& into,
+                                                                                        int32 index,
+                                                                                        int32 maxIndex ) const;
+//                     void                            _DrawAlignedString( const char* string,
+//                                                                                                     BRect frame,
+//                                                                                                     alignment mode = B_ALIGN_LEFT );
+
+                       uint32                          fMode;
+                       int32                           fCurrentFileIndex;
+                       int32                           fCurrentFileSize;
+                       int32                           fCurrentTitleIndex;
+                       int32                           fCurrentTitleSize;
+                       int32                           fCurrentChapterIndex;
+                       int32                           fCurrentChapterSize;
+
+                       int32                           fSeconds;
+                       BString                         fTimeString;
+                       bigtime_t                       fLastPulseUpdate;
+                       float                           fStackedWidthCache;
+                       float                           fStackedHeightCache;
+};
+
 #endif // BEOS_MEDIA_CONTROL_VIEW_H
index 0b6415511153be46c3f44775b78692af3c4cfa3b..4f90a724ebcd07ae6034f2ec0c88a8488fb9c2b7 100644 (file)
@@ -2,7 +2,7 @@
  * 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.3 2002/09/29 12:04:27 titer Exp $
+ * $Id: intf_vlc_wrapper.cpp,v 1.1.2.4 2002/10/09 15:29:51 stippi Exp $
  *
  * Authors: Florian G. Pflug <fgp@phlo.org>
  *          Jon Lech Johansen <jon-vl@nanocrew.net>
@@ -232,7 +232,7 @@ void Intf_VLCWrapper::getNavCapabilities( bool* canSkipPrev,
                        // first, look for chapters
                        if ( hasChapters )
                        {
-                               *canSkipPrev = input->stream.p_selected_area->i_part > 0;
+                               *canSkipPrev = input->stream.p_selected_area->i_part > 1;
                                *canSkipNext = input->stream.p_selected_area->i_part <
                                                                         input->stream.p_selected_area->i_part_nb - 1;
                        }
@@ -279,7 +279,7 @@ void Intf_VLCWrapper::navigatePrev()
                        // skip to the previous chapter
                        currentChapter--;
 
-                       if ( currentChapter >= 0 )
+                       if ( currentChapter >= 1 )
                        {
                                toggleChapter( currentChapter );
                                hasSkiped = true;
@@ -579,20 +579,19 @@ void Intf_VLCWrapper::eject(){}
 
     /* playback info */
 
-BString*  Intf_VLCWrapper::getTimeAsString()
+const char*
+Intf_VLCWrapper::getTimeAsString()
 {
-    static char psz_currenttime[ OFFSETTOTIME_MAX_SIZE ];
+       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 );        
+       if( p_input_bank->pp_input[0] == NULL )
+               return ("-:--:--");
 
-    return(new BString(psz_currenttime));
+       input_OffsetToTime( p_input_bank->pp_input[0],
+                                               psz_currenttime,
+                                               p_input_bank->pp_input[0]->stream.p_selected_area->i_tell );
+
+       return(psz_currenttime);
 }
 
 float  Intf_VLCWrapper::getTimeAsFloat()
@@ -639,6 +638,67 @@ BList  *Intf_VLCWrapper::playlistAsArray()
     return( p_list );
 }
 
+// getPlaylistInfo
+void
+Intf_VLCWrapper::getPlaylistInfo( int32& currentIndex, int32& maxIndex )
+{
+       currentIndex = -1;
+       maxIndex = -1;
+       if ( playlist_t* list = (playlist_t*)p_main->p_playlist )
+       {
+           vlc_mutex_lock( &list->change_lock );
+
+               maxIndex = list->i_size;
+               if ( maxIndex > 0 )
+                       currentIndex = list->i_index + 1;
+               else
+                       maxIndex = -1;
+
+           vlc_mutex_unlock( &list->change_lock );
+       }
+}
+
+// getTitleInfo
+void  
+Intf_VLCWrapper::getTitleInfo( int32& currentIndex, int32& maxIndex )
+{
+       currentIndex = -1;
+       maxIndex = -1;
+       if ( input_thread_s* input = p_input_bank->pp_input[0] )
+       {
+               vlc_mutex_lock( &input->stream.stream_lock );
+
+               maxIndex = input->stream.i_area_nb - 1;
+               if ( maxIndex > 0)
+                       currentIndex = input->stream.p_selected_area->i_id;
+               else
+                       maxIndex = -1;
+
+               vlc_mutex_unlock( &input->stream.stream_lock );
+       }
+}
+
+// getChapterInfo
+void
+Intf_VLCWrapper::getChapterInfo( int32& currentIndex, int32& maxIndex )
+{
+       currentIndex = -1;
+       maxIndex = -1;
+       if ( input_thread_s* input = p_input_bank->pp_input[0] )
+       {
+               vlc_mutex_lock( &input->stream.stream_lock );
+
+               maxIndex = input->stream.p_selected_area->i_part_nb - 1;
+               if ( maxIndex > 0)
+                       currentIndex = input->stream.p_selected_area->i_part;
+               else
+                       maxIndex = -1;
+
+               vlc_mutex_unlock( &input->stream.stream_lock );
+       }
+}
+
+
     /* open file/disc/network */
 void Intf_VLCWrapper::openFiles( BList* o_files, bool replace )
 {
index 314646792ec93782028345aa04bcce6821871764..23062a1231d134c618a19720c74d0a42d4c8b3c5 100644 (file)
@@ -2,7 +2,7 @@
  * 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.3 2002/09/29 12:04:27 titer Exp $
+ * $Id: intf_vlc_wrapper.h,v 1.1.2.4 2002/10/09 15:29:51 stippi Exp $
  *
  * Authors: Florian G. Pflug <fgp@phlo.org>
  *          Jon Lech Johansen <jon-vl@nanocrew.net>
@@ -83,11 +83,17 @@ public:
     static void eject();
 
     /* playback info */
-    static BString* getTimeAsString();
+    static const char* getTimeAsString();
     static float  getTimeAsFloat();
     static void   setTimeAsFloat( float i_offset );
     static bool   playlistPlaying();
     static BList* playlistAsArray();
+    static void   getPlaylistInfo( int32& currentIndex,
+                                                          int32& maxIndex );
+    static void   getTitleInfo( int32& currentIndex,
+                                                       int32& maxIndex );
+    static void   getChapterInfo( int32& currentIndex,
+                                                         int32& maxIndex );
 
     /* open file/disc/network */
     static void openFiles( BList *o_files, bool replace = true );
index f2b05da18bdb9749e9a70f6522830e30d5f54f96..9a8aad56bb02e1186b78c53fe335a83cf2046331 100644 (file)
@@ -2,7 +2,7 @@
  * spu_decoder.c : spu decoder thread
  *****************************************************************************
  * Copyright (C) 2000-2001 VideoLAN
- * $Id: spu_decoder.c,v 1.24.2.5 2002/09/29 12:04:28 titer Exp $
+ * $Id: spu_decoder.c,v 1.24.2.6 2002/10/09 15:29:51 stippi Exp $
  *
  * Authors: Samuel Hocevar <sam@zoy.org>
  *          Rudolf Cornelissen <rag.cornelissen@inter.nl.net>
@@ -1145,11 +1145,9 @@ static void RenderSPU( const vout_thread_t *p_vout, picture_t *p_pic,
     /* NVidia overlay, no scaling */
     case FOURCC_YUY2:
 
-    p_dest = p_pic->p->p_pixels +
-        + ( p_spu->i_y + p_spu->i_height ) * p_pic->p->i_pitch 
-                                                // * bytes per line
-        + ( p_spu->i_x + p_spu->i_width ) * 2;  // * bytes per pixel
-    
+    p_dest = p_pic->p->p_pixels
+              + ( p_spu->i_y + p_spu->i_height ) * p_pic->p->i_pitch  // * bytes per line
+              + ( p_spu->i_x + p_spu->i_width ) * 2;  // * bytes per pixel
     /* Draw until we reach the bottom of the subtitle */
     for( i_y = p_spu->i_height * p_pic->p->i_pitch / 2;
          i_y ;
index aad79c69f199e270b83cb69758b531b035dc85a2..1b4ec29cc5887b13cf61ff777c123cce0559999c 100644 (file)
Binary files a/share/vlc_beos.rsrc and b/share/vlc_beos.rsrc differ
index 3b3b9f02f414575d80e1d52d522f5c06608153ab..0a26ca19c6d6716feed6f658062791b2e9bc1c0b 100644 (file)
@@ -2,7 +2,7 @@
  * beos_init.cpp: Initialization for BeOS specific features 
  *****************************************************************************
  * Copyright (C) 1999-2001 VideoLAN
- * $Id: beos_specific.cpp,v 1.18.2.2 2002/09/29 12:04:28 titer Exp $
+ * $Id: beos_specific.cpp,v 1.18.2.3 2002/10/09 15:29:52 stippi Exp $
  *
  * Authors: Jean-Marc Dressler <polux@via.ecp.fr>
  *
@@ -109,11 +109,11 @@ void system_Configure( void )
  *****************************************************************************/
 void system_End( void )
 {
-    free( psz_program_path );
+       free( psz_program_path );
 
-    /* Tell the BApplication to die */
-    be_app->PostMessage( B_QUIT_REQUESTED );
-    vlc_thread_join( app_thread );
+       /* Tell the BApplication to die */
+       be_app->PostMessage( B_QUIT_REQUESTED );
+       vlc_thread_join( app_thread );
 }
 
 /*****************************************************************************
@@ -131,9 +131,9 @@ char * system_GetProgramPath( void )
  *****************************************************************************/
 static void system_AppThread( void * args )
 {
-    new VlcApplication("application/x-vnd.Ink-vlc");
-    be_app->Run();
-    delete be_app;
+       new VlcApplication( "application/x-vnd.Ink-vlc" );
+       be_app->Run();
+       delete be_app;
 }
 
 } /* extern "C" */