* @{
*/
+/**
+ * Video ouput thread private structure
+ */
+typedef struct vout_thread_sys_t vout_thread_sys_t;
+
/**
* Video output thread descriptor
*
/**@{*/
vlc_mutex_t picture_lock; /**< picture heap lock */
vlc_mutex_t change_lock; /**< thread change lock */
- vlc_mutex_t vfilter_lock; /**< video filter2 change lock */
vout_sys_t * p_sys; /**< system output method */
/**@}*/
/**@{*/
uint16_t i_changes; /**< changes made to the thread.
\see \ref vout_changes */
- float f_gamma; /**< gamma */
- bool b_grayscale; /**< color or grayscale display */
- bool b_info; /**< print additional information */
- bool b_interface; /**< render interface */
bool b_scale; /**< allow picture scaling */
bool b_fullscreen; /**< toogle fullscreen display */
- uint32_t render_time; /**< last picture render time */
unsigned int i_window_width; /**< video window width */
unsigned int i_window_height; /**< video window height */
unsigned int i_alignment; /**< video alignment in window */
- unsigned int i_par_num; /**< monitor pixel aspect-ratio */
- unsigned int i_par_den; /**< monitor pixel aspect-ratio */
struct vout_window_t *p_window; /**< window for embedded vout (if any) */
/**@}*/
int ( *pf_control ) ( vout_thread_t *, int, va_list );
/**@}*/
- /** \name Statistics
- * These numbers are not supposed to be accurate, but are a
- * good indication of the thread status */
- /**@{*/
- count_t c_fps_samples; /**< picture counts */
- mtime_t p_fps_sample[VOUT_FPS_SAMPLES]; /**< FPS samples dates */
- /**@}*/
-
/** \name Video heap and translation tables */
/**@{*/
int i_heap_size; /**< heap size */
picture_heap_t render; /**< rendered pictures */
picture_heap_t output; /**< direct buffers */
- bool b_direct; /**< rendered are like direct ? */
- filter_t *p_chroma; /**< translation tables */
video_format_t fmt_render; /* render format (from the decoder) */
video_format_t fmt_in; /* input (modified render) format */
/* Subpicture unit */
spu_t *p_spu;
- /* Statistics */
- count_t c_loops;
- count_t c_pictures, c_late_pictures;
- mtime_t display_jitter; /**< average deviation from the PTS */
- count_t c_jitter_samples; /**< number of samples used
- for the calculation of the
- jitter */
- /** delay created by internal caching */
- int i_pts_delay;
-
- /* Filter chain */
- char *psz_filter_chain;
- bool b_filter_change;
-
- /* Video filter2 chain */
- filter_chain_t *p_vf2_chain;
- char *psz_vf2;
-
- /* Misc */
- bool b_snapshot; /**< take one snapshot on the next loop */
-
/* Video output configuration */
config_chain_t *p_cfg;
- /* Show media title on videoutput */
- bool b_title_show;
- mtime_t i_title_timeout;
- int i_title_position;
+ /* Private vout_thread data */
+ vout_thread_sys_t *p;
};
#define I_OUTPUTPICTURES p_vout->output.i_pictures
*/
/** b_info changed */
#define VOUT_INFO_CHANGE 0x0001
-/** b_grayscale changed */
-#define VOUT_GRAYSCALE_CHANGE 0x0002
/** b_interface changed */
#define VOUT_INTF_CHANGE 0x0004
/** b_scale changed */
#define VOUT_SCALE_CHANGE 0x0008
-/** gamma changed */
-#define VOUT_GAMMA_CHANGE 0x0010
/** b_cursor changed */
#define VOUT_CURSOR_CHANGE 0x0020
/** b_fullscreen changed */
/* We don't directly check for the "vout-filter" variable for obvious
* performance reasons. */
- if( p_vout->b_filter_change )
+ if( p_vout->p->b_filter_change )
{
var_Get( p_vout, "vout-filter", &val );
psz_filter_chain = val.psz_string;
free( psz_filter_chain );
psz_filter_chain = NULL;
}
- if( p_vout->psz_filter_chain && !*p_vout->psz_filter_chain )
+ if( p_vout->p->psz_filter_chain && !*p_vout->p->psz_filter_chain )
{
- free( p_vout->psz_filter_chain );
- p_vout->psz_filter_chain = NULL;
+ free( p_vout->p->psz_filter_chain );
+ p_vout->p->psz_filter_chain = NULL;
}
- if( !psz_filter_chain && !p_vout->psz_filter_chain )
+ if( !psz_filter_chain && !p_vout->p->psz_filter_chain )
{
- p_vout->b_filter_change = false;
+ p_vout->p->b_filter_change = false;
}
free( psz_filter_chain );
if( p_vout->fmt_render.i_chroma != p_fmt->i_chroma ||
p_vout->fmt_render.i_width != p_fmt->i_width ||
p_vout->fmt_render.i_height != p_fmt->i_height ||
- p_vout->b_filter_change )
+ p_vout->p->b_filter_change )
{
vlc_mutex_unlock( &p_vout->change_lock );
/* Display title if we are not using the vout given to vout_Request.
* XXX for now b_vout_provided is always true at this stage */
- if( p_vout->b_title_show && !b_vout_provided )
+ if( p_vout->p->b_title_show && !b_vout_provided )
DisplayTitleOnOSD( p_vout );
}
}
if( p_vout == NULL )
return NULL;
+ /* */
+ p_vout->p = calloc( 1, sizeof(p_vout->p) );
+ if( !p_vout->p )
+ {
+ vlc_object_release( p_vout );
+ return NULL;
+ }
+
/* Initialize pictures - translation tables and functions
* will be initialized later in InitThread */
for( i_index = 0; i_index < 2 * VOUT_MAX_PICTURES + 1; i_index++)
/* Initialize misc stuff */
p_vout->i_changes = 0;
- p_vout->f_gamma = 0;
- p_vout->b_grayscale = 0;
- p_vout->b_info = 0;
- p_vout->b_interface = 0;
p_vout->b_scale = 1;
p_vout->b_fullscreen = 0;
p_vout->i_alignment = 0;
- p_vout->render_time = 10;
- p_vout->c_fps_samples = 0;
- p_vout->b_filter_change = 0;
+ p_vout->p->render_time = 10;
+ p_vout->p->c_fps_samples = 0;
+ p_vout->p->b_filter_change = 0;
p_vout->pf_control = NULL;
p_vout->p_window = NULL;
- p_vout->i_par_num = p_vout->i_par_den = 1;
+ p_vout->p->i_par_num =
+ p_vout->p->i_par_den = 1;
/* Initialize locks */
vlc_mutex_init( &p_vout->picture_lock );
vlc_mutex_init( &p_vout->change_lock );
- vlc_mutex_init( &p_vout->vfilter_lock );
+ vlc_mutex_init( &p_vout->p->vfilter_lock );
/* Mouse coordinates */
var_Create( p_vout, "mouse-x", VLC_VAR_INTEGER );
if( p_parent->i_object_type != VLC_OBJECT_VOUT )
{
/* Look for the default filter configuration */
- p_vout->psz_filter_chain =
+ p_vout->p->psz_filter_chain =
var_CreateGetStringCommand( p_vout, "vout-filter" );
/* Apply video filter2 objects on the first vout */
- p_vout->psz_vf2 =
+ p_vout->p->psz_vf2 =
var_CreateGetStringCommand( p_vout, "video-filter" );
}
else
char *psz_tmp;
/* Ugly hack to jump to our configuration chain */
- p_vout->psz_filter_chain
- = ((vout_thread_t *)p_parent)->psz_filter_chain;
- p_vout->psz_filter_chain
- = config_ChainCreate( &psz_tmp, &p_cfg, p_vout->psz_filter_chain );
+ p_vout->p->psz_filter_chain
+ = ((vout_thread_t *)p_parent)->p->psz_filter_chain;
+ p_vout->p->psz_filter_chain
+ = config_ChainCreate( &psz_tmp, &p_cfg, p_vout->p->psz_filter_chain );
config_ChainDestroy( p_cfg );
free( psz_tmp );
/* Create a video filter2 var ... but don't inherit values */
var_Create( p_vout, "video-filter",
VLC_VAR_STRING | VLC_VAR_ISCOMMAND );
- p_vout->psz_vf2 = var_GetString( p_vout, "video-filter" );
+ p_vout->p->psz_vf2 = var_GetString( p_vout, "video-filter" );
}
var_AddCallback( p_vout, "video-filter", VideoFilter2Callback, NULL );
- p_vout->p_vf2_chain = filter_chain_New( p_vout, "video filter2",
+ p_vout->p->p_vf2_chain = filter_chain_New( p_vout, "video filter2",
false, video_filter_buffer_allocation_init, NULL, p_vout );
/* Choose the video output module */
- if( !p_vout->psz_filter_chain || !*p_vout->psz_filter_chain )
+ if( !p_vout->p->psz_filter_chain || !*p_vout->p->psz_filter_chain )
{
var_Create( p_vout, "vout", VLC_VAR_STRING | VLC_VAR_DOINHERIT );
var_Get( p_vout, "vout", &val );
}
else
{
- psz_parser = strdup( p_vout->psz_filter_chain );
- p_vout->b_title_show = false;
+ psz_parser = strdup( p_vout->p->psz_filter_chain );
+ p_vout->p->b_title_show = false;
}
/* Create the vout thread */
free( psz_tmp );
p_vout->p_cfg = p_cfg;
p_vout->p_module = module_need( p_vout,
- ( p_vout->psz_filter_chain && *p_vout->psz_filter_chain ) ?
- "video filter" : "video output", psz_name, p_vout->psz_filter_chain && *p_vout->psz_filter_chain );
+ ( p_vout->p->psz_filter_chain && *p_vout->p->psz_filter_chain ) ?
+ "video filter" : "video output", psz_name, p_vout->p->psz_filter_chain && *p_vout->p->psz_filter_chain );
free( psz_name );
if( p_vout->p_module == NULL )
VLC_OBJECT_INPUT, FIND_ANYWHERE );
if( p_input_thread )
{
- p_vout->i_pts_delay = p_input_thread->i_pts_delay;
+ p_vout->p->i_pts_delay = p_input_thread->i_pts_delay;
vlc_object_release( p_input_thread );
}
else
{
- p_vout->i_pts_delay = DEFAULT_PTS_DELAY;
+ p_vout->p->i_pts_delay = DEFAULT_PTS_DELAY;
}
if( vlc_thread_create( p_vout, "video output", RunThread,
/* Destroy the locks */
vlc_mutex_destroy( &p_vout->picture_lock );
vlc_mutex_destroy( &p_vout->change_lock );
- vlc_mutex_destroy( &p_vout->vfilter_lock );
+ vlc_mutex_destroy( &p_vout->p->vfilter_lock );
- free( p_vout->psz_filter_chain );
+ free( p_vout->p->psz_filter_chain );
config_ChainDestroy( p_vout->p_cfg );
+ free( p_vout->p );
+
#ifndef __APPLE__
vout_thread_t *p_another_vout;
* directly decode into them ! Map the first render buffers to
* the first direct buffers, but keep the first direct buffer
* for memcpy operations */
- p_vout->b_direct = 1;
+ p_vout->p->b_direct = true;
for( i = 1; i < VOUT_MAX_PICTURES; i++ )
{
/* Rats... Something is wrong here, we could not find an output
* plugin able to directly render what we decode. See if we can
* find a chroma plugin to do the conversion */
- p_vout->b_direct = 0;
+ p_vout->p->b_direct = false;
if( ChromaCreate( p_vout ) )
{
vlc_object_lock( p_vout );
- if( p_vout->b_title_show )
+ if( p_vout->p->b_title_show )
DisplayTitleOnOSD( p_vout );
/*
}
/* Compute FPS rate */
- p_vout->p_fps_sample[ p_vout->c_fps_samples++ % VOUT_FPS_SAMPLES ]
+ p_vout->p->p_fps_sample[ p_vout->p->c_fps_samples++ % VOUT_FPS_SAMPLES ]
= display_date;
if( !p_picture->b_force &&
p_picture != p_last_picture &&
- display_date < current_date + p_vout->render_time &&
+ display_date < current_date + p_vout->p->render_time &&
b_drop_late )
{
/* Picture is late: it will be destroyed and the thread
}
if( display_date >
- current_date + p_vout->i_pts_delay + VOUT_BOGUS_DELAY )
+ current_date + p_vout->p->i_pts_delay + VOUT_BOGUS_DELAY )
{
/* Picture is waaay too early: it will be destroyed */
DropPicture( p_vout, p_picture );
i_lost++;
msg_Warn( p_vout, "vout warning: early picture skipped "
"(%"PRId64")", display_date - current_date
- - p_vout->i_pts_delay );
+ - p_vout->p->i_pts_delay );
continue;
}
{
/* We set the display date to something high, otherwise
* we'll have lots of problems with late pictures */
- display_date = current_date + p_vout->render_time;
+ display_date = current_date + p_vout->p->render_time;
}
}
}
p_filtered_picture = NULL;
if( p_picture )
- p_filtered_picture = filter_chain_VideoFilter( p_vout->p_vf2_chain,
+ p_filtered_picture = filter_chain_VideoFilter( p_vout->p->p_vf2_chain,
p_picture );
/* FIXME it is a bit ugly that b_snapshot is not locked but I do not
* know which lock to use (here and in the snapshot callback) */
- const bool b_snapshot = p_vout->b_snapshot;
+ const bool b_snapshot = p_vout->p->b_snapshot;
if( b_snapshot )
- p_vout->b_snapshot = false;
+ p_vout->p->b_snapshot = false;
/*
* Check for subpictures to display
{
mtime_t current_render_time = mdate() - current_date;
/* if render time is very large we don't include it in the mean */
- if( current_render_time < p_vout->render_time +
+ if( current_render_time < p_vout->p->render_time +
VOUT_DISPLAY_DELAY )
{
/* Store render time using a sliding mean weighting to
* current value in a 3 to 1 ratio*/
- p_vout->render_time *= 3;
- p_vout->render_time += current_render_time;
- p_vout->render_time >>= 2;
+ p_vout->p->render_time *= 3;
+ p_vout->p->render_time += current_render_time;
+ p_vout->p->render_time >>= 2;
}
}
{
/* If there are filters in the chain, better give them the picture
* in advance */
- if( !p_vout->psz_filter_chain || !*p_vout->psz_filter_chain )
+ if( !p_vout->p->psz_filter_chain || !*p_vout->p->psz_filter_chain )
{
mwait( display_date - VOUT_MWAIT_TOLERANCE );
}
p_vout->i_changes &= ~VOUT_SIZE_CHANGE;
- assert( !p_vout->b_direct );
+ assert( !p_vout->p->b_direct );
ChromaDestroy( p_vout );
* buffer!! */
p_vout->i_changes &= ~VOUT_PICTURE_BUFFERS_CHANGE;
- if( !p_vout->b_direct )
+ if( !p_vout->p->b_direct )
ChromaDestroy( p_vout );
vlc_mutex_lock( &p_vout->picture_lock );
}
/* Check for "video filter2" changes */
- vlc_mutex_lock( &p_vout->vfilter_lock );
- if( p_vout->psz_vf2 )
+ vlc_mutex_lock( &p_vout->p->vfilter_lock );
+ if( p_vout->p->psz_vf2 )
{
es_format_t fmt;
es_format_Init( &fmt, VIDEO_ES, p_vout->fmt_render.i_chroma );
fmt.video = p_vout->fmt_render;
- filter_chain_Reset( p_vout->p_vf2_chain, &fmt, &fmt );
+ filter_chain_Reset( p_vout->p->p_vf2_chain, &fmt, &fmt );
- if( filter_chain_AppendFromString( p_vout->p_vf2_chain,
- p_vout->psz_vf2 ) < 0 )
+ if( filter_chain_AppendFromString( p_vout->p->p_vf2_chain,
+ p_vout->p->psz_vf2 ) < 0 )
msg_Err( p_vout, "Video filter chain creation failed" );
- free( p_vout->psz_vf2 );
- p_vout->psz_vf2 = NULL;
+ free( p_vout->p->psz_vf2 );
+ p_vout->p->psz_vf2 = NULL;
}
- vlc_mutex_unlock( &p_vout->vfilter_lock );
+ vlc_mutex_unlock( &p_vout->p->vfilter_lock );
}
/*
{
int i_index; /* index in heap */
- if( !p_vout->b_direct )
+ if( !p_vout->p->b_direct )
ChromaDestroy( p_vout );
/* Destroy all remaining pictures */
spu_Destroy( p_vout->p_spu );
/* Destroy the video filters2 */
- filter_chain_Delete( p_vout->p_vf2_chain );
+ filter_chain_Delete( p_vout->p->p_vf2_chain );
}
/* Thread helpers */
filter_t *p_chroma;
/* Choose the best module */
- p_chroma = p_vout->p_chroma =
+ p_chroma = p_vout->p->p_chroma =
vlc_custom_create( p_vout, sizeof(filter_t), VLC_OBJECT_GENERIC,
typename );
p_chroma->fmt_out.video.i_width, p_chroma->fmt_out.video.i_height
);
- vlc_object_release( p_vout->p_chroma );
- p_vout->p_chroma = NULL;
+ vlc_object_release( p_vout->p->p_chroma );
+ p_vout->p->p_chroma = NULL;
+
return VLC_EGENERIC;
}
p_chroma->pf_vout_buffer_new = ChromaGetPicture;
static void ChromaDestroy( vout_thread_t *p_vout )
{
- assert( !p_vout->b_direct );
+ assert( !p_vout->p->b_direct );
- if( !p_vout->p_chroma )
+ if( !p_vout->p->p_chroma )
return;
- module_unneed( p_vout->p_chroma, p_vout->p_chroma->p_module );
- vlc_object_release( p_vout->p_chroma );
- p_vout->p_chroma = NULL;
+ module_unneed( p_vout->p->p_chroma, p_vout->p->p_chroma->p_module );
+ vlc_object_release( p_vout->p->p_chroma );
+ p_vout->p->p_chroma = NULL;
}
static void DropPicture( vout_thread_t *p_vout, picture_t *p_picture )
vout_thread_t *p_vout = (vout_thread_t *)p_this;
(void)psz_cmd; (void)oldval; (void)p_data;
- vlc_mutex_lock( &p_vout->vfilter_lock );
- p_vout->psz_vf2 = strdup( newval.psz_string );
- vlc_mutex_unlock( &p_vout->vfilter_lock );
+ vlc_mutex_lock( &p_vout->p->vfilter_lock );
+ p_vout->p->psz_vf2 = strdup( newval.psz_string );
+ vlc_mutex_unlock( &p_vout->p->vfilter_lock );
return VLC_SUCCESS;
}
if( p_input )
{
i_now = mdate();
- i_stop = i_now + (mtime_t)(p_vout->i_title_timeout * 1000);
+ i_stop = i_now + (mtime_t)(p_vout->p->i_title_timeout * 1000);
char *psz_nowplaying =
input_item_GetNowPlaying( input_GetItem( p_input ) );
char *psz_artist = input_item_GetArtist( input_GetItem( p_input ) );
{
vout_ShowTextAbsolute( p_vout, DEFAULT_CHAN,
psz_nowplaying, NULL,
- p_vout->i_title_position,
+ p_vout->p->i_title_position,
30 + p_vout->fmt_in.i_width
- p_vout->fmt_in.i_visible_width
- p_vout->fmt_in.i_x_offset,
{
vout_ShowTextAbsolute( p_vout, DEFAULT_CHAN,
psz_string, NULL,
- p_vout->i_title_position,
+ p_vout->p->i_title_position,
30 + p_vout->fmt_in.i_width
- p_vout->fmt_in.i_visible_width
- p_vout->fmt_in.i_x_offset,
{
vout_ShowTextAbsolute( p_vout, DEFAULT_CHAN,
psz_name, NULL,
- p_vout->i_title_position,
+ p_vout->p->i_title_position,
30 + p_vout->fmt_in.i_width
- p_vout->fmt_in.i_visible_width
- p_vout->fmt_in.i_x_offset,
#include <vlc_strings.h>
#include <vlc_charset.h>
#include "../libvlc.h"
+#include "vout_internal.h"
/*****************************************************************************
* Local prototypes
var_Create( p_vout, "mouse-hide-timeout",
VLC_VAR_INTEGER | VLC_VAR_DOINHERIT );
- p_vout->b_title_show = var_CreateGetBool( p_vout, "video-title-show" );
- p_vout->i_title_timeout =
+ p_vout->p->b_title_show = var_CreateGetBool( p_vout, "video-title-show" );
+ p_vout->p->i_title_timeout =
(mtime_t)var_CreateGetInteger( p_vout, "video-title-timeout" );
- p_vout->i_title_position =
+ p_vout->p->i_title_position =
var_CreateGetInteger( p_vout, "video-title-position" );
var_AddCallback( p_vout, "video-title-show", TitleShowCallback, NULL );
}
if( !i_aspect_num || !i_aspect_den ) i_aspect_num = i_aspect_den = 1;
- p_vout->i_par_num = i_aspect_num;
- p_vout->i_par_den = i_aspect_den;
+ p_vout->p->i_par_num = i_aspect_num;
+ p_vout->p->i_par_den = i_aspect_den;
- vlc_ureduce( &p_vout->i_par_num, &p_vout->i_par_den,
- p_vout->i_par_num, p_vout->i_par_den, 0 );
+ vlc_ureduce( &p_vout->p->i_par_num, &p_vout->p->i_par_den,
+ p_vout->p->i_par_num, p_vout->p->i_par_den, 0 );
msg_Dbg( p_vout, "overriding monitor pixel aspect-ratio: %i:%i",
- p_vout->i_par_num, p_vout->i_par_den );
+ p_vout->p->i_par_num, p_vout->p->i_par_den );
b_force_par = true;
}
free( val.psz_string );
return VLC_SUCCESS;
case VOUT_SNAPSHOT:
- p_vout->b_snapshot = true;
+ p_vout->p->b_snapshot = true;
return VLC_SUCCESS;
default:
p_vout->render.i_aspect = p_vout->fmt_in.i_aspect;
aspect_end:
- if( p_vout->i_par_num && p_vout->i_par_den )
+ if( p_vout->p->i_par_num && p_vout->p->i_par_den )
{
- p_vout->fmt_in.i_sar_num *= p_vout->i_par_den;
- p_vout->fmt_in.i_sar_den *= p_vout->i_par_num;
+ p_vout->fmt_in.i_sar_num *= p_vout->p->i_par_den;
+ p_vout->fmt_in.i_sar_den *= p_vout->p->i_par_num;
p_vout->fmt_in.i_aspect = p_vout->fmt_in.i_aspect *
- p_vout->i_par_den / p_vout->i_par_num;
+ p_vout->p->i_par_den / p_vout->p->i_par_num;
p_vout->render.i_aspect = p_vout->fmt_in.i_aspect;
}
VLC_UNUSED(psz_cmd); VLC_UNUSED(oldval);
VLC_UNUSED(p_data);
vout_thread_t *p_vout = (vout_thread_t *)p_this;
- p_vout->b_title_show = newval.b_bool;
+ p_vout->p->b_title_show = newval.b_bool;
return VLC_SUCCESS;
}
{
VLC_UNUSED(psz_cmd); VLC_UNUSED(oldval); VLC_UNUSED(p_data);
vout_thread_t *p_vout = (vout_thread_t *)p_this;
- p_vout->i_title_timeout = (mtime_t) newval.i_int;
+ p_vout->p->i_title_timeout = (mtime_t) newval.i_int;
return VLC_SUCCESS;
}
VLC_UNUSED(psz_cmd); VLC_UNUSED(oldval);
VLC_UNUSED(p_data);
vout_thread_t *p_vout = (vout_thread_t *)p_this;
- p_vout->i_title_position = newval.i_int;
+ p_vout->p->i_title_position = newval.i_int;
return VLC_SUCCESS;
}