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() */
41 #include "video_output.h"
44 #include "interface.h"
48 /*****************************************************************************
49 * intf_sys_t: description and status of 3dfx interface
50 *****************************************************************************/
51 typedef struct intf_sys_s
56 /*****************************************************************************
57 * intf_GlideCreate: initialize 3dfx interface
58 *****************************************************************************/
59 int intf_GlideCreate( intf_thread_t *p_intf )
61 /* Allocate instance and initialize some members */
62 p_intf->p_sys = malloc( sizeof( intf_sys_t ) );
63 if( p_intf->p_sys == NULL )
68 /* Spawn video output thread */
71 p_intf->p_vout = vout_CreateThread( NULL, 0, 0, 0, NULL, 0, NULL );
72 if( p_intf->p_vout == NULL ) /* error */
74 intf_ErrMsg("intf error: can't create output thread\n" );
81 /*****************************************************************************
82 * intf_GlideDestroy: destroy 3dfx interface
83 *****************************************************************************/
84 void intf_GlideDestroy( intf_thread_t *p_intf )
86 /* Close input thread, if any (blocking) */
89 input_DestroyThread( p_intf->p_input, NULL );
92 /* Close video output thread, if any (blocking) */
95 vout_DestroyThread( p_intf->p_vout, NULL );
98 /* Destroy structure */
99 free( p_intf->p_sys );
103 /*****************************************************************************
104 * intf_GlideManage: event loop
105 *****************************************************************************/
106 void intf_GlideManage( intf_thread_t *p_intf )
110 /* very Linux specific - see tlib.c in Glide for other versions */
113 if( intf_ProcessKey(p_intf, (int)buf = getch()) )
115 intf_ErrMsg( "unhandled key '%c' (%i)\n", (char) buf, buf );