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
d8ea040a
Commit
d8ea040a
authored
Jan 22, 2012
by
Rafaël Carré
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
opensles: move code around
parent
843516d1
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
49 additions
and
52 deletions
+49
-52
modules/audio_output/opensles_android.c
modules/audio_output/opensles_android.c
+49
-52
No files found.
modules/audio_output/opensles_android.c
View file @
d8ea040a
...
@@ -72,8 +72,6 @@ typedef SLresult (*slCreateEngine_t)(
...
@@ -72,8 +72,6 @@ typedef SLresult (*slCreateEngine_t)(
*****************************************************************************/
*****************************************************************************/
static
int
Open
(
vlc_object_t
*
);
static
int
Open
(
vlc_object_t
*
);
static
void
Close
(
vlc_object_t
*
);
static
void
Close
(
vlc_object_t
*
);
static
void
Play
(
audio_output_t
*
,
block_t
*
);
static
void
PlayedCallback
(
SLAndroidSimpleBufferQueueItf
caller
,
void
*
pContext
);
/*****************************************************************************
/*****************************************************************************
* Module descriptor
* Module descriptor
...
@@ -123,6 +121,55 @@ static void Clear( aout_sys_t *p_sys )
...
@@ -123,6 +121,55 @@ static void Clear( aout_sys_t *p_sys )
free
(
p_sys
);
free
(
p_sys
);
}
}
/*****************************************************************************
* Play: play a sound
*****************************************************************************/
static
void
Play
(
audio_output_t
*
p_aout
,
block_t
*
p_buffer
)
{
aout_sys_t
*
p_sys
=
p_aout
->
sys
;
int
tries
=
5
;
for
(;;)
{
SLresult
result
=
(
*
p_sys
->
playerBufferQueue
)
->
Enqueue
(
p_sys
->
playerBufferQueue
,
p_buffer
->
p_buffer
,
p_buffer
->
i_buffer
);
switch
(
result
)
{
case
SL_RESULT_SUCCESS
:
p_sys
->
p_buffer_array
[
p_sys
->
i_toappend_buffer
]
=
p_buffer
;
if
(
++
p_sys
->
i_toappend_buffer
==
BUFF_QUEUE
)
p_sys
->
i_toappend_buffer
=
0
;
return
;
case
SL_RESULT_BUFFER_INSUFFICIENT
:
msg_Err
(
p_aout
,
"buffer insufficient"
);
if
(
tries
--
)
{
// Wait a bit to retry.
msleep
(
CLOCK_FREQ
);
continue
;
}
default:
msg_Warn
(
p_aout
,
"Error %lu, dropping buffer"
,
result
);
aout_BufferFree
(
p_buffer
);
return
;
}
}
}
static
void
PlayedCallback
(
SLAndroidSimpleBufferQueueItf
caller
,
void
*
pContext
)
{
aout_sys_t
*
p_sys
=
pContext
;
assert
(
caller
==
p_sys
->
playerBufferQueue
);
aout_BufferFree
(
p_sys
->
p_buffer_array
[
p_sys
->
i_toclean_buffer
]
);
if
(
++
p_sys
->
i_toclean_buffer
==
BUFF_QUEUE
)
p_sys
->
i_toclean_buffer
=
0
;
}
/*****************************************************************************
/*****************************************************************************
* Open: open a dummy audio device
* Open: open a dummy audio device
*****************************************************************************/
*****************************************************************************/
...
@@ -277,53 +324,3 @@ static void Close( vlc_object_t *p_this )
...
@@ -277,53 +324,3 @@ static void Close( vlc_object_t *p_this )
Clear
(
p_sys
);
Clear
(
p_sys
);
}
}
/*****************************************************************************
* Play: play a sound
*****************************************************************************/
static
void
Play
(
audio_output_t
*
p_aout
,
block_t
*
p_buffer
)
{
aout_sys_t
*
p_sys
=
p_aout
->
sys
;
int
tries
=
5
;
for
(;;)
{
SLresult
result
=
(
*
p_sys
->
playerBufferQueue
)
->
Enqueue
(
p_sys
->
playerBufferQueue
,
p_buffer
->
p_buffer
,
p_buffer
->
i_buffer
);
switch
(
result
)
{
case
SL_RESULT_SUCCESS
:
p_sys
->
p_buffer_array
[
p_sys
->
i_toappend_buffer
]
=
p_buffer
;
if
(
++
p_sys
->
i_toappend_buffer
==
BUFF_QUEUE
)
p_sys
->
i_toappend_buffer
=
0
;
return
;
case
SL_RESULT_BUFFER_INSUFFICIENT
:
msg_Err
(
p_aout
,
"buffer insufficient"
);
if
(
tries
--
)
{
// Wait a bit to retry.
msleep
(
CLOCK_FREQ
);
continue
;
}
default:
msg_Warn
(
p_aout
,
"Error %lu, dropping buffer"
,
result
);
aout_BufferFree
(
p_buffer
);
return
;
}
}
}
static
void
PlayedCallback
(
SLAndroidSimpleBufferQueueItf
caller
,
void
*
pContext
)
{
aout_sys_t
*
p_sys
=
pContext
;
assert
(
caller
==
p_sys
->
playerBufferQueue
);
aout_BufferFree
(
p_sys
->
p_buffer_array
[
p_sys
->
i_toclean_buffer
]
);
if
(
++
p_sys
->
i_toclean_buffer
==
BUFF_QUEUE
)
p_sys
->
i_toclean_buffer
=
0
;
}
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