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
a4512d3b
Commit
a4512d3b
authored
Dec 08, 2008
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
osx: use GLib instead of utils.h/log.h
One my_usleep() invocation remains, until we find out if we can delete it.
parent
b0f46c20
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
9 deletions
+13
-9
osx_plugin.c
src/output/osx_plugin.c
+13
-9
No files found.
src/output/osx_plugin.c
View file @
a4512d3b
...
...
@@ -18,10 +18,14 @@
#include "../output_api.h"
#include "../utils.h"
#include "../log.h"
#include <glib.h>
#include <pthread.h>
#include <AudioUnit/AudioUnit.h>
#undef G_LOG_DOMAIN
#define G_LOG_DOMAIN "osx"
typedef
struct
_OsxData
{
AudioUnit
au
;
pthread_mutex_t
mutex
;
...
...
@@ -35,7 +39,7 @@ typedef struct _OsxData {
static
OsxData
*
newOsxData
(
void
)
{
OsxData
*
ret
=
xmalloc
(
sizeof
(
OsxData
)
);
OsxData
*
ret
=
g_new
(
OsxData
,
1
);
pthread_mutex_init
(
&
ret
->
mutex
,
NULL
);
pthread_cond_init
(
&
ret
->
condition
,
NULL
);
...
...
@@ -227,18 +231,18 @@ osx_openDevice(void *data, struct audio_format *audioFormat)
comp
=
FindNextComponent
(
NULL
,
&
desc
);
if
(
comp
==
0
)
{
ERROR
(
"Error finding OS X component
\n
"
);
g_warning
(
"Error finding OS X component
\n
"
);
return
false
;
}
if
(
OpenAComponent
(
comp
,
&
od
->
au
)
!=
noErr
)
{
ERROR
(
"Unable to open OS X component
\n
"
);
g_warning
(
"Unable to open OS X component
\n
"
);
return
false
;
}
if
(
AudioUnitInitialize
(
od
->
au
)
!=
0
)
{
CloseComponent
(
od
->
au
);
ERROR
(
"Unable to initialize OS X audio unit
\n
"
);
g_warning
(
"Unable to initialize OS X audio unit
\n
"
);
return
false
;
}
...
...
@@ -250,7 +254,7 @@ osx_openDevice(void *data, struct audio_format *audioFormat)
&
callback
,
sizeof
(
callback
))
!=
0
)
{
AudioUnitUninitialize
(
od
->
au
);
CloseComponent
(
od
->
au
);
ERROR
(
"unable to set callback for OS X audio unit
\n
"
);
g_warning
(
"unable to set callback for OS X audio unit
\n
"
);
return
false
;
}
...
...
@@ -272,14 +276,14 @@ osx_openDevice(void *data, struct audio_format *audioFormat)
&
streamDesc
,
sizeof
(
streamDesc
))
!=
0
)
{
AudioUnitUninitialize
(
od
->
au
);
CloseComponent
(
od
->
au
);
ERROR
(
"Unable to set format on OS X device
\n
"
);
g_warning
(
"Unable to set format on OS X device
\n
"
);
return
false
;
}
/* create a buffer of 1s */
od
->
bufferSize
=
(
audioFormat
->
sample_rate
)
*
audio_format_frame_size
(
audioFormat
);
od
->
buffer
=
x
realloc
(
od
->
buffer
,
od
->
bufferSize
);
od
->
buffer
=
g_
realloc
(
od
->
buffer
,
od
->
bufferSize
);
od
->
pos
=
0
;
od
->
len
=
0
;
...
...
@@ -301,7 +305,7 @@ osx_play(void *data, const char *playChunk, size_t size)
od
->
started
=
1
;
err
=
AudioOutputUnitStart
(
od
->
au
);
if
(
err
)
{
ERROR
(
"unable to start audio output: %i
\n
"
,
err
);
g_warning
(
"unable to start audio output: %i
\n
"
,
err
);
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