Commit cd70bf31 authored by Laurent Aimar's avatar Laurent Aimar

Privatized remaining vout fields.

parent fd28b417
...@@ -63,10 +63,6 @@ struct vout_thread_t ...@@ -63,10 +63,6 @@ struct vout_thread_t
{ {
VLC_COMMON_MEMBERS VLC_COMMON_MEMBERS
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) */
/* Private vout_thread data */ /* Private vout_thread data */
vout_thread_sys_t *p; vout_thread_sys_t *p;
}; };
......
...@@ -1411,7 +1411,7 @@ void vout_SendDisplayEventMouse(vout_thread_t *vout, const vlc_mouse_t *m) ...@@ -1411,7 +1411,7 @@ void vout_SendDisplayEventMouse(vout_thread_t *vout, const vlc_mouse_t *m)
{ {
vlc_mouse_t tmp; vlc_mouse_t tmp;
if (spu_ProcessMouse( vout->p->p_spu, m, &vout->fmt_out)) if (spu_ProcessMouse( vout->p->p_spu, m, &vout->p->fmt_out))
return; return;
vlc_mutex_lock( &vout->p->vfilter_lock ); vlc_mutex_lock( &vout->p->vfilter_lock );
......
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
# include "config.h" # include "config.h"
#endif #endif
#include <assert.h>
#include <vlc_common.h> #include <vlc_common.h>
#include <vlc_vout.h> #include <vlc_vout.h>
...@@ -33,6 +34,8 @@ ...@@ -33,6 +34,8 @@
#include <vlc_input_item.h> #include <vlc_input_item.h>
#include <vlc_epg.h> #include <vlc_epg.h>
/* TODO remove access to private vout data */
#include "vout_internal.h"
/* Layout percentage defines */ /* Layout percentage defines */
#define EPG_TOP 0.7 #define EPG_TOP 0.7
...@@ -275,8 +278,8 @@ int vout_OSDEpg( vout_thread_t *p_vout, input_item_t *p_input ) ...@@ -275,8 +278,8 @@ int vout_OSDEpg( vout_thread_t *p_vout, input_item_t *p_input )
/* Build the EPG event subpictures. */ /* Build the EPG event subpictures. */
p_spu->p_region = vout_BuildOSDEpg( p_vout, p_epg, p_spu->p_region = vout_BuildOSDEpg( p_vout, p_epg,
p_vout->fmt_in.i_width, p_vout->p->fmt_in.i_width,
p_vout->fmt_in.i_height ); p_vout->p->fmt_in.i_height );
vlc_epg_Delete( p_epg ); vlc_epg_Delete( p_epg );
spu_DisplaySubpicture( vout_GetSpu( p_vout ), p_spu ); spu_DisplaySubpicture( vout_GetSpu( p_vout ), p_spu );
......
...@@ -164,9 +164,9 @@ vout_thread_t *vout_Request( vlc_object_t *p_this, vout_thread_t *p_vout, ...@@ -164,9 +164,9 @@ vout_thread_t *vout_Request( vlc_object_t *p_this, vout_thread_t *p_vout,
#warning "FIXME: Check RGB masks in vout_Request" #warning "FIXME: Check RGB masks in vout_Request"
/* FIXME: check RGB masks */ /* FIXME: check RGB masks */
if( p_vout->fmt_render.i_chroma != vlc_fourcc_GetCodec( VIDEO_ES, p_fmt->i_chroma ) || if( p_vout->p->fmt_render.i_chroma != vlc_fourcc_GetCodec( VIDEO_ES, p_fmt->i_chroma ) ||
p_vout->fmt_render.i_width != p_fmt->i_width || p_vout->p->fmt_render.i_width != p_fmt->i_width ||
p_vout->fmt_render.i_height != p_fmt->i_height || p_vout->p->fmt_render.i_height != p_fmt->i_height ||
p_vout->p->b_filter_change ) p_vout->p->b_filter_change )
{ {
vlc_mutex_unlock( &p_vout->p->change_lock ); vlc_mutex_unlock( &p_vout->p->change_lock );
...@@ -195,14 +195,14 @@ vout_thread_t *vout_Request( vlc_object_t *p_this, vout_thread_t *p_vout, ...@@ -195,14 +195,14 @@ vout_thread_t *vout_Request( vlc_object_t *p_this, vout_thread_t *p_vout,
#endif #endif
if( i_sar_num > 0 && i_sar_den > 0 && if( i_sar_num > 0 && i_sar_den > 0 &&
( i_sar_num != p_vout->fmt_render.i_sar_num || ( i_sar_num != p_vout->p->fmt_render.i_sar_num ||
i_sar_den != p_vout->fmt_render.i_sar_den ) ) i_sar_den != p_vout->p->fmt_render.i_sar_den ) )
{ {
p_vout->fmt_in.i_sar_num = i_sar_num; p_vout->p->fmt_in.i_sar_num = i_sar_num;
p_vout->fmt_in.i_sar_den = i_sar_den; p_vout->p->fmt_in.i_sar_den = i_sar_den;
p_vout->fmt_render.i_sar_num = i_sar_num; p_vout->p->fmt_render.i_sar_num = i_sar_num;
p_vout->fmt_render.i_sar_den = i_sar_den; p_vout->p->fmt_render.i_sar_den = i_sar_den;
p_vout->p->i_changes |= VOUT_ASPECT_CHANGE; p_vout->p->i_changes |= VOUT_ASPECT_CHANGE;
} }
vlc_mutex_unlock( &p_vout->p->change_lock ); vlc_mutex_unlock( &p_vout->p->change_lock );
...@@ -273,13 +273,13 @@ vout_thread_t * (vout_Create)( vlc_object_t *p_parent, video_format_t *p_fmt ) ...@@ -273,13 +273,13 @@ vout_thread_t * (vout_Create)( vlc_object_t *p_parent, video_format_t *p_fmt )
} }
/* */ /* */
p_vout->fmt_render = *p_fmt; /* FIXME palette */ p_vout->p->fmt_render = *p_fmt; /* FIXME palette */
p_vout->fmt_in = *p_fmt; /* FIXME palette */ p_vout->p->fmt_in = *p_fmt; /* FIXME palette */
p_vout->fmt_render.i_chroma = p_vout->p->fmt_render.i_chroma =
p_vout->fmt_in.i_chroma = i_chroma; p_vout->p->fmt_in.i_chroma = i_chroma;
video_format_FixRgb( &p_vout->fmt_render ); video_format_FixRgb( &p_vout->p->fmt_render );
video_format_FixRgb( &p_vout->fmt_in ); video_format_FixRgb( &p_vout->p->fmt_in );
/* Initialize misc stuff */ /* Initialize misc stuff */
vout_control_Init( &p_vout->p->control ); vout_control_Init( &p_vout->p->control );
...@@ -614,13 +614,13 @@ static int ThreadInit(vout_thread_t *vout) ...@@ -614,13 +614,13 @@ static int ThreadInit(vout_thread_t *vout)
/* print some usefull debug info about different vout formats /* print some usefull debug info about different vout formats
*/ */
PrintVideoFormat(vout, "pic render", &vout->fmt_render); PrintVideoFormat(vout, "pic render", &vout->p->fmt_render);
PrintVideoFormat(vout, "pic in", &vout->fmt_in); PrintVideoFormat(vout, "pic in", &vout->p->fmt_in);
PrintVideoFormat(vout, "pic out", &vout->fmt_out); PrintVideoFormat(vout, "pic out", &vout->p->fmt_out);
assert(vout->fmt_out.i_width == vout->fmt_render.i_width && assert(vout->p->fmt_out.i_width == vout->p->fmt_render.i_width &&
vout->fmt_out.i_height == vout->fmt_render.i_height && vout->p->fmt_out.i_height == vout->p->fmt_render.i_height &&
vout->fmt_out.i_chroma == vout->fmt_render.i_chroma); vout->p->fmt_out.i_chroma == vout->p->fmt_render.i_chroma);
return VLC_SUCCESS; return VLC_SUCCESS;
} }
...@@ -760,7 +760,7 @@ static int ThreadDisplayPicture(vout_thread_t *vout, ...@@ -760,7 +760,7 @@ static int ThreadDisplayPicture(vout_thread_t *vout,
(vout->p->decoder_pool != vout->p->display_pool || subpic)) { (vout->p->decoder_pool != vout->p->display_pool || subpic)) {
picture_t *render; picture_t *render;
if (vout->p->is_decoder_pool_slow) if (vout->p->is_decoder_pool_slow)
render = picture_NewFromFormat(&vout->fmt_out); render = picture_NewFromFormat(&vout->p->fmt_out);
else if (vout->p->decoder_pool != vout->p->display_pool) else if (vout->p->decoder_pool != vout->p->display_pool)
render = picture_pool_Get(vout->p->display_pool); render = picture_pool_Get(vout->p->display_pool);
else else
...@@ -770,8 +770,8 @@ static int ThreadDisplayPicture(vout_thread_t *vout, ...@@ -770,8 +770,8 @@ static int ThreadDisplayPicture(vout_thread_t *vout,
picture_Copy(render, filtered); picture_Copy(render, filtered);
spu_RenderSubpictures(vout->p->p_spu, spu_RenderSubpictures(vout->p->p_spu,
render, &vout->fmt_out, render, &vout->p->fmt_out,
subpic, &vout->fmt_in, spu_render_time); subpic, &vout->p->fmt_in, spu_render_time);
} }
if (vout->p->is_decoder_pool_slow) { if (vout->p->is_decoder_pool_slow) {
direct = picture_pool_Get(vout->p->display_pool); direct = picture_pool_Get(vout->p->display_pool);
...@@ -792,7 +792,7 @@ static int ThreadDisplayPicture(vout_thread_t *vout, ...@@ -792,7 +792,7 @@ static int ThreadDisplayPicture(vout_thread_t *vout,
* Take a snapshot if requested * Take a snapshot if requested
*/ */
if (direct && do_snapshot) if (direct && do_snapshot)
vout_snapshot_Set(&vout->p->snapshot, &vout->fmt_out, direct); vout_snapshot_Set(&vout->p->snapshot, &vout->p->fmt_out, direct);
/* Render the direct buffer returned by vout_RenderPicture */ /* Render the direct buffer returned by vout_RenderPicture */
if (direct) { if (direct) {
...@@ -876,18 +876,18 @@ static void ThreadDisplayOsdTitle(vout_thread_t *vout, const char *string) ...@@ -876,18 +876,18 @@ static void ThreadDisplayOsdTitle(vout_thread_t *vout, const char *string)
vout_ShowTextAbsolute(vout, DEFAULT_CHAN, vout_ShowTextAbsolute(vout, DEFAULT_CHAN,
string, NULL, string, NULL,
vout->p->title.position, vout->p->title.position,
30 + vout->fmt_in.i_width 30 + vout->p->fmt_in.i_width
- vout->fmt_in.i_visible_width - vout->p->fmt_in.i_visible_width
- vout->fmt_in.i_x_offset, - vout->p->fmt_in.i_x_offset,
20 + vout->fmt_in.i_y_offset, 20 + vout->p->fmt_in.i_y_offset,
start, stop); start, stop);
} }
static void ThreadChangeFilters(vout_thread_t *vout, const char *filters) static void ThreadChangeFilters(vout_thread_t *vout, const char *filters)
{ {
es_format_t fmt; es_format_t fmt;
es_format_Init(&fmt, VIDEO_ES, vout->fmt_render.i_chroma); es_format_Init(&fmt, VIDEO_ES, vout->p->fmt_render.i_chroma);
fmt.video = vout->fmt_render; fmt.video = vout->p->fmt_render;
vlc_mutex_lock(&vout->p->vfilter_lock); vlc_mutex_lock(&vout->p->vfilter_lock);
...@@ -1057,7 +1057,7 @@ static void *Thread(void *object) ...@@ -1057,7 +1057,7 @@ static void *Thread(void *object)
*/ */
while (!vout_control_Pop(&vout->p->control, &cmd, deadline, 100000)) { while (!vout_control_Pop(&vout->p->control, &cmd, deadline, 100000)) {
/* TODO remove the lock when possible (ie when /* TODO remove the lock when possible (ie when
* vout->fmt_* are not protected by it anymore) */ * vout->p->fmt_* are not protected by it anymore) */
vlc_mutex_lock(&vout->p->change_lock); vlc_mutex_lock(&vout->p->change_lock);
switch(cmd.type) { switch(cmd.type) {
case VOUT_CONTROL_OSD_TITLE: case VOUT_CONTROL_OSD_TITLE:
......
...@@ -31,6 +31,9 @@ ...@@ -31,6 +31,9 @@
#include <vlc_filter.h> #include <vlc_filter.h>
#include <vlc_osd.h> #include <vlc_osd.h>
/* TODO remove access to private vout data */
#include "vout_internal.h"
/** /**
* \brief Show text on the video for some time * \brief Show text on the video for some time
* \param p_vout pointer to the vout the text is to be showed on * \param p_vout pointer to the vout the text is to be showed on
...@@ -140,10 +143,10 @@ void vout_OSDMessage( vlc_object_t *p_caller, int i_channel, ...@@ -140,10 +143,10 @@ void vout_OSDMessage( vlc_object_t *p_caller, int i_channel,
{ {
vout_ShowTextRelative( p_vout, i_channel, psz_string, NULL, vout_ShowTextRelative( p_vout, i_channel, psz_string, NULL,
OSD_ALIGN_TOP|OSD_ALIGN_RIGHT, OSD_ALIGN_TOP|OSD_ALIGN_RIGHT,
30 + p_vout->fmt_in.i_width 30 + p_vout->p->fmt_in.i_width
- p_vout->fmt_in.i_visible_width - p_vout->p->fmt_in.i_visible_width
- p_vout->fmt_in.i_x_offset, - p_vout->p->fmt_in.i_x_offset,
20 + p_vout->fmt_in.i_y_offset, 1000000 ); 20 + p_vout->p->fmt_in.i_y_offset, 1000000 );
free( psz_string ); free( psz_string );
} }
vlc_object_release( p_vout ); vlc_object_release( p_vout );
......
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
# include "config.h" # include "config.h"
#endif #endif
#include <assert.h>
#include <vlc_common.h> #include <vlc_common.h>
#include <vlc_vout.h> #include <vlc_vout.h>
...@@ -34,6 +35,9 @@ ...@@ -34,6 +35,9 @@
#include <vlc_filter.h> #include <vlc_filter.h>
/* TODO remove access to private vout data */
#include "vout_internal.h"
/***************************************************************************** /*****************************************************************************
* Displays an OSD slider. * Displays an OSD slider.
* Types are: OSD_HOR_SLIDER and OSD_VERT_SLIDER. * Types are: OSD_HOR_SLIDER and OSD_VERT_SLIDER.
...@@ -47,11 +51,11 @@ void vout_OSDSlider( vlc_object_t *p_caller, int i_channel, int i_position, ...@@ -47,11 +51,11 @@ void vout_OSDSlider( vlc_object_t *p_caller, int i_channel, int i_position,
if( p_vout && ( var_InheritBool( p_caller, "osd" ) && ( i_position >= 0 ) ) ) if( p_vout && ( var_InheritBool( p_caller, "osd" ) && ( i_position >= 0 ) ) )
{ {
osd_Slider( p_caller, vout_GetSpu( p_vout ), osd_Slider( p_caller, vout_GetSpu( p_vout ),
p_vout->fmt_render.i_width, p_vout->p->fmt_render.i_width,
p_vout->fmt_render.i_height, p_vout->p->fmt_render.i_height,
p_vout->fmt_in.i_x_offset, p_vout->p->fmt_in.i_x_offset,
p_vout->fmt_in.i_height - p_vout->fmt_in.i_visible_height p_vout->p->fmt_in.i_height - p_vout->p->fmt_in.i_visible_height
- p_vout->fmt_in.i_y_offset, - p_vout->p->fmt_in.i_y_offset,
i_channel, i_position, i_type ); i_channel, i_position, i_type );
} }
vlc_object_release( p_vout ); vlc_object_release( p_vout );
...@@ -72,11 +76,11 @@ void vout_OSDIcon( vlc_object_t *p_caller, int i_channel, short i_type ) ...@@ -72,11 +76,11 @@ void vout_OSDIcon( vlc_object_t *p_caller, int i_channel, short i_type )
{ {
osd_Icon( p_caller, osd_Icon( p_caller,
vout_GetSpu( p_vout ), vout_GetSpu( p_vout ),
p_vout->fmt_render.i_width, p_vout->p->fmt_render.i_width,
p_vout->fmt_render.i_height, p_vout->p->fmt_render.i_height,
p_vout->fmt_in.i_width - p_vout->fmt_in.i_visible_width p_vout->p->fmt_in.i_width - p_vout->p->fmt_in.i_visible_width
- p_vout->fmt_in.i_x_offset, - p_vout->p->fmt_in.i_x_offset,
p_vout->fmt_in.i_y_offset, p_vout->p->fmt_in.i_y_offset,
i_channel, i_type ); i_channel, i_type );
} }
vlc_object_release( p_vout ); vlc_object_release( p_vout );
......
...@@ -51,6 +51,11 @@ struct vout_thread_sys_t ...@@ -51,6 +51,11 @@ struct vout_thread_sys_t
/* Video output configuration */ /* Video output configuration */
config_chain_t *p_cfg; config_chain_t *p_cfg;
/* */
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) */
/* Thread & synchronization */ /* Thread & synchronization */
vlc_thread_t thread; vlc_thread_t thread;
vlc_cond_t change_wait; vlc_cond_t change_wait;
......
...@@ -637,10 +637,10 @@ static int CropCallback( vlc_object_t *p_this, char const *psz_cmd, ...@@ -637,10 +637,10 @@ static int CropCallback( vlc_object_t *p_this, char const *psz_cmd,
(void)oldval; (void)p_data; (void)oldval; (void)p_data;
/* Restore defaults */ /* Restore defaults */
p_vout->fmt_in.i_x_offset = p_vout->fmt_render.i_x_offset; p_vout->p->fmt_in.i_x_offset = p_vout->p->fmt_render.i_x_offset;
p_vout->fmt_in.i_visible_width = p_vout->fmt_render.i_visible_width; p_vout->p->fmt_in.i_visible_width = p_vout->p->fmt_render.i_visible_width;
p_vout->fmt_in.i_y_offset = p_vout->fmt_render.i_y_offset; p_vout->p->fmt_in.i_y_offset = p_vout->p->fmt_render.i_y_offset;
p_vout->fmt_in.i_visible_height = p_vout->fmt_render.i_visible_height; p_vout->p->fmt_in.i_visible_height = p_vout->p->fmt_render.i_visible_height;
if( !strcmp( psz_cmd, "crop" ) ) if( !strcmp( psz_cmd, "crop" ) )
{ {
...@@ -654,22 +654,22 @@ static int CropCallback( vlc_object_t *p_this, char const *psz_cmd, ...@@ -654,22 +654,22 @@ static int CropCallback( vlc_object_t *p_this, char const *psz_cmd,
i_aspect_den = strtol( ++psz_parser, &psz_end, 10 ); i_aspect_den = strtol( ++psz_parser, &psz_end, 10 );
if( psz_end == psz_parser || !i_aspect_den ) goto crop_end; if( psz_end == psz_parser || !i_aspect_den ) goto crop_end;
i_width = p_vout->fmt_in.i_sar_den*p_vout->fmt_render.i_visible_height * i_width = p_vout->p->fmt_in.i_sar_den*p_vout->p->fmt_render.i_visible_height *
i_aspect_num / i_aspect_den / p_vout->fmt_in.i_sar_num; i_aspect_num / i_aspect_den / p_vout->p->fmt_in.i_sar_num;
i_height = p_vout->fmt_render.i_visible_width*p_vout->fmt_in.i_sar_num * i_height = p_vout->p->fmt_render.i_visible_width*p_vout->p->fmt_in.i_sar_num *
i_aspect_den / i_aspect_num / p_vout->fmt_in.i_sar_den; i_aspect_den / i_aspect_num / p_vout->p->fmt_in.i_sar_den;
if( i_width < p_vout->fmt_render.i_visible_width ) if( i_width < p_vout->p->fmt_render.i_visible_width )
{ {
p_vout->fmt_in.i_x_offset = p_vout->fmt_render.i_x_offset + p_vout->p->fmt_in.i_x_offset = p_vout->p->fmt_render.i_x_offset +
(p_vout->fmt_render.i_visible_width - i_width) / 2; (p_vout->p->fmt_render.i_visible_width - i_width) / 2;
p_vout->fmt_in.i_visible_width = i_width; p_vout->p->fmt_in.i_visible_width = i_width;
} }
else else
{ {
p_vout->fmt_in.i_y_offset = p_vout->fmt_render.i_y_offset + p_vout->p->fmt_in.i_y_offset = p_vout->p->fmt_render.i_y_offset +
(p_vout->fmt_render.i_visible_height - i_height) / 2; (p_vout->p->fmt_render.i_visible_height - i_height) / 2;
p_vout->fmt_in.i_visible_height = i_height; p_vout->p->fmt_in.i_visible_height = i_height;
} }
} }
else else
...@@ -695,21 +695,21 @@ static int CropCallback( vlc_object_t *p_this, char const *psz_cmd, ...@@ -695,21 +695,21 @@ static int CropCallback( vlc_object_t *p_this, char const *psz_cmd,
i_crop_top = strtol( psz_end, &psz_end, 10 ); i_crop_top = strtol( psz_end, &psz_end, 10 );
if( *psz_end != '\0' ) goto crop_end; if( *psz_end != '\0' ) goto crop_end;
if( i_crop_top + i_crop_height >= p_vout->fmt_render.i_visible_height || if( i_crop_top + i_crop_height >= p_vout->p->fmt_render.i_visible_height ||
i_crop_left + i_crop_width >= p_vout->fmt_render.i_visible_width ) i_crop_left + i_crop_width >= p_vout->p->fmt_render.i_visible_width )
{ {
msg_Err( p_vout, "Unable to crop over picture boundaries"); msg_Err( p_vout, "Unable to crop over picture boundaries");
return VLC_EGENERIC; return VLC_EGENERIC;
} }
i_width = i_crop_width; i_width = i_crop_width;
p_vout->fmt_in.i_visible_width = i_width; p_vout->p->fmt_in.i_visible_width = i_width;
i_height = i_crop_height; i_height = i_crop_height;
p_vout->fmt_in.i_visible_height = i_height; p_vout->p->fmt_in.i_visible_height = i_height;
p_vout->fmt_in.i_x_offset = i_crop_left; p_vout->p->fmt_in.i_x_offset = i_crop_left;
p_vout->fmt_in.i_y_offset = i_crop_top; p_vout->p->fmt_in.i_y_offset = i_crop_top;
} }
else else
{ {
...@@ -732,23 +732,23 @@ static int CropCallback( vlc_object_t *p_this, char const *psz_cmd, ...@@ -732,23 +732,23 @@ static int CropCallback( vlc_object_t *p_this, char const *psz_cmd,
i_crop_bottom = strtol( psz_end, &psz_end, 10 ); i_crop_bottom = strtol( psz_end, &psz_end, 10 );
if( *psz_end != '\0' ) goto crop_end; if( *psz_end != '\0' ) goto crop_end;
if( i_crop_top + i_crop_bottom >= p_vout->fmt_render.i_visible_height || if( i_crop_top + i_crop_bottom >= p_vout->p->fmt_render.i_visible_height ||
i_crop_right + i_crop_left >= p_vout->fmt_render.i_visible_width ) i_crop_right + i_crop_left >= p_vout->p->fmt_render.i_visible_width )
{ {
msg_Err( p_vout, "Unable to crop over picture boundaries" ); msg_Err( p_vout, "Unable to crop over picture boundaries" );
return VLC_EGENERIC; return VLC_EGENERIC;
} }
i_width = p_vout->fmt_render.i_visible_width i_width = p_vout->p->fmt_render.i_visible_width
- i_crop_left - i_crop_right; - i_crop_left - i_crop_right;
p_vout->fmt_in.i_visible_width = i_width; p_vout->p->fmt_in.i_visible_width = i_width;
i_height = p_vout->fmt_render.i_visible_height i_height = p_vout->p->fmt_render.i_visible_height
- i_crop_top - i_crop_bottom; - i_crop_top - i_crop_bottom;
p_vout->fmt_in.i_visible_height = i_height; p_vout->p->fmt_in.i_visible_height = i_height;
p_vout->fmt_in.i_x_offset = i_crop_left; p_vout->p->fmt_in.i_x_offset = i_crop_left;
p_vout->fmt_in.i_y_offset = i_crop_top; p_vout->p->fmt_in.i_y_offset = i_crop_top;
} }
} }
} }
...@@ -764,33 +764,33 @@ static int CropCallback( vlc_object_t *p_this, char const *psz_cmd, ...@@ -764,33 +764,33 @@ static int CropCallback( vlc_object_t *p_this, char const *psz_cmd,
i_crop_right = var_GetInteger( p_vout, "crop-right" ); i_crop_right = var_GetInteger( p_vout, "crop-right" );
i_crop_bottom = var_GetInteger( p_vout, "crop-bottom" ); i_crop_bottom = var_GetInteger( p_vout, "crop-bottom" );
if( i_crop_top + i_crop_bottom >= p_vout->fmt_render.i_visible_height || if( i_crop_top + i_crop_bottom >= p_vout->p->fmt_render.i_visible_height ||
i_crop_right + i_crop_left >= p_vout->fmt_render.i_visible_width ) i_crop_right + i_crop_left >= p_vout->p->fmt_render.i_visible_width )
{ {
msg_Err( p_vout, "Unable to crop over picture boundaries" ); msg_Err( p_vout, "Unable to crop over picture boundaries" );
return VLC_EGENERIC; return VLC_EGENERIC;
} }
i_width = p_vout->fmt_render.i_visible_width i_width = p_vout->p->fmt_render.i_visible_width
- i_crop_left - i_crop_right; - i_crop_left - i_crop_right;
p_vout->fmt_in.i_visible_width = i_width; p_vout->p->fmt_in.i_visible_width = i_width;
i_height = p_vout->fmt_render.i_visible_height i_height = p_vout->p->fmt_render.i_visible_height
- i_crop_top - i_crop_bottom; - i_crop_top - i_crop_bottom;
p_vout->fmt_in.i_visible_height = i_height; p_vout->p->fmt_in.i_visible_height = i_height;
p_vout->fmt_in.i_x_offset = i_crop_left; p_vout->p->fmt_in.i_x_offset = i_crop_left;
p_vout->fmt_in.i_y_offset = i_crop_top; p_vout->p->fmt_in.i_y_offset = i_crop_top;
} }
crop_end: crop_end:
p_vout->p->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", 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, p_vout->p->fmt_in.i_width, p_vout->p->fmt_in.i_height,
p_vout->fmt_in.i_x_offset, p_vout->fmt_in.i_y_offset, p_vout->p->fmt_in.i_x_offset, p_vout->p->fmt_in.i_y_offset,
p_vout->fmt_in.i_visible_width, p_vout->p->fmt_in.i_visible_width,
p_vout->fmt_in.i_visible_height ); p_vout->p->fmt_in.i_visible_height );
var_TriggerCallback( p_vout, "crop-update" ); var_TriggerCallback( p_vout, "crop-update" );
...@@ -808,8 +808,8 @@ static int AspectCallback( vlc_object_t *p_this, char const *psz_cmd, ...@@ -808,8 +808,8 @@ static int AspectCallback( vlc_object_t *p_this, char const *psz_cmd,
(void)psz_cmd; (void)oldval; (void)p_data; (void)psz_cmd; (void)oldval; (void)p_data;
/* Restore defaults */ /* Restore defaults */
p_vout->fmt_in.i_sar_num = p_vout->fmt_render.i_sar_num; p_vout->p->fmt_in.i_sar_num = p_vout->p->fmt_render.i_sar_num;
p_vout->fmt_in.i_sar_den = p_vout->fmt_render.i_sar_den; p_vout->p->fmt_in.i_sar_den = p_vout->p->fmt_render.i_sar_den;
if( !psz_parser ) goto aspect_end; if( !psz_parser ) goto aspect_end;
...@@ -819,25 +819,25 @@ static int AspectCallback( vlc_object_t *p_this, char const *psz_cmd, ...@@ -819,25 +819,25 @@ static int AspectCallback( vlc_object_t *p_this, char const *psz_cmd,
i_aspect_den = strtol( ++psz_parser, &psz_end, 10 ); i_aspect_den = strtol( ++psz_parser, &psz_end, 10 );
if( psz_end == psz_parser || !i_aspect_den ) goto aspect_end; if( psz_end == psz_parser || !i_aspect_den ) goto aspect_end;
i_sar_num = i_aspect_num * p_vout->fmt_render.i_visible_height; i_sar_num = i_aspect_num * p_vout->p->fmt_render.i_visible_height;
i_sar_den = i_aspect_den * p_vout->fmt_render.i_visible_width; i_sar_den = i_aspect_den * p_vout->p->fmt_render.i_visible_width;
vlc_ureduce( &i_sar_num, &i_sar_den, i_sar_num, i_sar_den, 0 ); vlc_ureduce( &i_sar_num, &i_sar_den, i_sar_num, i_sar_den, 0 );
p_vout->fmt_in.i_sar_num = i_sar_num; p_vout->p->fmt_in.i_sar_num = i_sar_num;
p_vout->fmt_in.i_sar_den = i_sar_den; p_vout->p->fmt_in.i_sar_den = i_sar_den;
aspect_end: aspect_end:
if( p_vout->p->i_par_num && p_vout->p->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->p->i_par_den; p_vout->p->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->p->fmt_in.i_sar_den *= p_vout->p->i_par_num;
} }
p_vout->p->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", 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, p_vout->p->fmt_in.i_sar_num * p_vout->p->fmt_in.i_width,
p_vout->fmt_in.i_sar_den * p_vout->fmt_in.i_height, p_vout->p->fmt_in.i_sar_den * p_vout->p->fmt_in.i_height,
p_vout->fmt_in.i_sar_num, p_vout->fmt_in.i_sar_den ); p_vout->p->fmt_in.i_sar_num, p_vout->p->fmt_in.i_sar_den );
if( var_Get( p_vout, "crop", &val ) ) if( var_Get( p_vout, "crop", &val ) )
return VLC_EGENERIC; return VLC_EGENERIC;
......
...@@ -66,7 +66,7 @@ int vout_OpenWrapper(vout_thread_t *vout, const char *name) ...@@ -66,7 +66,7 @@ int vout_OpenWrapper(vout_thread_t *vout, const char *name)
sys->display.title = var_CreateGetNonEmptyString(vout, "video-title"); sys->display.title = var_CreateGetNonEmptyString(vout, "video-title");
/* */ /* */
video_format_t source = vout->fmt_render; video_format_t source = vout->p->fmt_render;
source.i_visible_width = source.i_width; source.i_visible_width = source.i_width;
source.i_visible_height = source.i_height; source.i_visible_height = source.i_height;
source.i_x_offset = 0; source.i_x_offset = 0;
...@@ -135,31 +135,31 @@ int vout_InitWrapper(vout_thread_t *vout) ...@@ -135,31 +135,31 @@ int vout_InitWrapper(vout_thread_t *vout)
/* */ /* */
video_format_t source = vd->source; video_format_t source = vd->source;
vout->fmt_out.i_chroma = source.i_chroma; vout->p->fmt_out.i_chroma = source.i_chroma;
vout->fmt_out.i_width = vout->p->fmt_out.i_width =
vout->fmt_out.i_visible_width = source.i_width; vout->p->fmt_out.i_visible_width = source.i_width;
vout->fmt_out.i_height = vout->p->fmt_out.i_height =
vout->fmt_out.i_visible_height = source.i_height; vout->p->fmt_out.i_visible_height = source.i_height;
if (source.i_sar_num > 0 && source.i_sar_den > 0) { if (source.i_sar_num > 0 && source.i_sar_den > 0) {
vlc_ureduce(&vout->fmt_out.i_sar_num, &vout->fmt_out.i_sar_den, vlc_ureduce(&vout->p->fmt_out.i_sar_num, &vout->p->fmt_out.i_sar_den,
source.i_sar_num, source.i_sar_den, 0); source.i_sar_num, source.i_sar_den, 0);
} else { } else {
vout->fmt_out.i_sar_num = 1; vout->p->fmt_out.i_sar_num = 1;
vout->fmt_out.i_sar_den = 1; vout->p->fmt_out.i_sar_den = 1;
} }
vout->fmt_out.i_sar_num = source.i_sar_num; vout->p->fmt_out.i_sar_num = source.i_sar_num;
vout->fmt_out.i_sar_den = source.i_sar_den; vout->p->fmt_out.i_sar_den = source.i_sar_den;
vout->fmt_out.i_x_offset = 0; vout->p->fmt_out.i_x_offset = 0;
vout->fmt_out.i_y_offset = 0; vout->p->fmt_out.i_y_offset = 0;
vout->fmt_out.i_rmask = source.i_rmask; vout->p->fmt_out.i_rmask = source.i_rmask;
vout->fmt_out.i_gmask = source.i_gmask; vout->p->fmt_out.i_gmask = source.i_gmask;
vout->fmt_out.i_bmask = source.i_bmask; vout->p->fmt_out.i_bmask = source.i_bmask;
video_format_FixRgb(&vout->fmt_out); video_format_FixRgb(&vout->p->fmt_out);
if (vout->fmt_in.i_visible_width != source.i_visible_width || if (vout->p->fmt_in.i_visible_width != source.i_visible_width ||
vout->fmt_in.i_visible_height != source.i_visible_height || vout->p->fmt_in.i_visible_height != source.i_visible_height ||
vout->fmt_in.i_x_offset != source.i_x_offset || vout->p->fmt_in.i_x_offset != source.i_x_offset ||
vout->fmt_in.i_y_offset != source.i_y_offset ) vout->p->fmt_in.i_y_offset != source.i_y_offset )
sys->i_changes |= VOUT_CROP_CHANGE; sys->i_changes |= VOUT_CROP_CHANGE;
/* XXX For non dr case, the current vout implementation force us to /* XXX For non dr case, the current vout implementation force us to
...@@ -217,16 +217,16 @@ int vout_ManageWrapper(vout_thread_t *vout) ...@@ -217,16 +217,16 @@ int vout_ManageWrapper(vout_thread_t *vout)
VOUT_CROP_CHANGE)) { VOUT_CROP_CHANGE)) {
/* */ /* */
if (sys->i_changes & VOUT_ASPECT_CHANGE) { if (sys->i_changes & VOUT_ASPECT_CHANGE) {
vout->fmt_out.i_sar_num = vout->fmt_in.i_sar_num; vout->p->fmt_out.i_sar_num = vout->p->fmt_in.i_sar_num;
vout->fmt_out.i_sar_den = vout->fmt_in.i_sar_den; vout->p->fmt_out.i_sar_den = vout->p->fmt_in.i_sar_den;
vout_SetDisplayAspect(vd, vout->fmt_in.i_sar_num, vout->fmt_in.i_sar_den); vout_SetDisplayAspect(vd, vout->p->fmt_in.i_sar_num, vout->p->fmt_in.i_sar_den);
sys->i_changes &= ~VOUT_ASPECT_CHANGE; sys->i_changes &= ~VOUT_ASPECT_CHANGE;
} }
if (sys->i_changes & VOUT_CROP_CHANGE) { if (sys->i_changes & VOUT_CROP_CHANGE) {
const video_format_t crop = vout->fmt_in; const video_format_t crop = vout->p->fmt_in;
const video_format_t org = vout->fmt_render; const video_format_t org = vout->p->fmt_render;
/* FIXME because of rounding errors, the reconstructed ratio is wrong */ /* FIXME because of rounding errors, the reconstructed ratio is wrong */
unsigned num = 0; unsigned num = 0;
unsigned den = 0; unsigned den = 0;
......
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