1 /*****************************************************************************
2 * intf_macosx.c: MacOS X interface plugin
3 *****************************************************************************
4 * Copyright (C) 2001 VideoLAN
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
21 *****************************************************************************/
23 #define MODULE_NAME macosx
24 #include "modules_inner.h"
26 /*****************************************************************************
28 *****************************************************************************/
31 #include <stdlib.h> /* malloc(), free() */
40 #include "interface.h"
46 /*****************************************************************************
47 * intf_sys_t: description and status of the interface
48 *****************************************************************************/
49 typedef struct intf_sys_s
54 /*****************************************************************************
56 *****************************************************************************/
57 static int intf_Probe ( probedata_t *p_data );
58 static int intf_Open ( intf_thread_t *p_intf );
59 static void intf_Close ( intf_thread_t *p_intf );
60 static void intf_Run ( intf_thread_t *p_intf );
62 /*****************************************************************************
63 * Functions exported as capabilities. They are declared as static so that
64 * we don't pollute the namespace too much.
65 *****************************************************************************/
66 void _M( intf_getfunctions )( function_list_t * p_function_list )
68 p_function_list->pf_probe = intf_Probe;
69 p_function_list->functions.intf.pf_open = intf_Open;
70 p_function_list->functions.intf.pf_close = intf_Close;
71 p_function_list->functions.intf.pf_run = intf_Run;
74 /*****************************************************************************
75 * intf_Probe: probe the interface and return a score
76 *****************************************************************************
77 * This function checks the interface can be run and returns a score to the
78 * plugin manager so that it can select the best plugin.
79 *****************************************************************************/
80 static int intf_Probe( probedata_t *p_data )
82 if( TestMethod( INTF_METHOD_VAR, "macosx" ) )
87 /* Under MacOS X, this plugin always works */
91 /*****************************************************************************
92 * intf_Open: initialize interface
93 *****************************************************************************/
94 static int intf_Open( intf_thread_t *p_intf )
96 /* Allocate instance and initialize some members */
97 p_intf->p_sys = malloc( sizeof( intf_sys_t ) );
98 if( p_intf->p_sys == NULL )
106 /*****************************************************************************
107 * intf_Close: destroy interface
108 *****************************************************************************/
109 static void intf_Close( intf_thread_t *p_intf )
111 /* Destroy structure */
112 free( p_intf->p_sys );
116 /*****************************************************************************
117 * intf_Run: main loop
118 *****************************************************************************/
119 static void intf_Run( intf_thread_t *p_intf )
121 while( !p_intf->b_die )
123 /* Manage core vlc functions through the callback */
124 p_intf->pf_manage( p_intf );
127 msleep( INTF_IDLE_SLEEP );