Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc
Commits
a31e6840
Commit
a31e6840
authored
Apr 18, 2006
by
Clément Stenac
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add vlc.hasAudio variable
parent
ab21bfce
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
110 additions
and
99 deletions
+110
-99
modules/gui/skins2/src/vlcproc.cpp
modules/gui/skins2/src/vlcproc.cpp
+104
-99
modules/gui/skins2/src/vlcproc.hpp
modules/gui/skins2/src/vlcproc.hpp
+6
-0
No files found.
modules/gui/skins2/src/vlcproc.cpp
View file @
a31e6840
...
...
@@ -108,6 +108,7 @@ VlcProc::VlcProc( intf_thread_t *pIntf ): SkinObject( pIntf ),
REGISTER_VAR
(
m_cVarHasVout
,
VarBoolImpl
,
"vlc.hasVout"
)
/* Aout variables */
REGISTER_VAR
(
m_cVarHasAudio
,
VarBoolImpl
,
"vlc.hasAudio"
)
REGISTER_VAR
(
m_cVarVolume
,
Volume
,
"volume"
)
REGISTER_VAR
(
m_cVarMute
,
VarBoolImpl
,
"vlc.isMute"
)
REGISTER_VAR
(
m_cVarEqualizer
,
VarBoolImpl
,
"equalizer.isEnabled"
)
...
...
@@ -241,23 +242,102 @@ void VlcProc::manage()
pQueue
->
push
(
CmdGenericPtr
(
pCmd
)
);
}
// Get the VLC variables
StreamTime
*
pTime
=
(
StreamTime
*
)
m_cVarTime
.
get
();
refreshPlaylist
();
refreshAudio
();
refreshInput
();
}
void
VlcProc
::
CmdManage
::
execute
()
{
// Just forward to VlcProc
m_pParent
->
manage
();
}
void
VlcProc
::
refreshAudio
()
{
char
*
pFilters
=
NULL
;
// Check if the audio output has changed
aout_instance_t
*
pAout
=
(
aout_instance_t
*
)
vlc_object_find
(
getIntf
(),
VLC_OBJECT_AOUT
,
FIND_ANYWHERE
);
if
(
pAout
)
{
if
(
pAout
!=
m_pAout
)
{
// Register the equalizer callbacks
if
(
!
var_AddCallback
(
pAout
,
"equalizer-bands"
,
onEqBandsChange
,
this
)
&&
!
var_AddCallback
(
pAout
,
"equalizer-preamp"
,
onEqPreampChange
,
this
)
)
{
m_pAout
=
pAout
;
//char * psz_bands = var_GetString( p_aout, "equalizer-bands" );
}
}
// Get the audio filters
pFilters
=
var_GetString
(
pAout
,
"audio-filter"
);
vlc_object_release
(
pAout
);
}
else
{
// Get the audio filters
pFilters
=
config_GetPsz
(
getIntf
(),
"audio-filter"
);
}
// Refresh sound volume
audio_volume_t
volume
;
aout_VolumeGet
(
getIntf
(),
&
volume
);
Volume
*
pVolume
=
(
Volume
*
)
m_cVarVolume
.
get
();
pVolume
->
set
(
(
double
)
volume
*
2.0
/
AOUT_VOLUME_MAX
);
// Set the mute variable
VarBoolImpl
*
pVarMute
=
(
VarBoolImpl
*
)
m_cVarMute
.
get
();
pVarMute
->
set
(
volume
==
0
);
// Refresh the equalizer variable
VarBoolImpl
*
pVarEqualizer
=
(
VarBoolImpl
*
)
m_cVarEqualizer
.
get
();
pVarEqualizer
->
set
(
pFilters
&&
strstr
(
pFilters
,
"equalizer"
)
);
}
void
VlcProc
::
refreshPlaylist
()
{
// Get the status of the playlist
VarBoolImpl
*
pVarPlaying
=
(
VarBoolImpl
*
)
m_cVarPlaying
.
get
();
VarBoolImpl
*
pVarStopped
=
(
VarBoolImpl
*
)
m_cVarStopped
.
get
();
VarBoolImpl
*
pVarPaused
=
(
VarBoolImpl
*
)
m_cVarPaused
.
get
();
VarBoolImpl
*
pVarSeekable
=
(
VarBoolImpl
*
)
m_cVarSeekable
.
get
();
playlist_status_t
status
=
getIntf
()
->
p_sys
->
p_playlist
->
status
.
i_status
;
pVarPlaying
->
set
(
status
==
PLAYLIST_RUNNING
);
pVarStopped
->
set
(
status
==
PLAYLIST_STOPPED
);
pVarPaused
->
set
(
status
==
PLAYLIST_PAUSED
);
// Refresh the random variable
VarBoolImpl
*
pVarRandom
=
(
VarBoolImpl
*
)
m_cVarRandom
.
get
();
vlc_value_t
val
;
var_Get
(
getIntf
()
->
p_sys
->
p_playlist
,
"random"
,
&
val
);
pVarRandom
->
set
(
val
.
b_bool
!=
0
);
// Refresh the loop variable
VarBoolImpl
*
pVarLoop
=
(
VarBoolImpl
*
)
m_cVarLoop
.
get
();
var_Get
(
getIntf
()
->
p_sys
->
p_playlist
,
"loop"
,
&
val
);
pVarLoop
->
set
(
val
.
b_bool
!=
0
);
// Refresh the repeat variable
VarBoolImpl
*
pVarRepeat
=
(
VarBoolImpl
*
)
m_cVarRepeat
.
get
();
var_Get
(
getIntf
()
->
p_sys
->
p_playlist
,
"repeat"
,
&
val
);
pVarRepeat
->
set
(
val
.
b_bool
!=
0
);
}
void
VlcProc
::
refreshInput
()
{
StreamTime
*
pTime
=
(
StreamTime
*
)
m_cVarTime
.
get
();
VarBoolImpl
*
pVarSeekable
=
(
VarBoolImpl
*
)
m_cVarSeekable
.
get
();
VarBoolImpl
*
pVarDvdActive
=
(
VarBoolImpl
*
)
m_cVarDvdActive
.
get
();
VarBoolImpl
*
pVarFullscreen
=
(
VarBoolImpl
*
)
m_cVarFullscreen
.
get
();
VarBoolImpl
*
pVarHasVout
=
(
VarBoolImpl
*
)
m_cVarHasVout
.
get
();
VarBoolImpl
*
pVarHasAudio
=
(
VarBoolImpl
*
)
m_cVarHasAudio
.
get
();
VarText
*
pBitrate
=
(
VarText
*
)
m_cVarStreamBitRate
.
get
();
VarText
*
pSampleRate
=
(
VarText
*
)
m_cVarStreamSampleRate
.
get
();
// Refresh audio variables
refreshAudio
();
VarBoolImpl
*
pVarFullscreen
=
(
VarBoolImpl
*
)
m_cVarFullscreen
.
get
();
// Update the input
if
(
getIntf
()
->
p_sys
->
p_input
==
NULL
)
...
...
@@ -280,124 +360,49 @@ void VlcProc::manage()
vlc_value_t
pos
;
var_Get
(
pInput
,
"position"
,
&
pos
);
pTime
->
set
(
pos
.
f_float
,
false
);
// Get the status of the playlist
playlist_status_t
status
=
getIntf
()
->
p_sys
->
p_playlist
->
status
.
i_status
;
pVarPlaying
->
set
(
status
==
PLAYLIST_RUNNING
);
pVarStopped
->
set
(
status
==
PLAYLIST_STOPPED
);
pVarPaused
->
set
(
status
==
PLAYLIST_PAUSED
);
pVarSeekable
->
set
(
pos
.
f_float
!=
0.0
);
// Refresh DVD detection
vlc_value_t
chapters_count
;
var_Change
(
pInput
,
"chapter"
,
VLC_VAR_CHOICESCOUNT
,
&
chapters_count
,
NULL
);
&
chapters_count
,
NULL
);
pVarDvdActive
->
set
(
chapters_count
.
i_int
>
0
);
// Get the input bitrate
int
bitrate
=
var_GetInteger
(
pInput
,
"bit-rate"
)
/
1000
;
pBitrate
->
set
(
UString
::
fromInt
(
getIntf
(),
bitrate
)
);
// Get the audio sample rate
int
sampleRate
=
var_GetInteger
(
pInput
,
"sample-rate"
)
/
1000
;
pSampleRate
->
set
(
UString
::
fromInt
(
getIntf
(),
sampleRate
)
);
// Do we have audio
vlc_value_t
audio_es
;
var_Change
(
pInput
,
"audio-es"
,
VLC_VAR_CHOICESCOUNT
,
&
audio_es
,
NULL
);
pVarHasAudio
->
set
(
audio_es
.
i_int
>
0
);
// Refresh fullscreen status
vout_thread_t
*
pVout
=
(
vout_thread_t
*
)
vlc_object_find
(
pInput
,
VLC_OBJECT_VOUT
,
FIND_CHILD
);
VLC_OBJECT_VOUT
,
FIND_CHILD
);
pVarHasVout
->
set
(
pVout
!=
NULL
);
if
(
pVout
)
{
pVarFullscreen
->
set
(
pVout
->
b_fullscreen
);
vlc_object_release
(
pVout
);
}
// Get the input bitrate
int
bitrate
=
var_GetInteger
(
pInput
,
"bit-rate"
)
/
1000
;
pBitrate
->
set
(
UString
::
fromInt
(
getIntf
(),
bitrate
)
);
// Get the audio sample rate
int
sampleRate
=
var_GetInteger
(
pInput
,
"sample-rate"
)
/
1000
;
pSampleRate
->
set
(
UString
::
fromInt
(
getIntf
(),
sampleRate
)
);
}
else
{
pVarPlaying
->
set
(
false
);
pVarPaused
->
set
(
false
);
pVarStopped
->
set
(
true
);
pVarSeekable
->
set
(
false
);
pVarDvdActive
->
set
(
false
);
pTime
->
set
(
0
,
false
);
pVarFullscreen
->
set
(
false
);
pVarHasAudio
->
set
(
false
);
pVarHasVout
->
set
(
false
);
}
// Refresh the random variable
vlc_value_t
val
;
var_Get
(
getIntf
()
->
p_sys
->
p_playlist
,
"random"
,
&
val
);
pVarRandom
->
set
(
val
.
b_bool
!=
0
);
// Refresh the loop variable
var_Get
(
getIntf
()
->
p_sys
->
p_playlist
,
"loop"
,
&
val
);
pVarLoop
->
set
(
val
.
b_bool
!=
0
);
// Refresh the repeat variable
var_Get
(
getIntf
()
->
p_sys
->
p_playlist
,
"repeat"
,
&
val
);
pVarRepeat
->
set
(
val
.
b_bool
!=
0
);
}
void
VlcProc
::
CmdManage
::
execute
()
{
// Just forward to VlcProc
m_pParent
->
manage
();
}
void
VlcProc
::
refreshAudio
()
{
char
*
pFilters
=
NULL
;
// Check if the audio output has changed
aout_instance_t
*
pAout
=
(
aout_instance_t
*
)
vlc_object_find
(
getIntf
(),
VLC_OBJECT_AOUT
,
FIND_ANYWHERE
);
if
(
pAout
)
{
if
(
pAout
!=
m_pAout
)
{
// Register the equalizer callbacks
if
(
!
var_AddCallback
(
pAout
,
"equalizer-bands"
,
onEqBandsChange
,
this
)
&&
!
var_AddCallback
(
pAout
,
"equalizer-preamp"
,
onEqPreampChange
,
this
)
)
{
m_pAout
=
pAout
;
//char * psz_bands = var_GetString( p_aout, "equalizer-bands" );
}
}
// Get the audio filters
pFilters
=
var_GetString
(
pAout
,
"audio-filter"
);
vlc_object_release
(
pAout
);
}
else
{
// Get the audio filters
pFilters
=
config_GetPsz
(
getIntf
(),
"audio-filter"
);
}
// Refresh sound volume
audio_volume_t
volume
;
aout_VolumeGet
(
getIntf
(),
&
volume
);
Volume
*
pVolume
=
(
Volume
*
)
m_cVarVolume
.
get
();
pVolume
->
set
(
(
double
)
volume
*
2.0
/
AOUT_VOLUME_MAX
);
// Set the mute variable
VarBoolImpl
*
pVarMute
=
(
VarBoolImpl
*
)
m_cVarMute
.
get
();
pVarMute
->
set
(
volume
==
0
);
// Refresh the equalizer variable
VarBoolImpl
*
pVarEqualizer
=
(
VarBoolImpl
*
)
m_cVarEqualizer
.
get
();
pVarEqualizer
->
set
(
pFilters
&&
strstr
(
pFilters
,
"equalizer"
)
);
}
int
VlcProc
::
onIntfChange
(
vlc_object_t
*
pObj
,
const
char
*
pVariable
,
vlc_value_t
oldVal
,
vlc_value_t
newVal
,
void
*
pParam
)
...
...
modules/gui/skins2/src/vlcproc.hpp
View file @
a31e6840
...
...
@@ -131,6 +131,8 @@ class VlcProc: public SkinObject
VariablePtr
m_cVarFullscreen
;
VarBox
m_varVoutSize
;
VariablePtr
m_cVarHasVout
;
/// Variables related to audio
VariablePtr
m_cVarHasAudio
;
/// Equalizer variables
EqualizerBands
m_varEqBands
;
VariablePtr
m_cVarEqPreamp
;
...
...
@@ -163,6 +165,10 @@ class VlcProc: public SkinObject
/// Refresh audio variables
void
refreshAudio
();
/// Refresh playlist variables
void
refreshPlaylist
();
/// Refresh input variables
void
refreshInput
();
/// Update the stream name variable
void
updateStreamName
(
playlist_t
*
p_playlist
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment