[vlc-commits] vlc_vout: channels disambiguation
Francois Cartegnie
git at videolan.org
Fri Jun 23 14:10:09 CEST 2017
vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Fri Jun 23 12:33:37 2017 +0200| [7d49b1c0332afdf1ffa34ceaf3238bc8bdb706f3] | committer: Francois Cartegnie
vlc_vout: channels disambiguation
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=7d49b1c0332afdf1ffa34ceaf3238bc8bdb706f3
---
include/vlc_input.h | 3 ++-
include/vlc_vout.h | 4 ++++
include/vlc_vout_osd.h | 3 ---
modules/control/hotkeys.c | 6 +++---
modules/gui/macosx/VLCCoreInteraction.m | 10 +++++-----
modules/gui/skins2/commands/cmd_quit.cpp | 2 +-
modules/lua/libs/osd.c | 6 +++---
src/video_output/video_epg.c | 2 +-
src/video_output/video_output.c | 4 ++--
src/video_output/vout_intf.c | 2 +-
src/video_output/vout_subpictures.c | 8 ++++----
11 files changed, 26 insertions(+), 24 deletions(-)
diff --git a/include/vlc_input.h b/include/vlc_input.h
index 6faae4638f..8afefafe73 100644
--- a/include/vlc_input.h
+++ b/include/vlc_input.h
@@ -38,6 +38,7 @@
#include <vlc_epg.h>
#include <vlc_events.h>
#include <vlc_input_item.h>
+#include <vlc_vout.h>
#include <vlc_vout_osd.h>
#include <string.h>
@@ -582,7 +583,7 @@ static inline int input_AddSubtitleOSD( input_thread_t *p_input, const char *psz
vout_thread_t *p_vout = input_GetVout( p_input );
if( p_vout )
{
- vout_OSDMessage(p_vout, SPU_DEFAULT_CHANNEL, "%s",
+ vout_OSDMessage(p_vout, VOUT_SPU_CHANNEL_OSD, "%s",
vlc_gettext("Subtitle track added") );
vlc_object_release( (vlc_object_t *)p_vout );
}
diff --git a/include/vlc_vout.h b/include/vlc_vout.h
index a6fb0af0d1..3dd50b1676 100644
--- a/include/vlc_vout.h
+++ b/include/vlc_vout.h
@@ -165,6 +165,10 @@ VLC_API void vout_ChangeAspectRatio( vout_thread_t *p_vout,
VLC_API picture_t * vout_GetPicture( vout_thread_t * );
VLC_API void vout_PutPicture( vout_thread_t *, picture_t * );
+/* Subpictures channels ID */
+#define VOUT_SPU_CHANNEL_OSD 1 /* OSD channel is automatically cleared */
+#define VOUT_SPU_CHANNEL_AVAIL_FIRST 8 /* Registerable channels from this offset */
+
/* */
VLC_API void vout_PutSubpicture( vout_thread_t *, subpicture_t * );
VLC_API int vout_RegisterSubpictureChannel( vout_thread_t * );
diff --git a/include/vlc_vout_osd.h b/include/vlc_vout_osd.h
index 57138933e7..a07cd90731 100644
--- a/include/vlc_vout_osd.h
+++ b/include/vlc_vout_osd.h
@@ -38,9 +38,6 @@ extern "C" {
* Overlay text and widgets
*/
-//* Default subpicture channel ID */
-#define SPU_DEFAULT_CHANNEL (1)
-
/**
* OSD menu position and picture type defines
*/
diff --git a/modules/control/hotkeys.c b/modules/control/hotkeys.c
index 7021e9c2d9..84b6b77fdf 100644
--- a/modules/control/hotkeys.c
+++ b/modules/control/hotkeys.c
@@ -87,10 +87,10 @@ static void ClearChannels ( vout_thread_t *, int );
#define DisplayMessage(vout, ...) \
do { \
if (vout) \
- vout_OSDMessage(vout, SPU_DEFAULT_CHANNEL, __VA_ARGS__); \
+ vout_OSDMessage(vout, VOUT_SPU_CHANNEL_OSD, __VA_ARGS__); \
} while(0)
#define DisplayIcon(vout, icon) \
- do { if(vout) vout_OSDIcon(vout, SPU_DEFAULT_CHANNEL, icon); } while(0)
+ do { if(vout) vout_OSDIcon(vout, VOUT_SPU_CHANNEL_OSD, icon); } while(0)
/*****************************************************************************
* Module descriptor
@@ -1535,7 +1535,7 @@ static void ClearChannels( vout_thread_t *p_vout, int slider_chan )
{
if( p_vout )
{
- vout_FlushSubpictureChannel( p_vout, SPU_DEFAULT_CHANNEL );
+ vout_FlushSubpictureChannel( p_vout, VOUT_SPU_CHANNEL_OSD );
vout_FlushSubpictureChannel( p_vout, slider_chan );
}
}
diff --git a/modules/gui/macosx/VLCCoreInteraction.m b/modules/gui/macosx/VLCCoreInteraction.m
index 6081e0a2cc..912ff8bc25 100644
--- a/modules/gui/macosx/VLCCoreInteraction.m
+++ b/modules/gui/macosx/VLCCoreInteraction.m
@@ -413,7 +413,7 @@ static int BossCallback(vlc_object_t *p_this, const char *psz_var,
var_Set(p_playlist, "random", val);
if (val.b_bool) {
if (p_vout) {
- vout_OSDMessage(p_vout, SPU_DEFAULT_CHANNEL, "%s", _("Random On"));
+ vout_OSDMessage(p_vout, VOUT_SPU_CHANNEL_OSD, "%s", _("Random On"));
vlc_object_release(p_vout);
}
config_PutInt(p_playlist, "random", 1);
@@ -421,7 +421,7 @@ static int BossCallback(vlc_object_t *p_this, const char *psz_var,
else
{
if (p_vout) {
- vout_OSDMessage(p_vout, SPU_DEFAULT_CHANNEL, "%s", _("Random Off"));
+ vout_OSDMessage(p_vout, VOUT_SPU_CHANNEL_OSD, "%s", _("Random Off"));
vlc_object_release(p_vout);
}
config_PutInt(p_playlist, "random", 0);
@@ -443,7 +443,7 @@ static int BossCallback(vlc_object_t *p_this, const char *psz_var,
vout_thread_t *p_vout = getVout();
if (p_vout) {
- vout_OSDMessage(p_vout, SPU_DEFAULT_CHANNEL, "%s", _("Repeat All"));
+ vout_OSDMessage(p_vout, VOUT_SPU_CHANNEL_OSD, "%s", _("Repeat All"));
vlc_object_release(p_vout);
}
}
@@ -463,7 +463,7 @@ static int BossCallback(vlc_object_t *p_this, const char *psz_var,
vout_thread_t *p_vout = getVout();
if (p_vout) {
- vout_OSDMessage(p_vout, SPU_DEFAULT_CHANNEL, "%s", _("Repeat One"));
+ vout_OSDMessage(p_vout, VOUT_SPU_CHANNEL_OSD, "%s", _("Repeat One"));
vlc_object_release(p_vout);
}
}
@@ -483,7 +483,7 @@ static int BossCallback(vlc_object_t *p_this, const char *psz_var,
vout_thread_t *p_vout = getVout();
if (p_vout) {
- vout_OSDMessage(p_vout, SPU_DEFAULT_CHANNEL, "%s", _("Repeat Off"));
+ vout_OSDMessage(p_vout, VOUT_SPU_CHANNEL_OSD, "%s", _("Repeat Off"));
vlc_object_release(p_vout);
}
}
diff --git a/modules/gui/skins2/commands/cmd_quit.cpp b/modules/gui/skins2/commands/cmd_quit.cpp
index 468cbd08ae..691b61399e 100644
--- a/modules/gui/skins2/commands/cmd_quit.cpp
+++ b/modules/gui/skins2/commands/cmd_quit.cpp
@@ -42,7 +42,7 @@ void CmdQuit::execute()
vout_thread_t *pVout = input_GetVout( getIntf()->p_sys->p_input );
if( pVout )
{
- vout_OSDMessage( pVout, SPU_DEFAULT_CHANNEL, "%s", _( "Quit" ) );
+ vout_OSDMessage( pVout, VOUT_SPU_CHANNEL_OSD, "%s", _( "Quit" ) );
vlc_object_release( pVout );
}
}
diff --git a/modules/lua/libs/osd.c b/modules/lua/libs/osd.c
index 9a4e0ae858..917e52eab6 100644
--- a/modules/lua/libs/osd.c
+++ b/modules/lua/libs/osd.c
@@ -67,7 +67,7 @@ static int vlclua_osd_icon( lua_State *L )
{
const char *psz_icon = luaL_checkstring( L, 1 );
int i_icon = vlc_osd_icon_from_string( psz_icon );
- int i_chan = (int)luaL_optinteger( L, 2, SPU_DEFAULT_CHANNEL );
+ int i_chan = (int)luaL_optinteger( L, 2, VOUT_SPU_CHANNEL_OSD );
if( !i_icon )
return luaL_error( L, "\"%s\" is not a valid osd icon.", psz_icon );
@@ -114,7 +114,7 @@ static int vlc_osd_position_from_string( const char *psz_name )
static int vlclua_osd_message( lua_State *L )
{
const char *psz_message = luaL_checkstring( L, 1 );
- int i_chan = (int)luaL_optinteger( L, 2, SPU_DEFAULT_CHANNEL );
+ int i_chan = (int)luaL_optinteger( L, 2, VOUT_SPU_CHANNEL_OSD );
const char *psz_position = luaL_optstring( L, 3, "top-right" );
mtime_t duration = (mtime_t)luaL_optinteger( L, 4, 1000000 );
@@ -157,7 +157,7 @@ static int vlclua_osd_slider( lua_State *L )
int i_position = luaL_checkint( L, 1 );
const char *psz_type = luaL_checkstring( L, 2 );
int i_type = vlc_osd_slider_type_from_string( psz_type );
- int i_chan = (int)luaL_optinteger( L, 3, SPU_DEFAULT_CHANNEL );
+ int i_chan = (int)luaL_optinteger( L, 3, VOUT_SPU_CHANNEL_OSD );
if( !i_type )
return luaL_error( L, "\"%s\" is not a valid slider type.",
psz_type );
diff --git a/src/video_output/video_epg.c b/src/video_output/video_epg.c
index 1ae73739b6..7eb1cc8b9b 100644
--- a/src/video_output/video_epg.c
+++ b/src/video_output/video_epg.c
@@ -394,7 +394,7 @@ int vout_OSDEpg(vout_thread_t *vout, input_item_t *input)
return VLC_EGENERIC;
}
- subpic->i_channel = SPU_DEFAULT_CHANNEL;
+ subpic->i_channel = VOUT_SPU_CHANNEL_OSD;
subpic->i_start = now;
subpic->i_stop = now + 3000 * INT64_C(1000);
subpic->b_ephemer = true;
diff --git a/src/video_output/video_output.c b/src/video_output/video_output.c
index 6e9ae1827c..3e8f92f589 100644
--- a/src/video_output/video_output.c
+++ b/src/video_output/video_output.c
@@ -380,7 +380,7 @@ void vout_PutSubpicture( vout_thread_t *vout, subpicture_t *subpic )
}
int vout_RegisterSubpictureChannel( vout_thread_t *vout )
{
- int channel = SPU_DEFAULT_CHANNEL;
+ int channel = VOUT_SPU_CHANNEL_OSD;
vlc_mutex_lock(&vout->p->spu_lock);
if (vout->p->spu)
@@ -1226,7 +1226,7 @@ static void ThreadDisplayOsdTitle(vout_thread_t *vout, const char *string)
if (!vout->p->title.show)
return;
- vout_OSDText(vout, SPU_DEFAULT_CHANNEL,
+ vout_OSDText(vout, VOUT_SPU_CHANNEL_OSD,
vout->p->title.position, INT64_C(1000) * vout->p->title.timeout,
string);
}
diff --git a/src/video_output/vout_intf.c b/src/video_output/vout_intf.c
index 4f23d8b0d0..631099c3ee 100644
--- a/src/video_output/vout_intf.c
+++ b/src/video_output/vout_intf.c
@@ -360,7 +360,7 @@ static int VoutSnapshotPip( vout_thread_t *p_vout, picture_t *p_pic )
static void VoutOsdSnapshot( vout_thread_t *p_vout, picture_t *p_pic, const char *psz_filename )
{
msg_Dbg( p_vout, "snapshot taken (%s)", psz_filename );
- vout_OSDMessage( p_vout, SPU_DEFAULT_CHANNEL, "%s", psz_filename );
+ vout_OSDMessage( p_vout, VOUT_SPU_CHANNEL_OSD, "%s", psz_filename );
if( var_InheritBool( p_vout, "snapshot-preview" ) )
{
diff --git a/src/video_output/vout_subpictures.c b/src/video_output/vout_subpictures.c
index ed35e7cec6..43d03f4232 100644
--- a/src/video_output/vout_subpictures.c
+++ b/src/video_output/vout_subpictures.c
@@ -1229,7 +1229,7 @@ spu_t *spu_Create(vlc_object_t *object)
sys->margin = var_InheritInteger(spu, "sub-margin");
/* Register the default subpicture channel */
- sys->channel = SPU_DEFAULT_CHANNEL + 1;
+ sys->channel = VOUT_SPU_CHANNEL_AVAIL_FIRST;
sys->source_chain_update = NULL;
sys->filter_chain_update = NULL;
@@ -1402,8 +1402,8 @@ void spu_PutSubpicture(spu_t *spu, subpicture_t *subpic)
return;
/* SPU_DEFAULT_CHANNEL always reset itself */
- if (subpic->i_channel == SPU_DEFAULT_CHANNEL)
- spu_ClearChannel(spu, SPU_DEFAULT_CHANNEL);
+ if (subpic->i_channel == VOUT_SPU_CHANNEL_OSD)
+ spu_ClearChannel(spu, VOUT_SPU_CHANNEL_OSD);
/* p_private is for spu only and cannot be non NULL here */
for (subpicture_region_t *r = subpic->p_region; r != NULL; r = r->p_next)
@@ -1551,7 +1551,7 @@ void spu_ClearChannel(spu_t *spu, int channel)
if (!subpic)
continue;
- if (subpic->i_channel != channel && (channel != -1 || subpic->i_channel == SPU_DEFAULT_CHANNEL))
+ if (subpic->i_channel != channel && (channel != -1 || subpic->i_channel == VOUT_SPU_CHANNEL_OSD))
continue;
/* You cannot delete subpicture outside of spu_SortSubpictures */
More information about the vlc-commits
mailing list