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
b602fb16
Commit
b602fb16
authored
Jun 11, 2004
by
Jon Lech Johansen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
* coreaudio: Fixed the failed to set buffer size: [nope] SPDIF issue.
parent
a7620012
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
44 deletions
+23
-44
modules/audio_output/coreaudio.c
modules/audio_output/coreaudio.c
+23
-44
No files found.
modules/audio_output/coreaudio.c
View file @
b602fb16
...
...
@@ -37,8 +37,6 @@
#include <CoreAudio/CoreAudio.h>
#define A52_FRAME_NB 1536
#define STREAM_FORMAT_MSG( pre, sfm ) \
pre ": [%ld][%4.4s][%ld][%ld][%ld][%ld][%ld][%ld]", \
(UInt32)sfm.mSampleRate, (char *)&sfm.mFormatID, \
...
...
@@ -164,7 +162,7 @@ struct aout_sys_t
vlc_bool_t
b_revert_sfmt
;
AudioStreamBasicDescription
sfmt_revert
;
UInt32
i_buff
er
_size
;
UInt32
i_buff
rame
_size
;
mtime_t
clock_diff
;
};
...
...
@@ -321,14 +319,14 @@ static int Open( vlc_object_t * p_this )
msg_Dbg
(
p_aout
,
STREAM_FORMAT_MSG
(
"using format"
,
p_sys
->
stream_format
)
);
/* Get the buff
er
size */
i_param_size
=
sizeof
(
p_sys
->
i_buff
er
_size
);
/* Get the buff
rame
size */
i_param_size
=
sizeof
(
p_sys
->
i_buff
rame
_size
);
err
=
AudioDeviceGetProperty
(
p_sys
->
devid
,
i_startingChannel
,
FALSE
,
kAudioDevicePropertyBufferSize
,
&
i_param_size
,
&
p_sys
->
i_buff
er
_size
);
kAudioDevicePropertyBuffer
Frame
Size
,
&
i_param_size
,
&
p_sys
->
i_buff
rame
_size
);
if
(
err
!=
noErr
)
{
msg_Err
(
p_aout
,
"failed to get buff
er
size: [%4.4s]"
,
msg_Err
(
p_aout
,
"failed to get buff
rame
size: [%4.4s]"
,
(
char
*
)
&
err
);
FreeDevice
(
p_aout
);
FreeHardwareInfo
(
p_aout
);
...
...
@@ -337,43 +335,23 @@ static int Open( vlc_object_t * p_this )
return
(
VLC_EGENERIC
);
}
msg_Dbg
(
p_aout
,
"device buff
er size: [%ld]"
,
p_sys
->
i_buffer
_size
);
msg_Dbg
(
p_aout
,
"device buff
rame size: [%ld]"
,
p_sys
->
i_bufframe
_size
);
msg_Dbg
(
p_aout
,
"device buffer index: [%ld]"
,
p_sys
->
i_stream_index
);
/* If we do AC3 over SPDIF, set buffer size to one AC3 frame */
if
(
(
p_sys
->
stream_format
.
mFormatID
==
kAudioFormat60958AC3
||
p_sys
->
stream_format
.
mFormatID
==
'
IAC3
'
)
&&
p_sys
->
i_buff
er_size
!=
AOUT_SPDIF_SIZE
)
p_sys
->
i_buff
rame_size
!=
A52_FRAME_NB
)
{
p_sys
->
i_buffer_size
=
AOUT_SPDIF_SIZE
;
i_param_size
=
sizeof
(
p_sys
->
i_buffer_size
);
err
=
AudioDeviceSetProperty
(
p_sys
->
devid
,
0
,
0
,
FALSE
,
kAudioDevicePropertyBufferSize
,
i_param_size
,
&
p_sys
->
i_buffer_size
);
if
(
err
!=
noErr
)
{
msg_Err
(
p_aout
,
"failed to set buffer size: [%4.4s]"
,
(
char
*
)
&
err
);
FreeDevice
(
p_aout
);
FreeHardwareInfo
(
p_aout
);
vlc_mutex_destroy
(
&
p_sys
->
lock
);
free
(
(
void
*
)
p_sys
);
return
(
VLC_EGENERIC
);
}
msg_Dbg
(
p_aout
,
"device buffer size set to: [%ld]"
,
p_sys
->
i_buffer_size
);
/* Set buffer frame size */
i_param_size
=
sizeof
(
p_aout
->
output
.
i_nb_samples
);
p_sys
->
i_bufframe_size
=
A52_FRAME_NB
;
i_param_size
=
sizeof
(
p_sys
->
i_bufframe_size
);
err
=
AudioDeviceSetProperty
(
p_sys
->
devid
,
0
,
0
,
FALSE
,
kAudioDevicePropertyBufferFrameSize
,
i_param_size
,
&
p_aout
->
output
.
i_nb_samples
);
i_param_size
,
&
p_sys
->
i_bufframe_size
);
if
(
err
!=
noErr
)
{
msg_Err
(
p_aout
,
"failed to set buff
er frame size
: [%4.4s]"
,
(
char
*
)
&
err
);
msg_Err
(
p_aout
,
"failed to set buff
rame size (%ld)
: [%4.4s]"
,
p_sys
->
i_bufframe_size
,
(
char
*
)
&
err
);
FreeDevice
(
p_aout
);
FreeHardwareInfo
(
p_aout
);
vlc_mutex_destroy
(
&
p_sys
->
lock
);
...
...
@@ -381,8 +359,8 @@ static int Open( vlc_object_t * p_this )
return
(
VLC_EGENERIC
);
}
msg_Dbg
(
p_aout
,
"device buff
er frame size set to: [%d]"
,
p_
aout
->
output
.
i_nb_samples
);
msg_Dbg
(
p_aout
,
"device buff
rame size set to: [%ld]"
,
p_
sys
->
i_bufframe_size
);
}
switch
(
p_sys
->
stream_format
.
mFormatID
)
...
...
@@ -432,8 +410,7 @@ static int Open( vlc_object_t * p_this )
return
(
VLC_EGENERIC
);
}
p_aout
->
output
.
i_nb_samples
=
(
int
)(
p_sys
->
i_buffer_size
/
p_sys
->
stream_format
.
mBytesPerFrame
);
p_aout
->
output
.
i_nb_samples
=
p_sys
->
i_bufframe_size
;
aout_VolumeSoftInit
(
p_aout
);
break
;
...
...
@@ -630,8 +607,8 @@ static OSStatus IOCallback( AudioDeviceID inDevice,
{
/* move data into output data buffer */
p_aout
->
p_vlc
->
pf_memcpy
(
outOutputData
->
mBuffers
[
p_sys
->
i_stream_index
].
mData
,
p_buffer
->
p_buffer
,
p_sys
->
i_buffer_siz
e
);
p_buffer
->
p_buffer
,
p_sys
->
i_bufframe_size
*
p_sys
->
stream_format
.
mBytesPerFram
e
);
aout_BufferFree
(
p_buffer
);
}
...
...
@@ -639,7 +616,8 @@ static OSStatus IOCallback( AudioDeviceID inDevice,
{
if
(
p_aout
->
output
.
output
.
i_format
==
VLC_FOURCC
(
'f'
,
'l'
,
'3'
,
'2'
)
)
{
UInt32
i
,
i_size
=
p_sys
->
i_buffer_size
/
sizeof
(
float
);
UInt32
i
,
i_size
=
p_sys
->
i_bufframe_size
*
p_sys
->
stream_format
.
mChannelsPerFrame
;
float
*
p
=
(
float
*
)
outOutputData
->
mBuffers
[
p_sys
->
i_stream_index
].
mData
;
for
(
i
=
0
;
i
<
i_size
;
i
++
)
...
...
@@ -650,7 +628,8 @@ static OSStatus IOCallback( AudioDeviceID inDevice,
else
{
memset
(
outOutputData
->
mBuffers
[
p_sys
->
i_stream_index
].
mData
,
0
,
p_sys
->
i_buffer_size
);
0
,
p_sys
->
i_bufframe_size
*
p_sys
->
stream_format
.
mBytesPerFrame
);
}
}
...
...
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