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
1afcd945
Commit
1afcd945
authored
Jan 21, 2013
by
Felix Paul Kühne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
AudioQueue: implemented TimeGet
parent
dbc10d65
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
9 deletions
+34
-9
modules/audio_output/audioqueue.c
modules/audio_output/audioqueue.c
+34
-9
No files found.
modules/audio_output/audioqueue.c
View file @
1afcd945
...
@@ -43,9 +43,13 @@
...
@@ -43,9 +43,13 @@
*****************************************************************************/
*****************************************************************************/
struct
aout_sys_t
struct
aout_sys_t
{
{
AudioQueueRef
audioQueue
;
AudioQueueRef
audioQueue
;
bool
b_stopped
;
AudioQueueTimelineRef
outTimeline
;
float
f_volume
;
int
i_rate
;
mtime_t
i_played_length
;
bool
b_stopped
;
float
f_volume
;
};
};
/*****************************************************************************
/*****************************************************************************
...
@@ -110,10 +114,14 @@ static int Start(audio_output_t *p_aout, audio_sample_format_t *restrict fmt)
...
@@ -110,10 +114,14 @@ static int Start(audio_output_t *p_aout, audio_sample_format_t *restrict fmt)
aout_FormatPrepare
(
fmt
);
aout_FormatPrepare
(
fmt
);
p_aout
->
sys
->
b_stopped
=
false
;
p_aout
->
sys
->
b_stopped
=
false
;
p_aout
->
sys
->
i_rate
=
fmt
->
i_rate
;
status
=
AudioQueueStart
(
p_sys
->
audioQueue
,
NULL
);
status
=
AudioQueueStart
(
p_sys
->
audioQueue
,
NULL
);
msg_Dbg
(
p_aout
,
"Starting AudioQueue (status = %li)"
,
status
);
msg_Dbg
(
p_aout
,
"Starting AudioQueue (status = %li)"
,
status
);
status
=
AudioQueueCreateTimeline
(
p_sys
->
audioQueue
,
&
p_sys
->
outTimeline
);
msg_Dbg
(
p_aout
,
"AudioQueue Timeline started (status = %li)"
,
status
);
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
;
...
@@ -132,7 +140,10 @@ static int Start(audio_output_t *p_aout, audio_sample_format_t *restrict fmt)
...
@@ -132,7 +140,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
)
{
{
p_aout
->
sys
->
b_stopped
=
true
;
p_aout
->
sys
->
b_stopped
=
true
;
p_aout
->
sys
->
i_played_length
=
0
;
msg_Dbg
(
p_aout
,
"Stopping AudioQueue timeline"
);
AudioQueueDisposeTimeline
(
p_aout
->
sys
->
audioQueue
,
p_aout
->
sys
->
outTimeline
);
msg_Dbg
(
p_aout
,
"Stopping AudioQueue"
);
msg_Dbg
(
p_aout
,
"Stopping AudioQueue"
);
AudioQueueStop
(
p_aout
->
sys
->
audioQueue
,
true
);
AudioQueueStop
(
p_aout
->
sys
->
audioQueue
,
true
);
msg_Dbg
(
p_aout
,
"Disposing AudioQueue"
);
msg_Dbg
(
p_aout
,
"Disposing AudioQueue"
);
...
@@ -157,6 +168,7 @@ static void Play (audio_output_t *p_aout, block_t *p_block)
...
@@ -157,6 +168,7 @@ static void Play (audio_output_t *p_aout, block_t *p_block)
memcpy
(
inBuffer
->
mAudioData
,
p_block
->
p_buffer
,
p_block
->
i_buffer
);
memcpy
(
inBuffer
->
mAudioData
,
p_block
->
p_buffer
,
p_block
->
i_buffer
);
inBuffer
->
mAudioDataByteSize
=
p_block
->
i_buffer
;
inBuffer
->
mAudioDataByteSize
=
p_block
->
i_buffer
;
p_aout
->
sys
->
i_played_length
+=
p_block
->
i_length
;
block_Release
(
p_block
);
block_Release
(
p_block
);
status
=
AudioQueueEnqueueBuffer
(
p_aout
->
sys
->
audioQueue
,
inBuffer
,
0
,
NULL
);
status
=
AudioQueueEnqueueBuffer
(
p_aout
->
sys
->
audioQueue
,
inBuffer
,
0
,
NULL
);
...
@@ -190,18 +202,31 @@ static void Flush (audio_output_t *p_aout, bool wait)
...
@@ -190,18 +202,31 @@ static void Flush (audio_output_t *p_aout, bool wait)
if
(
wait
)
if
(
wait
)
AudioQueueFlush
(
p_aout
->
sys
->
audioQueue
);
AudioQueueFlush
(
p_aout
->
sys
->
audioQueue
);
else
else
{
AudioQueueReset
(
p_aout
->
sys
->
audioQueue
);
p_aout
->
sys
->
i_played_length
=
0
;
AudioQueueStop
(
p_aout
->
sys
->
audioQueue
,
true
);
AudioQueueStart
(
p_aout
->
sys
->
audioQueue
,
NULL
);
}
}
}
static
int
TimeGet
(
audio_output_t
*
p_aout
,
mtime_t
*
restrict
delay
)
static
int
TimeGet
(
audio_output_t
*
p_aout
,
mtime_t
*
restrict
delay
)
{
{
// TODO
AudioTimeStamp
outTimeStamp
;
Boolean
b_discontinuity
;
OSStatus
status
=
AudioQueueGetCurrentTime
(
p_aout
->
sys
->
audioQueue
,
p_aout
->
sys
->
outTimeline
,
&
outTimeStamp
,
&
b_discontinuity
);
if
(
status
!=
noErr
)
{
msg_Warn
(
p_aout
,
"AudioQueueGetCurrentTime failed (%li)"
,
status
);
return
-
1
;
}
if
(
b_discontinuity
)
msg_Dbg
(
p_aout
,
"detected output discontinuity"
);
VLC_UNUSED
(
p_aout
)
;
mtime_t
i_pos
=
(
mtime_t
)
outTimeStamp
.
mSampleTime
*
CLOCK_FREQ
/
p_aout
->
sys
->
i_rate
;
VLC_UNUSED
(
delay
)
;
*
delay
=
p_aout
->
sys
->
i_played_length
-
i_pos
;
return
-
1
;
return
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