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
1d0ffadb
Commit
1d0ffadb
authored
Feb 04, 2013
by
Felix Paul Kühne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
audioqueue: use the AudioSession API to overwrite the mute switch during media playback (iOS only)
parent
b620bade
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
2 deletions
+30
-2
modules/audio_output/audioqueue.c
modules/audio_output/audioqueue.c
+30
-2
No files found.
modules/audio_output/audioqueue.c
View file @
1d0ffadb
...
@@ -31,6 +31,9 @@
...
@@ -31,6 +31,9 @@
#import <vlc_plugin.h>
#import <vlc_plugin.h>
#import <vlc_aout.h>
#import <vlc_aout.h>
#import <AudioToolBox/AudioQueue.h>
#import <AudioToolBox/AudioQueue.h>
#import <AudioToolBox/AudioSession.h>
#import <TargetConditionals.h>
#pragma mark -
#pragma mark -
#pragma mark private declarations
#pragma mark private declarations
...
@@ -62,6 +65,7 @@ set_subcategory(SUBCAT_AUDIO_AOUT)
...
@@ -62,6 +65,7 @@ set_subcategory(SUBCAT_AUDIO_AOUT)
add_shortcut
(
"audioqueue"
)
add_shortcut
(
"audioqueue"
)
set_callbacks
(
Open
,
Close
)
set_callbacks
(
Open
,
Close
)
vlc_module_end
()
vlc_module_end
()
#pragma mark -
#pragma mark -
#pragma mark initialization
#pragma mark initialization
...
@@ -150,6 +154,19 @@ static int Start(audio_output_t *p_aout, audio_sample_format_t *restrict fmt)
...
@@ -150,6 +154,19 @@ static int Start(audio_output_t *p_aout, audio_sample_format_t *restrict fmt)
if
(
error
!=
noErr
)
if
(
error
!=
noErr
)
return
VLC_EGENERIC
;
return
VLC_EGENERIC
;
#ifdef TARGET_OS_IPHONE
// start audio session so playback continues if mute switch is on
AudioSessionInitialize
(
NULL
,
kCFRunLoopCommonModes
,
NULL
,
NULL
);
// Set audio session to mediaplayback
UInt32
sessionCategory
=
kAudioSessionCategory_MediaPlayback
;
AudioSessionSetProperty
(
kAudioSessionProperty_AudioCategory
,
sizeof
(
sessionCategory
),
&
sessionCategory
);
AudioSessionSetActive
(
true
);
#endif
p_aout
->
time_get
=
TimeGet
;
p_aout
->
time_get
=
TimeGet
;
p_aout
->
play
=
Play
;
p_aout
->
play
=
Play
;
p_aout
->
pause
=
Pause
;
p_aout
->
pause
=
Pause
;
...
@@ -160,6 +177,10 @@ static int Start(audio_output_t *p_aout, audio_sample_format_t *restrict fmt)
...
@@ -160,6 +177,10 @@ static int Start(audio_output_t *p_aout, audio_sample_format_t *restrict fmt)
static
void
Stop
(
audio_output_t
*
p_aout
)
static
void
Stop
(
audio_output_t
*
p_aout
)
{
{
#ifdef TARGET_OS_IPHONE
AudioSessionSetActive
(
false
);
#endif
p_aout
->
sys
->
i_played_length
=
0
;
p_aout
->
sys
->
i_played_length
=
0
;
AudioQueueDisposeTimeline
(
p_aout
->
sys
->
audioQueueRef
,
p_aout
->
sys
->
timelineRef
);
AudioQueueDisposeTimeline
(
p_aout
->
sys
->
audioQueueRef
,
p_aout
->
sys
->
timelineRef
);
AudioQueueStop
(
p_aout
->
sys
->
audioQueueRef
,
true
);
AudioQueueStop
(
p_aout
->
sys
->
audioQueueRef
,
true
);
...
@@ -203,10 +224,17 @@ static void Pause(audio_output_t *p_aout, bool pause, mtime_t date)
...
@@ -203,10 +224,17 @@ static void Pause(audio_output_t *p_aout, bool pause, mtime_t date)
{
{
VLC_UNUSED
(
date
);
VLC_UNUSED
(
date
);
if
(
pause
)
if
(
pause
)
{
AudioQueuePause
(
p_aout
->
sys
->
audioQueueRef
);
AudioQueuePause
(
p_aout
->
sys
->
audioQueueRef
);
else
#ifdef TARGET_OS_IPHONE
AudioSessionSetActive
(
false
);
#endif
}
else
{
AudioQueueStart
(
p_aout
->
sys
->
audioQueueRef
,
NULL
);
AudioQueueStart
(
p_aout
->
sys
->
audioQueueRef
,
NULL
);
#ifdef TARGET_OS_IPHONE
AudioSessionSetActive
(
true
);
#endif
}
}
}
static
void
Flush
(
audio_output_t
*
p_aout
,
bool
wait
)
static
void
Flush
(
audio_output_t
*
p_aout
,
bool
wait
)
...
...
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