Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-gpu
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-gpu
Commits
4cc93968
Commit
4cc93968
authored
Aug 04, 2011
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
amem: add support for pause/resume and flush/drain
parent
4f6fae71
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
97 additions
and
8 deletions
+97
-8
include/vlc/libvlc_media_player.h
include/vlc/libvlc_media_player.h
+54
-4
modules/audio_output/amem.c
modules/audio_output/amem.c
+28
-2
src/control/media_player.c
src/control/media_player.c
+14
-2
src/libvlc.sym
src/libvlc.sym
+1
-0
No files found.
include/vlc/libvlc_media_player.h
View file @
4cc93968
...
@@ -475,10 +475,40 @@ LIBVLC_API void *libvlc_media_player_get_hwnd ( libvlc_media_player_t *p_mi );
...
@@ -475,10 +475,40 @@ LIBVLC_API void *libvlc_media_player_get_hwnd ( libvlc_media_player_t *p_mi );
typedef
void
(
*
libvlc_audio_play_cb
)(
void
*
data
,
const
void
*
samples
,
typedef
void
(
*
libvlc_audio_play_cb
)(
void
*
data
,
const
void
*
samples
,
unsigned
count
,
int64_t
pts
);
unsigned
count
,
int64_t
pts
);
/**
* Callback prototype for audio pause.
* \note The pause callback is never called if the audio is already paused.
* \param data data pointer as passed to libvlc_audio_set_callbacks() [IN]
* \param pts time stamp of the pause request (should be elapsed already)
*/
typedef
void
(
*
libvlc_audio_pause_cb
)(
void
*
data
,
int64_t
pts
);
/**
* Callback prototype for audio resumption (i.e. restart from pause).
* \note The resume callback is never called if the audio is not paused.
* \param data data pointer as passed to libvlc_audio_set_callbacks() [IN]
* \param pts time stamp of the resumption request (should be elapsed already)
*/
typedef
void
(
*
libvlc_audio_resume_cb
)(
void
*
data
,
int64_t
pts
);
/**
* Callback prototype for audio buffer flush
* (i.e. discard all pending buffers and stop playback as soon as possible).
* \param data data pointer as passed to libvlc_audio_set_callbacks() [IN]
*/
typedef
void
(
*
libvlc_audio_flush_cb
)(
void
*
data
,
int64_t
pts
);
/**
* Callback prototype for audio buffer drain
* (i.e. wait for pending buffers to be played).
* \param data data pointer as passed to libvlc_audio_set_callbacks() [IN]
*/
typedef
void
(
*
libvlc_audio_drain_cb
)(
void
*
data
);
/**
/**
* Callback prototype for audio volume change.
* Callback prototype for audio volume change.
* \param data data pointer as passed to libvlc_audio_set_callbacks() [IN]
* \param data data pointer as passed to libvlc_audio_set_callbacks() [IN]
* \param volume
linear
volume (1. = nominal, 0. = mute)
* \param volume
software
volume (1. = nominal, 0. = mute)
* \param mute muted flag
* \param mute muted flag
*/
*/
typedef
void
(
*
libvlc_audio_set_volume_cb
)(
void
*
data
,
typedef
void
(
*
libvlc_audio_set_volume_cb
)(
void
*
data
,
...
@@ -491,16 +521,36 @@ typedef void (*libvlc_audio_set_volume_cb)(void *data,
...
@@ -491,16 +521,36 @@ typedef void (*libvlc_audio_set_volume_cb)(void *data,
*
*
* \param mp the media player
* \param mp the media player
* \param play callback to play audio samples (must not be NULL)
* \param play callback to play audio samples (must not be NULL)
* \param set_volume callback to set audio volume, or NULL for software volume
* \param pause callback to pause playback (or NULL to ignore)
* \param opaque private pointer for the two callbacks (as first parameter)
* \param resume callback to resume playback (or NULL to ignore)
* \param flush callback to flush audio buffers (or NULL to ignore)
* \param drain callback to drain audio buffers (or NULL to ignore)
* \param opaque private pointer for the audio callbacks (as first parameter)
* \version LibVLC 1.2.0 or later
* \version LibVLC 1.2.0 or later
*/
*/
LIBVLC_API
LIBVLC_API
void
libvlc_audio_set_callbacks
(
libvlc_media_player_t
*
mp
,
void
libvlc_audio_set_callbacks
(
libvlc_media_player_t
*
mp
,
libvlc_audio_play_cb
play
,
libvlc_audio_play_cb
play
,
libvlc_audio_set_volume_cb
set_volume
,
libvlc_audio_pause_cb
pause
,
libvlc_audio_resume_cb
resume
,
libvlc_audio_flush_cb
flush
,
libvlc_audio_drain_cb
drain
,
void
*
opaque
);
void
*
opaque
);
/**
* Set callbacks and private data for decoded audio.
* Use libvlc_audio_set_format() or libvlc_audio_set_format_callbacks()
* to configure the decoded audio format.
*
* \param mp the media player
* \param set_volume callback to apply audio volume,
* or NULL to apply volume in software
* \version LibVLC 1.2.0 or later
*/
LIBVLC_API
void
libvlc_audio_set_volume_callback
(
libvlc_media_player_t
*
mp
,
libvlc_audio_set_volume_cb
set_volume
);
/**
/**
* Callback prototype to setup the audio playback.
* Callback prototype to setup the audio playback.
* This is called when the media player needs to create a new audio output.
* This is called when the media player needs to create a new audio output.
...
...
modules/audio_output/amem.c
View file @
4cc93968
...
@@ -55,6 +55,10 @@ struct aout_sys_t
...
@@ -55,6 +55,10 @@ struct aout_sys_t
{
{
void
*
opaque
;
void
*
opaque
;
void
(
*
play
)
(
void
*
opaque
,
const
void
*
data
,
unsigned
count
,
int64_t
pts
);
void
(
*
play
)
(
void
*
opaque
,
const
void
*
data
,
unsigned
count
,
int64_t
pts
);
void
(
*
pause
)
(
void
*
opaque
,
int64_t
pts
);
void
(
*
resume
)
(
void
*
opaque
,
int64_t
pts
);
void
(
*
flush
)
(
void
*
opaque
);
void
(
*
drain
)
(
void
*
opaque
);
int
(
*
set_volume
)
(
void
*
opaque
,
float
vol
,
bool
mute
);
int
(
*
set_volume
)
(
void
*
opaque
,
float
vol
,
bool
mute
);
void
(
*
cleanup
)
(
void
*
opaque
);
void
(
*
cleanup
)
(
void
*
opaque
);
};
};
...
@@ -68,6 +72,24 @@ static void Play (audio_output_t *aout, block_t *block)
...
@@ -68,6 +72,24 @@ static void Play (audio_output_t *aout, block_t *block)
block_Release
(
block
);
block_Release
(
block
);
}
}
static
void
Pause
(
audio_output_t
*
aout
,
bool
paused
,
mtime_t
date
)
{
aout_sys_t
*
sys
=
aout
->
sys
;
void
(
*
cb
)
(
void
*
,
int64_t
)
=
paused
?
sys
->
pause
:
sys
->
resume
;
if
(
cb
!=
NULL
)
cb
(
sys
->
opaque
,
date
);
}
static
void
Flush
(
audio_output_t
*
aout
,
bool
wait
)
{
aout_sys_t
*
sys
=
aout
->
sys
;
void
(
*
cb
)
(
void
*
)
=
wait
?
sys
->
drain
:
sys
->
flush
;
if
(
cb
!=
NULL
)
cb
(
sys
->
opaque
);
}
static
int
VolumeSet
(
audio_output_t
*
aout
,
float
vol
,
bool
mute
)
static
int
VolumeSet
(
audio_output_t
*
aout
,
float
vol
,
bool
mute
)
{
{
aout_sys_t
*
sys
=
aout
->
sys
;
aout_sys_t
*
sys
=
aout
->
sys
;
...
@@ -87,6 +109,10 @@ static int Open (vlc_object_t *obj)
...
@@ -87,6 +109,10 @@ static int Open (vlc_object_t *obj)
aout
->
sys
=
sys
;
aout
->
sys
=
sys
;
sys
->
opaque
=
var_InheritAddress
(
obj
,
"amem-data"
);
sys
->
opaque
=
var_InheritAddress
(
obj
,
"amem-data"
);
sys
->
play
=
var_InheritAddress
(
obj
,
"amem-play"
);
sys
->
play
=
var_InheritAddress
(
obj
,
"amem-play"
);
sys
->
pause
=
var_InheritAddress
(
obj
,
"amem-pause"
);
sys
->
resume
=
var_InheritAddress
(
obj
,
"amem-resume"
);
sys
->
flush
=
var_InheritAddress
(
obj
,
"amem-flush"
);
sys
->
drain
=
var_InheritAddress
(
obj
,
"amem-drain"
);
sys
->
set_volume
=
var_InheritAddress
(
obj
,
"amem-set-volume"
);
sys
->
set_volume
=
var_InheritAddress
(
obj
,
"amem-set-volume"
);
sys
->
cleanup
=
NULL
;
/* defer */
sys
->
cleanup
=
NULL
;
/* defer */
if
(
sys
->
play
==
NULL
)
if
(
sys
->
play
==
NULL
)
...
@@ -127,8 +153,8 @@ static int Open (vlc_object_t *obj)
...
@@ -127,8 +153,8 @@ static int Open (vlc_object_t *obj)
aout
->
format
.
i_rate
=
rate
;
aout
->
format
.
i_rate
=
rate
;
aout
->
pf_play
=
Play
;
aout
->
pf_play
=
Play
;
aout
->
pf_pause
=
NULL
;
aout
->
pf_pause
=
Pause
;
aout
->
pf_flush
=
NULL
;
aout
->
pf_flush
=
Flush
;
if
(
sys
->
set_volume
!=
NULL
)
if
(
sys
->
set_volume
!=
NULL
)
aout
->
pf_volume_set
=
VolumeSet
;
aout
->
pf_volume_set
=
VolumeSet
;
else
else
...
...
src/control/media_player.c
View file @
4cc93968
...
@@ -937,15 +937,27 @@ void *libvlc_media_player_get_hwnd( libvlc_media_player_t *p_mi )
...
@@ -937,15 +937,27 @@ void *libvlc_media_player_get_hwnd( libvlc_media_player_t *p_mi )
void
libvlc_audio_set_callbacks
(
libvlc_media_player_t
*
mp
,
void
libvlc_audio_set_callbacks
(
libvlc_media_player_t
*
mp
,
libvlc_audio_play_cb
play_cb
,
libvlc_audio_play_cb
play_cb
,
libvlc_audio_set_volume_cb
set_volume_cb
,
libvlc_audio_pause_cb
pause_cb
,
libvlc_audio_resume_cb
resume_cb
,
libvlc_audio_flush_cb
flush_cb
,
libvlc_audio_drain_cb
drain_cb
,
void
*
opaque
)
void
*
opaque
)
{
{
var_SetAddress
(
mp
,
"amem-play"
,
play_cb
);
var_SetAddress
(
mp
,
"amem-play"
,
play_cb
);
var_SetAddress
(
mp
,
"amem-set-volume"
,
set_volume_cb
);
var_SetAddress
(
mp
,
"amem-pause"
,
pause_cb
);
var_SetAddress
(
mp
,
"amem-resume"
,
resume_cb
);
var_SetAddress
(
mp
,
"amem-flush"
,
flush_cb
);
var_SetAddress
(
mp
,
"amem-drain"
,
drain_cb
);
var_SetAddress
(
mp
,
"amem-data"
,
opaque
);
var_SetAddress
(
mp
,
"amem-data"
,
opaque
);
var_SetString
(
mp
,
"aout"
,
"amem"
);
var_SetString
(
mp
,
"aout"
,
"amem"
);
}
}
void
libvlc_audio_set_volume_callback
(
libvlc_media_player_t
*
mp
,
libvlc_audio_set_volume_cb
cb
)
{
var_SetAddress
(
mp
,
"amem-set-volume"
,
cb
);
}
void
libvlc_audio_set_format_callbacks
(
libvlc_media_player_t
*
mp
,
void
libvlc_audio_set_format_callbacks
(
libvlc_media_player_t
*
mp
,
libvlc_audio_setup_cb
setup
,
libvlc_audio_setup_cb
setup
,
libvlc_audio_cleanup_cb
cleanup
)
libvlc_audio_cleanup_cb
cleanup
)
...
...
src/libvlc.sym
View file @
4cc93968
...
@@ -28,6 +28,7 @@ libvlc_audio_toggle_mute
...
@@ -28,6 +28,7 @@ libvlc_audio_toggle_mute
libvlc_audio_set_format
libvlc_audio_set_format
libvlc_audio_set_format_callbacks
libvlc_audio_set_format_callbacks
libvlc_audio_set_callbacks
libvlc_audio_set_callbacks
libvlc_audio_set_volume_callback
libvlc_clock
libvlc_clock
libvlc_event_attach
libvlc_event_attach
libvlc_event_detach
libvlc_event_detach
...
...
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