Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mpd
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Иван Мажукин
mpd
Commits
353ae5e5
Commit
353ae5e5
authored
Feb 26, 2009
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
osx: use OSStatus and GetMacOSStatusCommentString()
The return type of most OS X functions is OSStatus, not int. We can get a nice error message from GetMacOSStatusCommentString(), log it.
parent
9dc96604
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
15 deletions
+24
-15
osx_plugin.c
src/output/osx_plugin.c
+24
-15
No files found.
src/output/osx_plugin.c
View file @
353ae5e5
...
@@ -150,7 +150,8 @@ osx_output_open(void *data, struct audio_format *audio_format)
...
@@ -150,7 +150,8 @@ osx_output_open(void *data, struct audio_format *audio_format)
Component
comp
;
Component
comp
;
AURenderCallbackStruct
callback
;
AURenderCallbackStruct
callback
;
AudioStreamBasicDescription
stream_description
;
AudioStreamBasicDescription
stream_description
;
int
err
;
OSStatus
status
;
ComponentResult
result
;
if
(
audio_format
->
bits
>
16
)
if
(
audio_format
->
bits
>
16
)
audio_format
->
bits
=
16
;
audio_format
->
bits
=
16
;
...
@@ -167,23 +168,29 @@ osx_output_open(void *data, struct audio_format *audio_format)
...
@@ -167,23 +168,29 @@ osx_output_open(void *data, struct audio_format *audio_format)
return
false
;
return
false
;
}
}
if
(
OpenAComponent
(
comp
,
&
od
->
au
)
!=
noErr
)
{
status
=
OpenAComponent
(
comp
,
&
od
->
au
);
g_warning
(
"Unable to open OS X component
\n
"
);
if
(
status
!=
noErr
)
{
g_warning
(
"Unable to open OS X component: %s"
,
GetMacOSStatusCommentString
(
status
));
return
false
;
return
false
;
}
}
if
(
AudioUnitInitialize
(
od
->
au
)
!=
0
)
{
status
=
AudioUnitInitialize
(
od
->
au
);
if
(
status
!=
noErr
)
{
CloseComponent
(
od
->
au
);
CloseComponent
(
od
->
au
);
g_warning
(
"Unable to initialize OS X audio unit
\n
"
);
g_warning
(
"Unable to initialize OS X audio unit: %s"
,
GetMacOSStatusCommentString
(
status
));
return
false
;
return
false
;
}
}
callback
.
inputProc
=
osx_render
;
callback
.
inputProc
=
osx_render
;
callback
.
inputProcRefCon
=
od
;
callback
.
inputProcRefCon
=
od
;
if
(
AudioUnitSetProperty
(
od
->
au
,
kAudioUnitProperty_SetRenderCallback
,
result
=
AudioUnitSetProperty
(
od
->
au
,
kAudioUnitScope_Input
,
0
,
kAudioUnitProperty_SetRenderCallback
,
&
callback
,
sizeof
(
callback
))
!=
0
)
{
kAudioUnitScope_Input
,
0
,
&
callback
,
sizeof
(
callback
));
if
(
result
!=
noErr
)
{
AudioUnitUninitialize
(
od
->
au
);
AudioUnitUninitialize
(
od
->
au
);
CloseComponent
(
od
->
au
);
CloseComponent
(
od
->
au
);
g_warning
(
"unable to set callback for OS X audio unit
\n
"
);
g_warning
(
"unable to set callback for OS X audio unit
\n
"
);
...
@@ -204,10 +211,11 @@ osx_output_open(void *data, struct audio_format *audio_format)
...
@@ -204,10 +211,11 @@ osx_output_open(void *data, struct audio_format *audio_format)
stream_description
.
mChannelsPerFrame
=
audio_format
->
channels
;
stream_description
.
mChannelsPerFrame
=
audio_format
->
channels
;
stream_description
.
mBitsPerChannel
=
audio_format
->
bits
;
stream_description
.
mBitsPerChannel
=
audio_format
->
bits
;
if
(
AudioUnitSetProperty
(
od
->
au
,
kAudioUnitProperty_StreamFormat
,
result
=
AudioUnitSetProperty
(
od
->
au
,
kAudioUnitProperty_StreamFormat
,
kAudioUnitScope_Input
,
0
,
kAudioUnitScope_Input
,
0
,
&
stream_description
,
&
stream_description
,
sizeof
(
stream_description
))
!=
0
)
{
sizeof
(
stream_description
));
if
(
result
!=
noErr
)
{
AudioUnitUninitialize
(
od
->
au
);
AudioUnitUninitialize
(
od
->
au
);
CloseComponent
(
od
->
au
);
CloseComponent
(
od
->
au
);
g_warning
(
"Unable to set format on OS X device
\n
"
);
g_warning
(
"Unable to set format on OS X device
\n
"
);
...
@@ -222,9 +230,10 @@ osx_output_open(void *data, struct audio_format *audio_format)
...
@@ -222,9 +230,10 @@ osx_output_open(void *data, struct audio_format *audio_format)
od
->
pos
=
0
;
od
->
pos
=
0
;
od
->
len
=
0
;
od
->
len
=
0
;
err
=
AudioOutputUnitStart
(
od
->
au
);
status
=
AudioOutputUnitStart
(
od
->
au
);
if
(
err
!=
0
)
{
if
(
status
!=
0
)
{
g_warning
(
"unable to start audio output: %i"
,
err
);
g_warning
(
"unable to start audio output: %s"
,
GetMacOSStatusCommentString
(
status
));
return
false
;
return
false
;
}
}
...
...
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