| 1 |
|
|---|
| 2 |
|
|---|
| 3 |
|
|---|
| 4 |
|
|---|
| 5 |
|
|---|
| 6 |
|
|---|
| 7 |
|
|---|
| 8 |
|
|---|
| 9 |
|
|---|
| 10 |
|
|---|
| 11 |
|
|---|
| 12 |
|
|---|
| 13 |
|
|---|
| 14 |
|
|---|
| 15 |
|
|---|
| 16 |
|
|---|
| 17 |
|
|---|
| 18 |
|
|---|
| 19 |
|
|---|
| 20 |
|
|---|
| 21 |
|
|---|
| 22 |
|
|---|
| 23 |
|
|---|
| 24 |
|
|---|
| 25 |
|
|---|
| 26 |
|
|---|
| 27 |
|
|---|
| 28 |
|
|---|
| 29 |
|
|---|
| 30 |
|
|---|
| 31 |
|
|---|
| 32 |
#ifdef HAVE_CONFIG_H |
|---|
| 33 |
# include "config.h" |
|---|
| 34 |
#endif |
|---|
| 35 |
|
|---|
| 36 |
#include <vlc_common.h> |
|---|
| 37 |
|
|---|
| 38 |
#include <stdlib.h> |
|---|
| 39 |
#include <string.h> |
|---|
| 40 |
|
|---|
| 41 |
|
|---|
| 42 |
#ifdef HAVE_SYS_TIMES_H |
|---|
| 43 |
# include <sys/times.h> |
|---|
| 44 |
#endif |
|---|
| 45 |
|
|---|
| 46 |
#include <vlc_vout.h> |
|---|
| 47 |
|
|---|
| 48 |
#include <vlc_filter.h> |
|---|
| 49 |
#include <vlc_osd.h> |
|---|
| 50 |
#include <assert.h> |
|---|
| 51 |
|
|---|
| 52 |
#if defined( __APPLE__ ) |
|---|
| 53 |
|
|---|
| 54 |
#endif |
|---|
| 55 |
|
|---|
| 56 |
|
|---|
| 57 |
|
|---|
| 58 |
#include "input/input_internal.h" |
|---|
| 59 |
|
|---|
| 60 |
#include "modules/modules.h" |
|---|
| 61 |
#include "vout_pictures.h" |
|---|
| 62 |
#include "vout_internal.h" |
|---|
| 63 |
|
|---|
| 64 |
|
|---|
| 65 |
|
|---|
| 66 |
|
|---|
| 67 |
static int InitThread ( vout_thread_t * ); |
|---|
| 68 |
static void* RunThread ( vlc_object_t * ); |
|---|
| 69 |
static void ErrorThread ( vout_thread_t * ); |
|---|
| 70 |
static void CleanThread ( vout_thread_t * ); |
|---|
| 71 |
static void EndThread ( vout_thread_t * ); |
|---|
| 72 |
|
|---|
| 73 |
static void AspectRatio ( int, int *, int * ); |
|---|
| 74 |
|
|---|
| 75 |
static void VideoFormatImportRgb( video_format_t *, const picture_heap_t * ); |
|---|
| 76 |
static void PictureHeapFixRgb( picture_heap_t * ); |
|---|
| 77 |
|
|---|
| 78 |
static void vout_Destructor ( vlc_object_t * p_this ); |
|---|
| 79 |
|
|---|
| 80 |
|
|---|
| 81 |
static int DeinterlaceCallback( vlc_object_t *, char const *, |
|---|
| 82 |
vlc_value_t, vlc_value_t, void * ); |
|---|
| 83 |
static int FilterCallback( vlc_object_t *, char const *, |
|---|
| 84 |
vlc_value_t, vlc_value_t, void * ); |
|---|
| 85 |
static int VideoFilter2Callback( vlc_object_t *, char const *, |
|---|
| 86 |
vlc_value_t, vlc_value_t, void * ); |
|---|
| 87 |
|
|---|
| 88 |
|
|---|
| 89 |
int vout_Snapshot( vout_thread_t *, picture_t * ); |
|---|
| 90 |
|
|---|
| 91 |
|
|---|
| 92 |
static void DisplayTitleOnOSD( vout_thread_t *p_vout ); |
|---|
| 93 |
|
|---|
| 94 |
|
|---|
| 95 |
static void DropPicture( vout_thread_t *p_vout, picture_t *p_picture ); |
|---|
| 96 |
|
|---|
| 97 |
|
|---|
| 98 |
|
|---|
| 99 |
|
|---|
| 100 |
static picture_t *video_new_buffer_filter( filter_t *p_filter ) |
|---|
| 101 |
{ |
|---|
| 102 |
vout_thread_t *p_vout = (vout_thread_t*)p_filter->p_owner; |
|---|
| 103 |
picture_t *p_picture = vout_CreatePicture( p_vout, 0, 0, 0 ); |
|---|
| 104 |
|
|---|
| 105 |
p_picture->i_status = READY_PICTURE; |
|---|
| 106 |
|
|---|
| 107 |
return p_picture; |
|---|
| 108 |
} |
|---|
| 109 |
|
|---|
| 110 |
static void video_del_buffer_filter( filter_t *p_filter, picture_t *p_pic ) |
|---|
| 111 |
{ |
|---|
| 112 |
vout_thread_t *p_vout = (vout_thread_t*)p_filter->p_owner; |
|---|
| 113 |
|
|---|
| 114 |
DropPicture( p_vout, p_pic ); |
|---|
| 115 |
} |
|---|
| 116 |
|
|---|
| 117 |
static int video_filter_buffer_allocation_init( filter_t *p_filter, void *p_data ) |
|---|
| 118 |
{ |
|---|
| 119 |
p_filter->pf_vout_buffer_new = video_new_buffer_filter; |
|---|
| 120 |
p_filter->pf_vout_buffer_del = video_del_buffer_filter; |
|---|
| 121 |
p_filter->p_owner = p_data; |
|---|
| 122 |
return VLC_SUCCESS; |
|---|
| 123 |
} |
|---|
| 124 |
|
|---|
| 125 |
|
|---|
| 126 |
|
|---|
| 127 |
|
|---|
| 128 |
|
|---|
| 129 |
|
|---|
| 130 |
|
|---|
| 131 |
vout_thread_t *__vout_Request( vlc_object_t *p_this, vout_thread_t *p_vout, |
|---|
| 132 |
video_format_t *p_fmt ) |
|---|
| 133 |
{ |
|---|
| 134 |
const bool b_vout_provided = p_vout != NULL; |
|---|
| 135 |
if( !p_fmt ) |
|---|
| 136 |
{ |
|---|
| 137 |
|
|---|
| 138 |
|
|---|
| 139 |
|
|---|
| 140 |
if( p_vout ) |
|---|
| 141 |
vout_CloseAndRelease( p_vout ); |
|---|
| 142 |
return NULL; |
|---|
| 143 |
} |
|---|
| 144 |
|
|---|
| 145 |
|
|---|
| 146 |
if( p_vout ) |
|---|
| 147 |
{ |
|---|
| 148 |
vlc_object_hold( p_vout ); |
|---|
| 149 |
} |
|---|
| 150 |
|
|---|
| 151 |
|
|---|
| 152 |
|
|---|
| 153 |
|
|---|
| 154 |
if( p_vout ) |
|---|
| 155 |
{ |
|---|
| 156 |
char *psz_filter_chain; |
|---|
| 157 |
vlc_value_t val; |
|---|
| 158 |
|
|---|
| 159 |
vlc_mutex_lock( &p_vout->change_lock ); |
|---|
| 160 |
|
|---|
| 161 |
|
|---|
| 162 |
|
|---|
| 163 |
if( p_vout->p->b_filter_change ) |
|---|
| 164 |
{ |
|---|
| 165 |
var_Get( p_vout, "vout-filter", &val ); |
|---|
| 166 |
psz_filter_chain = val.psz_string; |
|---|
| 167 |
|
|---|
| 168 |
if( psz_filter_chain && !*psz_filter_chain ) |
|---|
| 169 |
{ |
|---|
| 170 |
free( psz_filter_chain ); |
|---|
| 171 |
psz_filter_chain = NULL; |
|---|
| 172 |
} |
|---|
| 173 |
if( p_vout->p->psz_filter_chain && !*p_vout->p->psz_filter_chain ) |
|---|
| 174 |
{ |
|---|
| 175 |
free( p_vout->p->psz_filter_chain ); |
|---|
| 176 |
p_vout->p->psz_filter_chain = NULL; |
|---|
| 177 |
} |
|---|
| 178 |
|
|---|
| 179 |
if( !psz_filter_chain && !p_vout->p->psz_filter_chain ) |
|---|
| 180 |
{ |
|---|
| 181 |
p_vout->p->b_filter_change = false; |
|---|
| 182 |
} |
|---|
| 183 |
|
|---|
| 184 |
free( psz_filter_chain ); |
|---|
| 185 |
} |
|---|
| 186 |
|
|---|
| 187 |
if( p_vout->fmt_render.i_chroma != p_fmt->i_chroma || |
|---|
| 188 |
p_vout->fmt_render.i_width != p_fmt->i_width || |
|---|
| 189 |
p_vout->fmt_render.i_height != p_fmt->i_height || |
|---|
| 190 |
p_vout->p->b_filter_change ) |
|---|
| 191 |
{ |
|---|
| 192 |
vlc_mutex_unlock( &p_vout->change_lock ); |
|---|
| 193 |
|
|---|
| 194 |
|
|---|
| 195 |
vout_CloseAndRelease( p_vout ); |
|---|
| 196 |
vlc_object_release( p_vout ); |
|---|
| 197 |
p_vout = NULL; |
|---|
| 198 |
} |
|---|
| 199 |
else |
|---|
| 200 |
{ |
|---|
| 201 |
|
|---|
| 202 |
if( p_vout->fmt_render.i_aspect != p_fmt->i_aspect ) |
|---|
| 203 |
{ |
|---|
| 204 |
|
|---|
| 205 |
|
|---|
| 206 |
unsigned int i_sar_num; |
|---|
| 207 |
unsigned int i_sar_den; |
|---|
| 208 |
unsigned int i_aspect; |
|---|
| 209 |
|
|---|
| 210 |
i_aspect = p_fmt->i_aspect; |
|---|
| 211 |
vlc_ureduce( &i_sar_num, &i_sar_den, |
|---|
| 212 |
p_fmt->i_sar_num, p_fmt->i_sar_den, 50000 ); |
|---|
| 213 |
#if 0 |
|---|
| 214 |
|
|---|
| 215 |
|
|---|
| 216 |
|
|---|
| 217 |
if( p_vout->i_par_num > 0 && p_vout->i_par_den > 0 ) |
|---|
| 218 |
{ |
|---|
| 219 |
i_sar_num *= p_vout->i_par_den; |
|---|
| 220 |
i_sar_den *= p_vout->i_par_num; |
|---|
| 221 |
i_aspect = i_aspect * p_vout->i_par_den / p_vout->i_par_num; |
|---|
| 222 |
} |
|---|
| 223 |
#endif |
|---|
| 224 |
|
|---|
| 225 |
if( i_sar_num > 0 && i_sar_den > 0 && i_aspect > 0 ) |
|---|
| 226 |
{ |
|---|
| 227 |
p_vout->fmt_in.i_sar_num = i_sar_num; |
|---|
| 228 |
p_vout->fmt_in.i_sar_den = i_sar_den; |
|---|
| 229 |
p_vout->fmt_in.i_aspect = i_aspect; |
|---|
| 230 |
|
|---|
| 231 |
p_vout->fmt_render.i_sar_num = i_sar_num; |
|---|
| 232 |
p_vout->fmt_render.i_sar_den = i_sar_den; |
|---|
| 233 |
p_vout->fmt_render.i_aspect = i_aspect; |
|---|
| 234 |
|
|---|
| 235 |
p_vout->render.i_aspect = i_aspect; |
|---|
| 236 |
|
|---|
| 237 |
p_vout->i_changes |= VOUT_ASPECT_CHANGE; |
|---|
| 238 |
|
|---|
| 239 |
} |
|---|
| 240 |
} |
|---|
| 241 |
vlc_mutex_unlock( &p_vout->change_lock ); |
|---|
| 242 |
|
|---|
| 243 |
vlc_object_release( p_vout ); |
|---|
| 244 |
} |
|---|
| 245 |
|
|---|
| 246 |
if( p_vout ) |
|---|
| 247 |
{ |
|---|
| 248 |
msg_Dbg( p_this, "reusing provided vout" ); |
|---|
| 249 |
|
|---|
| 250 |
spu_Attach( p_vout->p_spu, p_this, true ); |
|---|
| 251 |
|
|---|
| 252 |
vlc_object_detach( p_vout ); |
|---|
| 253 |
vlc_object_attach( p_vout, p_this ); |
|---|
| 254 |
|
|---|
| 255 |
|
|---|
| 256 |
|
|---|
| 257 |
if( p_vout->p->b_title_show && !b_vout_provided ) |
|---|
| 258 |
DisplayTitleOnOSD( p_vout ); |
|---|
| 259 |
} |
|---|
| 260 |
} |
|---|
| 261 |
|
|---|
| 262 |
if( !p_vout ) |
|---|
| 263 |
{ |
|---|
| 264 |
msg_Dbg( p_this, "no usable vout present, spawning one" ); |
|---|
| 265 |
|
|---|
| 266 |
p_vout = vout_Create( p_this, p_fmt ); |
|---|
| 267 |
} |
|---|
| 268 |
|
|---|
| 269 |
return p_vout; |
|---|
| 270 |
} |
|---|
| 271 |
|
|---|
| 272 |
|
|---|
| 273 |
|
|---|
| 274 |
|
|---|
| 275 |
|
|---|
| 276 |
|
|---|
| 277 |
|
|---|
| 278 |
vout_thread_t * __vout_Create( vlc_object_t *p_parent, video_format_t *p_fmt ) |
|---|
| 279 |
{ |
|---|
| 280 |
vout_thread_t * p_vout; |
|---|
| 281 |
input_thread_t * p_input_thread; |
|---|
| 282 |
int i_index; |
|---|
| 283 |
vlc_value_t val, text; |
|---|
| 284 |
|
|---|
| 285 |
unsigned int i_width = p_fmt->i_width; |
|---|
| 286 |
unsigned int i_height = p_fmt->i_height; |
|---|
| 287 |
vlc_fourcc_t i_chroma = p_fmt->i_chroma; |
|---|
| 288 |
unsigned int i_aspect = p_fmt->i_aspect; |
|---|
| 289 |
|
|---|
| 290 |
config_chain_t *p_cfg; |
|---|
| 291 |
char *psz_parser; |
|---|
| 292 |
char *psz_name; |
|---|
| 293 |
|
|---|
| 294 |
if( i_width <= 0 || i_height <= 0 || i_aspect <= 0 ) |
|---|
| 295 |
return NULL; |
|---|
| 296 |
|
|---|
| 297 |
vlc_ureduce( &p_fmt->i_sar_num, &p_fmt->i_sar_den, |
|---|
| 298 |
p_fmt->i_sar_num, p_fmt->i_sar_den, 50000 ); |
|---|
| 299 |
if( p_fmt->i_sar_num <= 0 || p_fmt->i_sar_den <= 0 ) |
|---|
| 300 |
return NULL; |
|---|
| 301 |
|
|---|
| 302 |
|
|---|
| 303 |
static const char typename[] = "video output"; |
|---|
| 304 |
p_vout = vlc_custom_create( p_parent, sizeof( *p_vout ), VLC_OBJECT_VOUT, |
|---|
| 305 |
typename ); |
|---|
| 306 |
if( p_vout == NULL ) |
|---|
| 307 |
return NULL; |
|---|
| 308 |
|
|---|
| 309 |
|
|---|
| 310 |
p_vout->p = calloc( 1, sizeof(*p_vout->p) ); |
|---|
| 311 |
if( !p_vout->p ) |
|---|
| 312 |
{ |
|---|
| 313 |
vlc_object_release( p_vout ); |
|---|
| 314 |
return NULL; |
|---|
| 315 |
} |
|---|
| 316 |
|
|---|
| 317 |
|
|---|
| 318 |
|
|---|
| 319 |
for( i_index = 0; i_index < 2 * VOUT_MAX_PICTURES + 1; i_index++) |
|---|
| 320 |
{ |
|---|
| 321 |
p_vout->p_picture[i_index].pf_lock = NULL; |
|---|
| 322 |
p_vout->p_picture[i_index].pf_unlock = NULL; |
|---|
| 323 |
p_vout->p_picture[i_index].i_status = FREE_PICTURE; |
|---|
| 324 |
p_vout->p_picture[i_index].i_type = EMPTY_PICTURE; |
|---|
| 325 |
p_vout->p_picture[i_index].b_slow = 0; |
|---|
| 326 |
} |
|---|
| 327 |
|
|---|
| 328 |
|
|---|
| 329 |
p_vout->i_heap_size = 0; |
|---|
| 330 |
|
|---|
| 331 |
|
|---|
| 332 |
I_RENDERPICTURES = 0; |
|---|
| 333 |
|
|---|
| 334 |
p_vout->fmt_render = *p_fmt; |
|---|
| 335 |
p_vout->fmt_in = *p_fmt; |
|---|
| 336 |
|
|---|
| 337 |
p_vout->render.i_width = i_width; |
|---|
| 338 |
p_vout->render.i_height = i_height; |
|---|
| 339 |
p_vout->render.i_chroma = i_chroma; |
|---|
| 340 |
p_vout->render.i_aspect = i_aspect; |
|---|
| 341 |
|
|---|
| 342 |
p_vout->render.i_rmask = p_fmt->i_rmask; |
|---|
| 343 |
p_vout->render.i_gmask = p_fmt->i_gmask; |
|---|
| 344 |
p_vout->render.i_bmask = p_fmt->i_bmask; |
|---|
| 345 |
|
|---|
| 346 |
p_vout->render.i_last_used_pic = -1; |
|---|
| 347 |
p_vout->render.b_allow_modify_pics = 1; |
|---|
| 348 |
|
|---|
| 349 |
|
|---|
| 350 |
I_OUTPUTPICTURES = 0; |
|---|
| 351 |
p_vout->output.i_width = 0; |
|---|
| 352 |
p_vout->output.i_height = 0; |
|---|
| 353 |
p_vout->output.i_chroma = 0; |
|---|
| 354 |
p_vout->output.i_aspect = 0; |
|---|
| 355 |
|
|---|
| 356 |
p_vout->output.i_rmask = 0; |
|---|
| 357 |
p_vout->output.i_gmask = 0; |
|---|
| 358 |
p_vout->output.i_bmask = 0; |
|---|
| 359 |
|
|---|
| 360 |
|
|---|
| 361 |
p_vout->i_changes = 0; |
|---|
| 362 |
p_vout->b_scale = 1; |
|---|
| 363 |
p_vout->b_fullscreen = 0; |
|---|
| 364 |
p_vout->i_alignment = 0; |
|---|
| 365 |
p_vout->p->render_time = 10; |
|---|
| 366 |
p_vout->p->c_fps_samples = 0; |
|---|
| 367 |
p_vout->p->b_filter_change = 0; |
|---|
| 368 |
p_vout->p->b_paused = false; |
|---|
| 369 |
p_vout->p->i_pause_date = 0; |
|---|
| 370 |
p_vout->pf_control = NULL; |
|---|
| 371 |
p_vout->p_window = NULL; |
|---|
| 372 |
p_vout->p->i_par_num = |
|---|
| 373 |
p_vout->p->i_par_den = 1; |
|---|
| 374 |
|
|---|
| 375 |
|
|---|
| 376 |
vlc_mutex_init( &p_vout->picture_lock ); |
|---|
| 377 |
vlc_mutex_init( &p_vout->change_lock ); |
|---|
| 378 |
vlc_mutex_init( &p_vout->p->vfilter_lock ); |
|---|
| 379 |
|
|---|
| 380 |
|
|---|
| 381 |
var_Create( p_vout, "mouse-x", VLC_VAR_INTEGER ); |
|---|
| 382 |
var_Create( p_vout, "mouse-y", VLC_VAR_INTEGER ); |
|---|
| 383 |
var_Create( p_vout, "mouse-button-down", VLC_VAR_INTEGER ); |
|---|
| 384 |
var_Create( p_vout, "mouse-moved", VLC_VAR_BOOL ); |
|---|
| 385 |
var_Create( p_vout, "mouse-clicked", VLC_VAR_INTEGER ); |
|---|
| 386 |
|
|---|
| 387 |
|
|---|
| 388 |
p_vout->p_spu = spu_Create( p_vout ); |
|---|
| 389 |
spu_Attach( p_vout->p_spu, p_parent, true ); |
|---|
| 390 |
|
|---|
| 391 |
|
|---|
| 392 |
vlc_object_attach( p_vout, p_parent ); |
|---|
| 393 |
|
|---|
| 394 |
spu_Init( p_vout->p_spu ); |
|---|
| 395 |
|
|---|
| 396 |
|
|---|
| 397 |
vout_IntfInit( p_vout ); |
|---|
| 398 |
|
|---|
| 399 |
|
|---|
| 400 |
|
|---|
| 401 |
if( p_parent->i_object_type != VLC_OBJECT_VOUT ) |
|---|
| 402 |
{ |
|---|
| 403 |
|
|---|
| 404 |
p_vout->p->psz_filter_chain = |
|---|
| 405 |
var_CreateGetStringCommand( p_vout, "vout-filter" ); |
|---|
| 406 |
|
|---|
| 407 |
|
|---|
| 408 |
p_vout->p->psz_vf2 = |
|---|
| 409 |
var_CreateGetStringCommand( p_vout, "video-filter" ); |
|---|
| 410 |
} |
|---|
| 411 |
else |
|---|
| 412 |
{ |
|---|
| 413 |
|
|---|
| 414 |
char *psz_tmp; |
|---|
| 415 |
|
|---|
| 416 |
|
|---|
| 417 |
p_vout->p->psz_filter_chain |
|---|
| 418 |
= ((vout_thread_t *)p_parent)->p->psz_filter_chain; |
|---|
| 419 |
p_vout->p->psz_filter_chain |
|---|
| 420 |
= config_ChainCreate( &psz_tmp, &p_cfg, p_vout->p->psz_filter_chain ); |
|---|
| 421 |
config_ChainDestroy( p_cfg ); |
|---|
| 422 |
free( psz_tmp ); |
|---|
| 423 |
|
|---|
| 424 |
|
|---|
| 425 |
var_Create( p_vout, "video-filter", |
|---|
| 426 |
VLC_VAR_STRING | VLC_VAR_ISCOMMAND ); |
|---|
| 427 |
p_vout->p->psz_vf2 = var_GetString( p_vout, "video-filter" ); |
|---|
| 428 |
} |
|---|
| 429 |
|
|---|
| 430 |
var_AddCallback( p_vout, "video-filter", VideoFilter2Callback, NULL ); |
|---|
| 431 |
p_vout->p->p_vf2_chain = filter_chain_New( p_vout, "video filter2", |
|---|
| 432 |
false, video_filter_buffer_allocation_init, NULL, p_vout ); |
|---|
| 433 |
|
|---|
| 434 |
|
|---|
| 435 |
if( !p_vout->p->psz_filter_chain || !*p_vout->p->psz_filter_chain ) |
|---|
| 436 |
{ |
|---|
| 437 |
var_Create( p_vout, "vout", VLC_VAR_STRING | VLC_VAR_DOINHERIT ); |
|---|
| 438 |
var_Get( p_vout, "vout", &val ); |
|---|
| 439 |
psz_parser = val.psz_string; |
|---|
| 440 |
} |
|---|
| 441 |
else |
|---|
| 442 |
{ |
|---|
| 443 |
psz_parser = strdup( p_vout->p->psz_filter_chain ); |
|---|
| 444 |
p_vout->p->b_title_show = false; |
|---|
| 445 |
} |
|---|
| 446 |
|
|---|
| 447 |
|
|---|
| 448 |
char* psz_tmp = config_ChainCreate( &psz_name, &p_cfg, psz_parser ); |
|---|
| 449 |
free( psz_parser ); |
|---|
| 450 |
free( psz_tmp ); |
|---|
| 451 |
p_vout->p_cfg = p_cfg; |
|---|
| 452 |
p_vout->p_module = module_need( p_vout, |
|---|
| 453 |
( p_vout->p->psz_filter_chain && *p_vout->p->psz_filter_chain ) ? |
|---|
| 454 |
"video filter" : "video output", psz_name, p_vout->p->psz_filter_chain && *p_vout->p->psz_filter_chain ); |
|---|
| 455 |
free( psz_name ); |
|---|
| 456 |
|
|---|
| 457 |
if( p_vout->p_module == NULL ) |
|---|
| 458 |
{ |
|---|
| 459 |
msg_Err( p_vout, "no suitable vout module" ); |
|---|
| 460 |
|
|---|
| 461 |
EndThread( p_vout ); |
|---|
| 462 |
vlc_object_detach( p_vout ); |
|---|
| 463 |
vlc_object_release( p_vout ); |
|---|
| 464 |
return NULL; |
|---|
| 465 |
} |
|---|
| 466 |
|
|---|
| 467 |
|
|---|
| 468 |
var_Create( p_vout, "deinterlace", VLC_VAR_STRING | VLC_VAR_HASCHOICE ); |
|---|
| 469 |
text.psz_string = _("Deinterlace"); |
|---|
| 470 |
var_Change( p_vout, "deinterlace", VLC_VAR_SETTEXT, &text, NULL ); |
|---|
| 471 |
val.psz_string = (char *)""; text.psz_string = _("Disable"); |
|---|
| 472 |
var_Change( p_vout, "deinterlace", VLC_VAR_ADDCHOICE, &val, &text ); |
|---|
| 473 |
val.psz_string = (char *)"discard"; text.psz_string = _("Discard"); |
|---|
| 474 |
var_Change( p_vout, "deinterlace", VLC_VAR_ADDCHOICE, &val, &text ); |
|---|
| 475 |
val.psz_string = (char *)"blend"; text.psz_string = _("Blend"); |
|---|
| 476 |
var_Change( p_vout, "deinterlace", VLC_VAR_ADDCHOICE, &val, &text ); |
|---|
| 477 |
val.psz_string = (char *)"mean"; text.psz_string = _("Mean"); |
|---|
| 478 |
var_Change( p_vout, "deinterlace", VLC_VAR_ADDCHOICE, &val, &text ); |
|---|
| 479 |
val.psz_string = (char *)"bob"; text.psz_string = _("Bob"); |
|---|
| 480 |
var_Change( p_vout, "deinterlace", VLC_VAR_ADDCHOICE, &val, &text ); |
|---|
| 481 |
val.psz_string = (char *)"linear"; text.psz_string = _("Linear"); |
|---|
| 482 |
var_Change( p_vout, "deinterlace", VLC_VAR_ADDCHOICE, &val, &text ); |
|---|
| 483 |
val.psz_string = (char *)"x"; text.psz_string = (char *)"X"; |
|---|
| 484 |
var_Change( p_vout, "deinterlace", VLC_VAR_ADDCHOICE, &val, &text ); |
|---|
| 485 |
|
|---|
| 486 |
if( var_Get( p_vout, "deinterlace-mode", &val ) == VLC_SUCCESS ) |
|---|
| 487 |
{ |
|---|
| 488 |
var_Set( p_vout, "deinterlace", val ); |
|---|
| 489 |
free( val.psz_string ); |
|---|
| 490 |
} |
|---|
| 491 |
var_AddCallback( p_vout, "deinterlace", DeinterlaceCallback, NULL ); |
|---|
| 492 |
|
|---|
| 493 |
var_Create( p_vout, "vout-filter", VLC_VAR_STRING | VLC_VAR_DOINHERIT ); |
|---|
| 494 |
text.psz_string = _("Filters"); |
|---|
| 495 |
var_Change( p_vout, "vout-filter", VLC_VAR_SETTEXT, &text, NULL ); |
|---|
| 496 |
var_AddCallback( p_vout, "vout-filter", FilterCallback, NULL ); |
|---|
| 497 |
|
|---|
| 498 |
|
|---|
| 499 |
p_input_thread = (input_thread_t *)vlc_object_find( p_vout, |
|---|
| 500 |
VLC_OBJECT_INPUT, FIND_ANYWHERE ); |
|---|
| 501 |
if( p_input_thread ) |
|---|
| 502 |
{ |
|---|
| 503 |
p_vout->p->i_pts_delay = p_input_thread->i_pts_delay; |
|---|
| 504 |
vlc_object_release( p_input_thread ); |
|---|
| 505 |
} |
|---|
| 506 |
else |
|---|
| 507 |
{ |
|---|
| 508 |
p_vout->p->i_pts_delay = DEFAULT_PTS_DELAY; |
|---|
| 509 |
} |
|---|
| 510 |
|
|---|
| 511 |
if( vlc_thread_create( p_vout, "video output", RunThread, |
|---|
| 512 |
VLC_THREAD_PRIORITY_OUTPUT, true ) ) |
|---|
| 513 |
{ |
|---|
| 514 |
module_unneed( p_vout, p_vout->p_module ); |
|---|
| 515 |
vlc_object_release( p_vout ); |
|---|
| 516 |
return NULL; |
|---|
| 517 |
} |
|---|
| 518 |
|
|---|
| 519 |
vlc_object_set_destructor( p_vout, vout_Destructor ); |
|---|
| 520 |
|
|---|
| 521 |
if( p_vout->b_error ) |
|---|
| 522 |
{ |
|---|
| 523 |
msg_Err( p_vout, "video output creation failed" ); |
|---|
| 524 |
vout_CloseAndRelease( p_vout ); |
|---|
| 525 |
return NULL; |
|---|
| 526 |
} |
|---|
| 527 |
|
|---|
| 528 |
return p_vout; |
|---|
| 529 |
} |
|---|
| 530 |
|
|---|
| 531 |
|
|---|
| 532 |
|
|---|
| 533 |
|
|---|
| 534 |
|
|---|
| 535 |
|
|---|
| 536 |
|
|---|
| 537 |
|
|---|
| 538 |
|
|---|
| 539 |
void vout_Close( vout_thread_t *p_vout ) |
|---|
| 540 |
{ |
|---|
| 541 |
assert( p_vout ); |
|---|
| 542 |
|
|---|
| 543 |
vlc_object_kill( p_vout ); |
|---|
| 544 |
vlc_thread_join( p_vout ); |
|---|
| 545 |
module_unneed( p_vout, p_vout->p_module ); |
|---|
| 546 |
p_vout->p_module = NULL; |
|---|
| 547 |
} |
|---|
| 548 |
|
|---|
| 549 |
|
|---|
| 550 |
static void vout_Destructor( vlc_object_t * p_this ) |
|---|
| 551 |
{ |
|---|
| 552 |
vout_thread_t *p_vout = (vout_thread_t *)p_this; |
|---|
| 553 |
|
|---|
| 554 |
|
|---|
| 555 |
assert( !p_vout->p_module ); |
|---|
| 556 |
|
|---|
| 557 |
|
|---|
| 558 |
vlc_mutex_destroy( &p_vout->picture_lock ); |
|---|
| 559 |
vlc_mutex_destroy( &p_vout->change_lock ); |
|---|
| 560 |
vlc_mutex_destroy( &p_vout->p->vfilter_lock ); |
|---|
| 561 |
|
|---|
| 562 |
free( p_vout->p->psz_filter_chain ); |
|---|
| 563 |
|
|---|
| 564 |
config_ChainDestroy( p_vout->p_cfg ); |
|---|
| 565 |
|
|---|
| 566 |
free( p_vout->p ); |
|---|
| 567 |
|
|---|
| 568 |
#ifndef __APPLE__ |
|---|
| 569 |
vout_thread_t *p_another_vout; |
|---|
| 570 |
|
|---|
| 571 |
|
|---|
| 572 |
|
|---|
| 573 |
|
|---|
| 574 |
|
|---|
| 575 |
|
|---|
| 576 |
p_another_vout = vlc_object_find( p_this->p_libvlc, |
|---|
| 577 |
VLC_OBJECT_VOUT, FIND_ANYWHERE ); |
|---|
| 578 |
if( p_another_vout == NULL ) |
|---|
| 579 |
var_SetBool( p_this->p_libvlc, "intf-show", true ); |
|---|
| 580 |
else |
|---|
| 581 |
vlc_object_release( p_another_vout ); |
|---|
| 582 |
#endif |
|---|
| 583 |
} |
|---|
| 584 |
|
|---|
| 585 |
|
|---|
| 586 |
void vout_ChangePause( vout_thread_t *p_vout, bool b_paused, mtime_t i_date ) |
|---|
| 587 |
{ |
|---|
| 588 |
vlc_object_lock( p_vout ); |
|---|
| 589 |
|
|---|
| 590 |
assert( (!p_vout->p->b_paused) != (!b_paused) ); |
|---|
| 591 |
if( p_vout->p->b_paused ) |
|---|
| 592 |
{ |
|---|
| 593 |
const mtime_t i_duration = i_date - p_vout->p->i_pause_date; |
|---|
| 594 |
|
|---|
| 595 |
for( int i_index = 0; i_index < I_RENDERPICTURES; i_index++ ) |
|---|
| 596 |
{ |
|---|
| 597 |
picture_t *p_pic = PP_RENDERPICTURE[i_index]; |
|---|
| 598 |
|
|---|
| 599 |
if( p_pic->i_status == READY_PICTURE ) |
|---|
| 600 |
p_pic->date += i_duration; |
|---|
| 601 |
} |
|---|
| 602 |
|
|---|
| 603 |
} |
|---|
| 604 |
p_vout->p->b_paused = b_paused; |
|---|
| 605 |
p_vout->p->i_pause_date = i_date; |
|---|
| 606 |
|
|---|
| 607 |
vlc_object_unlock( p_vout ); |
|---|
| 608 |
} |
|---|
| 609 |
|
|---|
| 610 |
|
|---|
| 611 |
|
|---|
| 612 |
|
|---|
| 613 |
|
|---|
| 614 |
|
|---|
| 615 |
|
|---|
| 616 |
|
|---|
| 617 |
|
|---|
| 618 |
static int ChromaCreate( vout_thread_t *p_vout ); |
|---|
| 619 |
static void ChromaDestroy( vout_thread_t *p_vout ); |
|---|
| 620 |
|
|---|
| 621 |
static bool ChromaIsEqual( const picture_heap_t *p_output, const picture_heap_t *p_render ) |
|---|
| 622 |
{ |
|---|
| 623 |
if( !vout_ChromaCmp( p_output->i_chroma, p_render->i_chroma ) ) |
|---|
| 624 |
return false; |
|---|
| 625 |
|
|---|
| 626 |
if( p_output->i_chroma != FOURCC_RV15 && |
|---|
| 627 |
p_output->i_chroma != FOURCC_RV16 && |
|---|
| 628 |
p_output->i_chroma != FOURCC_RV24 && |
|---|
| 629 |
p_output->i_chroma != FOURCC_RV32 ) |
|---|
| 630 |
return true; |
|---|
| 631 |
|
|---|
| 632 |
return p_output->i_rmask == p_render->i_rmask && |
|---|
| 633 |
p_output->i_gmask == p_render->i_gmask && |
|---|
| 634 |
p_output->i_bmask == p_render->i_bmask; |
|---|
| 635 |
} |
|---|
| 636 |
|
|---|
| 637 |
static int InitThread( vout_thread_t *p_vout ) |
|---|
| 638 |
{ |
|---|
| 639 |
int i, i_aspect_x, i_aspect_y; |
|---|
| 640 |
|
|---|
| 641 |
#ifdef STATS |
|---|
| 642 |
p_vout->c_loops = 0; |
|---|
| 643 |
#endif |
|---|
| 644 |
|
|---|
| 645 |
|
|---|
| 646 |
if( p_vout->pf_init( p_vout ) ) |
|---|
| 647 |
return VLC_EGENERIC; |
|---|
| 648 |
|
|---|
| 649 |
if( !I_OUTPUTPICTURES ) |
|---|
| 650 |
{ |
|---|
| 651 |
msg_Err( p_vout, "plugin was unable to allocate at least " |
|---|
| 652 |
"one direct buffer" ); |
|---|
| 653 |
p_vout->pf_end( p_vout ); |
|---|
| 654 |
return VLC_EGENERIC; |
|---|
| 655 |
} |
|---|
| 656 |
|
|---|
| 657 |
if( I_OUTPUTPICTURES > VOUT_MAX_PICTURES ) |
|---|
| 658 |
{ |
|---|
| 659 |
msg_Err( p_vout, "plugin allocated too many direct buffers, " |
|---|
| 660 |
"our internal buffers must have overflown." ); |
|---|
| 661 |
p_vout->pf_end( p_vout ); |
|---|
| 662 |
return VLC_EGENERIC; |
|---|
| 663 |
} |
|---|
| 664 |
|
|---|
| 665 |
msg_Dbg( p_vout, "got %i direct buffer(s)", I_OUTPUTPICTURES ); |
|---|
| 666 |
|
|---|
| 667 |
AspectRatio( p_vout->fmt_render.i_aspect, &i_aspect_x, &i_aspect_y ); |
|---|
| 668 |
|
|---|
| 669 |
msg_Dbg( p_vout, "picture in %ix%i (%i,%i,%ix%i), " |
|---|
| 670 |
"chroma %4.4s, ar %i:%i, sar %i:%i", |
|---|
| 671 |
p_vout->fmt_render.i_width, p_vout->fmt_render.i_height, |
|---|
| 672 |
p_vout->fmt_render.i_x_offset, p_vout->fmt_render.i_y_offset, |
|---|
| 673 |
p_vout->fmt_render.i_visible_width, |
|---|
| 674 |
p_vout->fmt_render.i_visible_height, |
|---|
| 675 |
(char*)&p_vout->fmt_render.i_chroma, |
|---|
| 676 |
i_aspect_x, i_aspect_y, |
|---|
| 677 |
p_vout->fmt_render.i_sar_num, p_vout->fmt_render.i_sar_den ); |
|---|
| 678 |
|
|---|
| 679 |
AspectRatio( p_vout->fmt_in.i_aspect, &i_aspect_x, &i_aspect_y ); |
|---|
| 680 |
|
|---|
| 681 |
msg_Dbg( p_vout, "picture user %ix%i (%i,%i,%ix%i), " |
|---|
| 682 |
"chroma %4.4s, ar %i:%i, sar %i:%i", |
|---|
| 683 |
p_vout->fmt_in.i_width, p_vout->fmt_in.i_height, |
|---|
| 684 |
p_vout->fmt_in.i_x_offset, p_vout->fmt_in.i_y_offset, |
|---|
| 685 |
p_vout->fmt_in.i_visible_width, |
|---|
| 686 |
p_vout->fmt_in.i_visible_height, |
|---|
| 687 |
(char*)&p_vout->fmt_in.i_chroma, |
|---|
| 688 |
i_aspect_x, i_aspect_y, |
|---|
| 689 |
p_vout->fmt_in.i_sar_num, p_vout->fmt_in.i_sar_den ); |
|---|
| 690 |
|
|---|
| 691 |
if( !p_vout->fmt_out.i_width || !p_vout->fmt_out.i_height ) |
|---|
| 692 |
{ |
|---|
| 693 |
p_vout->fmt_out.i_width = p_vout->fmt_out.i_visible_width = |
|---|
| 694 |
p_vout->output.i_width; |
|---|
| 695 |
p_vout->fmt_out.i_height = p_vout->fmt_out.i_visible_height = |
|---|
| 696 |
p_vout->output.i_height; |
|---|
| 697 |
p_vout->fmt_out.i_x_offset = p_vout->fmt_out.i_y_offset = 0; |
|---|
| 698 |
|
|---|
| 699 |
p_vout->fmt_out.i_aspect = p_vout->output.i_aspect; |
|---|
| 700 |
p_vout->fmt_out.i_chroma = p_vout->output.i_chroma; |
|---|
| 701 |
} |
|---|
| 702 |
if( !p_vout->fmt_out.i_sar_num || !p_vout->fmt_out.i_sar_num ) |
|---|
| 703 |
{ |
|---|
| 704 |
p_vout->fmt_out.i_sar_num = p_vout->fmt_out.i_aspect * |
|---|
| 705 |
p_vout->fmt_out.i_height; |
|---|
| 706 |
p_vout->fmt_out.i_sar_den = VOUT_ASPECT_FACTOR * |
|---|
| 707 |
p_vout->fmt_out.i_width; |
|---|
| 708 |
} |
|---|
| 709 |
|
|---|
| 710 |
vlc_ureduce( &p_vout->fmt_out.i_sar_num, &p_vout->fmt_out.i_sar_den, |
|---|
| 711 |
p_vout->fmt_out.i_sar_num, p_vout->fmt_out.i_sar_den, 0 ); |
|---|
| 712 |
|
|---|
| 713 |
AspectRatio( p_vout->fmt_out.i_aspect, &i_aspect_x, &i_aspect_y ); |
|---|
| 714 |
|
|---|
| 715 |
msg_Dbg( p_vout, "picture out %ix%i (%i,%i,%ix%i), " |
|---|
| 716 |
"chroma %4.4s, ar %i:%i, sar %i:%i", |
|---|
| 717 |
p_vout->fmt_out.i_width, p_vout->fmt_out.i_height, |
|---|
| 718 |
p_vout->fmt_out.i_x_offset, p_vout->fmt_out.i_y_offset, |
|---|
| 719 |
p_vout->fmt_out.i_visible_width, |
|---|
| 720 |
p_vout->fmt_out.i_visible_height, |
|---|
| 721 |
(char*)&p_vout->fmt_out.i_chroma, |
|---|
| 722 |
i_aspect_x, i_aspect_y, |
|---|
| 723 |
p_vout->fmt_out.i_sar_num, p_vout->fmt_out.i_sar_den ); |
|---|
| 724 |
|
|---|
| 725 |
|
|---|
| 726 |
|
|---|
| 727 |
PictureHeapFixRgb( &p_vout->render ); |
|---|
| 728 |
VideoFormatImportRgb( &p_vout->fmt_render, &p_vout->render ); |
|---|
| 729 |
|
|---|
| 730 |
PictureHeapFixRgb( &p_vout->output ); |
|---|
| 731 |
VideoFormatImportRgb( &p_vout->fmt_out, &p_vout->output ); |
|---|
| 732 |
|
|---|
| 733 |
|
|---|
| 734 |
|
|---|
| 735 |
if( ( p_vout->output.i_width == p_vout->render.i_width ) |
|---|
| 736 |
&& ( p_vout->output.i_height == p_vout->render.i_height ) |
|---|
| 737 |
&& ( ChromaIsEqual( &p_vout->output, &p_vout->render ) ) ) |
|---|
| 738 |
{ |
|---|
| 739 |
|
|---|
| 740 |
|
|---|
| 741 |
|
|---|
| 742 |
|
|---|
| 743 |
p_vout->p->b_direct = true; |
|---|
| 744 |
|
|---|
| 745 |
for( i = 1; i < VOUT_MAX_PICTURES; i++ ) |
|---|
| 746 |
{ |
|---|
| 747 |
if( p_vout->p_picture[ i ].i_type != DIRECT_PICTURE && |
|---|
| 748 |
I_RENDERPICTURES >= VOUT_MIN_DIRECT_PICTURES - 1 && |
|---|
| 749 |
p_vout->p_picture[ i - 1 ].i_type == DIRECT_PICTURE ) |
|---|
| 750 |
{ |
|---|
| 751 |
|
|---|
| 752 |
|
|---|
| 753 |
break; |
|---|
| 754 |
} |
|---|
| 755 |
PP_RENDERPICTURE[ I_RENDERPICTURES ] = &p_vout->p_picture[ i ]; |
|---|
| 756 |
I_RENDERPICTURES++; |
|---|
| 757 |
} |
|---|
| 758 |
|
|---|
| 759 |
msg_Dbg( p_vout, "direct render, mapping " |
|---|
| 760 |
"render pictures 0-%i to system pictures 1-%i", |
|---|
| 761 |
VOUT_MAX_PICTURES - 2, VOUT_MAX_PICTURES - 1 ); |
|---|
| 762 |
} |
|---|
| 763 |
else |
|---|
| 764 |
{ |
|---|
| 765 |
|
|---|
| 766 |
|
|---|
| 767 |
|
|---|
| 768 |
p_vout->p->b_direct = false; |
|---|
| 769 |
|
|---|
| 770 |
if( ChromaCreate( p_vout ) ) |
|---|
| 771 |
{ |
|---|
| 772 |
p_vout->pf_end( p_vout ); |
|---|
| 773 |
return VLC_EGENERIC; |
|---|
| 774 |
} |
|---|
| 775 |
|
|---|
| 776 |
msg_Dbg( p_vout, "indirect render, mapping " |
|---|
| 777 |
"render pictures 0-%i to system pictures %i-%i", |
|---|
| 778 |
VOUT_MAX_PICTURES - 1, I_OUTPUTPICTURES, |
|---|
| 779 |
I_OUTPUTPICTURES + VOUT_MAX_PICTURES - 1 ); |
|---|
| 780 |
|
|---|
| 781 |
|
|---|
| 782 |
for( i = I_OUTPUTPICTURES; i < 2 * VOUT_MAX_PICTURES; i++ ) |
|---|
| 783 |
{ |
|---|
| 784 |
PP_RENDERPICTURE[ I_RENDERPICTURES ] = &p_vout->p_picture[ i ]; |
|---|
| 785 |
I_RENDERPICTURES++; |
|---|
| 786 |
|
|---|
| 787 |
|
|---|
| 788 |
if( I_RENDERPICTURES == VOUT_MAX_PICTURES ) |
|---|
| 789 |
break; |
|---|
| 790 |
} |
|---|
| 791 |
} |
|---|
| 792 |
|
|---|
| 793 |
|
|---|
| 794 |
for( i = 0 ; i < I_RENDERPICTURES ; i++ ) |
|---|
| 795 |
{ |
|---|
| 796 |
PP_RENDERPICTURE[ i ]->p_heap = &p_vout->render; |
|---|
| 797 |
} |
|---|
| 798 |
|
|---|
| 799 |
for( i = 0 ; i < I_OUTPUTPICTURES ; i++ ) |
|---|
| 800 |
{ |
|---|
| 801 |
PP_OUTPUTPICTURE[ i ]->p_heap = &p_vout->output; |
|---|
| 802 |
} |
|---|
| 803 |
|
|---|
| 804 |
return VLC_SUCCESS; |
|---|
| 805 |
} |
|---|
| 806 |
|
|---|
| 807 |
|
|---|
| 808 |
|
|---|
| 809 |
|
|---|
| 810 |
|
|---|
| 811 |
|
|---|
| 812 |
|
|---|
| 813 |
|
|---|
| 814 |
static void* RunThread( vlc_object_t *p_this ) |
|---|
| 815 |
{ |
|---|
| 816 |
vout_thread_t *p_vout = (vout_thread_t *)p_this; |
|---|
| 817 |
int i_idle_loops = 0; |
|---|
| 818 |
|
|---|
| 819 |
picture_t * p_last_picture = NULL; |
|---|
| 820 |
|
|---|
| 821 |
subpicture_t * p_subpic = NULL; |
|---|
| 822 |
|
|---|
| 823 |
bool b_drop_late; |
|---|
| 824 |
|
|---|
| 825 |
int i_displayed = 0, i_lost = 0; |
|---|
| 826 |
int canc = vlc_savecancel (); |
|---|
| 827 |
|
|---|
| 828 |
|
|---|
| 829 |
|
|---|
| 830 |
|
|---|
| 831 |
vlc_mutex_lock( &p_vout->change_lock ); |
|---|
| 832 |
p_vout->b_error = InitThread( p_vout ); |
|---|
| 833 |
|
|---|
| 834 |
b_drop_late = var_CreateGetBool( p_vout, "drop-late-frames" ); |
|---|
| 835 |
|
|---|
| 836 |
|
|---|
| 837 |
vlc_thread_ready( p_vout ); |
|---|
| 838 |
|
|---|
| 839 |
if( p_vout->b_error ) |
|---|
| 840 |
{ |
|---|
| 841 |
EndThread( p_vout ); |
|---|
| 842 |
vlc_mutex_unlock( &p_vout->change_lock ); |
|---|
| 843 |
vlc_restorecancel (canc); |
|---|
| 844 |
return NULL; |
|---|
| 845 |
} |
|---|
| 846 |
|
|---|
| 847 |
vlc_object_lock( p_vout ); |
|---|
| 848 |
|
|---|
| 849 |
if( p_vout->p->b_title_show ) |
|---|
| 850 |
DisplayTitleOnOSD( p_vout ); |
|---|
| 851 |
|
|---|
| 852 |
|
|---|
| 853 |
|
|---|
| 854 |
|
|---|
| 855 |
|
|---|
| 856 |
while( vlc_object_alive( p_vout ) && !p_vout->b_error ) |
|---|
| 857 |
{ |
|---|
| 858 |
|
|---|
| 859 |
const mtime_t current_date = mdate(); |
|---|
| 860 |
picture_t *p_picture = NULL; |
|---|
| 861 |
picture_t *p_filtered_picture; |
|---|
| 862 |
mtime_t display_date = 0; |
|---|
| 863 |
picture_t *p_directbuffer; |
|---|
| 864 |
input_thread_t *p_input; |
|---|
| 865 |
int i_index; |
|---|
| 866 |
|
|---|
| 867 |
#if 0 |
|---|
| 868 |
p_vout->c_loops++; |
|---|
| 869 |
if( !(p_vout->c_loops % VOUT_STATS_NB_LOOPS) ) |
|---|
| 870 |
{ |
|---|
| 871 |
msg_Dbg( p_vout, "picture heap: %d/%d", |
|---|
| 872 |
I_RENDERPICTURES, p_vout->i_heap_size ); |
|---|
| 873 |
} |
|---|
| 874 |
#endif |
|---|
| 875 |
|
|---|
| 876 |
|
|---|
| 877 |
p_input = vlc_object_find( p_vout, VLC_OBJECT_INPUT, FIND_PARENT ); |
|---|
| 878 |
if( p_input ) |
|---|
| 879 |
{ |
|---|
| 880 |
vlc_mutex_lock( &p_input->p->counters.counters_lock ); |
|---|
| 881 |
stats_UpdateInteger( p_vout, p_input->p->counters.p_lost_pictures, |
|---|
| 882 |
i_lost , NULL); |
|---|
| 883 |
stats_UpdateInteger( p_vout, |
|---|
| 884 |
p_input->p->counters.p_displayed_pictures, |
|---|
| 885 |
i_displayed , NULL); |
|---|
| 886 |
i_displayed = i_lost = 0; |
|---|
| 887 |
vlc_mutex_unlock( &p_input->p->counters.counters_lock ); |
|---|
| 888 |
vlc_object_release( p_input ); |
|---|
| 889 |
} |
|---|
| 890 |
|
|---|
| 891 |
|
|---|
| 892 |
|
|---|
| 893 |
|
|---|
| 894 |
|
|---|
| 895 |
for( i_index = 0; i_index < I_RENDERPICTURES; i_index++ ) |
|---|
| 896 |
{ |
|---|
| 897 |
picture_t *p_pic = PP_RENDERPICTURE[i_index]; |
|---|
| 898 |
|
|---|
| 899 |
if( p_pic->i_status == READY_PICTURE && |
|---|
| 900 |
( p_picture == NULL || p_pic->date < display_date ) ) |
|---|
| 901 |
{ |
|---|
| 902 |
p_picture = p_pic; |
|---|
| 903 |
display_date = p_picture->date; |
|---|
| 904 |
} |
|---|
| 905 |
} |
|---|
| 906 |
if( p_vout->p->b_paused && p_last_picture != NULL ) |
|---|
| 907 |
p_picture = p_last_picture; |
|---|
| 908 |
|
|---|
| 909 |
if( p_pi |
|---|