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
98d30ac9
Commit
98d30ac9
authored
Nov 03, 2009
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
decoder_control: pass pipe and buffer to dc_start()
Don't access decoder_control attributes directly.
parent
98150f50
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
14 deletions
+25
-14
decoder_control.c
src/decoder_control.c
+6
-2
decoder_control.h
src/decoder_control.h
+14
-2
player_thread.c
src/player_thread.c
+5
-10
No files found.
src/decoder_control.c
View file @
98d30ac9
...
...
@@ -84,12 +84,16 @@ dc_command_async(struct decoder_control *dc, enum decoder_command cmd)
}
void
dc_start
(
struct
decoder_control
*
dc
,
struct
song
*
song
)
dc_start
(
struct
decoder_control
*
dc
,
struct
song
*
song
,
struct
music_buffer
*
buffer
,
struct
music_pipe
*
pipe
)
{
assert
(
dc
->
pipe
!=
NULL
);
assert
(
song
!=
NULL
);
assert
(
buffer
!=
NULL
);
assert
(
pipe
!=
NULL
);
dc
->
song
=
song
;
dc
->
buffer
=
buffer
;
dc
->
pipe
=
pipe
;
dc_command
(
dc
,
DECODE_COMMAND_START
);
}
...
...
src/decoder_control.h
View file @
98d30ac9
...
...
@@ -84,7 +84,10 @@ struct decoder_control {
/** the #music_chunk allocator */
struct
music_buffer
*
buffer
;
/** the destination pipe for decoded chunks */
/**
* The destination pipe for decoded chunks. The caller thread
* owns this object, and is responsible for freeing it.
*/
struct
music_pipe
*
pipe
;
};
...
...
@@ -211,8 +214,17 @@ decoder_current_song(const struct decoder_control *dc)
void
dc_command_wait
(
struct
decoder_control
*
dc
);
/**
* Start the decoder.
*
* @param the decoder
* @param song the song to be decoded
* @param pipe the pipe which receives the decoded chunks (owned by
* the caller)
*/
void
dc_start
(
struct
decoder_control
*
dc
,
struct
song
*
song
);
dc_start
(
struct
decoder_control
*
dc
,
struct
song
*
song
,
struct
music_buffer
*
buffer
,
struct
music_pipe
*
pipe
);
void
dc_stop
(
struct
decoder_control
*
dc
);
...
...
src/player_thread.c
View file @
98d30ac9
...
...
@@ -129,14 +129,14 @@ static void player_command_finished(void)
* Player lock is not held.
*/
static
void
player_dc_start
(
struct
player
*
player
)
player_dc_start
(
struct
player
*
player
,
struct
music_pipe
*
pipe
)
{
struct
decoder_control
*
dc
=
player
->
dc
;
assert
(
player
->
queued
);
assert
(
pc
.
next_song
!=
NULL
);
dc_start
(
dc
,
pc
.
next_song
);
dc_start
(
dc
,
pc
.
next_song
,
player_buffer
,
pipe
);
}
/**
...
...
@@ -346,10 +346,9 @@ static bool player_seek_decoder(struct player *player)
/* clear music chunks which might still reside in the
pipe */
music_pipe_clear
(
player
->
pipe
,
player_buffer
);
dc
->
pipe
=
player
->
pipe
;
/* re-start the decoder */
player_dc_start
(
player
);
player_dc_start
(
player
,
player
->
pipe
);
ret
=
player_wait_for_decoder
(
player
);
if
(
!
ret
)
{
/* decoder failure */
...
...
@@ -726,9 +725,7 @@ static void do_play(struct decoder_control *dc)
player
.
pipe
=
music_pipe_new
();
dc
->
buffer
=
player_buffer
;
dc
->
pipe
=
player
.
pipe
;
player_dc_start
(
&
player
);
player_dc_start
(
&
player
,
player
.
pipe
);
if
(
!
player_wait_for_decoder
(
&
player
))
{
player_dc_stop
(
&
player
);
player_command_finished
();
...
...
@@ -804,11 +801,9 @@ static void do_play(struct decoder_control *dc)
if
(
decoder_lock_is_idle
(
dc
)
&&
player
.
queued
)
{
/* the decoder has finished the current song;
make it decode the next song */
assert
(
pc
.
next_song
!=
NULL
);
assert
(
dc
->
pipe
==
NULL
||
dc
->
pipe
==
player
.
pipe
);
dc
->
pipe
=
music_pipe_new
();
player_dc_start
(
&
player
);
player_dc_start
(
&
player
,
music_pipe_new
());
}
if
(
dc
->
pipe
!=
NULL
&&
dc
->
pipe
!=
player
.
pipe
&&
...
...
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