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
20004b7e
Commit
20004b7e
authored
Oct 08, 2010
by
Denis Krjuchkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
win32_output: renamed win32 output plugin to winmm
Win32 has many audio APIs. New name is slightly more correct.
parent
84e03763
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
62 additions
and
62 deletions
+62
-62
Makefile.am
Makefile.am
+2
-2
configure.ac
configure.ac
+7
-7
winmm_output_plugin.c
src/output/winmm_output_plugin.c
+50
-50
output_list.c
src/output_list.c
+3
-3
No files found.
Makefile.am
View file @
20004b7e
...
...
@@ -736,8 +736,8 @@ if ENABLE_SOLARIS_OUTPUT
OUTPUT_SRC
+=
src/output/solaris_output_plugin.c
endif
if
ENABLE_WIN
32
_OUTPUT
OUTPUT_SRC
+=
src/output/win
32
_output_plugin.c
if
ENABLE_WIN
MM
_OUTPUT
OUTPUT_SRC
+=
src/output/win
mm
_output_plugin.c
endif
...
...
configure.ac
View file @
20004b7e
...
...
@@ -1375,21 +1375,21 @@ esac
AM_CONDITIONAL(ENABLE_SOLARIS_OUTPUT, test x$enable_solaris_output = xyes)
dnl ---------------------------------
Solaris
---------------------------------
dnl ---------------------------------
WinMM
---------------------------------
case "$host_os" in
mingw32* | windows*)
AC_DEFINE(ENABLE_WIN
32_OUTPUT, 1, [Define to enable WIN32 wave
support])
enable_win
32
_output=yes
AC_DEFINE(ENABLE_WIN
MM_OUTPUT, 1, [Define to enable WinMM
support])
enable_win
mm
_output=yes
MPD_LIBS="$MPD_LIBS -lwinmm"
;;
*)
enable_win
32
_output=no
enable_win
mm
_output=no
;;
esac
AM_CONDITIONAL(ENABLE_WIN
32_OUTPUT, test x$enable_win32
_output = xyes)
AM_CONDITIONAL(ENABLE_WIN
MM_OUTPUT, test x$enable_winmm
_output = xyes)
dnl --------------------- Post Audio Output Plugins Tests ---------------------
if
...
...
@@ -1407,7 +1407,7 @@ if
test x$enable_recorder_output = xno &&
test x$enable_shout = xno &&
test x$enable_solaris_output = xno &&
test x$enable_win
32
_output = xno &&
test x$enable_win
mm
_output = xno &&
AC_MSG_ERROR([No Audio Output types configured!])
fi
...
...
@@ -1544,7 +1544,7 @@ results(mvp, [Media MVP])
results(shout, [SHOUTcast])
echo -ne '\n\t'
results(solaris, [Solaris])
results(win
32_output, [WIN32 wave
])
results(win
mm_output, [WinMM
])
if
test x$enable_shout = xyes ||
...
...
src/output/win
32
_output_plugin.c
→
src/output/win
mm
_output_plugin.c
View file @
20004b7e
...
...
@@ -24,15 +24,15 @@
#include <windows.h>
#undef G_LOG_DOMAIN
#define G_LOG_DOMAIN "win
32
_output"
#define G_LOG_DOMAIN "win
mm
_output"
struct
win
32
_buffer
{
struct
win
mm
_buffer
{
struct
pcm_buffer
buffer
;
WAVEHDR
hdr
;
};
struct
win
32
_output
{
struct
win
mm
_output
{
HWAVEOUT
handle
;
/**
...
...
@@ -41,7 +41,7 @@ struct win32_output {
*/
HANDLE
event
;
struct
win
32
_buffer
buffers
[
8
];
struct
win
mm
_buffer
buffers
[
8
];
unsigned
next_buffer
;
};
...
...
@@ -49,45 +49,45 @@ struct win32_output {
* The quark used for GError.domain.
*/
static
inline
GQuark
win
32
_output_quark
(
void
)
win
mm
_output_quark
(
void
)
{
return
g_quark_from_static_string
(
"win
32
_output"
);
return
g_quark_from_static_string
(
"win
mm
_output"
);
}
static
bool
win
32
_output_test_default_device
(
void
)
win
mm
_output_test_default_device
(
void
)
{
/* we assume that Wave is always available */
return
true
;
}
static
void
*
win
32
_output_init
(
G_GNUC_UNUSED
const
struct
audio_format
*
audio_format
,
win
mm
_output_init
(
G_GNUC_UNUSED
const
struct
audio_format
*
audio_format
,
G_GNUC_UNUSED
const
struct
config_param
*
param
,
G_GNUC_UNUSED
GError
**
error
)
{
struct
win
32_output
*
wo
=
g_new
(
struct
win32
_output
,
1
);
struct
win
mm_output
*
wo
=
g_new
(
struct
winmm
_output
,
1
);
return
wo
;
}
static
void
win
32
_output_finish
(
void
*
data
)
win
mm
_output_finish
(
void
*
data
)
{
struct
win
32
_output
*
wo
=
data
;
struct
win
mm
_output
*
wo
=
data
;
g_free
(
wo
);
}
static
bool
win
32
_output_open
(
void
*
data
,
struct
audio_format
*
audio_format
,
win
mm
_output_open
(
void
*
data
,
struct
audio_format
*
audio_format
,
GError
**
error_r
)
{
struct
win
32
_output
*
wo
=
data
;
struct
win
mm
_output
*
wo
=
data
;
wo
->
event
=
CreateEvent
(
NULL
,
false
,
false
,
NULL
);
if
(
wo
->
event
==
NULL
)
{
g_set_error
(
error_r
,
win
32
_output_quark
(),
0
,
g_set_error
(
error_r
,
win
mm
_output_quark
(),
0
,
"CreateEvent() failed"
);
return
false
;
}
...
...
@@ -123,7 +123,7 @@ win32_output_open(void *data, struct audio_format *audio_format,
(
DWORD_PTR
)
wo
->
event
,
0
,
CALLBACK_EVENT
);
if
(
result
!=
MMSYSERR_NOERROR
)
{
CloseHandle
(
wo
->
event
);
g_set_error
(
error_r
,
win
32
_output_quark
(),
result
,
g_set_error
(
error_r
,
win
mm
_output_quark
(),
result
,
"waveOutOpen() failed"
);
return
false
;
}
...
...
@@ -139,9 +139,9 @@ win32_output_open(void *data, struct audio_format *audio_format,
}
static
void
win
32
_output_close
(
void
*
data
)
win
mm
_output_close
(
void
*
data
)
{
struct
win
32
_output
*
wo
=
data
;
struct
win
mm
_output
*
wo
=
data
;
for
(
unsigned
i
=
0
;
i
<
G_N_ELEMENTS
(
wo
->
buffers
);
++
i
)
pcm_buffer_deinit
(
&
wo
->
buffers
[
i
].
buffer
);
...
...
@@ -155,13 +155,13 @@ win32_output_close(void *data)
* Copy data into a buffer, and prepare the wave header.
*/
static
bool
win
32_set_buffer
(
struct
win32_output
*
wo
,
struct
win32
_buffer
*
buffer
,
win
mm_set_buffer
(
struct
winmm_output
*
wo
,
struct
winmm
_buffer
*
buffer
,
const
void
*
data
,
size_t
size
,
GError
**
error_r
)
{
void
*
dest
=
pcm_buffer_get
(
&
buffer
->
buffer
,
size
);
if
(
dest
==
NULL
)
{
g_set_error
(
error_r
,
win
32
_output_quark
(),
0
,
g_set_error
(
error_r
,
win
mm
_output_quark
(),
0
,
"Out of memory"
);
return
false
;
}
...
...
@@ -175,7 +175,7 @@ win32_set_buffer(struct win32_output *wo, struct win32_buffer *buffer,
MMRESULT
result
=
waveOutPrepareHeader
(
wo
->
handle
,
&
buffer
->
hdr
,
sizeof
(
buffer
->
hdr
));
if
(
result
!=
MMSYSERR_NOERROR
)
{
g_set_error
(
error_r
,
win
32
_output_quark
(),
result
,
g_set_error
(
error_r
,
win
mm
_output_quark
(),
result
,
"waveOutPrepareHeader() failed"
);
return
false
;
}
...
...
@@ -187,7 +187,7 @@ win32_set_buffer(struct win32_output *wo, struct win32_buffer *buffer,
* Wait until the buffer is finished.
*/
static
bool
win
32_drain_buffer
(
struct
win32_output
*
wo
,
struct
win32
_buffer
*
buffer
,
win
mm_drain_buffer
(
struct
winmm_output
*
wo
,
struct
winmm
_buffer
*
buffer
,
GError
**
error_r
)
{
if
((
buffer
->
hdr
.
dwFlags
&
WHDR_DONE
)
==
WHDR_DONE
)
...
...
@@ -201,7 +201,7 @@ win32_drain_buffer(struct win32_output *wo, struct win32_buffer *buffer,
if
(
result
==
MMSYSERR_NOERROR
)
return
true
;
else
if
(
result
!=
WAVERR_STILLPLAYING
)
{
g_set_error
(
error_r
,
win
32
_output_quark
(),
result
,
g_set_error
(
error_r
,
win
mm
_output_quark
(),
result
,
"waveOutUnprepareHeader() failed"
);
return
false
;
}
...
...
@@ -212,14 +212,14 @@ win32_drain_buffer(struct win32_output *wo, struct win32_buffer *buffer,
}
static
size_t
win
32
_output_play
(
void
*
data
,
const
void
*
chunk
,
size_t
size
,
GError
**
error_r
)
win
mm
_output_play
(
void
*
data
,
const
void
*
chunk
,
size_t
size
,
GError
**
error_r
)
{
struct
win
32
_output
*
wo
=
data
;
struct
win
mm
_output
*
wo
=
data
;
/* get the next buffer from the ring and prepare it */
struct
win
32
_buffer
*
buffer
=
&
wo
->
buffers
[
wo
->
next_buffer
];
if
(
!
win
32
_drain_buffer
(
wo
,
buffer
,
error_r
)
||
!
win
32
_set_buffer
(
wo
,
buffer
,
chunk
,
size
,
error_r
))
struct
win
mm
_buffer
*
buffer
=
&
wo
->
buffers
[
wo
->
next_buffer
];
if
(
!
win
mm
_drain_buffer
(
wo
,
buffer
,
error_r
)
||
!
win
mm
_set_buffer
(
wo
,
buffer
,
chunk
,
size
,
error_r
))
return
0
;
/* enqueue the buffer */
...
...
@@ -228,7 +228,7 @@ win32_output_play(void *data, const void *chunk, size_t size, GError **error_r)
if
(
result
!=
MMSYSERR_NOERROR
)
{
waveOutUnprepareHeader
(
wo
->
handle
,
&
buffer
->
hdr
,
sizeof
(
buffer
->
hdr
));
g_set_error
(
error_r
,
win
32
_output_quark
(),
result
,
g_set_error
(
error_r
,
win
mm
_output_quark
(),
result
,
"waveOutWrite() failed"
);
return
0
;
}
...
...
@@ -241,56 +241,56 @@ win32_output_play(void *data, const void *chunk, size_t size, GError **error_r)
}
static
bool
win
32_drain_all_buffers
(
struct
win32
_output
*
wo
,
GError
**
error_r
)
win
mm_drain_all_buffers
(
struct
winmm
_output
*
wo
,
GError
**
error_r
)
{
for
(
unsigned
i
=
wo
->
next_buffer
;
i
<
G_N_ELEMENTS
(
wo
->
buffers
);
++
i
)
if
(
!
win
32
_drain_buffer
(
wo
,
&
wo
->
buffers
[
i
],
error_r
))
if
(
!
win
mm
_drain_buffer
(
wo
,
&
wo
->
buffers
[
i
],
error_r
))
return
false
;
for
(
unsigned
i
=
0
;
i
<
wo
->
next_buffer
;
++
i
)
if
(
!
win
32
_drain_buffer
(
wo
,
&
wo
->
buffers
[
i
],
error_r
))
if
(
!
win
mm
_drain_buffer
(
wo
,
&
wo
->
buffers
[
i
],
error_r
))
return
false
;
return
true
;
}
static
void
win
32_stop
(
struct
win32
_output
*
wo
)
win
mm_stop
(
struct
winmm
_output
*
wo
)
{
waveOutReset
(
wo
->
handle
);
for
(
unsigned
i
=
0
;
i
<
G_N_ELEMENTS
(
wo
->
buffers
);
++
i
)
{
struct
win
32
_buffer
*
buffer
=
&
wo
->
buffers
[
i
];
struct
win
mm
_buffer
*
buffer
=
&
wo
->
buffers
[
i
];
waveOutUnprepareHeader
(
wo
->
handle
,
&
buffer
->
hdr
,
sizeof
(
buffer
->
hdr
));
}
}
static
void
win
32
_output_drain
(
void
*
data
)
win
mm
_output_drain
(
void
*
data
)
{
struct
win
32
_output
*
wo
=
data
;
struct
win
mm
_output
*
wo
=
data
;
if
(
!
win
32
_drain_all_buffers
(
wo
,
NULL
))
win
32
_stop
(
wo
);
if
(
!
win
mm
_drain_all_buffers
(
wo
,
NULL
))
win
mm
_stop
(
wo
);
}
static
void
win
32
_output_cancel
(
void
*
data
)
win
mm
_output_cancel
(
void
*
data
)
{
struct
win
32
_output
*
wo
=
data
;
struct
win
mm
_output
*
wo
=
data
;
win
32
_stop
(
wo
);
win
mm
_stop
(
wo
);
}
const
struct
audio_output_plugin
win
32
_output_plugin
=
{
.
name
=
"win
32
"
,
.
test_default_device
=
win
32
_output_test_default_device
,
.
init
=
win
32
_output_init
,
.
finish
=
win
32
_output_finish
,
.
open
=
win
32
_output_open
,
.
close
=
win
32
_output_close
,
.
play
=
win
32
_output_play
,
.
drain
=
win
32
_output_drain
,
.
cancel
=
win
32
_output_cancel
,
const
struct
audio_output_plugin
win
mm
_output_plugin
=
{
.
name
=
"win
mm
"
,
.
test_default_device
=
win
mm
_output_test_default_device
,
.
init
=
win
mm
_output_init
,
.
finish
=
win
mm
_output_finish
,
.
open
=
win
mm
_output_open
,
.
close
=
win
mm
_output_close
,
.
play
=
win
mm
_output_play
,
.
drain
=
win
mm
_output_drain
,
.
cancel
=
win
mm
_output_cancel
,
};
src/output_list.c
View file @
20004b7e
...
...
@@ -36,7 +36,7 @@ extern const struct audio_output_plugin mvp_output_plugin;
extern
const
struct
audio_output_plugin
jack_output_plugin
;
extern
const
struct
audio_output_plugin
httpd_output_plugin
;
extern
const
struct
audio_output_plugin
recorder_output_plugin
;
extern
const
struct
audio_output_plugin
win
32
_output_plugin
;
extern
const
struct
audio_output_plugin
win
mm
_output_plugin
;
const
struct
audio_output_plugin
*
audio_output_plugins
[]
=
{
#ifdef HAVE_SHOUT
...
...
@@ -82,8 +82,8 @@ const struct audio_output_plugin *audio_output_plugins[] = {
#ifdef ENABLE_RECORDER_OUTPUT
&
recorder_output_plugin
,
#endif
#ifdef ENABLE_WIN
32
_OUTPUT
&
win
32
_output_plugin
,
#ifdef ENABLE_WIN
MM
_OUTPUT
&
win
mm
_output_plugin
,
#endif
NULL
};
...
...
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