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
e2c8b960
Commit
e2c8b960
authored
Aug 26, 2008
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
moved code to pc_init(), dc_init()
parent
5e51fa02
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
37 additions
and
24 deletions
+37
-24
decoder_control.c
src/decoder_control.c
+8
-0
decoder_control.h
src/decoder_control.h
+2
-0
main.c
src/main.c
+6
-0
playerData.c
src/playerData.c
+1
-21
playerData.h
src/playerData.h
+1
-0
player_control.c
src/player_control.c
+13
-0
player_control.h
src/player_control.h
+4
-0
player_thread.c
src/player_thread.c
+2
-3
No files found.
src/decoder_control.c
View file @
e2c8b960
...
...
@@ -20,6 +20,14 @@
struct
decoder_control
dc
;
void
dc_init
(
void
)
{
notify_init
(
&
dc
.
notify
);
dc
.
state
=
DECODE_STATE_STOP
;
dc
.
command
=
DECODE_COMMAND_NONE
;
dc
.
error
=
DECODE_ERROR_NOERROR
;
}
void
dc_command_wait
(
Notify
*
notify
)
{
while
(
dc
.
command
!=
DECODE_COMMAND_NONE
)
{
...
...
src/decoder_control.h
View file @
e2c8b960
...
...
@@ -56,6 +56,8 @@ struct decoder_control {
extern
struct
decoder_control
dc
;
void
dc_init
(
void
);
static
inline
int
decoder_is_idle
(
void
)
{
return
dc
.
state
==
DECODE_STATE_STOP
&&
...
...
src/main.c
View file @
e2c8b960
...
...
@@ -25,7 +25,9 @@
#include "conf.h"
#include "path.h"
#include "playerData.h"
#include "outputBuffer.h"
#include "decoder_thread.h"
#include "decoder_control.h"
#include "player_control.h"
#include "stats.h"
#include "sig_handlers.h"
...
...
@@ -415,6 +417,9 @@ int main(int argc, char *argv[])
initCommands
();
initPlayerData
();
pc_init
(
buffered_before_play
);
ob_init
(
buffered_chunks
,
&
pc
.
notify
);
dc_init
();
initAudioConfig
();
initAudioDriver
();
initVolume
();
...
...
@@ -464,6 +469,7 @@ int main(int argc, char *argv[])
finishPermissions
();
finishCommands
();
decoder_plugin_deinit_all
();
ob_free
();
cleanUpPidFile
();
finishConf
();
...
...
src/playerData.c
View file @
e2c8b960
...
...
@@ -18,7 +18,6 @@
#include "playerData.h"
#include "player_control.h"
#include "decoder_control.h"
#include "outputBuffer.h"
#include "conf.h"
#include "log.h"
...
...
@@ -27,15 +26,14 @@
#define DEFAULT_BUFFER_SIZE 2048
#define DEFAULT_BUFFER_BEFORE_PLAY 10
unsigned
int
buffered_chunks
;
unsigned
int
buffered_before_play
;
void
initPlayerData
(
void
)
{
float
perc
=
DEFAULT_BUFFER_BEFORE_PLAY
;
char
*
test
;
int
crossfade
=
0
;
size_t
bufferSize
=
DEFAULT_BUFFER_SIZE
;
unsigned
int
buffered_chunks
;
ConfigParam
*
param
;
param
=
getConfigParam
(
CONF_AUDIO_BUFFER_SIZE
);
...
...
@@ -71,22 +69,4 @@ void initPlayerData(void)
if
(
buffered_before_play
>
buffered_chunks
)
{
buffered_before_play
=
buffered_chunks
;
}
ob_init
(
buffered_chunks
,
&
pc
.
notify
);
notify_init
(
&
pc
.
notify
);
pc
.
command
=
PLAYER_COMMAND_NONE
;
pc
.
error
=
PLAYER_ERROR_NOERROR
;
pc
.
state
=
PLAYER_STATE_STOP
;
pc
.
queueState
=
PLAYER_QUEUE_BLANK
;
pc
.
queueLockState
=
PLAYER_QUEUE_UNLOCKED
;
pc
.
crossFade
=
crossfade
;
pc
.
softwareVolume
=
1000
;
notify_init
(
&
dc
.
notify
);
dc
.
state
=
DECODE_STATE_STOP
;
dc
.
command
=
DECODE_COMMAND_NONE
;
dc
.
error
=
DECODE_ERROR_NOERROR
;
}
src/playerData.h
View file @
e2c8b960
...
...
@@ -19,6 +19,7 @@
#ifndef PLAYER_DATA_H
#define PLAYER_DATA_H
extern
unsigned
int
buffered_chunks
;
extern
unsigned
int
buffered_before_play
;
void
initPlayerData
(
void
);
...
...
src/player_control.c
View file @
e2c8b960
...
...
@@ -25,6 +25,19 @@
struct
player_control
pc
;
void
pc_init
(
unsigned
int
buffered_before_play
)
{
pc
.
buffered_before_play
=
buffered_before_play
;
notify_init
(
&
pc
.
notify
);
pc
.
command
=
PLAYER_COMMAND_NONE
;
pc
.
error
=
PLAYER_ERROR_NOERROR
;
pc
.
state
=
PLAYER_STATE_STOP
;
pc
.
queueState
=
PLAYER_QUEUE_BLANK
;
pc
.
queueLockState
=
PLAYER_QUEUE_UNLOCKED
;
pc
.
crossFade
=
0
;
pc
.
softwareVolume
=
1000
;
}
static
void
set_current_song
(
Song
*
song
)
{
assert
(
song
!=
NULL
);
...
...
src/player_control.h
View file @
e2c8b960
...
...
@@ -80,6 +80,8 @@ enum player_queue_state {
#define PLAYER_QUEUE_LOCKED 1
struct
player_control
{
unsigned
int
buffered_before_play
;
Notify
notify
;
volatile
enum
player_command
command
;
volatile
enum
player_state
state
;
...
...
@@ -103,6 +105,8 @@ struct player_control {
extern
struct
player_control
pc
;
void
pc_init
(
unsigned
int
buffered_before_play
);
void
player_command_finished
(
void
);
void
playerPlay
(
Song
*
song
);
...
...
src/player_thread.c
View file @
e2c8b960
...
...
@@ -18,7 +18,6 @@
#include "player_thread.h"
#include "player_control.h"
#include "playerData.h"
#include "decoder_control.h"
#include "audio.h"
#include "pcm_utils.h"
...
...
@@ -171,7 +170,7 @@ static void do_play(void)
{
int
do_pause
=
0
;
int
buffering
=
1
;
unsigned
int
bbp
=
buffered_before_play
;
unsigned
int
bbp
=
pc
.
buffered_before_play
;
enum
xfade_state
do_xfade
=
XFADE_UNKNOWN
;
unsigned
int
crossFadeChunks
=
0
;
/** the position of the next cross-faded chunk in the next
...
...
@@ -277,7 +276,7 @@ static void do_play(void)
cross_fade_calc
(
pc
.
crossFade
,
dc
.
totalTime
,
&
(
ob
.
audioFormat
),
ob
.
size
-
buffered_before_play
);
pc
.
buffered_before_play
);
if
(
crossFadeChunks
>
0
)
{
do_xfade
=
XFADE_ENABLED
;
nextChunk
=
-
1
;
...
...
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