Commit 4c1e4249 authored by Vincent Seguin's avatar Vincent Seguin

GGI fonctionnel. N'oubliez pas de d�finit GII_INPUT.

Nettoyage de video_* et intf_*.
parent fa66a86a
......@@ -17,7 +17,7 @@
VIDEO=X11
#VIDEO=DGA (not yet supported)
#VIDEO=FB
#VIDEO=GGI (not yet supported)
#VIDEO=GGI
#VIDEO=BEOS (not yet supported)
# Target architecture and optimization
......@@ -69,7 +69,9 @@ ifeq ($(VIDEO),X11)
LIB += -L/usr/X11R6/lib
LIB += -lX11
LIB += -lXext
LIB += -lXpm
endif
ifeq ($(VIDEO),GGI)
LIB += -lggi
endif
# System dependant libraries
......@@ -265,7 +267,7 @@ vlc: $(C_OBJ) $(ASM_OBJ)
# Generic rules (see below)
#
$(dependancies): %.d: FORCE
@make -s --no-print-directory -f Makefile.dep $@
@$(MAKE) -s --no-print-directory -f Makefile.dep $@
$(C_OBJ): %.o: dep/%.d
......
......@@ -29,6 +29,8 @@
#define VIDEO_OPTIONS "X11"
#elif defined(VIDEO_FB)
#define VIDEO_OPTIONS "Framebuffer"
#elif defined(VIDEO_GGI)
#define VIDEO_OPTIONS "GGI"
#else
#define VIDEO_OPTIONS ""
#endif
......@@ -47,8 +49,6 @@
* General compilation options
*******************************************************************************/
#define FRAMEBUFFER
/* Define for DVB support - Note that some extensions or restrictions may be
* incompatible with native MPEG2 streams */
//#define DVB_EXTENSIONS
......
......@@ -5,20 +5,14 @@
* This module describes the programming interface for video output threads.
* It includes functions allowing to open a new thread, send pictures to a
* thread, and destroy a previously oppenned video output thread.
*******************************************************************************
* Requires:
* "config.h"
* "common.h"
* "mtime.h"
* "vlc_thread.h"
* "video.h"
*******************************************************************************/
/*******************************************************************************
* vout_thread_t: video output thread descriptor
*******************************************************************************
* Any independant video output device, such as an X11 window, is represented
* by a video output thread, and described using following structure.
* Any independant video output device, such as an X11 window or a GGI device,
* is represented by a video output thread, and described using following
* structure.
*******************************************************************************/
typedef struct vout_thread_s
{
......@@ -38,13 +32,6 @@ typedef struct vout_thread_s
float f_x_ratio; /* horizontal display ratio */
float f_y_ratio; /* vertical display ratio */
/* Output method */
p_vout_sys_t p_sys; /* system output method */
/* Video heap */
int i_pictures; /* current heap size */
picture_t p_picture[VOUT_MAX_PICTURES]; /* pictures */
#ifdef STATS
/* Statistics */
count_t c_loops; /* number of loops */
......@@ -52,6 +39,13 @@ typedef struct vout_thread_s
count_t c_pictures; /* number of pictures added to heap */
#endif
/* Output method */
p_vout_sys_t p_sys; /* system output method */
/* Video heap */
int i_pictures; /* current heap size */
picture_t p_picture[VOUT_MAX_PICTURES]; /* pictures */
/* YUV translation tables, for 15,16 and 24/32 bpp displays. 16 bits and 32
* bits pointers points on the same data.
* CAUTION: these tables are translated: their origin is -384 */
......@@ -61,37 +55,14 @@ typedef struct vout_thread_s
u32 * pi_trans32_red;
u32 * pi_trans32_green;
u32 * pi_trans32_blue;
/* Rendering functions - these functions are of vout_render_blank_t and
* vout_render_line_t, but are not declared here using these types since
* they require vout_thread_t to be defined */
/* void (* RenderRGBBlank) ( struct vout_thread_s *p_vout, pixel_t pixel,
int i_x, int i_y, int i_width, int i_height );
void (* RenderPixelBlank) ( struct vout_thread_s *p_vout, pixel_t pixel,
int i_x, int i_y, int i_width, int i_height );
void (* RenderRGBLine) ( struct vout_thread_s *p_vout, picture_t *p_pic,
int i_x, int i_y, int i_pic_x, int i_pic_y,
int i_width, int i_line_width, int i_ratio );
void (* RenderPixelLine) ( struct vout_thread_s *p_vout, picture_t *p_pic,
int i_x, int i_y, int i_pic_x, int i_pic_y,
int i_width, int i_line_width, int i_ratio );
void (* RenderRGBMaskLine) ( struct vout_thread_s *p_vout, picture_t *p_pic,
int i_x, int i_y, int i_pic_x, int i_pic_y,
int i_width, int i_line_width, int i_ratio );
void (* RenderPixelMaskLine) ( struct vout_thread_s *p_vout, picture_t *p_pic,
int i_x, int i_y, int i_pic_x, int i_pic_y,
int i_width, int i_line_width, int i_ratio );
*/ /* ?? add YUV types */
} vout_thread_t;
/*******************************************************************************
* Prototypes
*******************************************************************************/
vout_thread_t * vout_CreateThread (
#if defined(VIDEO_X11)
#ifdef VIDEO_X11
char *psz_display, Window root_window,
#elif defined(VIDEO_FB)
//??void
#endif
int i_width, int i_height, int *pi_status
);
......@@ -105,9 +76,6 @@ void vout_DisplayPicture ( vout_thread_t *p_vout, picture
void vout_LinkPicture ( vout_thread_t *p_vout, picture_t *p_pic );
void vout_UnlinkPicture ( vout_thread_t *p_vout, picture_t *p_pic );
#ifdef DEBUG
void vout_PrintHeap ( vout_thread_t *p_vout, char *psz_str );
#endif
......
......@@ -6,11 +6,11 @@
/*******************************************************************************
* Prototypes
*******************************************************************************/
#if defined(VIDEO_X11)
int vout_SysCreate ( p_vout_thread_t p_vout, char *psz_display, Window root_window );
#elif defined(VIDEO_FB)
int vout_SysCreate ( p_vout_thread_t p_vout );
int vout_SysCreate ( p_vout_thread_t p_vout
#ifdef VIDEO_X11
, char *psz_display, Window root_window
#endif
);
int vout_SysInit ( p_vout_thread_t p_vout );
void vout_SysEnd ( p_vout_thread_t p_vout );
void vout_SysDestroy ( p_vout_thread_t p_vout );
......
......@@ -22,12 +22,13 @@
#include <string.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <net/if.h>
#include <netinet/in.h>
#include <sys/ioctl.h>
#include <sys/shm.h>
#include <sys/soundcard.h>
......
......@@ -15,6 +15,8 @@
#include <stdio.h> /* "intf_msg.h" */
#include <stdlib.h> /* malloc(), free() */
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h> /* ntohl() */
#include <sys/soundcard.h> /* "audio_output.h" */
#include <sys/uio.h> /* "input.h" */
......
......@@ -8,6 +8,8 @@
#include <unistd.h>
#include <stdio.h> /* "intf_msg.h" */
#include <stdlib.h> /* malloc(), free() */
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h> /* ntohl() */
#include <sys/soundcard.h> /* "audio_output.h" */
#include <sys/uio.h>
......
......@@ -6,6 +6,7 @@
/*******************************************************************************
* Preamble
*******************************************************************************/
#include <sys/types.h>
#include <sys/uio.h>
#include "common.h"
......
......@@ -8,6 +8,7 @@
/*******************************************************************************
* Preamble
*******************************************************************************/
#include <sys/types.h>
#include <sys/uio.h>
#include <stdlib.h>
#include <stdio.h>
......
......@@ -8,6 +8,7 @@
/*******************************************************************************
* Preamble
*******************************************************************************/
#include <sys/types.h>
#include <sys/uio.h>
#include <string.h>
#include <stdio.h>
......@@ -17,7 +18,6 @@
#include <netinet/in.h> /* sockaddr_in, htons(), htonl() */
#include <errno.h>
#include <sys/time.h>
#include <sys/types.h>
#include <unistd.h>
#include "common.h"
......
......@@ -9,8 +9,10 @@
* Preamble
*******************************************************************************/
#include <stdio.h>
#include <sys/types.h>
#include <sys/uio.h> /* iovec */
#include <stdlib.h> /* atoi(), malloc(), free() */
#include <sys/socket.h>
#include <netinet/in.h>
#include "config.h"
......
......@@ -12,6 +12,8 @@
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <sys/uio.h> /* for input.h */
#include "config.h"
......@@ -42,32 +44,32 @@ intf_thread_t* intf_Create( void )
p_intf = malloc( sizeof( intf_thread_t ) );
if( !p_intf )
{
errno = ENOMEM;
intf_ErrMsg("error: %s\n", strerror( ENOMEM ) );
return( NULL );
}
p_intf->b_die = 0;
intf_DbgMsg( "0x%x\n", p_intf );
/* Initialize structure */
p_intf->p_vout = NULL;
p_intf->p_input = NULL;
p_intf->b_die = 0;
p_intf->p_vout = NULL;
p_intf->p_input = NULL;
/* Start interfaces */
p_intf->p_console = intf_ConsoleCreate();
if( p_intf->p_console == NULL )
{
intf_ErrMsg("intf error: can't create control console\n");
intf_ErrMsg("error: can't create control console\n");
free( p_intf );
return( NULL );
}
if( intf_SysCreate( p_intf ) )
{
intf_ErrMsg("intf error: can't create interface\n");
intf_ErrMsg("error: can't create interface\n");
intf_ConsoleDestroy( p_intf->p_console );
free( p_intf );
return( NULL );
}
intf_Msg("Interface initialized\n");
return( p_intf );
}
......@@ -78,13 +80,11 @@ intf_thread_t* intf_Create( void )
*******************************************************************************/
void intf_Run( intf_thread_t *p_intf )
{
intf_DbgMsg("0x%x begin\n", p_intf );
/* Execute the initialization script - if a positive number is returned,
* the script could be executed but failed */
if( intf_ExecScript( main_GetPszVariable( INTF_INIT_SCRIPT_VAR, INTF_INIT_SCRIPT_DEFAULT ) ) > 0 )
{
intf_ErrMsg("intf error: error during initialization script\n");
intf_ErrMsg("warning: error(s) during startup script\n");
}
/* Main loop */
......@@ -100,8 +100,6 @@ void intf_Run( intf_thread_t *p_intf )
* keyboard events, a 100ms delay is a good compromise */
msleep( INTF_IDLE_SLEEP );
}
intf_DbgMsg("0x%x end\n", p_intf );
}
/*******************************************************************************
......@@ -111,8 +109,6 @@ void intf_Run( intf_thread_t *p_intf )
*******************************************************************************/
void intf_Destroy( intf_thread_t *p_intf )
{
intf_DbgMsg("0x%x\n", p_intf );
/* Destroy interfaces */
intf_SysDestroy( p_intf );
intf_ConsoleDestroy( p_intf->p_console );
......
......@@ -25,6 +25,7 @@
* Preamble
*******************************************************************************/
#include "vlc.h"
#include <sys/stat.h>
/*??#include <errno.h>
#include <fcntl.h>
#include <netinet/in.h>
......@@ -33,7 +34,6 @@
#include <string.h>
#include <unistd.h>
#include <sys/soundcard.h>
#include <sys/stat.h>
#include <sys/uio.h>
#include <X11/Xlib.h>
#include <X11/extensions/XShm.h>
......
......@@ -17,10 +17,11 @@
#include <errno.h>
#include <string.h>
#include <sys/ioctl.h>
#include <net/if.h>
#include <arpa/inet.h>
#include <netinet/in.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <net/if.h>
#include "config.h"
#include "common.h"
......
/*******************************************************************************
* vout_ggi.c: GGI video output display method
* (c)1998 VideoLAN
*******************************************************************************/
/*******************************************************************************
* Preamble
*******************************************************************************/
#include <errno.h>
#include <stdlib.h>
#include <string.h>
#include <ggi/ggi.h>
#include "config.h"
#include "common.h"
#include "mtime.h"
#include "vlc_thread.h"
#include "video.h"
#include "video_output.h"
#include "video_sys.h"
#include "intf_msg.h"
/*******************************************************************************
* vout_sys_t: video output GGI method descriptor
*******************************************************************************
* This structure is part of the video output thread descriptor.
* It describes the GGI specific properties of an output thread.
*******************************************************************************/
typedef struct vout_sys_s
{
/* GGI system informations */
ggi_visual_t p_display; /* display device */
/* Buffer index */
int i_buffer_index;
} vout_sys_t;
/*******************************************************************************
* Local prototypes
*******************************************************************************/
static int GGIOpenDisplay ( vout_thread_t *p_vout );
static void GGICloseDisplay ( vout_thread_t *p_vout );
/*******************************************************************************
* vout_SysCreate: allocate GGI video thread output method
*******************************************************************************
* This function allocate and initialize a GGI vout method. It uses some of the
* vout properties to choose the correct mode, and change them according to the
* mode actually used.
*******************************************************************************/
int vout_SysCreate( vout_thread_t *p_vout )
{
/* Allocate structure */
p_vout->p_sys = malloc( sizeof( vout_sys_t ) );
if( p_vout->p_sys == NULL )
{
intf_ErrMsg("error: %s\n", strerror(ENOMEM) );
return( 1 );
}
/* Open and initialize device */
if( GGIOpenDisplay( p_vout ) )
{
intf_ErrMsg("error: can't initialize GGI display\n");
free( p_vout->p_sys );
return( 1 );
}
return( 0 );
}
/*******************************************************************************
* vout_SysInit: initialize GGI video thread output method
*******************************************************************************
* This function initialize the GGI display device.
*******************************************************************************/
int vout_SysInit( vout_thread_t *p_vout )
{
p_vout->p_sys->i_buffer_index = 0;
return( 0 );
}
/*******************************************************************************
* vout_SysEnd: terminate Sys video thread output method
*******************************************************************************
* Terminate an output method created by vout_SysCreateOutputMethod
*******************************************************************************/
void vout_SysEnd( vout_thread_t *p_vout )
{
;
}
/*******************************************************************************
* vout_SysDestroy: destroy Sys video thread output method
*******************************************************************************
* Terminate an output method created by vout_SysCreateOutputMethod
*******************************************************************************/
void vout_SysDestroy( vout_thread_t *p_vout )
{
GGICloseDisplay( p_vout );
free( p_vout->p_sys );
}
/*******************************************************************************
* vout_SysManage: handle Sys events
*******************************************************************************
* This function should be called regularly by video output thread. It returns
* a negative value if something happened which does not allow the thread to
* continue, and a positive one if the thread can go on, but the images have
* been modified and therefore it is useless to display them.
*******************************************************************************/
int vout_SysManage( vout_thread_t *p_vout )
{
//??
return( 0 );
}
/*******************************************************************************
* vout_SysDisplay: displays previously rendered output
*******************************************************************************
* This function send the currently rendered image to the display, wait until
* it is displayed and switch the two rendering buffer, preparing next frame.
*******************************************************************************/
void vout_SysDisplay( vout_thread_t *p_vout )
{
/* Change display frame */
ggiFlush( p_vout->p_sys->p_display ); // ??
ggiSetDisplayFrame( p_vout->p_sys->p_display, p_vout->p_sys->i_buffer_index );
/* Swap buffers and change write frame */
p_vout->p_sys->i_buffer_index = ++p_vout->p_sys->i_buffer_index & 1;
ggiSetWriteFrame( p_vout->p_sys->p_display, p_vout->p_sys->i_buffer_index );
}
/*******************************************************************************
* vout_SysGetPicture: get current display buffer informations
*******************************************************************************
* This function returns the address of the current display buffer, and the
* number of samples per line. For 15, 16 and 32 bits displays, this value is
* the number of pixels in a line.
*******************************************************************************/
byte_t * vout_SysGetPicture( vout_thread_t *p_vout, int *pi_eol_offset )
{
*pi_eol_offset = p_vout->i_width;
//????
// return( p_vout->p_sys->p_ximage[ p_vout->p_sys->i_buffer_index ].data );
}
/* following functions are local */
/*******************************************************************************
* GGIOpenDisplay: open and initialize GGI device
*******************************************************************************
* Open and initialize display according to preferences specified in the vout
* thread fields.
*******************************************************************************/
static int GGIOpenDisplay( vout_thread_t *p_vout )
{
ggi_mode mode; /* mode descriptor */
/* Initialize library */
if( ggiInit() )
{
intf_ErrMsg("error: can't initialize GGI library\n");
return( 1 );
}
/* Open display */
p_vout->p_sys->p_display = ggiOpen( NULL );
if( p_vout->p_sys->p_display == NULL )
{
intf_ErrMsg("error: can't open GGI default display\n");
ggiExit();
return( 1 );
}
/* Find most appropriate mode */
mode.frames = 2; /* 2 buffers */
mode.visible.x = p_vout->i_width; /* minimum width */
mode.visible.y = p_vout->i_width; /* maximum width */
mode.virt.x = GGI_AUTO;
mode.virt.y = GGI_AUTO;
mode.size.x = GGI_AUTO;
mode.size.y = GGI_AUTO;
mode.graphtype = GT_15BIT; /* minimum usable screen depth */
mode.dpp.x = GGI_AUTO;
mode.dpp.y = GGI_AUTO;
ggiCheckMode( p_vout->p_sys->p_display, &mode );
/* Check that returned mode has some minimum properties */
//??
/* Set mode */
if( ggiSetMode( p_vout->p_sys->p_display, &mode ) )
{
intf_ErrMsg("error: can't set GGI mode\n");
ggiClose( p_vout->p_sys->p_display );
ggiExit();
return( 1 );
}
/* Set thread information */
p_vout->i_width = mode.visible.x;
p_vout->i_height = mode.visible.y;
switch( mode.graphtype )
{
case GT_15BIT:
p_vout->i_screen_depth = 15;
p_vout->i_bytes_per_pixel = 2;
break;
case GT_16BIT:
p_vout->i_screen_depth = 16;
p_vout->i_bytes_per_pixel = 2;
break;
case GT_24BIT:
p_vout->i_screen_depth = 24;
p_vout->i_bytes_per_pixel = 3;
break;
case GT_32BIT:
p_vout->i_screen_depth = 32;
p_vout->i_bytes_per_pixel = 4;
break;
default:
intf_ErrMsg("error: unsupported screen depth\n");
ggiClose( p_vout->p_sys->p_display );
ggiExit();
return( 1 );
break;
}
return( 0 );
}
/*******************************************************************************
* GGICloseDisplay: close and reset GGI device
*******************************************************************************
* This function returns all resources allocated by GGIOpenDisplay and restore
* the original state of the device.
*******************************************************************************/
static void GGICloseDisplay( vout_thread_t *p_vout )
{
// Restore original mode and close display
ggiClose( p_vout->p_sys->p_display );
// Exit library
ggiExit();
}
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment