Commit 7d49b1c0 authored by François Cartegnie's avatar François Cartegnie 🤞

vlc_vout: channels disambiguation

parent 0188f10d
......@@ -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 );
}
......
......@@ -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 * );
......
......@@ -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
*/
......
......@@ -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 );
}
}
......@@ -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);
}
}
......
......@@ -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 );
}
}
......
......@@ -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 );
......
......@@ -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;
......
......@@ -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);
}
......
......@@ -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" ) )
{
......
......@@ -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 */
......
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