]> git.sesse.net Git - vlc/blob - plugins/glide/intf_glide.c
. nouveaux plugins - ne fonctionnent pas encore tous
[vlc] / plugins / glide / intf_glide.c
1 /*****************************************************************************
2  * intf_glide.c: 3dfx interface plugin
3  *****************************************************************************
4  * Copyright (C) 2000 VideoLAN
5  *
6  * Authors:
7  *
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.
12  * 
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.
17  *
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  *****************************************************************************/
22
23 /*****************************************************************************
24  * Preamble
25  *****************************************************************************/
26 #include "defs.h"
27
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() */
32
33 #include "config.h"
34 #include "common.h"
35 #include "threads.h"
36 #include "mtime.h"
37 #include "plugins.h"
38
39 #include "input.h"
40 #include "video.h"
41 #include "video_output.h"
42
43 #include "intf_msg.h"
44 #include "interface.h"
45
46 #include "main.h"
47
48 /*****************************************************************************
49  * intf_sys_t: description and status of 3dfx interface
50  *****************************************************************************/
51 typedef struct intf_sys_s
52 {
53
54 } intf_sys_t;
55
56 /*****************************************************************************
57  * intf_SysCreate: initialize 3dfx interface
58  *****************************************************************************/
59 int intf_SysCreate( intf_thread_t *p_intf )
60 {
61     /* Allocate instance and initialize some members */
62     p_intf->p_sys = malloc( sizeof( intf_sys_t ) );
63     if( p_intf->p_sys == NULL )
64     {
65         return( 1 );
66     };
67
68     /* Spawn video output thread */
69     if( p_main->b_video )
70     {
71         p_intf->p_vout = vout_CreateThread( NULL, 0, 0, 0, NULL, 0, NULL );
72         if( p_intf->p_vout == NULL )                                /* error */
73         {
74             intf_ErrMsg("intf error: can't create output thread\n" );
75             return( 1 );
76         }
77     }
78     return( 0 );
79 }
80
81 /*****************************************************************************
82  * intf_SysDestroy: destroy 3dfx interface
83  *****************************************************************************/
84 void intf_SysDestroy( intf_thread_t *p_intf )
85 {
86     /* Close input thread, if any (blocking) */
87     if( p_intf->p_input )
88     {
89         input_DestroyThread( p_intf->p_input, NULL );
90     }
91
92     /* Close video output thread, if any (blocking) */
93     if( p_intf->p_vout )
94     {
95         vout_DestroyThread( p_intf->p_vout, NULL );
96     }
97
98     /* Destroy structure */
99     free( p_intf->p_sys );
100 }
101
102
103 /*****************************************************************************
104  * intf_SysManage: event loop
105  *****************************************************************************/
106 void intf_SysManage( intf_thread_t *p_intf )
107 {
108     unsigned int buf;
109
110     /* very Linux specific - see tlib.c in Glide for other versions */
111     while( kbhit() )
112     {
113         if( intf_ProcessKey(p_intf, (int)buf = getch()) )
114         {
115             intf_ErrMsg( "unhandled key '%c' (%i)\n", (char) buf, buf );
116         }
117     }
118 }
119