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
b76f7b76
Commit
b76f7b76
authored
Nov 25, 2008
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mvp: use GLib instead of utils.h/log.h
parent
be60ff83
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
14 deletions
+25
-14
mvp_plugin.c
src/output/mvp_plugin.c
+25
-14
No files found.
src/output/mvp_plugin.c
View file @
b76f7b76
...
@@ -20,13 +20,18 @@
...
@@ -20,13 +20,18 @@
*/
*/
#include "../output_api.h"
#include "../output_api.h"
#include "../utils.h"
#include "../log.h"
#include <glib.h>
#include <sys/types.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/stat.h>
#include <sys/ioctl.h>
#include <sys/ioctl.h>
#include <fcntl.h>
#include <fcntl.h>
#include <errno.h>
#include <unistd.h>
#include <stdlib.h>
#undef G_LOG_DOMAIN
#define G_LOG_DOMAIN "mvp"
typedef
struct
{
typedef
struct
{
unsigned
long
dsp_status
;
unsigned
long
dsp_status
;
...
@@ -92,7 +97,7 @@ static bool mvp_testDefault(void)
...
@@ -92,7 +97,7 @@ static bool mvp_testDefault(void)
return
true
;
return
true
;
}
}
WARNING
(
"Error opening PCM device
\"
/dev/adec_pcm
\"
: %s
\n
"
,
g_warning
(
"Error opening PCM device
\"
/dev/adec_pcm
\"
: %s
\n
"
,
strerror
(
errno
));
strerror
(
errno
));
return
false
;
return
false
;
...
@@ -102,7 +107,7 @@ static void *mvp_initDriver(mpd_unused struct audio_output *audio_output,
...
@@ -102,7 +107,7 @@ static void *mvp_initDriver(mpd_unused struct audio_output *audio_output,
mpd_unused
const
struct
audio_format
*
audio_format
,
mpd_unused
const
struct
audio_format
*
audio_format
,
mpd_unused
ConfigParam
*
param
)
mpd_unused
ConfigParam
*
param
)
{
{
MvpData
*
md
=
xmalloc
(
sizeof
(
MvpData
)
);
MvpData
*
md
=
g_new
(
MvpData
,
1
);
md
->
audio_output
=
audio_output
;
md
->
audio_output
=
audio_output
;
md
->
fd
=
-
1
;
md
->
fd
=
-
1
;
...
@@ -156,22 +161,23 @@ static int mvp_setPcmParams(MvpData * md, unsigned long rate, int channels,
...
@@ -156,22 +161,23 @@ static int mvp_setPcmParams(MvpData * md, unsigned long rate, int channels,
}
}
if
(
iloop
>=
numfrequencies
)
{
if
(
iloop
>=
numfrequencies
)
{
ERROR
(
"Can not find suitable output frequency for %ld
\n
"
,
rate
);
g_warning
(
"Can not find suitable output frequency for %ld
\n
"
,
rate
);
return
-
1
;
return
-
1
;
}
}
if
(
ioctl
(
md
->
fd
,
MVP_SET_AUD_FORMAT
,
&
mix
)
<
0
)
{
if
(
ioctl
(
md
->
fd
,
MVP_SET_AUD_FORMAT
,
&
mix
)
<
0
)
{
ERROR
(
"Can not set audio format
\n
"
);
g_warning
(
"Can not set audio format
\n
"
);
return
-
1
;
return
-
1
;
}
}
if
(
ioctl
(
md
->
fd
,
MVP_SET_AUD_SYNC
,
2
)
!=
0
)
{
if
(
ioctl
(
md
->
fd
,
MVP_SET_AUD_SYNC
,
2
)
!=
0
)
{
ERROR
(
"Can not set audio sync
\n
"
);
g_warning
(
"Can not set audio sync
\n
"
);
return
-
1
;
return
-
1
;
}
}
if
(
ioctl
(
md
->
fd
,
MVP_SET_AUD_PLAY
,
0
)
<
0
)
{
if
(
ioctl
(
md
->
fd
,
MVP_SET_AUD_PLAY
,
0
)
<
0
)
{
ERROR
(
"Can not set audio play mode
\n
"
);
g_warning
(
"Can not set audio play mode
\n
"
);
return
-
1
;
return
-
1
;
}
}
...
@@ -186,24 +192,29 @@ mvp_openDevice(void *data, struct audio_format *audioFormat)
...
@@ -186,24 +192,29 @@ mvp_openDevice(void *data, struct audio_format *audioFormat)
int
mix
[
5
]
=
{
0
,
2
,
7
,
1
,
0
};
int
mix
[
5
]
=
{
0
,
2
,
7
,
1
,
0
};
if
((
md
->
fd
=
open
(
"/dev/adec_pcm"
,
O_RDWR
|
O_NONBLOCK
))
<
0
)
{
if
((
md
->
fd
=
open
(
"/dev/adec_pcm"
,
O_RDWR
|
O_NONBLOCK
))
<
0
)
{
ERROR
(
"Error opening /dev/adec_pcm: %s
\n
"
,
strerror
(
errno
));
g_warning
(
"Error opening /dev/adec_pcm: %s
\n
"
,
strerror
(
errno
));
return
false
;
return
false
;
}
}
if
(
ioctl
(
md
->
fd
,
MVP_SET_AUD_SRC
,
1
)
<
0
)
{
if
(
ioctl
(
md
->
fd
,
MVP_SET_AUD_SRC
,
1
)
<
0
)
{
ERROR
(
"Error setting audio source: %s
\n
"
,
strerror
(
errno
));
g_warning
(
"Error setting audio source: %s
\n
"
,
strerror
(
errno
));
return
false
;
return
false
;
}
}
if
(
ioctl
(
md
->
fd
,
MVP_SET_AUD_STREAMTYPE
,
0
)
<
0
)
{
if
(
ioctl
(
md
->
fd
,
MVP_SET_AUD_STREAMTYPE
,
0
)
<
0
)
{
ERROR
(
"Error setting audio streamtype: %s
\n
"
,
strerror
(
errno
));
g_warning
(
"Error setting audio streamtype: %s
\n
"
,
strerror
(
errno
));
return
false
;
return
false
;
}
}
if
(
ioctl
(
md
->
fd
,
MVP_SET_AUD_FORMAT
,
&
mix
)
<
0
)
{
if
(
ioctl
(
md
->
fd
,
MVP_SET_AUD_FORMAT
,
&
mix
)
<
0
)
{
ERROR
(
"Error setting audio format: %s
\n
"
,
strerror
(
errno
));
g_warning
(
"Error setting audio format: %s
\n
"
,
strerror
(
errno
));
return
false
;
return
false
;
}
}
ioctl
(
md
->
fd
,
MVP_SET_AUD_STC
,
&
stc
);
ioctl
(
md
->
fd
,
MVP_SET_AUD_STC
,
&
stc
);
if
(
ioctl
(
md
->
fd
,
MVP_SET_AUD_BYPASS
,
1
)
<
0
)
{
if
(
ioctl
(
md
->
fd
,
MVP_SET_AUD_BYPASS
,
1
)
<
0
)
{
ERROR
(
"Error setting audio streamtype: %s
\n
"
,
strerror
(
errno
));
g_warning
(
"Error setting audio streamtype: %s
\n
"
,
strerror
(
errno
));
return
false
;
return
false
;
}
}
#ifdef WORDS_BIGENDIAN
#ifdef WORDS_BIGENDIAN
...
@@ -251,7 +262,7 @@ mvp_playAudio(void *data, const char *playChunk, size_t size)
...
@@ -251,7 +262,7 @@ mvp_playAudio(void *data, const char *playChunk, size_t size)
if
(
ret
<
0
)
{
if
(
ret
<
0
)
{
if
(
errno
==
EINTR
)
if
(
errno
==
EINTR
)
continue
;
continue
;
ERROR
(
"closing mvp PCM device due to write error: "
g_warning
(
"closing mvp PCM device due to write error: "
"%s
\n
"
,
strerror
(
errno
));
"%s
\n
"
,
strerror
(
errno
));
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