1 /*****************************************************************************
2 * intf_beos.cpp: beos interface
3 *****************************************************************************
4 * Copyright (C) 1999, 2000, 2001 VideoLAN
5 * $Id: intf_beos.cpp,v 1.41 2002/07/15 20:09:31 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 "InterfaceWindow.h"
40 /*****************************************************************************
41 * intf_sys_t: description and status of FB interface
42 *****************************************************************************/
45 InterfaceWindow * p_window;
53 /*****************************************************************************
55 *****************************************************************************/
56 static int intf_Open ( intf_thread_t *p_intf );
57 static void intf_Close ( intf_thread_t *p_intf );
58 static void intf_Run ( intf_thread_t *p_intf );
60 /*****************************************************************************
61 * Functions exported as capabilities. They are declared as static so that
62 * we don't pollute the namespace too much.
63 *****************************************************************************/
64 void _M( intf_getfunctions )( function_list_t * p_function_list )
66 p_function_list->functions.intf.pf_open = intf_Open;
67 p_function_list->functions.intf.pf_close = intf_Close;
68 p_function_list->functions.intf.pf_run = intf_Run;
71 /*****************************************************************************
72 * intf_Open: initialize interface
73 *****************************************************************************/
74 static int intf_Open( intf_thread_t *p_intf )
77 screen = new BScreen();
78 BRect rect = screen->Frame();
79 rect.top = rect.bottom-100;
82 rect.right = rect.left + 350;
85 /* Allocate instance and initialize some members */
86 p_intf->p_sys = (intf_sys_t*) malloc( sizeof( intf_sys_t ) );
87 if( p_intf->p_sys == NULL )
89 msg_Err( p_intf, "out of memory" );
92 p_intf->p_sys->i_key = -1;
94 /* Create the interface window */
95 p_intf->p_sys->p_window =
96 new InterfaceWindow( rect,
97 VOUT_TITLE " (BeOS interface)", p_intf );
98 if( p_intf->p_sys->p_window == 0 )
100 free( p_intf->p_sys );
101 msg_Err( p_intf, "cannot allocate InterfaceWindow" );
108 /*****************************************************************************
109 * intf_Close: destroy dummy interface
110 *****************************************************************************/
111 static void intf_Close( intf_thread_t *p_intf )
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 /* Manage the slider */
130 if( p_intf->p_vlc->p_input_bank->pp_input[0] != NULL
131 && p_intf->p_sys->p_window != NULL)
133 p_intf->p_sys->p_window->updateInterface();
137 msleep( INTF_IDLE_SLEEP );