1 /*****************************************************************************
2 * intf_glide.c: 3dfx interface plugin
3 *****************************************************************************
4 * Copyright (C) 2000 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 /*****************************************************************************
25 *****************************************************************************/
28 #include <stdlib.h> /* malloc(), free() */
29 #include <sys/types.h> /* on BSD, uio.h needs types.h */
30 #include <sys/uio.h> /* for input.h */
31 #include <linutil.h> /* Glide kbhit() and getch() */
39 #include "stream_control.h"
40 #include "input_ext-intf.h"
43 #include "video_output.h"
46 #include "interface.h"
50 /*****************************************************************************
51 * intf_sys_t: description and status of 3dfx interface
52 *****************************************************************************/
53 typedef struct intf_sys_s
58 /*****************************************************************************
59 * intf_GlideCreate: initialize 3dfx interface
60 *****************************************************************************/
61 int intf_GlideCreate( intf_thread_t *p_intf )
63 /* Allocate instance and initialize some members */
64 p_intf->p_sys = malloc( sizeof( intf_sys_t ) );
65 if( p_intf->p_sys == NULL )
70 /* Spawn video output thread */
73 p_intf->p_vout = vout_CreateThread( NULL, 0, 0, 0, NULL, 0, NULL );
74 if( p_intf->p_vout == NULL ) /* error */
76 intf_ErrMsg("intf error: can't create output thread" );
82 intf_AssignNormalKeys( p_intf );
87 /*****************************************************************************
88 * intf_GlideDestroy: destroy 3dfx interface
89 *****************************************************************************/
90 void intf_GlideDestroy( intf_thread_t *p_intf )
92 /* Close input thread, if any (blocking) */
95 input_DestroyThread( p_intf->p_input, NULL );
98 /* Close video output thread, if any (blocking) */
101 vout_DestroyThread( p_intf->p_vout, NULL );
104 /* Destroy structure */
105 free( p_intf->p_sys );
109 /*****************************************************************************
110 * intf_GlideManage: event loop
111 *****************************************************************************/
112 void intf_GlideManage( intf_thread_t *p_intf )
116 /* very Linux specific - see tlib.c in Glide for other versions */
119 if( intf_ProcessKey(p_intf, (int)buf = getch()) )
121 intf_ErrMsg( "unhandled key '%c' (%i)", (char) buf, buf );