1 /*****************************************************************************
2 * intf_beos.cpp: beos interface
3 *****************************************************************************
4 * Copyright (C) 1999, 2000, 2001 VideoLAN
5 * $Id: intf_beos.cpp,v 1.43 2002/07/23 12:42:17 tcastley 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"
44 /*****************************************************************************
46 *****************************************************************************/
47 static int intf_Open ( intf_thread_t *p_intf );
48 static void intf_Close ( intf_thread_t *p_intf );
49 static void intf_Run ( intf_thread_t *p_intf );
51 /*****************************************************************************
52 * Functions exported as capabilities. They are declared as static so that
53 * we don't pollute the namespace too much.
54 *****************************************************************************/
55 void _M( intf_getfunctions )( function_list_t * p_function_list )
57 p_function_list->functions.intf.pf_open = intf_Open;
58 p_function_list->functions.intf.pf_close = intf_Close;
59 p_function_list->functions.intf.pf_run = intf_Run;
62 /*****************************************************************************
63 * intf_Open: initialize interface
64 *****************************************************************************/
65 static int intf_Open( intf_thread_t *p_intf )
68 screen = new BScreen();
69 BRect rect = screen->Frame();
70 rect.top = rect.bottom-100;
73 rect.right = rect.left + 350;
76 /* Allocate instance and initialize some members */
77 p_intf->p_sys = (intf_sys_t*) malloc( sizeof( intf_sys_t ) );
78 if( p_intf->p_sys == NULL )
80 msg_Err( p_intf, "out of memory" );
83 // p_intf->p_sys->p_sub = msg_Subscribe( p_intf );
84 p_intf->p_sys->p_input = NULL;
87 /* Create the interface window */
88 p_intf->p_sys->p_window =
89 new InterfaceWindow( rect,
90 VOUT_TITLE " (BeOS interface)", p_intf );
91 if( p_intf->p_sys->p_window == 0 )
93 free( p_intf->p_sys );
94 msg_Err( p_intf, "cannot allocate InterfaceWindow" );
101 /*****************************************************************************
102 * intf_Close: destroy dummy interface
103 *****************************************************************************/
104 static void intf_Close( intf_thread_t *p_intf )
106 if( p_intf->p_sys->p_input )
108 vlc_object_release( p_intf->p_sys->p_input );
111 // msg_Unsubscribe( p_intf, p_intf->p_sys->p_sub );
113 /* Destroy the interface window */
114 p_intf->p_sys->p_window->Lock();
115 p_intf->p_sys->p_window->Quit();
117 /* Destroy structure */
118 free( p_intf->p_sys );
122 /*****************************************************************************
123 * intf_Run: event loop
124 *****************************************************************************/
125 static void intf_Run( intf_thread_t *p_intf )
127 while( !p_intf->b_die )
129 /* Update the input */
130 if( p_intf->p_sys->p_input != NULL )
132 if( p_intf->p_sys->p_input->b_dead )
134 vlc_object_release( p_intf->p_sys->p_input );
135 p_intf->p_sys->p_input = NULL;
137 /* Manage the slider */
138 p_intf->p_sys->p_window->updateInterface();
141 if( p_intf->p_sys->p_input == NULL )
143 p_intf->p_sys->p_input =
144 (input_thread_t *)vlc_object_find( p_intf, VLC_OBJECT_INPUT,
151 msleep( INTF_IDLE_SLEEP );