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
ba4dd651
Commit
ba4dd651
authored
Feb 25, 2009
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ao: no CamelCase
Renamed functions and variables.
parent
074d5ae1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
43 additions
and
50 deletions
+43
-50
ao_plugin.c
src/output/ao_plugin.c
+41
-48
output_list.c
src/output_list.c
+2
-2
No files found.
src/output/ao_plugin.c
View file @
ba4dd651
...
...
@@ -24,24 +24,17 @@
#undef G_LOG_DOMAIN
#define G_LOG_DOMAIN "ao"
static
int
driverInitCount
;
static
unsigned
ao_output_ref
;
typedef
struct
_AoD
ata
{
size_t
write
S
ize
;
int
driver
Id
;
struct
ao_d
ata
{
size_t
write
_s
ize
;
int
driver
;
ao_option
*
options
;
ao_device
*
device
;
}
AoData
;
static
AoData
*
newAoData
(
void
)
{
AoData
*
ret
=
g_malloc
(
sizeof
(
AoData
));
ret
->
options
=
NULL
;
return
ret
;
}
static
void
audioOutputAo_error
(
const
char
*
msg
)
static
void
ao_output_error
(
const
char
*
msg
)
{
const
char
*
error
;
...
...
@@ -74,28 +67,30 @@ static void audioOutputAo_error(const char *msg)
}
static
void
*
a
udioOutputAo_initDriver
(
G_GNUC_UNUSED
const
struct
audio_format
*
audio_format
,
const
struct
config_param
*
param
)
a
o_output_init
(
G_GNUC_UNUSED
const
struct
audio_format
*
audio_format
,
const
struct
config_param
*
param
)
{
struct
ao_data
*
ad
=
g_new
(
struct
ao_data
,
1
);
ao_info
*
ai
;
AoData
*
ad
=
newAoData
();
const
char
*
value
;
ad
->
writeSize
=
config_get_block_unsigned
(
param
,
"write_size"
,
1024
);
ad
->
options
=
NULL
;
ad
->
write_size
=
config_get_block_unsigned
(
param
,
"write_size"
,
1024
);
if
(
driverInitCount
==
0
)
{
if
(
ao_output_ref
==
0
)
{
ao_initialize
();
}
driverInitCount
++
;
ao_output_ref
++
;
value
=
config_get_block_string
(
param
,
"driver"
,
"default"
);
if
(
0
==
strcmp
(
value
,
"default"
))
{
ad
->
driver
Id
=
ao_default_driver_id
();
}
else
if
((
ad
->
driver
Id
=
ao_driver_id
(
value
))
<
0
)
ad
->
driver
=
ao_default_driver_id
();
}
else
if
((
ad
->
driver
=
ao_driver_id
(
value
))
<
0
)
g_error
(
"
\"
%s
\"
is not a valid ao driver at line %i
\n
"
,
value
,
param
->
line
);
if
((
ai
=
ao_driver_info
(
ad
->
driver
Id
))
==
NULL
)
{
if
((
ai
=
ao_driver_info
(
ad
->
driver
))
==
NULL
)
{
g_error
(
"problems getting driver info for device defined at line %i
\n
"
"you may not have permission to the audio device
\n
"
,
param
->
line
);
}
...
...
@@ -126,35 +121,33 @@ audioOutputAo_initDriver(G_GNUC_UNUSED const struct audio_format *audio_format,
return
ad
;
}
static
void
freeAoData
(
AoData
*
ad
)
static
void
ao_output_finish
(
void
*
data
)
{
struct
ao_data
*
ad
=
(
struct
ao_data
*
)
data
;
ao_free_options
(
ad
->
options
);
g_free
(
ad
);
}
static
void
audioOutputAo_finishDriver
(
void
*
data
)
{
AoData
*
ad
=
(
AoData
*
)
data
;
freeAoData
(
ad
);
driverInitCount
--
;
ao_output_ref
--
;
if
(
driverInitCount
==
0
)
if
(
ao_output_ref
==
0
)
ao_shutdown
();
}
static
void
audioOutputAo_closeDevice
(
void
*
data
)
static
void
ao_output_close
(
void
*
data
)
{
AoData
*
ad
=
(
AoD
ata
*
)
data
;
struct
ao_data
*
ad
=
(
struct
ao_d
ata
*
)
data
;
ao_close
(
ad
->
device
);
}
static
bool
a
udioOutputAo_openDevice
(
void
*
data
,
struct
audio_format
*
audio_format
)
a
o_output_open
(
void
*
data
,
struct
audio_format
*
audio_format
)
{
ao_sample_format
format
;
AoData
*
ad
=
(
AoD
ata
*
)
data
;
struct
ao_data
*
ad
=
(
struct
ao_d
ata
*
)
data
;
/* support for 24 bit samples in libao is currently dubious,
and until we have sorted that out, resample everything to
...
...
@@ -167,10 +160,10 @@ audioOutputAo_openDevice(void *data, struct audio_format *audio_format)
format
.
byte_format
=
AO_FMT_NATIVE
;
format
.
channels
=
audio_format
->
channels
;
ad
->
device
=
ao_open_live
(
ad
->
driver
Id
,
&
format
,
ad
->
options
);
ad
->
device
=
ao_open_live
(
ad
->
driver
,
&
format
,
ad
->
options
);
if
(
ad
->
device
==
NULL
)
{
a
udioOutputAo
_error
(
"Failed to open libao"
);
a
o_output
_error
(
"Failed to open libao"
);
return
false
;
}
...
...
@@ -195,26 +188,26 @@ static int ao_play_deconst(ao_device *device, const void *output_samples,
}
static
size_t
a
udioOutputAo
_play
(
void
*
data
,
const
void
*
chunk
,
size_t
size
)
a
o_output
_play
(
void
*
data
,
const
void
*
chunk
,
size_t
size
)
{
AoData
*
ad
=
(
AoD
ata
*
)
data
;
struct
ao_data
*
ad
=
(
struct
ao_d
ata
*
)
data
;
if
(
size
>
ad
->
write
S
ize
)
size
=
ad
->
write
S
ize
;
if
(
size
>
ad
->
write
_s
ize
)
size
=
ad
->
write
_s
ize
;
if
(
ao_play_deconst
(
ad
->
device
,
chunk
,
size
)
==
0
)
{
a
udioOutputAo
_error
(
"Closing libao device due to play error"
);
a
o_output
_error
(
"Closing libao device due to play error"
);
return
0
;
}
return
size
;
}
const
struct
audio_output_plugin
ao
P
lugin
=
{
const
struct
audio_output_plugin
ao
_output_p
lugin
=
{
.
name
=
"ao"
,
.
init
=
a
udioOutputAo_initDriver
,
.
finish
=
a
udioOutputAo_finishDriver
,
.
open
=
a
udioOutputAo_openDevice
,
.
play
=
audioOutputAo_play
,
.
close
=
audioOutputAo_closeDevice
,
.
init
=
a
o_output_init
,
.
finish
=
a
o_output_finish
,
.
open
=
a
o_output_open
,
.
close
=
ao_output_close
,
.
play
=
ao_output_play
,
};
src/output_list.c
View file @
ba4dd651
...
...
@@ -24,7 +24,7 @@ extern const struct audio_output_plugin shoutPlugin;
extern
const
struct
audio_output_plugin
null_output_plugin
;
extern
const
struct
audio_output_plugin
fifoPlugin
;
extern
const
struct
audio_output_plugin
alsaPlugin
;
extern
const
struct
audio_output_plugin
ao
P
lugin
;
extern
const
struct
audio_output_plugin
ao
_output_p
lugin
;
extern
const
struct
audio_output_plugin
ossPlugin
;
extern
const
struct
audio_output_plugin
osxPlugin
;
extern
const
struct
audio_output_plugin
pulse_plugin
;
...
...
@@ -43,7 +43,7 @@ const struct audio_output_plugin *audio_output_plugins[] = {
&
alsaPlugin
,
#endif
#ifdef HAVE_AO
&
ao
P
lugin
,
&
ao
_output_p
lugin
,
#endif
#ifdef HAVE_OSS
&
ossPlugin
,
...
...
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