Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc
Commits
665782c8
Commit
665782c8
authored
Jan 21, 2000
by
Sam Hocevar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
l'output framebuffer fonctionne presque.
ca va *pas* merder.
parent
4ffdf05c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
247 additions
and
232 deletions
+247
-232
src/video_output/video_fb.c
src/video_output/video_fb.c
+146
-131
src/video_output/video_output.c
src/video_output/video_output.c
+101
-101
No files found.
src/video_output/video_fb.c
View file @
665782c8
/******************************************************************************
*
* vout_fb.c: framebuffer video output display method
/******************************************************************************
* vout_fb.c:
Linux
framebuffer video output display method
* (c)1998 VideoLAN
******************************************************************************
*
/
******************************************************************************/
/******************************************************************************
*
/******************************************************************************
* Preamble
*******************************************************************************/
******************************************************************************/
#include <errno.h>
#include <fcntl.h>
...
...
@@ -32,208 +31,219 @@
#include "intf_msg.h"
#include "main.h"
/******************************************************************************
*
/******************************************************************************
* vout_sys_t: video output framebuffer method descriptor
******************************************************************************
*
******************************************************************************
* This structure is part of the video output thread descriptor.
* It describes the FB specific properties of an output thread. FB video
* output is performed through regular resizable windows. Windows can be
* dynamically resized to adapt to the size of the streams.
*******************************************************************************/
* It describes the FB specific properties of an output thread.
******************************************************************************/
typedef
struct
vout_sys_s
{
{
/* System informations */
int
i_fb_dev
;
/* framebuffer device handle */
size_t
i_page_size
;
/* page size */
int
i_fb_dev
;
/* framebuffer device handle */
size_t
i_page_size
;
/* page size */
struct
fb_var_screeninfo
var_info
;
/* framebuffer mode informations */
/* 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
;
/******************************************************************************
*
/******************************************************************************
* Local prototypes
******************************************************************************
*
/
******************************************************************************/
static
int
FBOpenDisplay
(
vout_thread_t
*
p_vout
);
static
void
FBCloseDisplay
(
vout_thread_t
*
p_vout
);
/*******************************************************************************
* vout_SysCreate: allocate framebuffer video thread output method
*******************************************************************************
* This function allocate and initialize a framebuffer vout method.
*******************************************************************************/
int
vout_SysCreate
(
vout_thread_t
*
p_vout
)
{
/******************************************************************************
* vout_SysCreate: allocates FB video thread output method
******************************************************************************
* This function allocates and initializes a FB vout method.
******************************************************************************/
int
vout_SysCreate
(
vout_thread_t
*
p_vout
,
char
*
psz_display
,
int
i_root_window
)
{
/* 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
)
{
intf_ErrMsg
(
"
vout
error: %s
\n
"
,
strerror
(
ENOMEM
)
);
{
intf_ErrMsg
(
"error: %s
\n
"
,
strerror
(
ENOMEM
)
);
return
(
1
);
}
/* Open and initialize device */
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
);
return
(
1
);
return
(
1
);
}
return
(
0
);
}
/*******************************************************************************
* vout_SysInit: initialize Sys video thread output method
*******************************************************************************
* This function initialize the framebuffer device.
*******************************************************************************/
/******************************************************************************
* vout_SysInit: initialize framebuffer video thread output method
******************************************************************************
* 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
)
{
// 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
);
}
/*******************************************************************************
* vout_SysEnd: terminate Sys video thread output method
*******************************************************************************
* Terminate an output method created by vout_SysCreateOutputMethod
*******************************************************************************/
/******************************************************************************
* vout_SysEnd: terminate FB video thread output method
******************************************************************************
* 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
)
{
intf_DbgMsg
(
"%p
\n
"
,
p_vout
);
//??
}
/******************************************************************************
*
* vout_SysDestroy: destroy
Sys
video thread output method
******************************************************************************
*
* Terminate an output method created by vout_
Sys
CreateOutputMethod
******************************************************************************
*
/
/******************************************************************************
* vout_SysDestroy: destroy
FB
video thread output method
******************************************************************************
* Terminate an output method created by vout_
FB
CreateOutputMethod
******************************************************************************/
void
vout_SysDestroy
(
vout_thread_t
*
p_vout
)
{
FBCloseDisplay
(
p_vout
);
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
* Sys events and allows window resizing. 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.
*******************************************************************************
* Messages type: vout, major code: 103
*******************************************************************************/
* console events and allows screen resizing. It returns a non null value on
* error.
******************************************************************************/
int
vout_SysManage
(
vout_thread_t
*
p_vout
)
{
/
/??
return
(
0
)
;
/
* XXX */
return
0
;
}
/******************************************************************************
*
/******************************************************************************
* vout_SysDisplay: displays previously rendered output
******************************************************************************
*
* This function send the currently rendered image to
Sys server, wait
until
* it is displayed and switch the two rendering buffer, preparing next frame.
******************************************************************************
*
/
******************************************************************************
* This function send the currently rendered image to
FB image, waits
until
* it is displayed and switch the two rendering buffer
s
, preparing next frame.
******************************************************************************/
void
vout_SysDisplay
(
vout_thread_t
*
p_vout
)
{
/* 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
*******************************************************************************
* 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
)
******************************************************************************
* This function returns the address of the current display buffer.
******************************************************************************/
void
*
vout_SysGetPicture
(
vout_thread_t
*
p_vout
)
{
*
pi_eol_offset
=
p_vout
->
i_width
;
//????
// return( p_vout->p_sys->p_ximage[ p_vout->p_sys->i_buffer_index ].data );
return
(
p_vout
->
p_sys
->
p_image
[
p_vout
->
p_sys
->
i_buffer_index
]
);
}
/* following functions are local */
/******************************************************************************
*
/******************************************************************************
* FBOpenDisplay: open and initialize framebuffer device
******************************************************************************
*
******************************************************************************
* ?? 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
* 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
)
{
char
*
psz_device
;
/* framebuffer device path */
struct
fb_fix_screeninfo
fix_info
;
/* framebuffer fix information */
struct
fb_var_screeninfo
var_info
;
/* frambuffer mode informations */
/* 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
);
if
(
p_vout
->
p_sys
->
i_fb_dev
==
-
1
)
{
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
// ?? change to the most appropriate mode...
/* 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
)
);
close
(
p_vout
->
p_sys
->
i_fb_dev
);
close
(
p_vout
->
p_sys
->
i_fb_dev
);
return
(
1
);
}
/* Framebuffer must have some basic properties to be usable */
/* Framebuffer must have some basic properties to be usable */
//??
/* Set some attributes */
var_info
.
activate
=
FB_ACTIVATE_NXTOPEN
;
var_info
.
xoffset
=
0
;
var_info
.
yoffset
=
0
;
p_vout
->
p_sys
->
var_info
.
activate
=
FB_ACTIVATE_NXTOPEN
;
p_vout
->
p_sys
->
var_info
.
xoffset
=
0
;
p_vout
->
p_sys
->
var_info
.
yoffset
=
0
;
//??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
)
);
close
(
p_vout
->
p_sys
->
i_fb_dev
);
return
(
1
);
close
(
p_vout
->
p_sys
->
i_fb_dev
);
return
(
1
);
}
/* Get some informations again, in the definitive configuration */
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
)
);
// ?? restore fb config
close
(
p_vout
->
p_sys
->
i_fb_dev
);
close
(
p_vout
->
p_sys
->
i_fb_dev
);
return
(
1
);
}
p_vout
->
i_width
=
var_info
.
xres
;
p_vout
->
i_height
=
var_info
.
yres
;
p_vout
->
i_screen_depth
=
var_info
.
bits_per_pixel
;
p_vout
->
i_width
=
p_vout
->
p_sys
->
var_info
.
xres
;
p_vout
->
i_height
=
p_vout
->
p_sys
->
var_info
.
yres
;
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
)
{
case
15
:
/* 15 bpp (16bpp with a missing green bit) */
...
...
@@ -250,43 +260,48 @@ static int FBOpenDisplay( vout_thread_t *p_vout )
break
;
default:
/* unsupported screen depth */
intf_ErrMsg
(
"vout error: screen depth %i is not supported
\n
"
,
p_vout
->
i_screen_depth
);
intf_ErrMsg
(
"vout error: screen depth %i is not supported
\n
"
,
p_vout
->
i_screen_depth
);
return
(
1
);
break
;
}
p_vout
->
p_sys
->
i_page_size
=
var_info
.
xres
*
var_info
.
yres
*
p_vout
->
i_bytes_per_pixel
;
p_vout
->
p_sys
->
i_page_size
=
p_vout
->
p_sys
->
var_info
.
xres
*
p_vout
->
p_sys
->
var_info
.
yres
*
p_vout
->
i_bytes_per_pixel
;
/* 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
,
PROT_READ
|
PROT_WRITE
,
MAP_SHARED
,
p_vout
->
p_sys
->
p_video
=
mmap
(
0
,
p_vout
->
p_sys
->
i_page_size
*
2
,
PROT_READ
|
PROT_WRITE
,
MAP_SHARED
,
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
)
);
// ?? restore fb config
close
(
p_vout
->
p_sys
->
i_fb_dev
);
return
(
1
);
return
(
1
);
}
intf_DbgMsg
(
"framebuffer type=%d, visual=%d, ypanstep=%d, ywrap=%d, accel=%d
\n
"
,
p_vout
->
p_sys
->
p_image
[
0
]
=
p_vout
->
p_sys
->
p_video
;
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
);
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
);
return
(
0
);
}
fix_info
.
id
,
p_vout
->
i_width
,
p_vout
->
i_height
,
p_vout
->
i_screen_depth
);
/*******************************************************************************
return
(
0
);
}
/******************************************************************************
* FBCloseDisplay: close and reset framebuffer device
******************************************************************************
*
*
This function returns all resources allocated by FBOpenDisplay and restore
*
the original
state of the device.
******************************************************************************
*
/
******************************************************************************
*
Returns all resources allocated by FBOpenDisplay and restore the original
* state of the device.
******************************************************************************/
static
void
FBCloseDisplay
(
vout_thread_t
*
p_vout
)
{
//?? unmap memory
//?? restore original mode
close
(
p_vout
->
p_sys
->
i_fb_dev
);
// Free font info
free
(
p_vout
->
p_sys
->
pi_font
);
// Destroy window and close display
close
(
p_vout
->
p_sys
->
i_fb_dev
);
}
src/video_output/video_output.c
View file @
665782c8
/******************************************************************************
*
/******************************************************************************
* video_output.c : video output thread
* (c)2000 VideoLAN
******************************************************************************
*
******************************************************************************
* 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.
******************************************************************************
*
/
******************************************************************************/
/******************************************************************************
*
/******************************************************************************
* Preamble
******************************************************************************
*
/
******************************************************************************/
#include <errno.h>
#include <stdlib.h>
#include <stdio.h>
...
...
@@ -26,9 +26,9 @@
#include "intf_msg.h"
#include "main.h"
/******************************************************************************
*
/******************************************************************************
* Local prototypes
******************************************************************************
*
/
******************************************************************************/
static
int
InitThread
(
vout_thread_t
*
p_vout
);
static
void
RunThread
(
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
static
int
RenderInfo
(
vout_thread_t
*
p_vout
,
boolean_t
b_balnk
);
static
int
Manage
(
vout_thread_t
*
p_vout
);
/******************************************************************************
*
/******************************************************************************
* vout_CreateThread: creates a new video output thread
******************************************************************************
*
******************************************************************************
* This function creates a new video output thread, and returns a pointer
* to its description. On error, it returns NULL.
* 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.
******************************************************************************
*
/
******************************************************************************/
vout_thread_t
*
vout_CreateThread
(
char
*
psz_display
,
int
i_root_window
,
int
i_width
,
int
i_height
,
int
*
pi_status
)
{
vout_thread_t
*
p_vout
;
/* thread descriptor */
int
i_status
;
/* thread status */
vout_thread_t
*
p_vout
;
/* thread descriptor */
int
i_status
;
/* thread status */
/* Allocate descriptor */
intf_DbgMsg
(
"
\n
"
);
...
...
@@ -143,17 +143,17 @@ vout_thread_t * vout_CreateThread ( char *psz_display, int i_root_
return
(
p_vout
);
}
/******************************************************************************
*
/******************************************************************************
* vout_DestroyThread: destroys a previously created thread
******************************************************************************
*
******************************************************************************
* Destroy a terminated thread.
* 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
* update using one of the THREAD_* constants.
******************************************************************************
*
/
******************************************************************************/
void
vout_DestroyThread
(
vout_thread_t
*
p_vout
,
int
*
pi_status
)
{
int
i_status
;
/* thread status */
int
i_status
;
/* thread status */
/* Set status */
intf_DbgMsg
(
"
\n
"
);
...
...
@@ -174,18 +174,18 @@ void vout_DestroyThread( vout_thread_t *p_vout, int *pi_status )
}
}
/******************************************************************************
*
/******************************************************************************
* vout_DisplaySubtitle: display a subtitle
******************************************************************************
*
******************************************************************************
* 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
* the output thread if is reserved.
******************************************************************************
*
/
******************************************************************************/
void
vout_DisplaySubtitle
(
vout_thread_t
*
p_vout
,
subtitle_t
*
p_sub
)
{
#ifdef DEBUG_VIDEO
char
psz_begin_date
[
MSTRTIME_MAX_SIZE
];
/* buffer for date string */
char
psz_end_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 */
#endif
#ifdef DEBUG
...
...
@@ -207,28 +207,28 @@ void vout_DisplaySubtitle( vout_thread_t *p_vout, subtitle_t *p_sub )
#endif
}
/******************************************************************************
*
/******************************************************************************
* vout_CreateSubtitle: allocate a 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
* already allocated zone of memory in the subtitle data fields. It needs locking
* since several pictures can be created by several producers threads.
******************************************************************************
*
/
******************************************************************************/
subtitle_t
*
vout_CreateSubtitle
(
vout_thread_t
*
p_vout
,
int
i_type
,
int
i_size
)
{
//???
}
/******************************************************************************
*
/******************************************************************************
* vout_DestroySubtitle: remove a permanent or reserved subtitle from the heap
******************************************************************************
*
******************************************************************************
* This function frees a previously reserved subtitle.
* 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
* the output thread.
******************************************************************************
*
/
******************************************************************************/
void
vout_DestroySubtitle
(
vout_thread_t
*
p_vout
,
subtitle_t
*
p_sub
)
{
#ifdef DEBUG
...
...
@@ -246,13 +246,13 @@ void vout_DestroySubtitle( vout_thread_t *p_vout, subtitle_t *p_sub )
#endif
}
/******************************************************************************
*
/******************************************************************************
* vout_DisplayPicture: display a picture
******************************************************************************
*
******************************************************************************
* 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
* called.
******************************************************************************
*
/
******************************************************************************/
void
vout_DisplayPicture
(
vout_thread_t
*
p_vout
,
picture_t
*
p_pic
)
{
vlc_mutex_lock
(
&
p_vout
->
picture_lock
);
...
...
@@ -278,13 +278,13 @@ void vout_DisplayPicture( vout_thread_t *p_vout, picture_t *p_pic )
vlc_mutex_unlock
(
&
p_vout
->
picture_lock
);
}
/******************************************************************************
*
/******************************************************************************
* vout_DatePicture: date a picture
******************************************************************************
*
******************************************************************************
* 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
* called.
******************************************************************************
*
/
******************************************************************************/
void
vout_DatePicture
(
vout_thread_t
*
p_vout
,
picture_t
*
p_pic
,
mtime_t
date
)
{
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 )
vlc_mutex_unlock
(
&
p_vout
->
picture_lock
);
}
/******************************************************************************
*
/******************************************************************************
* vout_CreatePicture: allocate a picture 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
* already allocated zone of memory in the picture data fields. It needs locking
* since several pictures can be created by several producers threads.
******************************************************************************
*
/
******************************************************************************/
picture_t
*
vout_CreatePicture
(
vout_thread_t
*
p_vout
,
int
i_type
,
int
i_width
,
int
i_height
)
{
int
i_picture
;
/* picture index */
int
i_chroma_width
=
0
;
/* chroma width */
picture_t
*
p_free_picture
=
NULL
;
/* first free picture */
picture_t
*
p_destroyed_picture
=
NULL
;
/* first destroyed picture */
int
i_picture
;
/* picture index */
int
i_chroma_width
=
0
;
/* chroma width */
picture_t
*
p_free_picture
=
NULL
;
/* first free picture */
picture_t
*
p_destroyed_picture
=
NULL
;
/* first destroyed picture */
/* Get lock */
vlc_mutex_lock
(
&
p_vout
->
picture_lock
);
...
...
@@ -456,15 +456,15 @@ picture_t *vout_CreatePicture( vout_thread_t *p_vout, int i_type,
return
(
NULL
);
}
/******************************************************************************
*
/******************************************************************************
* vout_DestroyPicture: remove a permanent or reserved picture from the heap
******************************************************************************
*
******************************************************************************
* This function frees a previously reserved picture or a permanent
* 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 !
* This function does not need locking since reserved pictures are ignored by
* the output thread.
******************************************************************************
*
/
******************************************************************************/
void
vout_DestroyPicture
(
vout_thread_t
*
p_vout
,
picture_t
*
p_pic
)
{
#ifdef DEBUG
...
...
@@ -484,12 +484,12 @@ void vout_DestroyPicture( vout_thread_t *p_vout, picture_t *p_pic )
#endif
}
/******************************************************************************
*
/******************************************************************************
* vout_LinkPicture: increment reference counter of a picture
******************************************************************************
*
******************************************************************************
* 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.
******************************************************************************
*
/
******************************************************************************/
void
vout_LinkPicture
(
vout_thread_t
*
p_vout
,
picture_t
*
p_pic
)
{
vlc_mutex_lock
(
&
p_vout
->
picture_lock
);
...
...
@@ -502,11 +502,11 @@ void vout_LinkPicture( vout_thread_t *p_vout, picture_t *p_pic )
vlc_mutex_unlock
(
&
p_vout
->
picture_lock
);
}
/******************************************************************************
*
/******************************************************************************
* vout_UnlinkPicture: decrement reference counter of a picture
******************************************************************************
*
******************************************************************************
* 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
)
{
vlc_mutex_lock
(
&
p_vout
->
picture_lock
);
...
...
@@ -534,16 +534,16 @@ void vout_UnlinkPicture( vout_thread_t *p_vout, picture_t *p_pic )
/* following functions are local */
/******************************************************************************
*
/******************************************************************************
* InitThread: initialize video output thread
******************************************************************************
*
******************************************************************************
* 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
* modified inside this function.
******************************************************************************
*
/
******************************************************************************/
static
int
InitThread
(
vout_thread_t
*
p_vout
)
{
int
i_index
;
/* generic index */
int
i_index
;
/* generic index */
/* Update status */
intf_DbgMsg
(
"
\n
"
);
...
...
@@ -579,20 +579,20 @@ static int InitThread( vout_thread_t *p_vout )
return
(
0
);
}
/******************************************************************************
*
/******************************************************************************
* RunThread: video output thread
******************************************************************************
*
******************************************************************************
* Video output thread. This function does only returns when the thread is
* terminated. It handles the pictures arriving in the video heap and the
* display device events.
******************************************************************************
*
/
******************************************************************************/
static
void
RunThread
(
vout_thread_t
*
p_vout
)
{
int
i_picture
;
/* picture index */
mtime_t
current_date
;
/* current date */
mtime_t
pic_date
=
0
;
/* picture date */
boolean_t
b_display
;
/* display flag */
picture_t
*
p_pic
;
/* picture pointer */
int
i_picture
;
/* picture index */
mtime_t
current_date
;
/* current date */
mtime_t
pic_date
=
0
;
/* picture date */
boolean_t
b_display
;
/* display flag */
picture_t
*
p_pic
;
/* picture pointer */
/*
* Initialize thread and free configuration
...
...
@@ -600,7 +600,7 @@ static void RunThread( vout_thread_t *p_vout)
p_vout
->
b_error
=
InitThread
(
p_vout
);
if
(
p_vout
->
b_error
)
{
free
(
p_vout
);
/* destroy descriptor */
free
(
p_vout
);
/* destroy descriptor */
return
;
}
intf_DbgMsg
(
"
\n
"
);
...
...
@@ -746,13 +746,13 @@ static void RunThread( vout_thread_t *p_vout)
intf_DbgMsg
(
"thread end
\n
"
);
}
/******************************************************************************
*
/******************************************************************************
* ErrorThread: RunThread() error loop
******************************************************************************
*
******************************************************************************
* 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
* possible.
******************************************************************************
*
/
******************************************************************************/
static
void
ErrorThread
(
vout_thread_t
*
p_vout
)
{
/* Wait until a `die' order */
...
...
@@ -764,15 +764,15 @@ static void ErrorThread( vout_thread_t *p_vout )
}
}
/******************************************************************************
*
/******************************************************************************
* EndThread: thread destruction
******************************************************************************
*
******************************************************************************
* This function is called when the thread ends after a sucessfull
* initialization.
******************************************************************************
*
/
******************************************************************************/
static
void
EndThread
(
vout_thread_t
*
p_vout
)
{
int
*
pi_status
;
/* thread status */
int
*
pi_status
;
/* thread status */
int
i_picture
;
/* Store status */
...
...
@@ -801,18 +801,18 @@ static void EndThread( vout_thread_t *p_vout )
*
pi_status
=
THREAD_OVER
;
}
/******************************************************************************
*
/******************************************************************************
* RenderBlank: render a blank screen
******************************************************************************
*
******************************************************************************
* This function is called by all other rendering functions when they arrive on
* a non blanked screen.
******************************************************************************
*
/
******************************************************************************/
static
void
RenderBlank
(
vout_thread_t
*
p_vout
)
{
//?? toooooo slow
int
i_index
;
/* current 64 bits sample */
int
i_width
;
/* number of 64 bits samples */
u64
*
p_pic
;
/* pointer to 64 bits samples */
int
i_index
;
/* current 64 bits sample */
int
i_width
;
/* number of 64 bits samples */
u64
*
p_pic
;
/* pointer to 64 bits samples */
/* Initialize variables */
p_pic
=
vout_SysGetPicture
(
p_vout
);
...
...
@@ -844,22 +844,22 @@ static void RenderBlank( vout_thread_t *p_vout )
}
/******************************************************************************
*
/******************************************************************************
* RenderPicture: render a picture
******************************************************************************
*
******************************************************************************
* 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
* rendered picture has been determined as existant, and will only be destroyed
* by the vout thread later.
******************************************************************************
*
/
******************************************************************************/
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_height
,
i_width
;
/* source picture dimensions */
int
i_scaled_height
;
/* scaled height of the picture */
int
i_aspect_scale
;
/* aspect ratio vertical scale */
int
i_eol
;
/* end of line offset for source */
byte_t
*
p_convert_dst
;
/* convertion destination */
int
i_display_height
,
i_display_width
;
/* display dimensions */
int
i_height
,
i_width
;
/* source picture dimensions */
int
i_scaled_height
;
/* scaled height of the picture */
int
i_aspect_scale
;
/* aspect ratio vertical scale */
int
i_eol
;
/* end of line offset for source */
byte_t
*
p_convert_dst
;
/* convertion destination */
#ifdef STATS
/* Start recording render time */
...
...
@@ -953,15 +953,15 @@ static int RenderPicture( vout_thread_t *p_vout, picture_t *p_pic, boolean_t b_b
return
(
1
);
}
/******************************************************************************
*
/******************************************************************************
* RenderPictureInfo: print additionnal informations on a picture
******************************************************************************
*
******************************************************************************
* This function will print informations such as fps and other picture
* dependant informations.
******************************************************************************
*
/
******************************************************************************/
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
/*
...
...
@@ -1004,11 +1004,11 @@ static int RenderPictureInfo( vout_thread_t *p_vout, picture_t *p_pic, boolean_t
return
(
0
);
}
/******************************************************************************
*
/******************************************************************************
* RenderIdle: render idle picture
******************************************************************************
*
******************************************************************************
* This function will clear the display or print a logo.
******************************************************************************
*
/
******************************************************************************/
static
int
RenderIdle
(
vout_thread_t
*
p_vout
,
boolean_t
b_blank
)
{
/* Blank screen if required */
...
...
@@ -1026,19 +1026,19 @@ static int RenderIdle( vout_thread_t *p_vout, boolean_t b_blank )
return
(
0
);
}
/******************************************************************************
*
/******************************************************************************
* RenderInfo: render additionnal informations
******************************************************************************
*
******************************************************************************
* This function render informations which do not depend of the current picture
* rendered.
******************************************************************************
*
/
******************************************************************************/
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
int
i_ready_pic
=
0
;
/* ready pictures */
int
i_reserved_pic
=
0
;
/* reserved pictures */
int
i_picture
;
/* picture index */
int
i_ready_pic
=
0
;
/* ready pictures */
int
i_reserved_pic
=
0
;
/* reserved pictures */
int
i_picture
;
/* picture index */
#endif
#ifdef DEBUG
...
...
@@ -1068,11 +1068,11 @@ static int RenderInfo( vout_thread_t *p_vout, boolean_t b_blank )
return
(
0
);
}
/******************************************************************************
*
/******************************************************************************
* Manage: manage thread
******************************************************************************
*
******************************************************************************
* This function will handle changes in thread configuration.
******************************************************************************
*
/
******************************************************************************/
static
int
Manage
(
vout_thread_t
*
p_vout
)
{
/* On gamma or grayscale change, rebuild tables */
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment