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
cc261872
Commit
cc261872
authored
Nov 05, 2010
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
decoder_control: pass music_pipe to dc_start()
More abstraction for decoder_control.pipe.
parent
5223261f
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
12 deletions
+18
-12
decoder_control.c
src/decoder_control.c
+11
-4
decoder_control.h
src/decoder_control.h
+2
-2
player_thread.c
src/player_thread.c
+5
-6
No files found.
src/decoder_control.c
View file @
cc261872
...
@@ -18,6 +18,7 @@
...
@@ -18,6 +18,7 @@
*/
*/
#include "decoder_control.h"
#include "decoder_control.h"
#include "pipe.h"
#include <assert.h>
#include <assert.h>
...
@@ -58,22 +59,28 @@ static void dc_command_async(enum decoder_command cmd)
...
@@ -58,22 +59,28 @@ static void dc_command_async(enum decoder_command cmd)
}
}
void
void
dc_start
(
struct
notify
*
notify
,
struct
song
*
song
)
dc_start
(
struct
notify
*
notify
,
struct
song
*
song
,
struct
music_pipe
*
pipe
)
{
{
assert
(
dc
.
pipe
!
=
NULL
);
assert
(
dc
.
pipe
=
=
NULL
);
assert
(
song
!=
NULL
);
assert
(
song
!=
NULL
);
assert
(
pipe
!=
NULL
);
assert
(
music_pipe_empty
(
pipe
));
dc
.
next_song
=
song
;
dc
.
next_song
=
song
;
dc
.
pipe
=
pipe
;
dc_command
(
notify
,
DECODE_COMMAND_START
);
dc_command
(
notify
,
DECODE_COMMAND_START
);
}
}
void
void
dc_start_async
(
struct
song
*
song
)
dc_start_async
(
struct
song
*
song
,
struct
music_pipe
*
pipe
)
{
{
assert
(
dc
.
pipe
!
=
NULL
);
assert
(
dc
.
pipe
=
=
NULL
);
assert
(
song
!=
NULL
);
assert
(
song
!=
NULL
);
assert
(
pipe
!=
NULL
);
assert
(
music_pipe_empty
(
pipe
));
dc
.
next_song
=
song
;
dc
.
next_song
=
song
;
dc
.
pipe
=
pipe
;
dc_command_async
(
DECODE_COMMAND_START
);
dc_command_async
(
DECODE_COMMAND_START
);
}
}
...
...
src/decoder_control.h
View file @
cc261872
...
@@ -118,10 +118,10 @@ void
...
@@ -118,10 +118,10 @@ void
dc_command_wait
(
struct
notify
*
notify
);
dc_command_wait
(
struct
notify
*
notify
);
void
void
dc_start
(
struct
notify
*
notify
,
struct
song
*
song
);
dc_start
(
struct
notify
*
notify
,
struct
song
*
song
,
struct
music_pipe
*
pipe
);
void
void
dc_start_async
(
struct
song
*
song
);
dc_start_async
(
struct
song
*
song
,
struct
music_pipe
*
pipe
);
void
void
dc_stop
(
struct
notify
*
notify
);
dc_stop
(
struct
notify
*
notify
);
...
...
src/player_thread.c
View file @
cc261872
...
@@ -324,10 +324,9 @@ static bool player_seek_decoder(struct player *player)
...
@@ -324,10 +324,9 @@ static bool player_seek_decoder(struct player *player)
/* clear music chunks which might still reside in the
/* clear music chunks which might still reside in the
pipe */
pipe */
music_pipe_clear
(
player
->
pipe
,
player_buffer
);
music_pipe_clear
(
player
->
pipe
,
player_buffer
);
dc
.
pipe
=
player
->
pipe
;
/* re-start the decoder */
/* re-start the decoder */
dc_start_async
(
pc
.
next_song
);
dc_start_async
(
pc
.
next_song
,
player
->
pipe
);
ret
=
player_wait_for_decoder
(
player
);
ret
=
player_wait_for_decoder
(
player
);
if
(
!
ret
)
{
if
(
!
ret
)
{
/* decoder failure */
/* decoder failure */
...
@@ -665,8 +664,7 @@ static void do_play(void)
...
@@ -665,8 +664,7 @@ static void do_play(void)
player
.
pipe
=
music_pipe_new
();
player
.
pipe
=
music_pipe_new
();
dc
.
buffer
=
player_buffer
;
dc
.
buffer
=
player_buffer
;
dc
.
pipe
=
player
.
pipe
;
dc_start
(
&
pc
.
notify
,
pc
.
next_song
,
player
.
pipe
);
dc_start
(
&
pc
.
notify
,
pc
.
next_song
);
if
(
!
player_wait_for_decoder
(
&
player
))
{
if
(
!
player_wait_for_decoder
(
&
player
))
{
player_dc_stop
(
&
player
);
player_dc_stop
(
&
player
);
player_command_finished
();
player_command_finished
();
...
@@ -735,9 +733,10 @@ static void do_play(void)
...
@@ -735,9 +733,10 @@ static void do_play(void)
assert
(
pc
.
next_song
!=
NULL
);
assert
(
pc
.
next_song
!=
NULL
);
assert
(
!
player_dc_at_next_song
(
&
player
));
assert
(
!
player_dc_at_next_song
(
&
player
));
dc
.
pipe
=
NULL
;
player
.
queued
=
false
;
player
.
queued
=
false
;
dc
.
pipe
=
music_pipe_new
();
dc_start_async
(
pc
.
next_song
,
music_pipe_new
());
dc_start_async
(
pc
.
next_song
);
}
}
if
(
player_dc_at_next_song
(
&
player
)
&&
if
(
player_dc_at_next_song
(
&
player
)
&&
...
...
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