1 /*****************************************************************************
2 * intf_beos.cpp: beos interface
3 *****************************************************************************
4 * Copyright (C) 1999, 2000, 2001 VideoLAN
5 * $Id: Interface.cpp,v 1.3 2002/10/10 23:11:52 titer Exp $
7 * Authors: Jean-Marc Dressler <polux@via.ecp.fr>
8 * Samuel Hocevar <sam@zoy.org>
9 * Tony Castley <tony@castley.net>
10 * Richard Shepherd <richard@rshepherd.demon.co.uk>
11 * Stephan Aßmus <stippi@yellowbites.com>
13 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License as published by
15 * the Free Software Foundation; either version 2 of the License, or
16 * (at your option) any later version.
18 * This program is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
23 * You should have received a copy of the GNU General Public License
24 * along with this program; if not, write to the Free Software
25 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
26 *****************************************************************************/
28 /*****************************************************************************
30 *****************************************************************************/
32 #include <stdlib.h> /* malloc(), free() */
33 #include <InterfaceKit.h>
34 #include <Application.h>
41 #include "VlcWrapper.h"
42 #include "InterfaceWindow.h"
45 /*****************************************************************************
47 *****************************************************************************/
48 static void Run ( intf_thread_t *p_intf );
50 /*****************************************************************************
51 * intf_Open: initialize interface
52 *****************************************************************************/
53 int E_(OpenIntf) ( vlc_object_t *p_this )
55 intf_thread_t *p_intf = (intf_thread_t*) p_this;
57 screen = new BScreen();
58 BRect rect = screen->Frame();
59 rect.top = rect.bottom-100;
62 rect.right = rect.left + 350;
65 /* Allocate instance and initialize some members */
66 p_intf->p_sys = (intf_sys_t*) malloc( sizeof( intf_sys_t ) );
67 if( p_intf->p_sys == NULL )
69 msg_Err( p_intf, "out of memory" );
73 p_intf->p_sys->p_input = NULL;
74 p_intf->p_sys->p_vlc_wrapper = new Intf_VLCWrapper( p_intf );
75 p_intf->p_sys->p_playlist =
76 (playlist_t *)vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
81 /* Create the interface window */
82 p_intf->p_sys->p_window =
83 new InterfaceWindow( rect,
84 VOUT_TITLE " (BeOS interface)", p_intf );
85 if( p_intf->p_sys->p_window == 0 )
87 free( p_intf->p_sys );
88 msg_Err( p_intf, "cannot allocate InterfaceWindow" );
91 BMessage message(INTERFACE_CREATED);
92 message.AddPointer("window", p_intf->p_sys->p_window);
93 be_app->PostMessage(&message);
95 p_intf->p_sys->b_disabled_menus = 0;
96 p_intf->p_sys->i_saved_volume = AOUT_VOLUME_DEFAULT;
97 p_intf->p_sys->b_loop = 0;
98 p_intf->p_sys->b_mute = 0;
103 /*****************************************************************************
104 * intf_Close: destroy dummy interface
105 *****************************************************************************/
106 void E_(CloseIntf) ( vlc_object_t *p_this )
108 intf_thread_t *p_intf = (intf_thread_t*) p_this;
110 if( p_intf->p_sys->p_input )
112 vlc_object_release( p_intf->p_sys->p_input );
115 /* Destroy the interface window */
116 p_intf->p_sys->p_window->Lock();
117 p_intf->p_sys->p_window->Quit();
119 /* Destroy structure */
120 free( p_intf->p_sys );
124 /*****************************************************************************
125 * intf_Run: event loop
126 *****************************************************************************/
127 static void Run( intf_thread_t *p_intf )
129 while( !p_intf->b_die )
131 if( p_intf->p_sys->p_input == NULL )
133 p_intf->p_sys->p_input =
134 (input_thread_t *)vlc_object_find( p_intf, VLC_OBJECT_INPUT,
138 /* Update the input */
139 if( p_intf->p_sys->p_input != NULL )
141 if( p_intf->p_sys->p_input->b_dead )
143 vlc_object_release( p_intf->p_sys->p_input );
144 p_intf->p_sys->p_input = NULL;
146 /* Manage the slider */
147 p_intf->p_sys->p_window->updateInterface();
151 msleep( INTF_IDLE_SLEEP );