From: Laurent Aimar Date: Sun, 28 Sep 2008 08:21:00 +0000 (+0200) Subject: Privatized part of vout fields. X-Git-Tag: 1.0.0-pre1~2840 X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=b0123347ac0773bf85a22bb97797bc682539325a;p=vlc Privatized part of vout fields. --- diff --git a/include/vlc_vout.h b/include/vlc_vout.h index b58730ccb3..7ef2bdb105 100644 --- a/include/vlc_vout.h +++ b/include/vlc_vout.h @@ -469,6 +469,11 @@ VLC_EXPORT( int, __vout_AllocatePicture,( vlc_object_t *p_this, picture_t *p_pic * @{ */ +/** + * Video ouput thread private structure + */ +typedef struct vout_thread_sys_t vout_thread_sys_t; + /** * Video output thread descriptor * @@ -484,7 +489,6 @@ struct vout_thread_t /**@{*/ 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 */ /**@}*/ @@ -492,18 +496,11 @@ struct vout_thread_t /**@{*/ 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) */ /**@}*/ @@ -522,21 +519,11 @@ struct vout_thread_t 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 */ @@ -549,34 +536,11 @@ struct vout_thread_t /* 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 @@ -591,14 +555,10 @@ struct vout_thread_t */ /** 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 */ diff --git a/modules/gui/beos/VideoOutput.cpp b/modules/gui/beos/VideoOutput.cpp index 62a4ec676d..8364ea184a 100644 --- a/modules/gui/beos/VideoOutput.cpp +++ b/modules/gui/beos/VideoOutput.cpp @@ -1271,8 +1271,6 @@ int Init( vout_thread_t *p_vout ) p_vout->output.i_chroma = colspace[p_vout->p_sys->p_window->colspace_index].chroma; p_vout->p_sys->i_index = 0; - p_vout->b_direct = 1; - p_vout->output.i_rmask = 0x00ff0000; p_vout->output.i_gmask = 0x0000ff00; p_vout->output.i_bmask = 0x000000ff; diff --git a/modules/gui/qnx/vout.c b/modules/gui/qnx/vout.c index 98a07654df..bc34b1bfe9 100644 --- a/modules/gui/qnx/vout.c +++ b/modules/gui/qnx/vout.c @@ -378,12 +378,6 @@ static int QNXManage( vout_thread_t *p_vout ) p_vout->i_changes |= VOUT_FULLSCREEN_CHANGE; break; - case Pk_c: - case Pk_C: - p_vout->b_grayscale = ! p_vout->b_grayscale; - p_vout->i_changes |= VOUT_GRAYSCALE_CHANGE; - break; - default: break; } diff --git a/src/video_output/video_output.c b/src/video_output/video_output.c index 1b05a377c9..d56f209458 100644 --- a/src/video_output/video_output.c +++ b/src/video_output/video_output.c @@ -160,7 +160,7 @@ vout_thread_t *__vout_Request( vlc_object_t *p_this, vout_thread_t *p_vout, /* 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; @@ -170,15 +170,15 @@ vout_thread_t *__vout_Request( vlc_object_t *p_this, vout_thread_t *p_vout, 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 ); @@ -187,7 +187,7 @@ vout_thread_t *__vout_Request( vlc_object_t *p_this, vout_thread_t *p_vout, 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 ); @@ -254,7 +254,7 @@ vout_thread_t *__vout_Request( vlc_object_t *p_this, vout_thread_t *p_vout, /* 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 ); } } @@ -306,6 +306,14 @@ vout_thread_t * __vout_Create( vlc_object_t *p_parent, video_format_t *p_fmt ) 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++) @@ -351,24 +359,21 @@ vout_thread_t * __vout_Create( vlc_object_t *p_parent, video_format_t *p_fmt ) /* 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 ); @@ -394,11 +399,11 @@ vout_thread_t * __vout_Create( vlc_object_t *p_parent, video_format_t *p_fmt ) 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 @@ -407,25 +412,25 @@ vout_thread_t * __vout_Create( vlc_object_t *p_parent, video_format_t *p_fmt ) 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 ); @@ -433,8 +438,8 @@ vout_thread_t * __vout_Create( vlc_object_t *p_parent, video_format_t *p_fmt ) } 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 */ @@ -443,8 +448,8 @@ vout_thread_t * __vout_Create( vlc_object_t *p_parent, video_format_t *p_fmt ) 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 ) @@ -493,12 +498,12 @@ vout_thread_t * __vout_Create( vlc_object_t *p_parent, video_format_t *p_fmt ) 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, @@ -550,12 +555,14 @@ static void vout_Destructor( vlc_object_t * p_this ) /* 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; @@ -706,7 +713,7 @@ static int InitThread( vout_thread_t *p_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++ ) { @@ -731,7 +738,7 @@ static int InitThread( vout_thread_t *p_vout ) /* 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 ) ) { @@ -812,7 +819,7 @@ static void* RunThread( vlc_object_t *p_this ) vlc_object_lock( p_vout ); - if( p_vout->b_title_show ) + if( p_vout->p->b_title_show ) DisplayTitleOnOSD( p_vout ); /* @@ -898,12 +905,12 @@ static void* RunThread( vlc_object_t *p_this ) } /* 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 @@ -916,14 +923,14 @@ static void* RunThread( vlc_object_t *p_this ) } 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; } @@ -949,7 +956,7 @@ static void* RunThread( vlc_object_t *p_this ) { /* 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; } } } @@ -959,14 +966,14 @@ static void* RunThread( vlc_object_t *p_this ) 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 @@ -1010,14 +1017,14 @@ static void* RunThread( vlc_object_t *p_this ) { 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; } } @@ -1031,7 +1038,7 @@ static void* RunThread( vlc_object_t *p_this ) { /* 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 ); } @@ -1096,7 +1103,7 @@ static void* RunThread( vlc_object_t *p_this ) p_vout->i_changes &= ~VOUT_SIZE_CHANGE; - assert( !p_vout->b_direct ); + assert( !p_vout->p->b_direct ); ChromaDestroy( p_vout ); @@ -1140,7 +1147,7 @@ static void* RunThread( vlc_object_t *p_this ) * 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 ); @@ -1160,23 +1167,23 @@ static void* RunThread( vlc_object_t *p_this ) } /* 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 ); } /* @@ -1220,7 +1227,7 @@ static void CleanThread( vout_thread_t *p_vout ) { int i_index; /* index in heap */ - if( !p_vout->b_direct ) + if( !p_vout->p->b_direct ) ChromaDestroy( p_vout ); /* Destroy all remaining pictures */ @@ -1263,7 +1270,7 @@ static void EndThread( vout_thread_t *p_vout ) 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 */ @@ -1280,7 +1287,7 @@ static int ChromaCreate( vout_thread_t *p_vout ) 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 ); @@ -1303,8 +1310,9 @@ static int ChromaCreate( vout_thread_t *p_vout ) 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; @@ -1313,14 +1321,14 @@ static int ChromaCreate( vout_thread_t *p_vout ) 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 ) @@ -1539,9 +1547,9 @@ static int VideoFilter2Callback( vlc_object_t *p_this, char const *psz_cmd, 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; } @@ -1558,7 +1566,7 @@ static void DisplayTitleOnOSD( vout_thread_t *p_vout ) 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 ) ); @@ -1572,7 +1580,7 @@ static void DisplayTitleOnOSD( vout_thread_t *p_vout ) { 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, @@ -1586,7 +1594,7 @@ static void DisplayTitleOnOSD( vout_thread_t *p_vout ) { 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, @@ -1599,7 +1607,7 @@ static void DisplayTitleOnOSD( vout_thread_t *p_vout ) { 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, diff --git a/src/video_output/vout_internal.h b/src/video_output/vout_internal.h index fad85fcec4..4b3e892ed6 100644 --- a/src/video_output/vout_internal.h +++ b/src/video_output/vout_internal.h @@ -30,6 +30,55 @@ #ifndef _VOUT_INTERNAL_H #define _VOUT_INTERNAL_H 1 +struct vout_thread_sys_t +{ + /* */ + vlc_mutex_t vfilter_lock; /**< video filter2 change lock */ + + /* */ + uint32_t render_time; /**< last picture render time */ + unsigned int i_par_num; /**< monitor pixel aspect-ratio */ + unsigned int i_par_den; /**< monitor pixel aspect-ratio */ + + /* */ + bool b_direct; /**< rendered are like direct ? */ + filter_t *p_chroma; + + /** + * 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 */ + +#if 0 + /* 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 */ +#endif + + /** 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 */ + + /* Show media title on videoutput */ + bool b_title_show; + mtime_t i_title_timeout; + int i_title_position; +}; + /* DO NOT use vout_RenderPicture unless you are in src/video_ouput */ picture_t *vout_RenderPicture( vout_thread_t *, picture_t *, subpicture_t *, bool b_paused ); diff --git a/src/video_output/vout_intf.c b/src/video_output/vout_intf.c index 3bce1b0b82..89c972b13d 100644 --- a/src/video_output/vout_intf.c +++ b/src/video_output/vout_intf.c @@ -50,6 +50,7 @@ #include #include #include "../libvlc.h" +#include "vout_internal.h" /***************************************************************************** * Local prototypes @@ -257,10 +258,10 @@ void vout_IntfInit( vout_thread_t *p_vout ) 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 ); @@ -352,14 +353,14 @@ void vout_IntfInit( vout_thread_t *p_vout ) } 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 ); @@ -877,7 +878,7 @@ int vout_vaControlDefault( vout_thread_t *p_vout, int i_query, va_list args ) return VLC_SUCCESS; case VOUT_SNAPSHOT: - p_vout->b_snapshot = true; + p_vout->p->b_snapshot = true; return VLC_SUCCESS; default: @@ -1158,12 +1159,12 @@ static int AspectCallback( vlc_object_t *p_this, char const *psz_cmd, 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; } @@ -1231,7 +1232,7 @@ static int TitleShowCallback( vlc_object_t *p_this, char const *psz_cmd, 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; } @@ -1240,7 +1241,7 @@ static int TitleTimeoutCallback( vlc_object_t *p_this, char const *psz_cmd, { 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; } @@ -1250,6 +1251,6 @@ static int TitlePositionCallback( vlc_object_t *p_this, char const *psz_cmd, 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; } diff --git a/src/video_output/vout_pictures.c b/src/video_output/vout_pictures.c index f1b4d8797e..dbdfa6781f 100644 --- a/src/video_output/vout_pictures.c +++ b/src/video_output/vout_pictures.c @@ -35,6 +35,7 @@ #include #include #include "vout_pictures.h" +#include "vout_internal.h" #include @@ -357,7 +358,7 @@ picture_t *vout_RenderPicture( vout_thread_t *p_vout, picture_t *p_pic, /* Not a direct buffer. We either need to copy it to a direct buffer, * or render it if the chroma isn't the same. */ - if( p_vout->b_direct ) + if( p_vout->p->b_direct ) { /* Picture is not in a direct buffer, but is exactly the * same size as the direct buffers. A memcpy() is enough, @@ -401,8 +402,8 @@ picture_t *vout_RenderPicture( vout_thread_t *p_vout, picture_t *p_pic, } /* Convert image to the first direct buffer */ - p_vout->p_chroma->p_owner = (filter_owner_sys_t *)p_tmp_pic; - p_vout->p_chroma->pf_video_filter( p_vout->p_chroma, p_pic ); + p_vout->p->p_chroma->p_owner = (filter_owner_sys_t *)p_tmp_pic; + p_vout->p->p_chroma->pf_video_filter( p_vout->p->p_chroma, p_pic ); /* Render subpictures on the first direct buffer */ spu_RenderSubpictures( p_vout->p_spu, @@ -420,8 +421,8 @@ picture_t *vout_RenderPicture( vout_thread_t *p_vout, picture_t *p_pic, return NULL; /* Convert image to the first direct buffer */ - p_vout->p_chroma->p_owner = (filter_owner_sys_t *)&p_vout->p_picture[0]; - p_vout->p_chroma->pf_video_filter( p_vout->p_chroma, p_pic ); + p_vout->p->p_chroma->p_owner = (filter_owner_sys_t *)&p_vout->p_picture[0]; + p_vout->p->p_chroma->pf_video_filter( p_vout->p->p_chroma, p_pic ); /* Render subpictures on the first direct buffer */ spu_RenderSubpictures( p_vout->p_spu,