[vlc-commits] commit: Moved "sub-margin" to vout. (Laurent Aimar )
git at videolan.org
git at videolan.org
Sat May 29 22:12:54 CEST 2010
vlc | branch: master | Laurent Aimar <fenrir at videolan.org> | Fri May 28 22:04:09 2010 +0200| [e5ab4b4142a2d9430f74b11b379036a700972dea] | committer: Laurent Aimar
Moved "sub-margin" to vout.
It doesn't belong to the input.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=e5ab4b4142a2d9430f74b11b379036a700972dea
---
modules/control/hotkeys.c | 8 ++++----
src/input/var.c | 2 --
src/video_output/control.h | 1 +
src/video_output/video_output.c | 12 ++++++++++++
src/video_output/vout_internal.h | 2 ++
src/video_output/vout_intf.c | 19 ++++++++++++++++++-
src/video_output/vout_subpictures.c | 30 +++++++++---------------------
7 files changed, 46 insertions(+), 28 deletions(-)
diff --git a/modules/control/hotkeys.c b/modules/control/hotkeys.c
index 31e1895..5a06649 100644
--- a/modules/control/hotkeys.c
+++ b/modules/control/hotkeys.c
@@ -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,
diff --git a/src/input/var.c b/src/input/var.c
index 93b967a..0ad6ff4 100644
--- a/src/input/var.c
+++ b/src/input/var.c
@@ -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 );
diff --git a/src/video_output/control.h b/src/video_output/control.h
index 4654736..9510c22 100644
--- a/src/video_output/control.h
+++ b/src/video_output/control.h
@@ -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,
diff --git a/src/video_output/video_output.c b/src/video_output/video_output.c
index b873d4c..6f9e7ab 100644
--- a/src/video_output/video_output.c
+++ b/src/video_output/video_output.c
@@ -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;
diff --git a/src/video_output/vout_internal.h b/src/video_output/vout_internal.h
index 951a9d1..de8f058 100644
--- a/src/video_output/vout_internal.h
+++ b/src/video_output/vout_internal.h
@@ -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
diff --git a/src/video_output/vout_intf.c b/src/video_output/vout_intf.c
index 666fcc2..23a727e 100644
--- a/src/video_output/vout_intf.c
+++ b/src/video_output/vout_intf.c
@@ -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 )
{
diff --git a/src/video_output/vout_subpictures.c b/src/video_output/vout_subpictures.c
index 1d71ef2..16dd34c 100644
--- a/src/video_output/vout_subpictures.c
+++ b/src/video_output/vout_subpictures.c
@@ -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
*****************************************************************************/
@@ -1853,22 +1857,6 @@ static int CropCallback( vlc_object_t *p_object, char const *psz_var,
}
/*****************************************************************************
- * 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
*****************************************************************************/
static int spu_get_attachments( filter_t *p_filter,
More information about the vlc-commits
mailing list