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
f57be50d
Commit
f57be50d
authored
Jun 02, 2008
by
Eric Wong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove audioDeviceStates from playerData and getPlayerData
git-svn-id:
https://svn.musicpd.org/mpd/trunk@7372
09075e82-0dd4-0310-85a5-a0d7c8717e4f
parent
6ac1d797
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
14 additions
and
40 deletions
+14
-40
audio.c
src/audio.c
+13
-9
audio.h
src/audio.h
+0
-2
main.c
src/main.c
+0
-1
playerData.c
src/playerData.c
+1
-20
playerData.h
src/playerData.h
+0
-8
No files found.
src/audio.c
View file @
f57be50d
...
...
@@ -37,14 +37,16 @@ static AudioFormat *audio_configFormat;
static
AudioOutput
*
audioOutputArray
;
static
unsigned
int
audioOutputArraySize
;
#define DEVICE_OFF 0x00
#define DEVICE_ENABLE 0x01
/* currently off, but to be turned on */
#define DEVICE_ON 0x03
#define DEVICE_DISABLE 0x04
/* currently on, but to be turned off */
enum
ad_state
{
DEVICE_OFF
=
0x00
,
DEVICE_ENABLE
=
0x01
,
/* currently off, but to be turned on */
DEVICE_ON
=
0x03
,
DEVICE_DISABLE
=
0x04
/* currently on, but to be turned off */
};
/* the audioEnabledArray should be stuck into shared memory, and then disable
and enable in playAudio() routine */
static
mpd_uint8
*
audioDeviceStates
;
static
enum
ad_state
*
audioDeviceStates
;
static
mpd_uint8
audioOpened
;
...
...
@@ -52,7 +54,7 @@ static size_t audioBufferSize;
static
char
*
audioBuffer
;
static
size_t
audioBufferPos
;
unsigned
int
audio_device
_count
(
void
)
static
unsigned
int
audio_output
_count
(
void
)
{
unsigned
int
nr
=
0
;
ConfigParam
*
param
=
NULL
;
...
...
@@ -103,8 +105,9 @@ void initAudioDriver(void)
loadAudioDrivers
();
audioOutputArraySize
=
audio_device_count
();
audioDeviceStates
=
(
getPlayerData
())
->
audioDeviceStates
;
audioOutputArraySize
=
audio_output_count
();
audioDeviceStates
=
xmalloc
(
sizeof
(
enum
ad_state
)
*
audioOutputArraySize
);
audioOutputArray
=
xmalloc
(
sizeof
(
AudioOutput
)
*
audioOutputArraySize
);
for
(
i
=
0
;
i
<
audioOutputArraySize
;
i
++
)
...
...
@@ -273,6 +276,8 @@ static void syncAudioDeviceStates(void)
for
(
i
=
0
;
i
<
audioOutputArraySize
;
++
i
)
{
audioOutput
=
&
audioOutputArray
[
i
];
switch
(
audioDeviceStates
[
i
])
{
case
DEVICE_OFF
:
break
;
case
DEVICE_ON
:
/* This will reopen only if the audio format changed */
if
(
openAudioOutput
(
audioOutput
,
&
audio_format
)
<
0
)
...
...
@@ -286,7 +291,6 @@ static void syncAudioDeviceStates(void)
dropBufferedAudioOutput
(
audioOutput
);
closeAudioOutput
(
audioOutput
);
audioDeviceStates
[
i
]
=
DEVICE_OFF
;
break
;
}
}
}
...
...
src/audio.h
View file @
f57be50d
...
...
@@ -31,8 +31,6 @@ typedef struct _AudioFormat {
volatile
mpd_sint8
bits
;
}
AudioFormat
;
unsigned
int
audio_device_count
(
void
);
static
inline
double
audioFormatSizeToTime
(
const
AudioFormat
*
af
)
{
return
8
.
0
/
af
->
bits
/
af
->
channels
/
af
->
sampleRate
;
...
...
src/main.c
View file @
f57be50d
...
...
@@ -464,7 +464,6 @@ int main(int argc, char *argv[])
finishInputPlugins
();
cleanUpPidFile
();
finishConf
();
freePlayerData
();
close_log_files
();
return
EXIT_SUCCESS
;
...
...
src/playerData.c
View file @
f57be50d
...
...
@@ -21,12 +21,10 @@
#include "log.h"
#include "utils.h"
unsigned
int
buffered_before_play
;
#define DEFAULT_BUFFER_SIZE 2048
#define DEFAULT_BUFFER_BEFORE_PLAY 10
static
PlayerData
playerData_pd
;
unsigned
int
buffered_before_play
;
PlayerControl
pc
;
DecoderControl
dc
;
OutputBuffer
ob
;
...
...
@@ -39,7 +37,6 @@ void initPlayerData(void)
size_t
bufferSize
=
DEFAULT_BUFFER_SIZE
;
unsigned
int
buffered_chunks
;
ConfigParam
*
param
;
size_t
device_array_size
=
audio_device_count
()
*
sizeof
(
mpd_sint8
);
param
=
getConfigParam
(
CONF_AUDIO_BUFFER_SIZE
);
...
...
@@ -75,8 +72,6 @@ void initPlayerData(void)
buffered_before_play
=
buffered_chunks
;
}
playerData_pd
.
audioDeviceStates
=
xmalloc
(
device_array_size
);
ob_init
(
buffered_chunks
);
notify_init
(
&
pc
.
notify
);
...
...
@@ -92,18 +87,4 @@ void initPlayerData(void)
dc
.
error
=
DECODE_ERROR_NOERROR
;
}
PlayerData
*
getPlayerData
(
void
)
{
return
&
playerData_pd
;
}
void
freePlayerData
(
void
)
{
/* We don't want to release this memory until we know our player and
* decoder have exited. Otherwise, their signal handlers will want to
* access playerData_pd and we need to keep it available for them */
waitpid
(
-
1
,
NULL
,
0
);
ob_free
();
free
(
playerData_pd
.
audioDeviceStates
);
}
src/playerData.h
View file @
f57be50d
...
...
@@ -30,14 +30,6 @@ extern PlayerControl pc;
extern
DecoderControl
dc
;
extern
OutputBuffer
ob
;
typedef
struct
_PlayerData
{
mpd_uint8
*
audioDeviceStates
;
}
PlayerData
;
void
initPlayerData
(
void
);
PlayerData
*
getPlayerData
(
void
);
void
freePlayerData
(
void
);
#endif
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