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