Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-2-2
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-2-2
Commits
617abeec
Commit
617abeec
authored
Nov 01, 2012
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
playlist: type-safe functions for audio output management
parent
1e10857a
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
171 additions
and
0 deletions
+171
-0
include/vlc_playlist.h
include/vlc_playlist.h
+24
-0
src/Makefile.am
src/Makefile.am
+1
-0
src/libvlccore.sym
src/libvlccore.sym
+6
-0
src/playlist/aout.c
src/playlist/aout.c
+140
-0
No files found.
include/vlc_playlist.h
View file @
617abeec
...
...
@@ -364,6 +364,30 @@ VLC_API int playlist_NodeDelete( playlist_t *, playlist_item_t *, bool , bool );
VLC_API
playlist_item_t
*
playlist_GetNextLeaf
(
playlist_t
*
p_playlist
,
playlist_item_t
*
p_root
,
playlist_item_t
*
p_item
,
bool
b_ena
,
bool
b_unplayed
)
VLC_USED
;
VLC_API
playlist_item_t
*
playlist_GetPrevLeaf
(
playlist_t
*
p_playlist
,
playlist_item_t
*
p_root
,
playlist_item_t
*
p_item
,
bool
b_ena
,
bool
b_unplayed
)
VLC_USED
;
/**************************
* Audio output management
**************************/
#define AOUT_VOLUME_DEFAULT 256
#define AOUT_VOLUME_MAX 512
VLC_API
float
playlist_VolumeGet
(
playlist_t
*
);
VLC_API
int
playlist_VolumeSet
(
playlist_t
*
,
float
);
VLC_API
int
playlist_VolumeUp
(
playlist_t
*
,
int
,
float
*
);
#define playlist_VolumeDown(a, b, c) playlist_VolumeUp(a, -(b), c)
VLC_API
int
playlist_MuteSet
(
playlist_t
*
,
bool
);
VLC_API
int
playlist_MuteGet
(
playlist_t
*
);
static
inline
int
playlist_MuteToggle
(
playlist_t
*
pl
)
{
int
val
=
playlist_MuteGet
(
pl
);
if
(
val
>=
0
)
val
=
playlist_MuteSet
(
pl
,
!
val
);
return
val
;
}
VLC_API
void
playlist_EnableAudioFilter
(
playlist_t
*
,
const
char
*
,
bool
);
/***********************************************************************
* Inline functions
***********************************************************************/
...
...
src/Makefile.am
View file @
617abeec
...
...
@@ -330,6 +330,7 @@ SOURCES_libvlc_common = \
playlist/playlist_internal.h
\
playlist/art.c
\
playlist/art.h
\
playlist/aout.c
\
playlist/thread.c
\
playlist/control.c
\
playlist/engine.c
\
...
...
src/libvlccore.sym
View file @
617abeec
...
...
@@ -352,6 +352,12 @@ playlist_Status
playlist_TreeMove
playlist_TreeMoveMany
playlist_Unlock
playlist_EnableAudioFilter
playlist_VolumeGet
playlist_VolumeSet
playlist_VolumeUp
playlist_MuteSet
playlist_MuteGet
pl_Get
resolve_xml_special_chars
sdp_AddAttribute
...
...
src/playlist/aout.c
0 → 100644
View file @
617abeec
/*****************************************************************************
* aout.c: audio output controls for the VLC playlist
*****************************************************************************
* Copyright (C) 2002-2012 VLC authors and VideoLAN
*
* Authors: Christophe Massiot <massiot@via.ecp.fr>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2.1 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <vlc_common.h>
#include <vlc_aout.h>
#include <vlc_playlist.h>
#include "../audio_output/aout_internal.h"
#include "playlist_internal.h"
static
inline
audio_output_t
*
findAout
(
playlist_t
*
pl
)
{
/* NOTE: it is assumed that the input resource exists. In practice,
* the playlist must have been activated. This is automatic when calling * pl_Get(). FIXME: input resources are deleted at deactivation, this can
* be too early. */
playlist_private_t
*
sys
=
pl_priv
(
pl
);
return
input_resource_HoldAout
(
sys
->
p_input_resource
);
}
float
playlist_VolumeGet
(
playlist_t
*
pl
)
{
float
volume
=
-
1
.
f
;
audio_output_t
*
aout
=
findAout
(
pl
);
if
(
aout
!=
NULL
)
{
volume
=
aout_OutputVolumeGet
(
aout
);
vlc_object_release
(
aout
);
}
return
volume
;
}
int
playlist_VolumeSet
(
playlist_t
*
pl
,
float
vol
)
{
int
ret
=
-
1
;
audio_output_t
*
aout
=
findAout
(
pl
);
if
(
aout
!=
NULL
)
{
ret
=
aout_OutputVolumeSet
(
aout
,
vol
);
vlc_object_release
(
aout
);
}
return
ret
;
}
/**
* Raises the volume.
* \param value how much to increase (> 0) or decrease (< 0) the volume
* \param volp if non-NULL, will contain contain the resulting volume
*/
int
playlist_VolumeUp
(
playlist_t
*
pl
,
int
value
,
float
*
volp
)
{
int
ret
=
-
1
;
value
*=
var_InheritInteger
(
pl
,
"volume-step"
);
audio_output_t
*
aout
=
findAout
(
pl
);
if
(
aout
!=
NULL
)
{
float
vol
=
aout_OutputVolumeGet
(
aout
);
if
(
vol
>=
0
.)
{
vol
+=
value
/
(
float
)
AOUT_VOLUME_DEFAULT
;
if
(
vol
<
0
.)
vol
=
0
.;
if
(
vol
>
2
.)
vol
=
2
.;
if
(
volp
!=
NULL
)
*
volp
=
vol
;
ret
=
aout_OutputVolumeSet
(
aout
,
vol
);
}
vlc_object_release
(
aout
);
}
return
ret
;
}
int
playlist_MuteGet
(
playlist_t
*
pl
)
{
int
mute
=
-
1
;
audio_output_t
*
aout
=
findAout
(
pl
);
if
(
aout
!=
NULL
)
{
mute
=
aout_OutputMuteGet
(
aout
);
vlc_object_release
(
aout
);
}
return
mute
;
}
int
playlist_MuteSet
(
playlist_t
*
pl
,
bool
mute
)
{
int
ret
=
-
1
;
audio_output_t
*
aout
=
findAout
(
pl
);
if
(
aout
!=
NULL
)
{
ret
=
aout_OutputMuteSet
(
aout
,
mute
);
vlc_object_release
(
aout
);
if
(
ret
==
0
)
var_SetBool
(
pl
,
"mute"
,
mute
);
}
return
ret
;
}
void
playlist_EnableAudioFilter
(
playlist_t
*
pl
,
const
char
*
name
,
bool
add
)
{
audio_output_t
*
aout
=
findAout
(
pl
);
if
(
aout_ChangeFilterString
(
VLC_OBJECT
(
pl
),
VLC_OBJECT
(
aout
),
"audio-filter"
,
name
,
add
))
{
if
(
aout
!=
NULL
)
aout_InputRequestRestart
(
aout
);
}
if
(
aout
!=
NULL
)
vlc_object_release
(
aout
);
}
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