1 /*****************************************************************************
2 * intf_beos.cpp: beos interface
3 *****************************************************************************
4 * Copyright (C) 1999, 2000, 2001 VideoLAN
5 * $Id: intf_beos.cpp,v 1.38 2002/02/15 13:32:52 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>
37 #include <videolan/vlc.h>
39 #include "stream_control.h"
41 #include "interface.h"
42 #include "input_ext-intf.h"
45 #include "InterfaceWindow.h"
47 /*****************************************************************************
48 * intf_sys_t: description and status of FB interface
49 *****************************************************************************/
50 typedef struct intf_sys_s
52 InterfaceWindow * p_window;
60 /*****************************************************************************
62 *****************************************************************************/
63 static int intf_Open ( intf_thread_t *p_intf );
64 static void intf_Close ( intf_thread_t *p_intf );
65 static void intf_Run ( intf_thread_t *p_intf );
67 /*****************************************************************************
68 * Functions exported as capabilities. They are declared as static so that
69 * we don't pollute the namespace too much.
70 *****************************************************************************/
71 void _M( intf_getfunctions )( function_list_t * p_function_list )
73 p_function_list->functions.intf.pf_open = intf_Open;
74 p_function_list->functions.intf.pf_close = intf_Close;
75 p_function_list->functions.intf.pf_run = intf_Run;
78 /*****************************************************************************
79 * intf_Open: initialize interface
80 *****************************************************************************/
81 static int intf_Open( intf_thread_t *p_intf )
84 screen = new BScreen();
85 BRect rect = screen->Frame();
86 rect.top = rect.bottom-100;
89 rect.right = rect.left + 350;
92 /* Allocate instance and initialize some members */
93 p_intf->p_sys = (intf_sys_t*) malloc( sizeof( intf_sys_t ) );
94 if( p_intf->p_sys == NULL )
96 intf_ErrMsg("error: %s", strerror(ENOMEM));
99 p_intf->p_sys->i_key = -1;
101 /* Create the interface window */
102 p_intf->p_sys->p_window =
103 new InterfaceWindow( rect,
104 VOUT_TITLE " (BeOS interface)", p_intf );
105 if( p_intf->p_sys->p_window == 0 )
107 free( p_intf->p_sys );
108 intf_ErrMsg( "error: cannot allocate memory for InterfaceWindow" );
115 /*****************************************************************************
116 * intf_Close: destroy dummy interface
117 *****************************************************************************/
118 static void intf_Close( intf_thread_t *p_intf )
120 /* Destroy the interface window */
121 p_intf->p_sys->p_window->Lock();
122 p_intf->p_sys->p_window->Quit();
124 /* Destroy structure */
125 free( p_intf->p_sys );
129 /*****************************************************************************
130 * intf_Run: event loop
131 *****************************************************************************/
132 static void intf_Run( intf_thread_t *p_intf )
135 while( !p_intf->b_die )
137 /* Manage core vlc functions through the callback */
138 p_intf->pf_manage( p_intf );
140 /* Manage the slider */
141 if( p_input_bank->pp_input[0] != NULL
142 && p_intf->p_sys->p_window != NULL)
144 p_intf->p_sys->p_window->updateInterface();
148 msleep( INTF_IDLE_SLEEP );