1 /*****************************************************************************
2 * intf_beos.cpp: beos interface
3 *****************************************************************************
4 * Copyright (C) 1999, 2000, 2001 VideoLAN
5 * $Id: intf_beos.cpp,v 1.44 2002/07/31 20:56:50 sam 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>
12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by
14 * the Free Software Foundation; either version 2 of the License, or
15 * (at your option) any later version.
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, write to the Free Software
24 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
25 *****************************************************************************/
27 /*****************************************************************************
29 *****************************************************************************/
31 #include <stdlib.h> /* malloc(), free() */
32 #include <InterfaceKit.h>
38 #include "intf_vlc_wrapper.h"
39 #include "InterfaceWindow.h"
41 /*****************************************************************************
43 *****************************************************************************/
44 static void Run ( intf_thread_t *p_intf );
46 /*****************************************************************************
47 * OpenIntf: initialize interface
48 *****************************************************************************/
49 int E_(OpenIntf) ( vlc_object_t *p_this )
51 intf_thread_t *p_intf = (intf_thread_t*) p_this;
53 screen = new BScreen();
54 BRect rect = screen->Frame();
55 rect.top = rect.bottom-100;
58 rect.right = rect.left + 350;
61 /* Allocate instance and initialize some members */
62 p_intf->p_sys = (intf_sys_t*) malloc( sizeof( intf_sys_t ) );
63 if( p_intf->p_sys == NULL )
65 msg_Err( p_intf, "out of memory" );
68 // p_intf->p_sys->p_sub = msg_Subscribe( p_intf );
69 p_intf->p_sys->p_input = NULL;
73 /* Create the interface window */
74 p_intf->p_sys->p_window =
75 new InterfaceWindow( rect,
76 VOUT_TITLE " (BeOS interface)", p_intf );
77 if( p_intf->p_sys->p_window == 0 )
79 free( p_intf->p_sys );
80 msg_Err( p_intf, "cannot allocate InterfaceWindow" );
87 /*****************************************************************************
88 * CloseIntf: destroy interface
89 *****************************************************************************/
90 void E_(CloseIntf) ( vlc_object_t *p_this )
92 intf_thread_t *p_intf = (intf_thread_t*) p_this;
94 if( p_intf->p_sys->p_input )
96 vlc_object_release( p_intf->p_sys->p_input );
99 // msg_Unsubscribe( p_intf, p_intf->p_sys->p_sub );
101 /* Destroy the interface window */
102 p_intf->p_sys->p_window->Lock();
103 p_intf->p_sys->p_window->Quit();
105 /* Destroy structure */
106 free( p_intf->p_sys );
110 /*****************************************************************************
112 *****************************************************************************/
113 static void Run( intf_thread_t *p_intf )
115 while( !p_intf->b_die )
117 /* Update the input */
118 if( p_intf->p_sys->p_input != NULL )
120 if( p_intf->p_sys->p_input->b_dead )
122 vlc_object_release( p_intf->p_sys->p_input );
123 p_intf->p_sys->p_input = NULL;
125 /* Manage the slider */
126 p_intf->p_sys->p_window->updateInterface();
129 if( p_intf->p_sys->p_input == NULL )
131 p_intf->p_sys->p_input =
132 (input_thread_t *)vlc_object_find( p_intf, VLC_OBJECT_INPUT,
139 msleep( INTF_IDLE_SLEEP );