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
9906d3a7
Commit
9906d3a7
authored
Oct 29, 2004
by
Warren Dukes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
begin integrating np's oss code
git-svn-id:
https://svn.musicpd.org/mpd/trunk@2394
09075e82-0dd4-0310-85a5-a0d7c8717e4f
parent
94ee5317
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
189 additions
and
1 deletion
+189
-1
TODO
TODO
+8
-0
audioOutput.c
src/audioOutput.c
+2
-0
audioOutput_oss.c
src/audioOutput_oss.c
+178
-0
audioOutput_shout.c
src/audioOutput_shout.c
+1
-1
No files found.
TODO
View file @
9906d3a7
0.12
----
*) AudioOutput
*) intigrate np's oss shit
*) have "format" as a default config option for all audioOutputs
*) don't automatically close audioOutput devices on openDevice(),
instead, let the plugins determine if they should be closed
or not, so that they can just leave the device open,
like if they are using a constant audioFormat
*) Fix id3v1 encoding
*) Cleanup Config File Code
...
...
src/audioOutput.c
View file @
9906d3a7
...
...
@@ -11,11 +11,13 @@
static
List
*
audioOutputPluginList
;
void
loadAudioOutputPlugin
(
AudioOutputPlugin
*
audioOutputPlugin
)
{
if
(
!
audioOutputPlugin
->
name
)
return
;
insertInList
(
audioOutputPluginList
,
audioOutputPlugin
->
name
,
audioOutputPlugin
);
}
void
unloadAudioOutputPlugin
(
AudioOutputPlugin
*
audioOutputPlugin
)
{
if
(
!
audioOutputPlugin
->
name
)
return
;
deleteFromList
(
audioOutputPluginList
,
audioOutputPlugin
->
name
);
}
...
...
src/audioOutput_oss.c
0 → 100644
View file @
9906d3a7
/* the Music Player Daemon (MPD)
* (c)2003-2004 by Warren Dukes (shank@mercury.chem.pitt.edu)
* This project's homepage is: http://www.musicpd.org
*
* OSS audio output (c) 2004 by Eric Wong <eric@petta-tech.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "audio.h"
#ifdef HAVE_OSS
#include "conf.h"
#include "log.h"
#include "sig_handlers.h"
#include <string.h>
#include <assert.h>
#include <signal.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/ioctl.h>
#include <fcntl.h>
#include <unistd.h>
#include <errno.h>
#if defined(__OpenBSD__) || defined(__NetBSD__)
# include <soundcard.h>
#else
/* !(defined(__OpenBSD__) || defined(__NetBSD__) */
# include <sys/soundcard.h>
#endif
/* !(defined(__OpenBSD__) || defined(__NetBSD__) */
static
typedef
struct
_OssData
{
int
device
;
}
OssData
;
static
OssData
*
newOssData
()
{
OssData
*
ret
=
malloc
(
sizeof
(
OssData
));
ret
->
device
=
0
;
return
ret
;
}
static
void
freeOssData
(
OssData
*
od
)
{
free
(
od
);
}
static
void
oss_initDriver
(
AudioOutput
*
audioOutput
,
ConfigParam
*
param
)
{
char
*
test
;
audio_write_size
=
strtol
((
getConf
())[
CONF_AUDIO_WRITE_SIZE
],
&
test
,
10
);
if
(
*
test
!=
'\0'
)
{
ERROR
(
"
\"
%s
\"
is not a valid write size"
,
(
getConf
())[
CONF_AUDIO_WRITE_SIZE
]);
exit
(
EXIT_FAILURE
);
}
}
static
void
oss_finishDriver
(
AudioOutput
*
audioOutput
)
{
OssData
*
od
=
audioOutput
->
data
;
freeOssData
(
od
);
}
static
int
oss_openDevice
(
AudioOutput
*
audioOutput
,
AudioFormat
*
audioFormat
)
{
int
i
=
AFMT_S16_LE
,
err
=
0
;
if
(
audio_device
&&
!
isCurrentAudioFormat
(
audioFormat
))
closeAudioDevice
();
if
(
audio_device
!=
0
)
return
0
;
if
(
audioFormat
)
copyAudioFormat
(
&
audio_format
,
audioFormat
);
blockSignals
();
audio_device
=
open
(
"/dev/dsp"
,
O_WRONLY
);
if
(
audio_device
<
0
)
err
|=
1
;
if
(
ioctl
(
audio_device
,
SNDCTL_DSP_SETFMT
,
&
i
))
err
|=
2
;
if
(
ioctl
(
audio_device
,
SNDCTL_DSP_CHANNELS
,
&
audio_format
.
channels
))
err
|=
4
;
if
(
ioctl
(
audio_device
,
SNDCTL_DSP_SPEED
,
&
audio_format
.
sampleRate
))
err
|=
8
;
if
(
ioctl
(
audio_device
,
SNDCTL_DSP_SAMPLESIZE
,
&
audio_format
.
bits
))
err
|=
16
;
/*i = 1; if (ioctl(audio_device,SNDCTL_DSP_STEREO,&i)) err != 32; */
unblockSignals
();
if
(
err
)
ERROR
(
"Error opening /dev/dsp: 0x%x
\n
"
);
if
(
!
audio_device
)
return
-
1
;
return
0
;
}
static
int
oss_playAudio
(
AudioOutput
*
audioOutput
,
char
*
playChunk
,
int
size
)
{
int
send
;
int
ret
;
if
(
audio_device
==
0
)
{
ERROR
(
"trying to play w/o the audio device being open!
\n
"
);
return
-
1
;
}
send
=
audio_write_size
>
size
?
size
:
audio_write_size
;
while
(
size
>
0
)
{
ret
=
write
(
audio_device
,
playChunk
,
send
);
if
(
ret
<
0
)
{
audioError
();
ERROR
(
"closing audio device due to write error
\n
"
);
closeAudioDevice
();
return
-
1
;
}
playChunk
+=
ret
;
size
-=
ret
;
}
return
0
;
}
static
void
oss_closeDevice
(
AudioOutput
*
audioOutput
)
{
if
(
audio_device
)
{
blockSignals
();
close
(
audio_device
);
audio_device
=
0
;
unblockSignals
();
}
}
AudioOutput
ossPlugin
=
{
"oss"
,
oss_initDriver
,
oss_finishDriver
,
oss_openDevice
,
oss_playAudio
,
oss_closeDevice
,
NULL
/* sendMetadataFunc */
};
#else
/* HAVE OSS */
AudioOutput
ossPlugin
=
{
NULL
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
/* sendMetadataFunc */
};
#endif
/* HAVE_OSS */
src/audioOutput_shout.c
View file @
9906d3a7
...
...
@@ -467,7 +467,7 @@ AudioOutputPlugin shoutPlugin =
AudioOutputPlugin
shoutPlugin
=
{
"shout"
,
NULL
,
NULL
,
NULL
,
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