Commit 665782c8 authored by Sam Hocevar's avatar Sam Hocevar

l'output framebuffer fonctionne presque.

 ca va *pas* merder.
parent 4ffdf05c
/******************************************************************************* /******************************************************************************
* vout_fb.c: framebuffer video output display method * vout_fb.c: Linux framebuffer video output display method
* (c)1998 VideoLAN * (c)1998 VideoLAN
*******************************************************************************/ ******************************************************************************/
/******************************************************************************* /******************************************************************************
* Preamble * Preamble
*******************************************************************************/ ******************************************************************************/
#include <errno.h> #include <errno.h>
#include <fcntl.h> #include <fcntl.h>
...@@ -32,208 +31,219 @@ ...@@ -32,208 +31,219 @@
#include "intf_msg.h" #include "intf_msg.h"
#include "main.h" #include "main.h"
/******************************************************************************* /******************************************************************************
* vout_sys_t: video output framebuffer method descriptor * vout_sys_t: video output framebuffer method descriptor
******************************************************************************* ******************************************************************************
* This structure is part of the video output thread descriptor. * This structure is part of the video output thread descriptor.
* It describes the FB specific properties of an output thread. FB video * It describes the FB specific properties of an output thread.
* output is performed through regular resizable windows. Windows can be ******************************************************************************/
* dynamically resized to adapt to the size of the streams.
*******************************************************************************/
typedef struct vout_sys_s typedef struct vout_sys_s
{ {
/* System informations */ /* System informations */
int i_fb_dev; /* framebuffer device handle */ int i_fb_dev; /* framebuffer device handle */
size_t i_page_size; /* page size */ size_t i_page_size; /* page size */
struct fb_var_screeninfo var_info; /* framebuffer mode informations */
/* Video memory */ /* Video memory */
byte_t * p_video; byte_t * p_video;
/* User settings */
boolean_t b_shm; /* shared memory extension flag */
/* Font information */
int i_char_bytes_per_line; /* character width (bytes) */
int i_char_height; /* character height (lines) */
int i_char_interspacing;/* space between centers (pixels) */
byte_t * pi_font; /* pointer to font data */
/* Display buffers information */
int i_buffer_index; /* buffer index */
void * p_image[2]; /* image */
} vout_sys_t; } vout_sys_t;
/******************************************************************************* /******************************************************************************
* Local prototypes * Local prototypes
*******************************************************************************/ ******************************************************************************/
static int FBOpenDisplay ( vout_thread_t *p_vout ); static int FBOpenDisplay ( vout_thread_t *p_vout );
static void FBCloseDisplay ( vout_thread_t *p_vout ); static void FBCloseDisplay ( vout_thread_t *p_vout );
/*******************************************************************************
* vout_SysCreate: allocate framebuffer video thread output method /******************************************************************************
******************************************************************************* * vout_SysCreate: allocates FB video thread output method
* This function allocate and initialize a framebuffer vout method. ******************************************************************************
*******************************************************************************/ * This function allocates and initializes a FB vout method.
int vout_SysCreate( vout_thread_t *p_vout ) ******************************************************************************/
{ int vout_SysCreate( vout_thread_t *p_vout, char *psz_display, int i_root_window )
{
/* Allocate structure */ /* Allocate structure */
p_vout->p_sys = malloc( sizeof( vout_sys_t ) ); p_vout->p_sys = malloc( sizeof( vout_sys_t ) );
if( p_vout->p_sys == NULL ) if( p_vout->p_sys == NULL )
{ {
intf_ErrMsg("vout error: %s\n", strerror(ENOMEM) ); intf_ErrMsg("error: %s\n", strerror(ENOMEM) );
return( 1 ); return( 1 );
} }
/* Open and initialize device */ /* Open and initialize device */
if( FBOpenDisplay( p_vout ) ) if( FBOpenDisplay( p_vout ) )
{ {
intf_ErrMsg("vout error: can't open display\n"); intf_ErrMsg("vout error: can't open display\n");
free( p_vout->p_sys ); free( p_vout->p_sys );
return( 1 ); return( 1 );
} }
return( 0 ); return( 0 );
} }
/******************************************************************************* /******************************************************************************
* vout_SysInit: initialize Sys video thread output method * vout_SysInit: initialize framebuffer video thread output method
******************************************************************************* ******************************************************************************
* This function initialize the framebuffer device. * This function creates the images needed by the output thread. It is called
*******************************************************************************/ * at the beginning of the thread, but also each time the display is resized.
******************************************************************************/
int vout_SysInit( vout_thread_t *p_vout ) int vout_SysInit( vout_thread_t *p_vout )
{ {
// Blank both screens // Blank both screens
memset( p_vout->p_sys->p_video, 0x00, 2*p_vout->p_sys->i_page_size ); memset( p_vout->p_sys->p_video, 0x00, 2*p_vout->p_sys->i_page_size );
//memset( p_vout->p_sys->p_image[0], 0xf0, p_vout->p_sys->i_page_size );
//memset( p_vout->p_sys->p_image[1], 0x0f, p_vout->p_sys->i_page_size );
/* Set buffer index to 0 */
p_vout->p_sys->i_buffer_index = 0;
//??
//??
// intf_Msg("vout: framebuffer display initialized (%s), %dx%d depth=%d bpp",
// fb_fix_screeninfo.id, p_vout->i_witdh, p_vout->i_height,
// p_vout->i_screen_depth );
return( 0 ); return( 0 );
} }
/******************************************************************************* /******************************************************************************
* vout_SysEnd: terminate Sys video thread output method * vout_SysEnd: terminate FB video thread output method
******************************************************************************* ******************************************************************************
* Terminate an output method created by vout_SysCreateOutputMethod * Destroy the FB images created by vout_SysInit. It is called at the end of
*******************************************************************************/ * the thread, but also each time the window is resized.
******************************************************************************/
void vout_SysEnd( vout_thread_t *p_vout ) void vout_SysEnd( vout_thread_t *p_vout )
{ {
intf_DbgMsg("%p\n", p_vout ); intf_DbgMsg("%p\n", p_vout );
//??
} }
/******************************************************************************* /******************************************************************************
* vout_SysDestroy: destroy Sys video thread output method * vout_SysDestroy: destroy FB video thread output method
******************************************************************************* ******************************************************************************
* Terminate an output method created by vout_SysCreateOutputMethod * Terminate an output method created by vout_FBCreateOutputMethod
*******************************************************************************/ ******************************************************************************/
void vout_SysDestroy( vout_thread_t *p_vout ) void vout_SysDestroy( vout_thread_t *p_vout )
{ {
FBCloseDisplay( p_vout ); FBCloseDisplay( p_vout );
free( p_vout->p_sys ); free( p_vout->p_sys );
} }
/******************************************************************************* /******************************************************************************
* vout_SysManage: handle Sys events * vout_SysManage: handle FB events
******************************************************************************* ******************************************************************************
* This function should be called regularly by video output thread. It manages * This function should be called regularly by video output thread. It manages
* Sys events and allows window resizing. It returns a negative value if * console events and allows screen resizing. It returns a non null value on
* something happened which does not allow the thread to continue, and a * error.
* positive one if the thread can go on, but the images have been modified and ******************************************************************************/
* therefore it is useless to display them.
*******************************************************************************
* Messages type: vout, major code: 103
*******************************************************************************/
int vout_SysManage( vout_thread_t *p_vout ) int vout_SysManage( vout_thread_t *p_vout )
{ {
//?? /* XXX */
return( 0 ); return 0;
} }
/******************************************************************************* /******************************************************************************
* vout_SysDisplay: displays previously rendered output * vout_SysDisplay: displays previously rendered output
******************************************************************************* ******************************************************************************
* This function send the currently rendered image to Sys server, wait until * This function send the currently rendered image to FB image, waits until
* it is displayed and switch the two rendering buffer, preparing next frame. * it is displayed and switch the two rendering buffers, preparing next frame.
*******************************************************************************/ ******************************************************************************/
void vout_SysDisplay( vout_thread_t *p_vout ) void vout_SysDisplay( vout_thread_t *p_vout )
{ {
/* Swap buffers */ /* Swap buffers */
//?? p_vout->p_sys->i_buffer_index = ++p_vout->p_sys->i_buffer_index & 1; //p_vout->p_sys->i_buffer_index = ++p_vout->p_sys->i_buffer_index & 1;
/* tout est bien affich, on peut changer les 2 crans */
p_vout->p_sys->var_info.yoffset =
/*p_vout->p_sys->i_buffer_index ?*/ 0 /*: p_vout->p_sys->var_info.yres*/;
ioctl( p_vout->p_sys->i_fb_dev, FBIOPUT_VSCREENINFO, &p_vout->p_sys->var_info );
} }
/******************************************************************************* /******************************************************************************
* vout_SysGetPicture: get current display buffer informations * vout_SysGetPicture: get current display buffer informations
******************************************************************************* ******************************************************************************
* This function returns the address of the current display buffer, and the * This function returns the address of the current display buffer.
* number of samples per line. For 15, 16 and 32 bits displays, this value is ******************************************************************************/
* the number of pixels in a line. void * vout_SysGetPicture( vout_thread_t *p_vout )
*******************************************************************************/
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_image[ p_vout->p_sys->i_buffer_index ] );
//????
// return( p_vout->p_sys->p_ximage[ p_vout->p_sys->i_buffer_index ].data );
} }
/* following functions are local */ /* following functions are local */
/******************************************************************************* /******************************************************************************
* FBOpenDisplay: open and initialize framebuffer device * FBOpenDisplay: open and initialize framebuffer device
******************************************************************************* ******************************************************************************
* ?? The framebuffer mode is only provided as a fast and efficient way to * ?? The framebuffer mode is only provided as a fast and efficient way to
* display video, providing the card is configured and the mode ok. It is * display video, providing the card is configured and the mode ok. It is
* not portable, and is not supposed to work with many cards. Use at your * not portable, and is not supposed to work with many cards. Use at your
* own risks ! * own risk !
*******************************************************************************/ ******************************************************************************/
static int FBOpenDisplay( vout_thread_t *p_vout ) static int FBOpenDisplay( vout_thread_t *p_vout )
{ {
char *psz_device; /* framebuffer device path */ char *psz_device; /* framebuffer device path */
struct fb_fix_screeninfo fix_info; /* framebuffer fix information */ struct fb_fix_screeninfo fix_info; /* framebuffer fix information */
struct fb_var_screeninfo var_info; /* frambuffer mode informations */
/* Open framebuffer device */ /* Open framebuffer device */
psz_device = main_GetPszVariable( VOUT_FB_DEV_VAR, VOUT_FB_DEV_DEFAULT ); psz_device = main_GetPszVariable( VOUT_FB_DEV_VAR, VOUT_FB_DEV_DEFAULT );
p_vout->p_sys->i_fb_dev = open( psz_device, O_RDWR); p_vout->p_sys->i_fb_dev = open( psz_device, O_RDWR);
if( p_vout->p_sys->i_fb_dev == -1 ) if( p_vout->p_sys->i_fb_dev == -1 )
{ {
intf_ErrMsg("vout error: can't open %s (%s)\n", psz_device, strerror(errno) ); intf_ErrMsg("vout error: can't open %s (%s)\n", psz_device, strerror(errno) );
return( 1 ); return( 1 );
} }
// ?? here would be the code used to save the current mode and // ?? here would be the code used to save the current mode and
// ?? change to the most appropriate mode... // ?? change to the most appropriate mode...
/* Get framebuffer device informations */ /* Get framebuffer device informations */
if( ioctl( p_vout->p_sys->i_fb_dev, FBIOGET_VSCREENINFO, &var_info ) ) if( ioctl( p_vout->p_sys->i_fb_dev, FBIOGET_VSCREENINFO, &p_vout->p_sys->var_info ) )
{ {
intf_ErrMsg("vout error: can't get framebuffer informations (%s)\n", strerror(errno) ); intf_ErrMsg("vout error: can't get framebuffer informations (%s)\n", strerror(errno) );
close( p_vout->p_sys->i_fb_dev ); close( p_vout->p_sys->i_fb_dev );
return( 1 ); return( 1 );
} }
/* Framebuffer must have some basic properties to be usable */ /* Framebuffer must have some basic properties to be usable */
//?? //??
/* Set some attributes */ /* Set some attributes */
var_info.activate = FB_ACTIVATE_NXTOPEN; p_vout->p_sys->var_info.activate = FB_ACTIVATE_NXTOPEN;
var_info.xoffset = 0; p_vout->p_sys->var_info.xoffset = 0;
var_info.yoffset = 0; p_vout->p_sys->var_info.yoffset = 0;
//??ask sam p_vout->p_sys->mode_info.sync = FB_SYNC_VERT_HIGH_ACT; //??ask sam p_vout->p_sys->mode_info.sync = FB_SYNC_VERT_HIGH_ACT;
//??? //???
if( ioctl( p_vout->p_sys->i_fb_dev, FBIOPUT_VSCREENINFO, &var_info ) ) if( ioctl( p_vout->p_sys->i_fb_dev, FBIOPUT_VSCREENINFO, &p_vout->p_sys->var_info ) )
{ {
intf_ErrMsg("vout error: can't set framebuffer informations (%s)\n", strerror(errno) ); intf_ErrMsg("vout error: can't set framebuffer informations (%s)\n", strerror(errno) );
close( p_vout->p_sys->i_fb_dev ); close( p_vout->p_sys->i_fb_dev );
return( 1 ); return( 1 );
} }
/* Get some informations again, in the definitive configuration */ /* Get some informations again, in the definitive configuration */
if( ioctl( p_vout->p_sys->i_fb_dev, FBIOGET_FSCREENINFO, &fix_info ) || if( ioctl( p_vout->p_sys->i_fb_dev, FBIOGET_FSCREENINFO, &fix_info ) ||
ioctl( p_vout->p_sys->i_fb_dev, FBIOGET_VSCREENINFO, &var_info ) ) ioctl( p_vout->p_sys->i_fb_dev, FBIOGET_VSCREENINFO, &p_vout->p_sys->var_info ) )
{ {
intf_ErrMsg("vout error: can't get framebuffer informations (%s)\n", strerror(errno) ); intf_ErrMsg("vout error: can't get framebuffer informations (%s)\n", strerror(errno) );
// ?? restore fb config // ?? restore fb config
close( p_vout->p_sys->i_fb_dev ); close( p_vout->p_sys->i_fb_dev );
return( 1 ); return( 1 );
} }
p_vout->i_width = var_info.xres; p_vout->i_width = p_vout->p_sys->var_info.xres;
p_vout->i_height = var_info.yres; p_vout->i_height = p_vout->p_sys->var_info.yres;
p_vout->i_screen_depth = var_info.bits_per_pixel; p_vout->i_bytes_per_line = p_vout->i_width * 2;
p_vout->i_screen_depth = p_vout->p_sys->var_info.bits_per_pixel;
switch( p_vout->i_screen_depth ) switch( p_vout->i_screen_depth )
{ {
case 15: /* 15 bpp (16bpp with a missing green bit) */ case 15: /* 15 bpp (16bpp with a missing green bit) */
...@@ -250,43 +260,48 @@ static int FBOpenDisplay( vout_thread_t *p_vout ) ...@@ -250,43 +260,48 @@ static int FBOpenDisplay( vout_thread_t *p_vout )
break; break;
default: /* unsupported screen depth */ default: /* unsupported screen depth */
intf_ErrMsg("vout error: screen depth %i is not supported\n", intf_ErrMsg("vout error: screen depth %i is not supported\n",
p_vout->i_screen_depth); p_vout->i_screen_depth);
return( 1 ); return( 1 );
break; break;
} }
p_vout->p_sys->i_page_size = var_info.xres * p_vout->p_sys->i_page_size = p_vout->p_sys->var_info.xres *
var_info.yres * p_vout->i_bytes_per_pixel; p_vout->p_sys->var_info.yres * p_vout->i_bytes_per_pixel;
/* Map two framebuffers a the very beginning of the fb */ /* Map two framebuffers a the very beginning of the fb */
p_vout->p_sys->p_video = mmap(0, p_vout->p_sys->i_page_size * 2, p_vout->p_sys->p_video = mmap(0, p_vout->p_sys->i_page_size * 2,
PROT_READ | PROT_WRITE, MAP_SHARED, PROT_READ | PROT_WRITE, MAP_SHARED,
p_vout->p_sys->i_fb_dev, 0 ); p_vout->p_sys->i_fb_dev, 0 );
if( p_vout->p_sys->p_video == -1 ) //?? according to man, it is -1. What about NULL ? if( (int)p_vout->p_sys->p_video == -1 ) //?? according to man, it is -1. What about NULL ?
{ {
intf_ErrMsg("vout error: can't map video memory (%s)\n", strerror(errno) ); intf_ErrMsg("vout error: can't map video memory (%s)\n", strerror(errno) );
// ?? restore fb config // ?? restore fb config
close( p_vout->p_sys->i_fb_dev ); close( p_vout->p_sys->i_fb_dev );
return( 1 ); return( 1 );
} }
p_vout->p_sys->p_image[ 0 ] = p_vout->p_sys->p_video;
intf_DbgMsg("framebuffer type=%d, visual=%d, ypanstep=%d, ywrap=%d, accel=%d\n", p_vout->p_sys->p_image[ 1 ] = p_vout->p_sys->p_video + p_vout->p_sys->i_page_size;
intf_DbgMsg("framebuffer type=%d, visual=%d, ypanstep=%d, ywrap=%d, accel=%d\n",
fix_info.type, fix_info.visual, fix_info.ypanstep, fix_info.ywrapstep, fix_info.accel ); fix_info.type, fix_info.visual, fix_info.ypanstep, fix_info.ywrapstep, fix_info.accel );
intf_Msg("vout: framebuffer display initialized (%s), %dx%d depth=%d bpp\n", intf_Msg("vout: framebuffer display initialized (%s), %dx%d depth=%d bpp\n",
fix_info.id, p_vout->i_width, p_vout->i_height, p_vout->i_screen_depth ); fix_info.id, p_vout->i_width, p_vout->i_height, p_vout->i_screen_depth );
return( 0 );
}
/******************************************************************************* return( 0 );
}
/******************************************************************************
* FBCloseDisplay: close and reset framebuffer device * FBCloseDisplay: close and reset framebuffer device
******************************************************************************* ******************************************************************************
* This function returns all resources allocated by FBOpenDisplay and restore * Returns all resources allocated by FBOpenDisplay and restore the original
* the original state of the device. * state of the device.
*******************************************************************************/ ******************************************************************************/
static void FBCloseDisplay( vout_thread_t *p_vout ) static void FBCloseDisplay( vout_thread_t *p_vout )
{ {
//?? unmap memory // Free font info
//?? restore original mode free( p_vout->p_sys->pi_font );
close( p_vout->p_sys->i_fb_dev );
// Destroy window and close display
close( p_vout->p_sys->i_fb_dev );
} }
/******************************************************************************* /******************************************************************************
* video_output.c : video output thread * video_output.c : video output thread
* (c)2000 VideoLAN * (c)2000 VideoLAN
******************************************************************************* ******************************************************************************
* This module describes the programming interface for video output threads. * This module describes the programming interface for video output threads.
* It includes functions allowing to open a new thread, send pictures to a * It includes functions allowing to open a new thread, send pictures to a
* thread, and destroy a previously oppenned video output thread. * thread, and destroy a previously oppenned video output thread.
*******************************************************************************/ ******************************************************************************/
/******************************************************************************* /******************************************************************************
* Preamble * Preamble
*******************************************************************************/ ******************************************************************************/
#include <errno.h> #include <errno.h>
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
...@@ -26,9 +26,9 @@ ...@@ -26,9 +26,9 @@
#include "intf_msg.h" #include "intf_msg.h"
#include "main.h" #include "main.h"
/******************************************************************************* /******************************************************************************
* Local prototypes * Local prototypes
*******************************************************************************/ ******************************************************************************/
static int InitThread ( vout_thread_t *p_vout ); static int InitThread ( vout_thread_t *p_vout );
static void RunThread ( vout_thread_t *p_vout ); static void RunThread ( vout_thread_t *p_vout );
static void ErrorThread ( vout_thread_t *p_vout ); static void ErrorThread ( vout_thread_t *p_vout );
...@@ -40,19 +40,19 @@ static int RenderIdle ( vout_thread_t *p_vout, boolean_t b_bla ...@@ -40,19 +40,19 @@ static int RenderIdle ( vout_thread_t *p_vout, boolean_t b_bla
static int RenderInfo ( vout_thread_t *p_vout, boolean_t b_balnk ); static int RenderInfo ( vout_thread_t *p_vout, boolean_t b_balnk );
static int Manage ( vout_thread_t *p_vout ); static int Manage ( vout_thread_t *p_vout );
/******************************************************************************* /******************************************************************************
* vout_CreateThread: creates a new video output thread * vout_CreateThread: creates a new video output thread
******************************************************************************* ******************************************************************************
* This function creates a new video output thread, and returns a pointer * This function creates a new video output thread, and returns a pointer
* to its description. On error, it returns NULL. * to its description. On error, it returns NULL.
* If pi_status is NULL, then the function will block until the thread is ready. * If pi_status is NULL, then the function will block until the thread is ready.
* If not, it will be updated using one of the THREAD_* constants. * If not, it will be updated using one of the THREAD_* constants.
*******************************************************************************/ ******************************************************************************/
vout_thread_t * vout_CreateThread ( char *psz_display, int i_root_window, vout_thread_t * vout_CreateThread ( char *psz_display, int i_root_window,
int i_width, int i_height, int *pi_status ) int i_width, int i_height, int *pi_status )
{ {
vout_thread_t * p_vout; /* thread descriptor */ vout_thread_t * p_vout; /* thread descriptor */
int i_status; /* thread status */ int i_status; /* thread status */
/* Allocate descriptor */ /* Allocate descriptor */
intf_DbgMsg("\n"); intf_DbgMsg("\n");
...@@ -143,17 +143,17 @@ vout_thread_t * vout_CreateThread ( char *psz_display, int i_root_ ...@@ -143,17 +143,17 @@ vout_thread_t * vout_CreateThread ( char *psz_display, int i_root_
return( p_vout ); return( p_vout );
} }
/******************************************************************************* /******************************************************************************
* vout_DestroyThread: destroys a previously created thread * vout_DestroyThread: destroys a previously created thread
******************************************************************************* ******************************************************************************
* Destroy a terminated thread. * Destroy a terminated thread.
* The function will request a destruction of the specified thread. If pi_error * The function will request a destruction of the specified thread. If pi_error
* is NULL, it will return once the thread is destroyed. Else, it will be * is NULL, it will return once the thread is destroyed. Else, it will be
* update using one of the THREAD_* constants. * update using one of the THREAD_* constants.
*******************************************************************************/ ******************************************************************************/
void vout_DestroyThread( vout_thread_t *p_vout, int *pi_status ) void vout_DestroyThread( vout_thread_t *p_vout, int *pi_status )
{ {
int i_status; /* thread status */ int i_status; /* thread status */
/* Set status */ /* Set status */
intf_DbgMsg("\n"); intf_DbgMsg("\n");
...@@ -174,18 +174,18 @@ void vout_DestroyThread( vout_thread_t *p_vout, int *pi_status ) ...@@ -174,18 +174,18 @@ void vout_DestroyThread( vout_thread_t *p_vout, int *pi_status )
} }
} }
/******************************************************************************* /******************************************************************************
* vout_DisplaySubtitle: display a subtitle * vout_DisplaySubtitle: display a subtitle
******************************************************************************* ******************************************************************************
* Remove the reservation flag of a subtitle, which will cause it to be ready for * Remove the reservation flag of a subtitle, which will cause it to be ready for
* display. The picture does not need to be locked, since it is ignored by * display. The picture does not need to be locked, since it is ignored by
* the output thread if is reserved. * the output thread if is reserved.
*******************************************************************************/ ******************************************************************************/
void vout_DisplaySubtitle( vout_thread_t *p_vout, subtitle_t *p_sub ) void vout_DisplaySubtitle( vout_thread_t *p_vout, subtitle_t *p_sub )
{ {
#ifdef DEBUG_VIDEO #ifdef DEBUG_VIDEO
char psz_begin_date[MSTRTIME_MAX_SIZE]; /* buffer for date string */ char psz_begin_date[MSTRTIME_MAX_SIZE]; /* buffer for date string */
char psz_end_date[MSTRTIME_MAX_SIZE]; /* buffer for date string */ char psz_end_date[MSTRTIME_MAX_SIZE]; /* buffer for date string */
#endif #endif
#ifdef DEBUG #ifdef DEBUG
...@@ -207,28 +207,28 @@ void vout_DisplaySubtitle( vout_thread_t *p_vout, subtitle_t *p_sub ) ...@@ -207,28 +207,28 @@ void vout_DisplaySubtitle( vout_thread_t *p_vout, subtitle_t *p_sub )
#endif #endif
} }
/******************************************************************************* /******************************************************************************
* vout_CreateSubtitle: allocate a subtitle in the video output heap. * vout_CreateSubtitle: allocate a subtitle in the video output heap.
******************************************************************************* ******************************************************************************
* This function create a reserved subtitle in the video output heap. * This function create a reserved subtitle in the video output heap.
* A null pointer is returned if the function fails. This method provides an * A null pointer is returned if the function fails. This method provides an
* already allocated zone of memory in the subtitle data fields. It needs locking * already allocated zone of memory in the subtitle data fields. It needs locking
* since several pictures can be created by several producers threads. * since several pictures can be created by several producers threads.
*******************************************************************************/ ******************************************************************************/
subtitle_t *vout_CreateSubtitle( vout_thread_t *p_vout, int i_type, subtitle_t *vout_CreateSubtitle( vout_thread_t *p_vout, int i_type,
int i_size ) int i_size )
{ {
//??? //???
} }
/******************************************************************************* /******************************************************************************
* vout_DestroySubtitle: remove a permanent or reserved subtitle from the heap * vout_DestroySubtitle: remove a permanent or reserved subtitle from the heap
******************************************************************************* ******************************************************************************
* This function frees a previously reserved subtitle. * This function frees a previously reserved subtitle.
* It is meant to be used when the construction of a picture aborted. * It is meant to be used when the construction of a picture aborted.
* This function does not need locking since reserved subtitles are ignored by * This function does not need locking since reserved subtitles are ignored by
* the output thread. * the output thread.
*******************************************************************************/ ******************************************************************************/
void vout_DestroySubtitle( vout_thread_t *p_vout, subtitle_t *p_sub ) void vout_DestroySubtitle( vout_thread_t *p_vout, subtitle_t *p_sub )
{ {
#ifdef DEBUG #ifdef DEBUG
...@@ -246,13 +246,13 @@ void vout_DestroySubtitle( vout_thread_t *p_vout, subtitle_t *p_sub ) ...@@ -246,13 +246,13 @@ void vout_DestroySubtitle( vout_thread_t *p_vout, subtitle_t *p_sub )
#endif #endif
} }
/******************************************************************************* /******************************************************************************
* vout_DisplayPicture: display a picture * vout_DisplayPicture: display a picture
******************************************************************************* ******************************************************************************
* Remove the reservation flag of a picture, which will cause it to be ready for * Remove the reservation flag of a picture, which will cause it to be ready for
* display. The picture won't be displayed until vout_DatePicture has been * display. The picture won't be displayed until vout_DatePicture has been
* called. * called.
*******************************************************************************/ ******************************************************************************/
void vout_DisplayPicture( vout_thread_t *p_vout, picture_t *p_pic ) void vout_DisplayPicture( vout_thread_t *p_vout, picture_t *p_pic )
{ {
vlc_mutex_lock( &p_vout->picture_lock ); vlc_mutex_lock( &p_vout->picture_lock );
...@@ -278,13 +278,13 @@ void vout_DisplayPicture( vout_thread_t *p_vout, picture_t *p_pic ) ...@@ -278,13 +278,13 @@ void vout_DisplayPicture( vout_thread_t *p_vout, picture_t *p_pic )
vlc_mutex_unlock( &p_vout->picture_lock ); vlc_mutex_unlock( &p_vout->picture_lock );
} }
/******************************************************************************* /******************************************************************************
* vout_DatePicture: date a picture * vout_DatePicture: date a picture
******************************************************************************* ******************************************************************************
* Remove the reservation flag of a picture, which will cause it to be ready for * Remove the reservation flag of a picture, which will cause it to be ready for
* display. The picture won't be displayed until vout_DisplayPicture has been * display. The picture won't be displayed until vout_DisplayPicture has been
* called. * called.
*******************************************************************************/ ******************************************************************************/
void vout_DatePicture( vout_thread_t *p_vout, picture_t *p_pic, mtime_t date ) void vout_DatePicture( vout_thread_t *p_vout, picture_t *p_pic, mtime_t date )
{ {
vlc_mutex_lock( &p_vout->picture_lock ); vlc_mutex_lock( &p_vout->picture_lock );
...@@ -311,21 +311,21 @@ void vout_DatePicture( vout_thread_t *p_vout, picture_t *p_pic, mtime_t date ) ...@@ -311,21 +311,21 @@ void vout_DatePicture( vout_thread_t *p_vout, picture_t *p_pic, mtime_t date )
vlc_mutex_unlock( &p_vout->picture_lock ); vlc_mutex_unlock( &p_vout->picture_lock );
} }
/******************************************************************************* /******************************************************************************
* vout_CreatePicture: allocate a picture in the video output heap. * vout_CreatePicture: allocate a picture in the video output heap.
******************************************************************************* ******************************************************************************
* This function create a reserved image in the video output heap. * This function create a reserved image in the video output heap.
* A null pointer is returned if the function fails. This method provides an * A null pointer is returned if the function fails. This method provides an
* already allocated zone of memory in the picture data fields. It needs locking * already allocated zone of memory in the picture data fields. It needs locking
* since several pictures can be created by several producers threads. * since several pictures can be created by several producers threads.
*******************************************************************************/ ******************************************************************************/
picture_t *vout_CreatePicture( vout_thread_t *p_vout, int i_type, picture_t *vout_CreatePicture( vout_thread_t *p_vout, int i_type,
int i_width, int i_height ) int i_width, int i_height )
{ {
int i_picture; /* picture index */ int i_picture; /* picture index */
int i_chroma_width = 0; /* chroma width */ int i_chroma_width = 0; /* chroma width */
picture_t * p_free_picture = NULL; /* first free picture */ picture_t * p_free_picture = NULL; /* first free picture */
picture_t * p_destroyed_picture = NULL; /* first destroyed picture */ picture_t * p_destroyed_picture = NULL; /* first destroyed picture */
/* Get lock */ /* Get lock */
vlc_mutex_lock( &p_vout->picture_lock ); vlc_mutex_lock( &p_vout->picture_lock );
...@@ -456,15 +456,15 @@ picture_t *vout_CreatePicture( vout_thread_t *p_vout, int i_type, ...@@ -456,15 +456,15 @@ picture_t *vout_CreatePicture( vout_thread_t *p_vout, int i_type,
return( NULL ); return( NULL );
} }
/******************************************************************************* /******************************************************************************
* vout_DestroyPicture: remove a permanent or reserved picture from the heap * vout_DestroyPicture: remove a permanent or reserved picture from the heap
******************************************************************************* ******************************************************************************
* This function frees a previously reserved picture or a permanent * This function frees a previously reserved picture or a permanent
* picture. It is meant to be used when the construction of a picture aborted. * picture. It is meant to be used when the construction of a picture aborted.
* Note that the picture will be destroyed even if it is linked ! * Note that the picture will be destroyed even if it is linked !
* This function does not need locking since reserved pictures are ignored by * This function does not need locking since reserved pictures are ignored by
* the output thread. * the output thread.
*******************************************************************************/ ******************************************************************************/
void vout_DestroyPicture( vout_thread_t *p_vout, picture_t *p_pic ) void vout_DestroyPicture( vout_thread_t *p_vout, picture_t *p_pic )
{ {
#ifdef DEBUG #ifdef DEBUG
...@@ -484,12 +484,12 @@ void vout_DestroyPicture( vout_thread_t *p_vout, picture_t *p_pic ) ...@@ -484,12 +484,12 @@ void vout_DestroyPicture( vout_thread_t *p_vout, picture_t *p_pic )
#endif #endif
} }
/******************************************************************************* /******************************************************************************
* vout_LinkPicture: increment reference counter of a picture * vout_LinkPicture: increment reference counter of a picture
******************************************************************************* ******************************************************************************
* This function increment the reference counter of a picture in the video * This function increment the reference counter of a picture in the video
* heap. It needs a lock since several producer threads can access the picture. * heap. It needs a lock since several producer threads can access the picture.
*******************************************************************************/ ******************************************************************************/
void vout_LinkPicture( vout_thread_t *p_vout, picture_t *p_pic ) void vout_LinkPicture( vout_thread_t *p_vout, picture_t *p_pic )
{ {
vlc_mutex_lock( &p_vout->picture_lock ); vlc_mutex_lock( &p_vout->picture_lock );
...@@ -502,11 +502,11 @@ void vout_LinkPicture( vout_thread_t *p_vout, picture_t *p_pic ) ...@@ -502,11 +502,11 @@ void vout_LinkPicture( vout_thread_t *p_vout, picture_t *p_pic )
vlc_mutex_unlock( &p_vout->picture_lock ); vlc_mutex_unlock( &p_vout->picture_lock );
} }
/******************************************************************************* /******************************************************************************
* vout_UnlinkPicture: decrement reference counter of a picture * vout_UnlinkPicture: decrement reference counter of a picture
******************************************************************************* ******************************************************************************
* This function decrement the reference counter of a picture in the video heap. * This function decrement the reference counter of a picture in the video heap.
*******************************************************************************/ ******************************************************************************/
void vout_UnlinkPicture( vout_thread_t *p_vout, picture_t *p_pic ) void vout_UnlinkPicture( vout_thread_t *p_vout, picture_t *p_pic )
{ {
vlc_mutex_lock( &p_vout->picture_lock ); vlc_mutex_lock( &p_vout->picture_lock );
...@@ -534,16 +534,16 @@ void vout_UnlinkPicture( vout_thread_t *p_vout, picture_t *p_pic ) ...@@ -534,16 +534,16 @@ void vout_UnlinkPicture( vout_thread_t *p_vout, picture_t *p_pic )
/* following functions are local */ /* following functions are local */
/******************************************************************************* /******************************************************************************
* InitThread: initialize video output thread * InitThread: initialize video output thread
******************************************************************************* ******************************************************************************
* This function is called from RunThread and performs the second step of the * This function is called from RunThread and performs the second step of the
* initialization. It returns 0 on success. Note that the thread's flag are not * initialization. It returns 0 on success. Note that the thread's flag are not
* modified inside this function. * modified inside this function.
*******************************************************************************/ ******************************************************************************/
static int InitThread( vout_thread_t *p_vout ) static int InitThread( vout_thread_t *p_vout )
{ {
int i_index; /* generic index */ int i_index; /* generic index */
/* Update status */ /* Update status */
intf_DbgMsg("\n"); intf_DbgMsg("\n");
...@@ -579,20 +579,20 @@ static int InitThread( vout_thread_t *p_vout ) ...@@ -579,20 +579,20 @@ static int InitThread( vout_thread_t *p_vout )
return( 0 ); return( 0 );
} }
/******************************************************************************* /******************************************************************************
* RunThread: video output thread * RunThread: video output thread
******************************************************************************* ******************************************************************************
* Video output thread. This function does only returns when the thread is * Video output thread. This function does only returns when the thread is
* terminated. It handles the pictures arriving in the video heap and the * terminated. It handles the pictures arriving in the video heap and the
* display device events. * display device events.
*******************************************************************************/ ******************************************************************************/
static void RunThread( vout_thread_t *p_vout) static void RunThread( vout_thread_t *p_vout)
{ {
int i_picture; /* picture index */ int i_picture; /* picture index */
mtime_t current_date; /* current date */ mtime_t current_date; /* current date */
mtime_t pic_date = 0; /* picture date */ mtime_t pic_date = 0; /* picture date */
boolean_t b_display; /* display flag */ boolean_t b_display; /* display flag */
picture_t * p_pic; /* picture pointer */ picture_t * p_pic; /* picture pointer */
/* /*
* Initialize thread and free configuration * Initialize thread and free configuration
...@@ -600,7 +600,7 @@ static void RunThread( vout_thread_t *p_vout) ...@@ -600,7 +600,7 @@ static void RunThread( vout_thread_t *p_vout)
p_vout->b_error = InitThread( p_vout ); p_vout->b_error = InitThread( p_vout );
if( p_vout->b_error ) if( p_vout->b_error )
{ {
free( p_vout ); /* destroy descriptor */ free( p_vout ); /* destroy descriptor */
return; return;
} }
intf_DbgMsg("\n"); intf_DbgMsg("\n");
...@@ -746,13 +746,13 @@ static void RunThread( vout_thread_t *p_vout) ...@@ -746,13 +746,13 @@ static void RunThread( vout_thread_t *p_vout)
intf_DbgMsg( "thread end\n" ); intf_DbgMsg( "thread end\n" );
} }
/******************************************************************************* /******************************************************************************
* ErrorThread: RunThread() error loop * ErrorThread: RunThread() error loop
******************************************************************************* ******************************************************************************
* This function is called when an error occured during thread main's loop. The * This function is called when an error occured during thread main's loop. The
* thread can still receive feed, but must be ready to terminate as soon as * thread can still receive feed, but must be ready to terminate as soon as
* possible. * possible.
*******************************************************************************/ ******************************************************************************/
static void ErrorThread( vout_thread_t *p_vout ) static void ErrorThread( vout_thread_t *p_vout )
{ {
/* Wait until a `die' order */ /* Wait until a `die' order */
...@@ -764,15 +764,15 @@ static void ErrorThread( vout_thread_t *p_vout ) ...@@ -764,15 +764,15 @@ static void ErrorThread( vout_thread_t *p_vout )
} }
} }
/******************************************************************************* /******************************************************************************
* EndThread: thread destruction * EndThread: thread destruction
******************************************************************************* ******************************************************************************
* This function is called when the thread ends after a sucessfull * This function is called when the thread ends after a sucessfull
* initialization. * initialization.
*******************************************************************************/ ******************************************************************************/
static void EndThread( vout_thread_t *p_vout ) static void EndThread( vout_thread_t *p_vout )
{ {
int * pi_status; /* thread status */ int * pi_status; /* thread status */
int i_picture; int i_picture;
/* Store status */ /* Store status */
...@@ -801,18 +801,18 @@ static void EndThread( vout_thread_t *p_vout ) ...@@ -801,18 +801,18 @@ static void EndThread( vout_thread_t *p_vout )
*pi_status = THREAD_OVER; *pi_status = THREAD_OVER;
} }
/******************************************************************************* /******************************************************************************
* RenderBlank: render a blank screen * RenderBlank: render a blank screen
******************************************************************************* ******************************************************************************
* This function is called by all other rendering functions when they arrive on * This function is called by all other rendering functions when they arrive on
* a non blanked screen. * a non blanked screen.
*******************************************************************************/ ******************************************************************************/
static void RenderBlank( vout_thread_t *p_vout ) static void RenderBlank( vout_thread_t *p_vout )
{ {
//?? toooooo slow //?? toooooo slow
int i_index; /* current 64 bits sample */ int i_index; /* current 64 bits sample */
int i_width; /* number of 64 bits samples */ int i_width; /* number of 64 bits samples */
u64 *p_pic; /* pointer to 64 bits samples */ u64 *p_pic; /* pointer to 64 bits samples */
/* Initialize variables */ /* Initialize variables */
p_pic = vout_SysGetPicture( p_vout ); p_pic = vout_SysGetPicture( p_vout );
...@@ -844,22 +844,22 @@ static void RenderBlank( vout_thread_t *p_vout ) ...@@ -844,22 +844,22 @@ static void RenderBlank( vout_thread_t *p_vout )
} }
/******************************************************************************* /******************************************************************************
* RenderPicture: render a picture * RenderPicture: render a picture
******************************************************************************* ******************************************************************************
* This function convert a picture from a video heap to a pixel-encoded image * This function convert a picture from a video heap to a pixel-encoded image
* and copy it to the current rendering buffer. No lock is required, since the * and copy it to the current rendering buffer. No lock is required, since the
* rendered picture has been determined as existant, and will only be destroyed * rendered picture has been determined as existant, and will only be destroyed
* by the vout thread later. * by the vout thread later.
*******************************************************************************/ ******************************************************************************/
static int RenderPicture( vout_thread_t *p_vout, picture_t *p_pic, boolean_t b_blank ) static int RenderPicture( vout_thread_t *p_vout, picture_t *p_pic, boolean_t b_blank )
{ {
int i_display_height, i_display_width; /* display dimensions */ int i_display_height, i_display_width; /* display dimensions */
int i_height, i_width; /* source picture dimensions */ int i_height, i_width; /* source picture dimensions */
int i_scaled_height; /* scaled height of the picture */ int i_scaled_height; /* scaled height of the picture */
int i_aspect_scale; /* aspect ratio vertical scale */ int i_aspect_scale; /* aspect ratio vertical scale */
int i_eol; /* end of line offset for source */ int i_eol; /* end of line offset for source */
byte_t * p_convert_dst; /* convertion destination */ byte_t * p_convert_dst; /* convertion destination */
#ifdef STATS #ifdef STATS
/* Start recording render time */ /* Start recording render time */
...@@ -953,15 +953,15 @@ static int RenderPicture( vout_thread_t *p_vout, picture_t *p_pic, boolean_t b_b ...@@ -953,15 +953,15 @@ static int RenderPicture( vout_thread_t *p_vout, picture_t *p_pic, boolean_t b_b
return( 1 ); return( 1 );
} }
/******************************************************************************* /******************************************************************************
* RenderPictureInfo: print additionnal informations on a picture * RenderPictureInfo: print additionnal informations on a picture
******************************************************************************* ******************************************************************************
* This function will print informations such as fps and other picture * This function will print informations such as fps and other picture
* dependant informations. * dependant informations.
*******************************************************************************/ ******************************************************************************/
static int RenderPictureInfo( vout_thread_t *p_vout, picture_t *p_pic, boolean_t b_blank ) static int RenderPictureInfo( vout_thread_t *p_vout, picture_t *p_pic, boolean_t b_blank )
{ {
char psz_buffer[256]; /* string buffer */ char psz_buffer[256]; /* string buffer */
#ifdef STATS #ifdef STATS
/* /*
...@@ -1004,11 +1004,11 @@ static int RenderPictureInfo( vout_thread_t *p_vout, picture_t *p_pic, boolean_t ...@@ -1004,11 +1004,11 @@ static int RenderPictureInfo( vout_thread_t *p_vout, picture_t *p_pic, boolean_t
return( 0 ); return( 0 );
} }
/******************************************************************************* /******************************************************************************
* RenderIdle: render idle picture * RenderIdle: render idle picture
******************************************************************************* ******************************************************************************
* This function will clear the display or print a logo. * This function will clear the display or print a logo.
*******************************************************************************/ ******************************************************************************/
static int RenderIdle( vout_thread_t *p_vout, boolean_t b_blank ) static int RenderIdle( vout_thread_t *p_vout, boolean_t b_blank )
{ {
/* Blank screen if required */ /* Blank screen if required */
...@@ -1026,19 +1026,19 @@ static int RenderIdle( vout_thread_t *p_vout, boolean_t b_blank ) ...@@ -1026,19 +1026,19 @@ static int RenderIdle( vout_thread_t *p_vout, boolean_t b_blank )
return( 0 ); return( 0 );
} }
/******************************************************************************* /******************************************************************************
* RenderInfo: render additionnal informations * RenderInfo: render additionnal informations
******************************************************************************* ******************************************************************************
* This function render informations which do not depend of the current picture * This function render informations which do not depend of the current picture
* rendered. * rendered.
*******************************************************************************/ ******************************************************************************/
static int RenderInfo( vout_thread_t *p_vout, boolean_t b_blank ) static int RenderInfo( vout_thread_t *p_vout, boolean_t b_blank )
{ {
char psz_buffer[256]; /* string buffer */ char psz_buffer[256]; /* string buffer */
#ifdef DEBUG #ifdef DEBUG
int i_ready_pic = 0; /* ready pictures */ int i_ready_pic = 0; /* ready pictures */
int i_reserved_pic = 0; /* reserved pictures */ int i_reserved_pic = 0; /* reserved pictures */
int i_picture; /* picture index */ int i_picture; /* picture index */
#endif #endif
#ifdef DEBUG #ifdef DEBUG
...@@ -1068,11 +1068,11 @@ static int RenderInfo( vout_thread_t *p_vout, boolean_t b_blank ) ...@@ -1068,11 +1068,11 @@ static int RenderInfo( vout_thread_t *p_vout, boolean_t b_blank )
return( 0 ); return( 0 );
} }
/******************************************************************************* /******************************************************************************
* Manage: manage thread * Manage: manage thread
******************************************************************************* ******************************************************************************
* This function will handle changes in thread configuration. * This function will handle changes in thread configuration.
*******************************************************************************/ ******************************************************************************/
static int Manage( vout_thread_t *p_vout ) static int Manage( vout_thread_t *p_vout )
{ {
/* On gamma or grayscale change, rebuild tables */ /* On gamma or grayscale change, rebuild tables */
......
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