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