Commit 38ac8544 authored by Laurent Aimar's avatar Laurent Aimar

Moved most of private vout_thread_t fields out of vlc_vout.h

parent b67a5864
......@@ -76,64 +76,14 @@ struct vout_thread_t
{
VLC_COMMON_MEMBERS
/** \name Thread properties and locks */
/**@{*/
vlc_mutex_t picture_lock; /**< picture heap lock */
vlc_mutex_t change_lock; /**< thread change lock */
/**@}*/
/** \name Current display properties */
/**@{*/
uint16_t i_changes; /**< changes made to the thread.
\see \ref vout_changes */
unsigned b_fullscreen:1; /**< toogle fullscreen display */
unsigned b_on_top:1; /**< stay always on top of other windows */
/**@}*/
/** \name Video heap and translation tables */
/**@{*/
picture_heap_t render; /**< rendered pictures */
picture_heap_t output; /**< direct buffers */
video_format_t fmt_render; /* render format (from the decoder) */
video_format_t fmt_in; /* input (modified render) format */
video_format_t fmt_out; /* output format (for the video output) */
/**@}*/
/* Picture heap */
picture_t p_picture[2*VOUT_MAX_PICTURES+1]; /**< pictures */
/* Private vout_thread data */
vout_thread_sys_t *p;
};
#define I_OUTPUTPICTURES p_vout->output.i_pictures
#define PP_OUTPUTPICTURE p_vout->output.pp_picture
#define I_RENDERPICTURES p_vout->render.i_pictures
#define PP_RENDERPICTURE p_vout->render.pp_picture
/** \defgroup vout_changes Flags for changes
* These flags are set in the vout_thread_t::i_changes field when another
* thread changed a variable
* @{
*/
/** b_autoscale changed */
#define VOUT_SCALE_CHANGE 0x0008
/** b_on_top changed */
#define VOUT_ON_TOP_CHANGE 0x0010
/** b_fullscreen changed */
#define VOUT_FULLSCREEN_CHANGE 0x0040
/** i_zoom changed */
#define VOUT_ZOOM_CHANGE 0x0080
/** cropping parameters changed */
#define VOUT_CROP_CHANGE 0x1000
/** aspect ratio changed */
#define VOUT_ASPECT_CHANGE 0x2000
/** change/recreate picture buffers */
#define VOUT_PICTURE_BUFFERS_CHANGE 0x4000
/**@}*/
/* Alignment flags */
#define VOUT_ALIGN_LEFT 0x0001
#define VOUT_ALIGN_RIGHT 0x0002
......
......@@ -129,9 +129,9 @@ static void video_del_buffer_filter( filter_t *p_filter, picture_t *p_pic )
{
vout_thread_t *p_vout = (vout_thread_t*)p_filter->p_owner;
vlc_mutex_lock( &p_vout->picture_lock );
vlc_mutex_lock( &p_vout->p->picture_lock );
vout_UsePictureLocked( p_vout, p_pic );
vlc_mutex_unlock( &p_vout->picture_lock );
vlc_mutex_unlock( &p_vout->p->picture_lock );
}
static int video_filter_buffer_allocation_init( filter_t *p_filter, void *p_data )
......@@ -173,7 +173,7 @@ vout_thread_t *vout_Request( vlc_object_t *p_this, vout_thread_t *p_vout,
/* If we now have a video output, check it has the right properties */
if( p_vout )
{
vlc_mutex_lock( &p_vout->change_lock );
vlc_mutex_lock( &p_vout->p->change_lock );
/* We don't directly check for the "vout-filter" variable for obvious
* performance reasons. */
......@@ -207,7 +207,7 @@ vout_thread_t *vout_Request( vlc_object_t *p_this, vout_thread_t *p_vout,
p_vout->fmt_render.i_height != p_fmt->i_height ||
p_vout->p->b_filter_change )
{
vlc_mutex_unlock( &p_vout->change_lock );
vlc_mutex_unlock( &p_vout->p->change_lock );
/* We are not interested in this format, close this vout */
vout_CloseAndRelease( p_vout );
......@@ -241,9 +241,9 @@ vout_thread_t *vout_Request( vlc_object_t *p_this, vout_thread_t *p_vout,
p_vout->fmt_render.i_sar_num = i_sar_num;
p_vout->fmt_render.i_sar_den = i_sar_den;
p_vout->i_changes |= VOUT_ASPECT_CHANGE;
p_vout->p->i_changes |= VOUT_ASPECT_CHANGE;
}
vlc_mutex_unlock( &p_vout->change_lock );
vlc_mutex_unlock( &p_vout->p->change_lock );
vlc_object_release( p_vout );
}
......@@ -316,9 +316,9 @@ vout_thread_t * vout_Create( vlc_object_t *p_parent, video_format_t *p_fmt )
* will be initialized later in InitThread */
for( i_index = 0; i_index < 2 * VOUT_MAX_PICTURES + 1; i_index++)
{
p_vout->p_picture[i_index].i_status = FREE_PICTURE;
p_vout->p_picture[i_index].i_type = EMPTY_PICTURE;
p_vout->p_picture[i_index].b_slow = 0;
p_vout->p->p_picture[i_index].i_status = FREE_PICTURE;
p_vout->p->p_picture[i_index].i_type = EMPTY_PICTURE;
p_vout->p->p_picture[i_index].b_slow = 0;
}
/* Initialize the rendering heap */
......@@ -332,14 +332,14 @@ vout_thread_t * vout_Create( vlc_object_t *p_parent, video_format_t *p_fmt )
video_format_FixRgb( &p_vout->fmt_render );
video_format_FixRgb( &p_vout->fmt_in );
p_vout->render.i_last_used_pic = -1;
p_vout->p->render.i_last_used_pic = -1;
/* Zero the output heap */
I_OUTPUTPICTURES = 0;
/* Initialize misc stuff */
p_vout->i_changes = 0;
p_vout->b_fullscreen = 0;
p_vout->p->i_changes = 0;
p_vout->p->b_fullscreen = 0;
p_vout->p->render_time = 10;
p_vout->p->c_fps_samples = 0;
vout_statistic_Init( &p_vout->p->statistic );
......@@ -360,9 +360,9 @@ vout_thread_t * vout_Create( vlc_object_t *p_parent, video_format_t *p_fmt )
vout_snapshot_Init( &p_vout->p->snapshot );
/* Initialize locks */
vlc_mutex_init( &p_vout->picture_lock );
vlc_mutex_init( &p_vout->p->picture_lock );
vlc_cond_init( &p_vout->p->picture_wait );
vlc_mutex_init( &p_vout->change_lock );
vlc_mutex_init( &p_vout->p->change_lock );
vlc_mutex_init( &p_vout->p->vfilter_lock );
/* Mouse coordinates */
......@@ -477,14 +477,14 @@ vout_thread_t * vout_Create( vlc_object_t *p_parent, video_format_t *p_fmt )
return NULL;
}
vlc_mutex_lock( &p_vout->change_lock );
vlc_mutex_lock( &p_vout->p->change_lock );
while( !p_vout->p->b_ready )
{ /* We are (ab)using the same condition in opposite directions for
* b_ready and b_done. This works because of the strict ordering. */
assert( !p_vout->p->b_done );
vlc_cond_wait( &p_vout->p->change_wait, &p_vout->change_lock );
vlc_cond_wait( &p_vout->p->change_wait, &p_vout->p->change_lock );
}
vlc_mutex_unlock( &p_vout->change_lock );
vlc_mutex_unlock( &p_vout->p->change_lock );
if( p_vout->p->b_error )
{
......@@ -508,10 +508,10 @@ void vout_Close( vout_thread_t *p_vout )
{
assert( p_vout );
vlc_mutex_lock( &p_vout->change_lock );
vlc_mutex_lock( &p_vout->p->change_lock );
p_vout->p->b_done = true;
vlc_cond_signal( &p_vout->p->change_wait );
vlc_mutex_unlock( &p_vout->change_lock );
vlc_mutex_unlock( &p_vout->p->change_lock );
vout_snapshot_End( &p_vout->p->snapshot );
......@@ -535,8 +535,8 @@ static void vout_Destructor( vlc_object_t * p_this )
/* Destroy the locks */
vlc_cond_destroy( &p_vout->p->change_wait );
vlc_cond_destroy( &p_vout->p->picture_wait );
vlc_mutex_destroy( &p_vout->picture_lock );
vlc_mutex_destroy( &p_vout->change_lock );
vlc_mutex_destroy( &p_vout->p->picture_lock );
vlc_mutex_destroy( &p_vout->p->change_lock );
vlc_mutex_destroy( &p_vout->p->vfilter_lock );
/* */
......@@ -558,11 +558,11 @@ static void vout_Destructor( vlc_object_t * p_this )
/* */
void vout_ChangePause( vout_thread_t *p_vout, bool b_paused, mtime_t i_date )
{
vlc_mutex_lock( &p_vout->change_lock );
vlc_mutex_lock( &p_vout->p->change_lock );
assert( !p_vout->p->b_paused || !b_paused );
vlc_mutex_lock( &p_vout->picture_lock );
vlc_mutex_lock( &p_vout->p->picture_lock );
p_vout->p->i_picture_displayed_date = 0;
......@@ -578,18 +578,18 @@ void vout_ChangePause( vout_thread_t *p_vout, bool b_paused, mtime_t i_date )
p_pic->date += i_duration;
}
vlc_cond_signal( &p_vout->p->picture_wait );
vlc_mutex_unlock( &p_vout->picture_lock );
vlc_mutex_unlock( &p_vout->p->picture_lock );
spu_OffsetSubtitleDate( p_vout->p->p_spu, i_duration );
}
else
{
vlc_mutex_unlock( &p_vout->picture_lock );
vlc_mutex_unlock( &p_vout->p->picture_lock );
}
p_vout->p->b_paused = b_paused;
p_vout->p->i_pause_date = i_date;
vlc_mutex_unlock( &p_vout->change_lock );
vlc_mutex_unlock( &p_vout->p->change_lock );
}
void vout_GetResetStatistic( vout_thread_t *p_vout, int *pi_displayed, int *pi_lost )
......@@ -600,11 +600,11 @@ void vout_GetResetStatistic( vout_thread_t *p_vout, int *pi_displayed, int *pi_l
void vout_Flush( vout_thread_t *p_vout, mtime_t i_date )
{
vlc_mutex_lock( &p_vout->picture_lock );
vlc_mutex_lock( &p_vout->p->picture_lock );
p_vout->p->i_picture_displayed_date = 0;
for( int i = 0; i < p_vout->render.i_pictures; i++ )
for( int i = 0; i < p_vout->p->render.i_pictures; i++ )
{
picture_t *p_pic = p_vout->render.pp_picture[i];
picture_t *p_pic = p_vout->p->render.pp_picture[i];
if( p_pic->i_status == READY_PICTURE ||
p_pic->i_status == DISPLAYED_PICTURE )
......@@ -616,18 +616,18 @@ void vout_Flush( vout_thread_t *p_vout, mtime_t i_date )
}
}
vlc_cond_signal( &p_vout->p->picture_wait );
vlc_mutex_unlock( &p_vout->picture_lock );
vlc_mutex_unlock( &p_vout->p->picture_lock );
}
void vout_FixLeaks( vout_thread_t *p_vout, bool b_forced )
{
int i_pic, i_ready_pic;
vlc_mutex_lock( &p_vout->picture_lock );
vlc_mutex_lock( &p_vout->p->picture_lock );
for( i_pic = 0, i_ready_pic = 0; i_pic < p_vout->render.i_pictures && !b_forced; i_pic++ )
for( i_pic = 0, i_ready_pic = 0; i_pic < p_vout->p->render.i_pictures && !b_forced; i_pic++ )
{
const picture_t *p_pic = p_vout->render.pp_picture[i_pic];
const picture_t *p_pic = p_vout->p->render.pp_picture[i_pic];
if( p_pic->i_status == READY_PICTURE )
{
......@@ -648,9 +648,9 @@ void vout_FixLeaks( vout_thread_t *p_vout, bool b_forced )
break;
}
}
if( i_pic < p_vout->render.i_pictures && !b_forced )
if( i_pic < p_vout->p->render.i_pictures && !b_forced )
{
vlc_mutex_unlock( &p_vout->picture_lock );
vlc_mutex_unlock( &p_vout->p->picture_lock );
return;
}
......@@ -660,9 +660,9 @@ void vout_FixLeaks( vout_thread_t *p_vout, bool b_forced )
msg_Err( p_vout, "pictures leaked, resetting the heap" );
/* Just free all the pictures */
for( i_pic = 0; i_pic < p_vout->render.i_pictures; i_pic++ )
for( i_pic = 0; i_pic < p_vout->p->render.i_pictures; i_pic++ )
{
picture_t *p_pic = p_vout->render.pp_picture[i_pic];
picture_t *p_pic = p_vout->p->render.pp_picture[i_pic];
msg_Dbg( p_vout, "[%d] %d %d", i_pic, p_pic->i_status, p_pic->i_refcount );
p_pic->i_refcount = 0;
......@@ -678,11 +678,11 @@ void vout_FixLeaks( vout_thread_t *p_vout, bool b_forced )
}
}
vlc_cond_signal( &p_vout->p->picture_wait );
vlc_mutex_unlock( &p_vout->picture_lock );
vlc_mutex_unlock( &p_vout->p->picture_lock );
}
void vout_NextPicture( vout_thread_t *p_vout, mtime_t *pi_duration )
{
vlc_mutex_lock( &p_vout->picture_lock );
vlc_mutex_lock( &p_vout->p->picture_lock );
const mtime_t i_displayed_date = p_vout->p->i_picture_displayed_date;
......@@ -695,13 +695,13 @@ void vout_NextPicture( vout_thread_t *p_vout, mtime_t *pi_duration )
}
while( !p_vout->p->b_picture_displayed && !p_vout->p->b_picture_empty )
vlc_cond_wait( &p_vout->p->picture_wait, &p_vout->picture_lock );
vlc_cond_wait( &p_vout->p->picture_wait, &p_vout->p->picture_lock );
*pi_duration = __MAX( p_vout->p->i_picture_displayed_date - i_displayed_date, 0 );
/* TODO advance subpicture by the duration ... */
vlc_mutex_unlock( &p_vout->picture_lock );
vlc_mutex_unlock( &p_vout->p->picture_lock );
}
void vout_DisplayTitle( vout_thread_t *p_vout, const char *psz_title )
......@@ -711,10 +711,10 @@ void vout_DisplayTitle( vout_thread_t *p_vout, const char *psz_title )
if( !var_InheritBool( p_vout, "osd" ) )
return;
vlc_mutex_lock( &p_vout->change_lock );
vlc_mutex_lock( &p_vout->p->change_lock );
free( p_vout->p->psz_title );
p_vout->p->psz_title = strdup( psz_title );
vlc_mutex_unlock( &p_vout->change_lock );
vlc_mutex_unlock( &p_vout->p->change_lock );
}
spu_t *vout_GetSpu( vout_thread_t *p_vout )
......@@ -815,15 +815,15 @@ static int InitThread( vout_thread_t *p_vout )
* for memcpy operations */
for( i = 1; i < VOUT_MAX_PICTURES; i++ )
{
if( p_vout->p_picture[ i ].i_type != DIRECT_PICTURE &&
if( p_vout->p->p_picture[ i ].i_type != DIRECT_PICTURE &&
I_RENDERPICTURES >= VOUT_MIN_DIRECT_PICTURES - 1 &&
p_vout->p_picture[ i - 1 ].i_type == DIRECT_PICTURE )
p_vout->p->p_picture[ i - 1 ].i_type == DIRECT_PICTURE )
{
/* We have enough direct buffers so there's no need to
* try to use system memory buffers. */
break;
}
PP_RENDERPICTURE[ I_RENDERPICTURES ] = &p_vout->p_picture[ i ];
PP_RENDERPICTURE[ I_RENDERPICTURES ] = &p_vout->p->p_picture[ i ];
I_RENDERPICTURES++;
}
......@@ -855,7 +855,7 @@ static void* RunThread( void *p_this )
*/
b_has_wrapper = !vout_OpenWrapper( p_vout, p_vout->p->psz_module_name );
vlc_mutex_lock( &p_vout->change_lock );
vlc_mutex_lock( &p_vout->p->change_lock );
if( b_has_wrapper )
p_vout->p->b_error = InitThread( p_vout );
......@@ -890,7 +890,7 @@ static void* RunThread( void *p_this )
if( p_vout->p->b_title_show && p_vout->p->psz_title )
DisplayTitleOnOSD( p_vout );
vlc_mutex_lock( &p_vout->picture_lock );
vlc_mutex_lock( &p_vout->p->picture_lock );
/* Look for the earliest picture but after the last displayed one */
picture_t *p_last = p_vout->p->p_picture_displayed;;
......@@ -1007,7 +1007,7 @@ static void* RunThread( void *p_this )
const bool b_picture_interlaced = p_vout->p->b_picture_interlaced;
const int i_picture_interlaced_state = (!!p_vout->p->b_picture_interlaced) - (!!b_picture_interlaced_last);
vlc_mutex_unlock( &p_vout->picture_lock );
vlc_mutex_unlock( &p_vout->p->picture_lock );
if( p_picture == NULL )
i_idle_loops++;
......@@ -1083,7 +1083,7 @@ static void* RunThread( void *p_this )
}
/* Give back change lock */
vlc_mutex_unlock( &p_vout->change_lock );
vlc_mutex_unlock( &p_vout->p->change_lock );
/* Sleep a while or until a given date */
if( display_date != 0 )
......@@ -1098,15 +1098,15 @@ static void* RunThread( void *p_this )
else
{
/* Wait until a frame is being sent or a spurious wakeup (not a problem here) */
vlc_mutex_lock( &p_vout->picture_lock );
vlc_cond_timedwait( &p_vout->p->picture_wait, &p_vout->picture_lock, current_date + VOUT_IDLE_SLEEP );
vlc_mutex_unlock( &p_vout->picture_lock );
vlc_mutex_lock( &p_vout->p->picture_lock );
vlc_cond_timedwait( &p_vout->p->picture_wait, &p_vout->p->picture_lock, current_date + VOUT_IDLE_SLEEP );
vlc_mutex_unlock( &p_vout->p->picture_lock );
}
/* On awakening, take back lock and send immediately picture
* to display. */
/* Note: p_vout->p->b_done could be true here and now */
vlc_mutex_lock( &p_vout->change_lock );
vlc_mutex_lock( &p_vout->p->change_lock );
/*
* Display the previously rendered picture
......@@ -1124,9 +1124,9 @@ static void* RunThread( void *p_this )
/* Drop the filtered picture if created by video filters */
if( p_filtered_picture != NULL && p_filtered_picture != p_picture )
{
vlc_mutex_lock( &p_vout->picture_lock );
vlc_mutex_lock( &p_vout->p->picture_lock );
vout_UsePictureLocked( p_vout, p_filtered_picture );
vlc_mutex_unlock( &p_vout->picture_lock );
vlc_mutex_unlock( &p_vout->p->picture_lock );
}
if( p_picture != NULL )
......@@ -1148,19 +1148,19 @@ static void* RunThread( void *p_this )
break;
}
if( p_vout->i_changes & VOUT_ON_TOP_CHANGE )
p_vout->i_changes &= ~VOUT_ON_TOP_CHANGE;
if( p_vout->p->i_changes & VOUT_ON_TOP_CHANGE )
p_vout->p->i_changes &= ~VOUT_ON_TOP_CHANGE;
if( p_vout->i_changes & VOUT_PICTURE_BUFFERS_CHANGE )
if( p_vout->p->i_changes & VOUT_PICTURE_BUFFERS_CHANGE )
{
/* This happens when the picture buffers need to be recreated.
* This is useful on multimonitor displays for instance.
*
* Warning: This only works when the vout creates only 1 picture
* buffer!! */
p_vout->i_changes &= ~VOUT_PICTURE_BUFFERS_CHANGE;
p_vout->p->i_changes &= ~VOUT_PICTURE_BUFFERS_CHANGE;
vlc_mutex_lock( &p_vout->picture_lock );
vlc_mutex_lock( &p_vout->p->picture_lock );
vout_EndWrapper( p_vout );
......@@ -1171,7 +1171,7 @@ static void* RunThread( void *p_this )
msg_Err( p_vout, "InitThread after VOUT_PICTURE_BUFFERS_CHANGE failed" );
vlc_cond_signal( &p_vout->p->picture_wait );
vlc_mutex_unlock( &p_vout->picture_lock );
vlc_mutex_unlock( &p_vout->p->picture_lock );
if( p_vout->p->b_error )
break;
......@@ -1232,7 +1232,7 @@ static void* RunThread( void *p_this )
exit_thread:
/* End of thread */
EndThread( p_vout );
vlc_mutex_unlock( &p_vout->change_lock );
vlc_mutex_unlock( &p_vout->p->change_lock );
if( b_has_wrapper )
vout_CloseWrapper( p_vout );
......@@ -1251,7 +1251,7 @@ static void ErrorThread( vout_thread_t *p_vout )
{
/* Wait until a `close' order */
while( !p_vout->p->b_done )
vlc_cond_wait( &p_vout->p->change_wait, &p_vout->change_lock );
vlc_cond_wait( &p_vout->p->change_wait, &p_vout->p->change_lock );
}
/*****************************************************************************
......@@ -1268,9 +1268,9 @@ static void CleanThread( vout_thread_t *p_vout )
/* Destroy all remaining pictures */
for( i_index = 0; i_index < 2 * VOUT_MAX_PICTURES + 1; i_index++ )
{
if ( p_vout->p_picture[i_index].i_type == MEMORY_PICTURE )
if ( p_vout->p->p_picture[i_index].i_type == MEMORY_PICTURE )
{
free( p_vout->p_picture[i_index].p_data_orig );
free( p_vout->p->p_picture[i_index].p_data_orig );
}
}
......@@ -1463,7 +1463,7 @@ static void DisplayTitleOnOSD( vout_thread_t *p_vout )
if( i_stop <= i_start )
return;
vlc_assert_locked( &p_vout->change_lock );
vlc_assert_locked( &p_vout->p->change_lock );
vout_ShowTextAbsolute( p_vout, DEFAULT_CHAN,
p_vout->p->psz_title, NULL,
......
......@@ -113,8 +113,49 @@ struct vout_thread_sys_t
/* */
vlc_mouse_t mouse;
/* */
vlc_mutex_t picture_lock; /**< picture heap lock */
vlc_mutex_t change_lock; /**< thread change lock */
uint16_t i_changes; /**< changes made to the thread.
\see \ref vout_changes */
unsigned b_fullscreen:1; /**< toogle fullscreen display */
unsigned b_on_top:1; /**< stay always on top of other windows */
picture_heap_t render; /**< rendered pictures */
picture_heap_t output; /**< direct buffers */
picture_t p_picture[2*VOUT_MAX_PICTURES+1]; /**< pictures */
};
#define I_OUTPUTPICTURES p_vout->p->output.i_pictures
#define PP_OUTPUTPICTURE p_vout->p->output.pp_picture
#define I_RENDERPICTURES p_vout->p->render.i_pictures
#define PP_RENDERPICTURE p_vout->p->render.pp_picture
/** \defgroup vout_changes Flags for changes
* These flags are set in the vout_thread_t::i_changes field when another
* thread changed a variable
* @{
*/
/** b_autoscale changed */
#define VOUT_SCALE_CHANGE 0x0008
/** b_on_top changed */
#define VOUT_ON_TOP_CHANGE 0x0010
/** b_fullscreen changed */
#define VOUT_FULLSCREEN_CHANGE 0x0040
/** i_zoom changed */
#define VOUT_ZOOM_CHANGE 0x0080
/** cropping parameters changed */
#define VOUT_CROP_CHANGE 0x1000
/** aspect ratio changed */
#define VOUT_ASPECT_CHANGE 0x2000
/** change/recreate picture buffers */
#define VOUT_PICTURE_BUFFERS_CHANGE 0x4000
/**@}*/
/* */
int vout_AllocatePicture( vlc_object_t *, picture_t *, uint32_t i_chroma, int i_width, int i_height, int i_sar_num, int i_sar_den );
#define vout_AllocatePicture(a,b,c,d,e,f,g) \
......
......@@ -344,7 +344,7 @@ void vout_IntfInit( vout_thread_t *p_vout )
if( var_CreateGetBoolCommand( p_vout, "fullscreen" ) )
{
/* user requested fullscreen */
p_vout->i_changes |= VOUT_FULLSCREEN_CHANGE;
p_vout->p->i_changes |= VOUT_FULLSCREEN_CHANGE;
}
text.psz_string = _("Fullscreen");
var_Change( p_vout, "fullscreen", VLC_VAR_SETTEXT, &text, NULL );
......@@ -791,7 +791,7 @@ static int CropCallback( vlc_object_t *p_this, char const *psz_cmd,
}
crop_end:
p_vout->i_changes |= VOUT_CROP_CHANGE;
p_vout->p->i_changes |= VOUT_CROP_CHANGE;
msg_Dbg( p_vout, "cropping picture %ix%i to %i,%i,%ix%i",
p_vout->fmt_in.i_width, p_vout->fmt_in.i_height,
......@@ -839,7 +839,7 @@ static int AspectCallback( vlc_object_t *p_this, char const *psz_cmd,
p_vout->fmt_in.i_sar_den *= p_vout->p->i_par_num;
}
p_vout->i_changes |= VOUT_ASPECT_CHANGE;
p_vout->p->i_changes |= VOUT_ASPECT_CHANGE;
msg_Dbg( p_vout, "new aspect-ratio %i:%i, sample aspect-ratio %i:%i",
p_vout->fmt_in.i_sar_num * p_vout->fmt_in.i_width,
......@@ -860,18 +860,18 @@ static int ScalingCallback( vlc_object_t *p_this, char const *psz_cmd,
vout_thread_t *p_vout = (vout_thread_t *)p_this;
(void)oldval; (void)newval; (void)p_data;
vlc_mutex_lock( &p_vout->change_lock );
vlc_mutex_lock( &p_vout->p->change_lock );
if( !strcmp( psz_cmd, "autoscale" ) )
{
p_vout->i_changes |= VOUT_SCALE_CHANGE;
p_vout->p->i_changes |= VOUT_SCALE_CHANGE;
}
else if( !strcmp( psz_cmd, "scale" ) )
{
p_vout->i_changes |= VOUT_ZOOM_CHANGE;
p_vout->p->i_changes |= VOUT_ZOOM_CHANGE;
}
vlc_mutex_unlock( &p_vout->change_lock );
vlc_mutex_unlock( &p_vout->p->change_lock );
return VLC_SUCCESS;
}
......@@ -881,10 +881,10 @@ static int OnTopCallback( vlc_object_t *p_this, char const *psz_cmd,
{
vout_thread_t *p_vout = (vout_thread_t *)p_this;
vlc_mutex_lock( &p_vout->change_lock );
p_vout->i_changes |= VOUT_ON_TOP_CHANGE;
p_vout->b_on_top = newval.b_bool;
vlc_mutex_unlock( &p_vout->change_lock );
vlc_mutex_lock( &p_vout->p->change_lock );
p_vout->p->i_changes |= VOUT_ON_TOP_CHANGE;
p_vout->p->b_on_top = newval.b_bool;
vlc_mutex_unlock( &p_vout->p->change_lock );
(void)psz_cmd; (void)oldval; (void)p_data;
return VLC_SUCCESS;
......@@ -899,7 +899,7 @@ static int FullscreenCallback( vlc_object_t *p_this, char const *psz_cmd,
if( oldval.b_bool == newval.b_bool )
return VLC_SUCCESS; /* no-op */
p_vout->i_changes |= VOUT_FULLSCREEN_CHANGE;
p_vout->p->i_changes |= VOUT_FULLSCREEN_CHANGE;
val.b_bool = true;
var_Set( p_vout, "intf-change", val );
......
......@@ -52,7 +52,7 @@
*/
void vout_DisplayPicture( vout_thread_t *p_vout, picture_t *p_pic )
{
vlc_mutex_lock( &p_vout->picture_lock );
vlc_mutex_lock( &p_vout->p->picture_lock );
if( p_pic->i_status == RESERVED_PICTURE )
{
......@@ -67,7 +67,7 @@ void vout_DisplayPicture( vout_thread_t *p_vout, picture_t *p_pic )
p_vout->p->i_picture_qtype = p_pic->i_qtype;
p_vout->p->b_picture_interlaced = !p_pic->b_progressive;
vlc_mutex_unlock( &p_vout->picture_lock );
vlc_mutex_unlock( &p_vout->p->picture_lock );
}
/**
......@@ -84,10 +84,10 @@ int vout_CountPictureAvailable( vout_thread_t *p_vout )
int i_free = 0;
int i_pic;
vlc_mutex_lock( &p_vout->picture_lock );
vlc_mutex_lock( &p_vout->p->picture_lock );
for( i_pic = 0; i_pic < I_RENDERPICTURES; i_pic++ )
{
picture_t *p_pic = PP_RENDERPICTURE[(p_vout->render.i_last_used_pic + i_pic + 1) % I_RENDERPICTURES];
picture_t *p_pic = PP_RENDERPICTURE[(p_vout->p->render.i_last_used_pic + i_pic + 1) % I_RENDERPICTURES];
switch( p_pic->i_status )
{
......@@ -103,7 +103,7 @@ int vout_CountPictureAvailable( vout_thread_t *p_vout )
break;
}
}
vlc_mutex_unlock( &p_vout->picture_lock );
vlc_mutex_unlock( &p_vout->p->picture_lock );
return i_free;
}
......@@ -118,14 +118,14 @@ picture_t *vout_CreatePicture( vout_thread_t *p_vout,
picture_t * p_freepic = NULL; /* first free picture */
/* Get lock */
vlc_mutex_lock( &p_vout->picture_lock );
vlc_mutex_lock( &p_vout->p->picture_lock );
/*
* Look for an empty place in the picture heap.
*/
for( i_pic = 0; i_pic < I_RENDERPICTURES; i_pic++ )
{
p_pic = PP_RENDERPICTURE[(p_vout->render.i_last_used_pic + i_pic + 1)
p_pic = PP_RENDERPICTURE[(p_vout->p->render.i_last_used_pic + i_pic + 1)
% I_RENDERPICTURES];
switch( p_pic->i_status )
......@@ -142,16 +142,16 @@ picture_t *vout_CreatePicture( vout_thread_t *p_vout,
p_pic->i_nb_fields = i_nb_fields;
p_pic->b_top_field_first = b_top_field_first;
p_vout->render.i_last_used_pic =
( p_vout->render.i_last_used_pic + i_pic + 1 )
p_vout->p->render.i_last_used_pic =
( p_vout->p->render.i_last_used_pic + i_pic + 1 )
% I_RENDERPICTURES;
vlc_mutex_unlock( &p_vout->picture_lock );
vlc_mutex_unlock( &p_vout->p->picture_lock );
return( p_pic );
case FREE_PICTURE:
/* Picture is empty and ready for allocation */
p_vout->render.i_last_used_pic =
( p_vout->render.i_last_used_pic + i_pic + 1 )
p_vout->p->render.i_last_used_pic =
( p_vout->p->render.i_last_used_pic + i_pic + 1 )
% I_RENDERPICTURES;
p_freepic = p_pic;
break;
......@@ -195,14 +195,14 @@ picture_t *vout_CreatePicture( vout_thread_t *p_vout,
msg_Err( p_vout, "picture allocation failed" );
}
vlc_mutex_unlock( &p_vout->picture_lock );
vlc_mutex_unlock( &p_vout->p->picture_lock );
return( p_freepic );
}
/* No free or destroyed picture could be found, but the decoder
* will try again in a while. */
vlc_mutex_unlock( &p_vout->picture_lock );
vlc_mutex_unlock( &p_vout->p->picture_lock );
return( NULL );
}
......@@ -210,7 +210,7 @@ picture_t *vout_CreatePicture( vout_thread_t *p_vout,
/* */
static void DestroyPicture( vout_thread_t *p_vout, picture_t *p_picture )
{
vlc_assert_locked( &p_vout->picture_lock );
vlc_assert_locked( &p_vout->p->picture_lock );
p_picture->i_status = DESTROYED_PICTURE;
picture_CleanupQuant( p_picture );
......@@ -231,13 +231,13 @@ void vout_DestroyPicture( vout_thread_t *p_vout, picture_t *p_pic )
{
#ifndef NDEBUG
/* Check if picture status is valid */
vlc_mutex_lock( &p_vout->picture_lock );
vlc_mutex_lock( &p_vout->p->picture_lock );
if( p_pic->i_status != RESERVED_PICTURE )
{
msg_Err( p_vout, "picture to destroy %p has invalid status %d",
p_pic, p_pic->i_status );
}
vlc_mutex_unlock( &p_vout->picture_lock );
vlc_mutex_unlock( &p_vout->p->picture_lock );
#endif
vout_DropPicture( p_vout, p_pic );
......@@ -246,7 +246,7 @@ void vout_DestroyPicture( vout_thread_t *p_vout, picture_t *p_pic )
/* */
void vout_UsePictureLocked( vout_thread_t *p_vout, picture_t *p_picture )
{
vlc_assert_locked( &p_vout->picture_lock );
vlc_assert_locked( &p_vout->p->picture_lock );
if( p_picture->i_refcount > 0 )
{
/* Pretend we displayed the picture, but don't destroy
......@@ -263,7 +263,7 @@ void vout_UsePictureLocked( vout_thread_t *p_vout, picture_t *p_picture )
/* */
void vout_DropPicture( vout_thread_t *p_vout, picture_t *p_pic )
{
vlc_mutex_lock( &p_vout->picture_lock );
vlc_mutex_lock( &p_vout->p->picture_lock );
if( p_pic->i_status == READY_PICTURE )
{
......@@ -276,7 +276,7 @@ void vout_DropPicture( vout_thread_t *p_vout, picture_t *p_pic )
vout_UsePictureLocked( p_vout, p_pic );
}
vlc_mutex_unlock( &p_vout->picture_lock );
vlc_mutex_unlock( &p_vout->p->picture_lock );
}
/**
......@@ -287,9 +287,9 @@ void vout_DropPicture( 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->p->picture_lock );
p_pic->i_refcount++;
vlc_mutex_unlock( &p_vout->picture_lock );
vlc_mutex_unlock( &p_vout->p->picture_lock );
}
/**
......@@ -299,7 +299,7 @@ void vout_LinkPicture( 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->p->picture_lock );
if( p_pic->i_refcount > 0 )
p_pic->i_refcount--;
......@@ -311,7 +311,7 @@ void vout_UnlinkPicture( vout_thread_t *p_vout, picture_t *p_pic )
( p_pic->i_status == DISPLAYED_PICTURE || p_pic->i_status == RESERVED_PICTURE ) )
DestroyPicture( p_vout, p_pic );
vlc_mutex_unlock( &p_vout->picture_lock );
vlc_mutex_unlock( &p_vout->p->picture_lock );
}
/**
......@@ -346,7 +346,7 @@ picture_t *vout_RenderPicture( vout_thread_t *p_vout, picture_t *p_pic,
/* The picture buffer is in slow memory. We'll use
* the "2 * VOUT_MAX_PICTURES + 1" picture as a temporary
* one for subpictures rendering. */
p_render = &p_vout->p_picture[2 * VOUT_MAX_PICTURES];
p_render = &p_vout->p->p_picture[2 * VOUT_MAX_PICTURES];
if( p_render->i_status == FREE_PICTURE )
{
vout_AllocatePicture( VLC_OBJECT(p_vout),
......
......@@ -163,9 +163,9 @@ int vout_InitWrapper(vout_thread_t *vout)
vout->fmt_in.i_visible_height != source.i_visible_height ||
vout->fmt_in.i_x_offset != source.i_x_offset ||
vout->fmt_in.i_y_offset != source.i_y_offset )
vout->i_changes |= VOUT_CROP_CHANGE;
vout->p->i_changes |= VOUT_CROP_CHANGE;
if (vout->b_on_top)
if (vout->p->b_on_top)
vout_SetWindowState(vd, VOUT_WINDOW_STATE_ABOVE);
/* XXX For non dr case, the current vout implementation force us to
......@@ -175,14 +175,14 @@ int vout_InitWrapper(vout_thread_t *vout)
sys->use_dr = !vout_IsDisplayFiltered(vd);
const bool allow_dr = !vd->info.has_pictures_invalid && sys->use_dr;
const int picture_max = allow_dr ? VOUT_MAX_PICTURES : 1;
for (vout->output.i_pictures = 0;
vout->output.i_pictures < picture_max;
vout->output.i_pictures++) {
for (vout->p->output.i_pictures = 0;
vout->p->output.i_pictures < picture_max;
vout->p->output.i_pictures++) {
/* Find an empty picture slot */
picture_t *picture = NULL;
for (int index = 0; index < VOUT_MAX_PICTURES; index++) {
if (vout->p_picture[index].i_status == FREE_PICTURE) {
picture = &vout->p_picture[index];
if (vout->p->p_picture[index].i_status == FREE_PICTURE) {
picture = &vout->p->p_picture[index];
break;
}
}
......@@ -218,7 +218,7 @@ int vout_InitWrapper(vout_thread_t *vout)
picture->i_status = DESTROYED_PICTURE;
picture->i_type = DIRECT_PICTURE;
vout->output.pp_picture[vout->output.i_pictures] = picture;
vout->p->output.pp_picture[vout->p->output.i_pictures] = picture;
}
return VLC_SUCCESS;
}
......@@ -231,7 +231,7 @@ void vout_EndWrapper(vout_thread_t *vout)
vout_sys_t *sys = vout->p->p_sys;
for (int i = 0; i < VOUT_MAX_PICTURES; i++) {
picture_t *picture = &vout->p_picture[i];
picture_t *picture = &vout->p->p_picture[i];
if (picture->i_type != DIRECT_PICTURE)
continue;
......@@ -256,29 +256,29 @@ int vout_ManageWrapper(vout_thread_t *vout)
vout_sys_t *sys = vout->p->p_sys;
vout_display_t *vd = sys->vd;
while (vout->i_changes & (VOUT_FULLSCREEN_CHANGE |
while (vout->p->i_changes & (VOUT_FULLSCREEN_CHANGE |
VOUT_ASPECT_CHANGE |
VOUT_ZOOM_CHANGE |
VOUT_SCALE_CHANGE |
VOUT_ON_TOP_CHANGE |
VOUT_CROP_CHANGE)) {
/* */
if (vout->i_changes & VOUT_FULLSCREEN_CHANGE) {
vout->b_fullscreen = !vout->b_fullscreen;
if (vout->p->i_changes & VOUT_FULLSCREEN_CHANGE) {
vout->p->b_fullscreen = !vout->p->b_fullscreen;
var_SetBool(vout, "fullscreen", vout->b_fullscreen);
vout_SetDisplayFullscreen(vd, vout->b_fullscreen);
vout->i_changes &= ~VOUT_FULLSCREEN_CHANGE;
var_SetBool(vout, "fullscreen", vout->p->b_fullscreen);
vout_SetDisplayFullscreen(vd, vout->p->b_fullscreen);
vout->p->i_changes &= ~VOUT_FULLSCREEN_CHANGE;
}
if (vout->i_changes & VOUT_ASPECT_CHANGE) {
if (vout->p->i_changes & VOUT_ASPECT_CHANGE) {
vout->fmt_out.i_sar_num = vout->fmt_in.i_sar_num;
vout->fmt_out.i_sar_den = vout->fmt_in.i_sar_den;
vout_SetDisplayAspect(vd, vout->fmt_in.i_sar_num, vout->fmt_in.i_sar_den);
vout->i_changes &= ~VOUT_ASPECT_CHANGE;
vout->p->i_changes &= ~VOUT_ASPECT_CHANGE;
}
if (vout->i_changes & VOUT_ZOOM_CHANGE) {
if (vout->p->i_changes & VOUT_ZOOM_CHANGE) {
const float zoom = var_GetFloat(vout, "scale");
unsigned den = ZOOM_FP_FACTOR;
......@@ -290,23 +290,23 @@ int vout_ManageWrapper(vout_thread_t *vout)
vout_SetDisplayZoom(vd, num, den);
vout->i_changes &= ~VOUT_ZOOM_CHANGE;
vout->p->i_changes &= ~VOUT_ZOOM_CHANGE;
}
if (vout->i_changes & VOUT_SCALE_CHANGE) {
if (vout->p->i_changes & VOUT_SCALE_CHANGE) {
const bool is_display_filled = var_GetBool(vout, "autoscale");
vout_SetDisplayFilled(vd, is_display_filled);
vout->i_changes &= ~VOUT_SCALE_CHANGE;
vout->p->i_changes &= ~VOUT_SCALE_CHANGE;
}
if (vout->i_changes & VOUT_ON_TOP_CHANGE) {
vout_SetWindowState(vd, vout->b_on_top
if (vout->p->i_changes & VOUT_ON_TOP_CHANGE) {
vout_SetWindowState(vd, vout->p->b_on_top
? VOUT_WINDOW_STATE_ABOVE
: VOUT_WINDOW_STATE_NORMAL);
vout->i_changes &= ~VOUT_ON_TOP_CHANGE;
vout->p->i_changes &= ~VOUT_ON_TOP_CHANGE;
}
if (vout->i_changes & VOUT_CROP_CHANGE) {
if (vout->p->i_changes & VOUT_CROP_CHANGE) {
const video_format_t crop = vout->fmt_in;
const video_format_t org = vout->fmt_render;
/* FIXME because of rounding errors, the reconstructed ratio is wrong */
......@@ -328,13 +328,13 @@ int vout_ManageWrapper(vout_thread_t *vout)
vout_SetDisplayCrop(vd, num, den,
crop.i_x_offset, crop.i_y_offset,
crop.i_visible_width, crop.i_visible_height);
vout->i_changes &= ~VOUT_CROP_CHANGE;
vout->p->i_changes &= ~VOUT_CROP_CHANGE;
}
}
if (sys->use_dr && vout_AreDisplayPicturesInvalid(vd)) {
vout->i_changes |= VOUT_PICTURE_BUFFERS_CHANGE;
vout->p->i_changes |= VOUT_PICTURE_BUFFERS_CHANGE;
}
vout_ManageDisplay(vd, !sys->use_dr);
return VLC_SUCCESS;
......
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