1 /*****************************************************************************
2 * fb.c : Linux framebuffer plugin for vlc
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 <sys/types.h>
31 #include <stdlib.h> /* malloc(), free() */
32 #include <unistd.h> /* close() */
35 #include "common.h" /* boolean_t, byte_t */
41 #include "interface.h"
42 #include "audio_output.h"
44 #include "video_output.h"
48 /*****************************************************************************
50 *****************************************************************************/
51 static void vout_GetPlugin( p_vout_thread_t p_vout );
52 static void intf_GetPlugin( p_intf_thread_t p_intf );
55 int vout_FBCreate ( vout_thread_t *p_vout, char *psz_display,
56 int i_root_window, void *p_data );
57 int vout_FBInit ( p_vout_thread_t p_vout );
58 void vout_FBEnd ( p_vout_thread_t p_vout );
59 void vout_FBDestroy ( p_vout_thread_t p_vout );
60 int vout_FBManage ( p_vout_thread_t p_vout );
61 void vout_FBDisplay ( p_vout_thread_t p_vout );
62 void vout_FBSetPalette ( p_vout_thread_t p_vout,
63 u16 *red, u16 *green, u16 *blue, u16 *transp );
66 int intf_FBCreate ( p_intf_thread_t p_intf );
67 void intf_FBDestroy ( p_intf_thread_t p_intf );
68 void intf_FBManage ( p_intf_thread_t p_intf );
70 /*****************************************************************************
71 * GetConfig: get the plugin structure and configuration
72 *****************************************************************************/
73 plugin_info_t * GetConfig( void )
76 plugin_info_t * p_info = (plugin_info_t *) malloc( sizeof(plugin_info_t) );
78 p_info->psz_name = "Linux framebuffer";
79 p_info->psz_version = VERSION;
80 p_info->psz_author = "the VideoLAN team <vlc@videolan.org>";
82 p_info->aout_GetPlugin = NULL;
83 p_info->vout_GetPlugin = vout_GetPlugin;
84 p_info->intf_GetPlugin = intf_GetPlugin;
85 p_info->yuv_GetPlugin = NULL;
87 /* Test if the device can be opened */
88 if ( (i_fd = open( main_GetPszVariable( VOUT_FB_DEV_VAR,
89 VOUT_FB_DEV_DEFAULT ),
97 p_info->i_score = 0x100;
100 if( TestProgram( "fbvlc" ) )
102 p_info->i_score += 0x180;
105 /* If this plugin was requested, score it higher */
106 if( TestMethod( VOUT_METHOD_VAR, "fb" ) )
108 p_info->i_score += 0x200;
114 /*****************************************************************************
115 * Following functions are only called through the p_info structure
116 *****************************************************************************/
118 static void vout_GetPlugin( p_vout_thread_t p_vout )
120 p_vout->p_sys_create = vout_FBCreate;
121 p_vout->p_sys_init = vout_FBInit;
122 p_vout->p_sys_end = vout_FBEnd;
123 p_vout->p_sys_destroy = vout_FBDestroy;
124 p_vout->p_sys_manage = vout_FBManage;
125 p_vout->p_sys_display = vout_FBDisplay;
127 /* optional functions */
128 p_vout->p_set_palette = vout_FBSetPalette;
131 static void intf_GetPlugin( p_intf_thread_t p_intf )
133 p_intf->p_sys_create = intf_FBCreate;
134 p_intf->p_sys_destroy = intf_FBDestroy;
135 p_intf->p_sys_manage = intf_FBManage;