Commit e5ab4b41 authored by Laurent Aimar's avatar Laurent Aimar

Moved "sub-margin" to vout.

It doesn't belong to the input.
parent dbc2edac
......@@ -783,14 +783,14 @@ static int PutAction( intf_thread_t *p_intf, int i_action )
_( "Subtitle delay %i ms" ),
(int)(i_delay/1000) );
}
else if( i_action == ACTIONID_SUBPOS_DOWN ||
i_action == ACTIONID_SUBPOS_UP )
else if( ( i_action == ACTIONID_SUBPOS_DOWN ||
i_action == ACTIONID_SUBPOS_UP ) && p_vout )
{
int i_pos;
if( i_action == ACTIONID_SUBPOS_DOWN )
i_pos = var_DecInteger( p_input, "sub-margin" );
i_pos = var_DecInteger( p_vout, "sub-margin" );
else
i_pos = var_IncInteger( p_input, "sub-margin" );
i_pos = var_IncInteger( p_vout, "sub-margin" );
ClearChannels( p_intf, p_vout );
DisplayMessage( p_vout, SPU_DEFAULT_CHANNEL,
......
......@@ -220,8 +220,6 @@ void input_ControlVarInit ( input_thread_t *p_input )
text.psz_string = _("Subtitles Track");
var_Change( p_input, "spu-es", VLC_VAR_SETTEXT, &text, NULL );
var_Create( p_input, "sub-margin", VLC_VAR_INTEGER | VLC_VAR_DOINHERIT );
/* Special read only objects variables for intf */
var_Create( p_input, "bookmarks", VLC_VAR_STRING | VLC_VAR_DOINHERIT );
......
......@@ -44,6 +44,7 @@ enum {
VOUT_CONTROL_OSD_TITLE, /* string */
VOUT_CONTROL_CHANGE_FILTERS, /* string */
VOUT_CONTROL_CHANGE_SUB_FILTERS, /* string */
VOUT_CONTROL_CHANGE_SUB_MARGIN, /* integer */
VOUT_CONTROL_PAUSE,
VOUT_CONTROL_RESET,
......
......@@ -435,6 +435,11 @@ void vout_ControlChangeSubFilters(vout_thread_t *vout, const char *filters)
vout_control_PushString(&vout->p->control, VOUT_CONTROL_CHANGE_SUB_FILTERS,
filters);
}
void vout_ControlChangeSubMargin(vout_thread_t *vout, int margin)
{
vout_control_PushInteger(&vout->p->control, VOUT_CONTROL_CHANGE_SUB_MARGIN,
margin);
}
/* */
static void VoutGetDisplayCfg(vout_thread_t *vout, vout_display_cfg_t *cfg, const char *title)
......@@ -798,6 +803,10 @@ static void ThreadChangeSubFilters(vout_thread_t *vout, const char *filters)
{
spu_ChangeFilters(vout->p->p_spu, filters);
}
static void ThreadChangeSubMargin(vout_thread_t *vout, int margin)
{
spu_ChangeMargin(vout->p->p_spu, margin);
}
static void ThreadChangePause(vout_thread_t *vout, bool is_paused, mtime_t date)
{
......@@ -1135,6 +1144,9 @@ static void *Thread(void *object)
case VOUT_CONTROL_CHANGE_SUB_FILTERS:
ThreadChangeSubFilters(vout, cmd.u.string);
break;
case VOUT_CONTROL_CHANGE_SUB_MARGIN:
ThreadChangeSubMargin(vout, cmd.u.integer);
break;
case VOUT_CONTROL_PAUSE:
ThreadChangePause(vout, cmd.u.pause.is_on, cmd.u.pause.date);
break;
......
......@@ -151,6 +151,7 @@ void vout_ControlChangeCropWindow(vout_thread_t *, int x, int y, int width, int
void vout_ControlChangeCropBorder(vout_thread_t *, int left, int top, int right, int bottom);
void vout_ControlChangeFilters(vout_thread_t *, const char *);
void vout_ControlChangeSubFilters(vout_thread_t *, const char *);
void vout_ControlChangeSubMargin(vout_thread_t *, int);
/* */
void vout_IntfInit( vout_thread_t * );
......@@ -167,6 +168,7 @@ void vout_DisplayWrapper(vout_thread_t *, picture_t *);
/* */
int spu_ProcessMouse(spu_t *, const vlc_mouse_t *, const video_format_t *);
void spu_Attach( spu_t *, vlc_object_t *input, bool );
void spu_ChangeMargin(spu_t *, int);
#endif
......@@ -75,7 +75,8 @@ static int VideoSplitterCallback( vlc_object_t *, char const *,
vlc_value_t, vlc_value_t, void * );
static int SubFilterCallback( vlc_object_t *, char const *,
vlc_value_t, vlc_value_t, void * );
static int SubMarginCallback( vlc_object_t *, char const *,
vlc_value_t, vlc_value_t, void * );
static int TitleShowCallback( vlc_object_t *, char const *,
vlc_value_t, vlc_value_t, void * );
static int TitleTimeoutCallback( vlc_object_t *, char const *,
......@@ -377,6 +378,12 @@ void vout_IntfInit( vout_thread_t *p_vout )
var_AddCallback( p_vout, "sub-filter", SubFilterCallback, NULL );
var_TriggerCallback( p_vout, "sub-filter" );
/* Add sub-margin variable */
var_Create( p_vout, "sub-margin",
VLC_VAR_INTEGER | VLC_VAR_DOINHERIT | VLC_VAR_ISCOMMAND );
var_AddCallback( p_vout, "sub-margin", SubMarginCallback, NULL );
var_TriggerCallback( p_vout, "sub-margin" );
/* Mouse coordinates */
var_Create( p_vout, "mouse-button-down", VLC_VAR_INTEGER );
var_Create( p_vout, "mouse-moved", VLC_VAR_COORDS );
......@@ -790,6 +797,16 @@ static int SubFilterCallback( vlc_object_t *p_this, char const *psz_cmd,
return VLC_SUCCESS;
}
static int SubMarginCallback( vlc_object_t *p_this, char const *psz_cmd,
vlc_value_t oldval, vlc_value_t newval, void *p_data)
{
vout_thread_t *p_vout = (vout_thread_t *)p_this;
VLC_UNUSED(psz_cmd); VLC_UNUSED(oldval); VLC_UNUSED(p_data);
vout_ControlChangeSubMargin( p_vout, newval.i_int );
return VLC_SUCCESS;
}
static int TitleShowCallback( vlc_object_t *p_this, char const *psz_cmd,
vlc_value_t oldval, vlc_value_t newval, void *p_data )
{
......
......@@ -163,8 +163,6 @@ static void SpuRenderRegion( spu_t *,
static void UpdateSPU ( spu_t *, vlc_object_t * );
static int CropCallback( vlc_object_t *, char const *,
vlc_value_t, vlc_value_t, void * );
static int MarginCallback( vlc_object_t *, char const *,
vlc_value_t, vlc_value_t, void * );
/* Buffer allocation for SPU filter (blend, scale, ...) */
struct filter_owner_sys_t
......@@ -288,11 +286,9 @@ void spu_Attach( spu_t *p_spu, vlc_object_t *p_input, bool b_attach )
UpdateSPU( p_spu, p_input );
var_Create( p_input, "highlight", VLC_VAR_BOOL );
var_AddCallback( p_input, "highlight", CropCallback, p_spu );
var_AddCallback( p_input, "sub-margin", MarginCallback, p_spu->p );
vlc_mutex_lock( &p_spu->p->lock );
p_spu->p->p_input = p_input;
p_spu->p->i_margin = var_GetInteger( p_input, "sub-margin" );
FilterRelease( p_spu->p->p_text );
p_spu->p->p_text = NULL;
......@@ -307,7 +303,6 @@ void spu_Attach( spu_t *p_spu, vlc_object_t *p_input, bool b_attach )
vlc_mutex_unlock( &p_spu->p->lock );
/* Delete callbacks */
var_DelCallback( p_input, "sub-margin", MarginCallback, p_spu->p );
var_DelCallback( p_input, "highlight", CropCallback, p_spu );
var_Destroy( p_input, "highlight" );
}
......@@ -765,6 +760,15 @@ void spu_ChangeFilters( spu_t *p_spu, const char *psz_filters )
vlc_mutex_unlock( &p_sys->lock );
}
void spu_ChangeMargin( spu_t *p_spu, int i_margin )
{
spu_private_t *p_sys = p_spu->p;
vlc_mutex_lock( &p_sys->lock );
p_sys->i_margin = i_margin;
vlc_mutex_unlock( &p_sys->lock );
}
/*****************************************************************************
* subpicture_t allocation
*****************************************************************************/
......@@ -1852,22 +1856,6 @@ static int CropCallback( vlc_object_t *p_object, char const *psz_var,
return VLC_SUCCESS;
}
/*****************************************************************************
* MarginCallback: called when requested subtitle position has changed *
*****************************************************************************/
static int MarginCallback( vlc_object_t *p_object, char const *psz_var,
vlc_value_t oldval, vlc_value_t newval, void *p_data )
{
VLC_UNUSED( psz_var ); VLC_UNUSED( oldval ); VLC_UNUSED( p_object );
spu_private_t *p_sys = ( spu_private_t* ) p_data;
vlc_mutex_lock( &p_sys->lock );
p_sys->i_margin = newval.i_int;
vlc_mutex_unlock( &p_sys->lock );
return VLC_SUCCESS;
}
/*****************************************************************************
* Buffers allocation callbacks for the filters
*****************************************************************************/
......
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