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
89893faa
Commit
89893faa
authored
Nov 03, 2009
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
decoder_control: merge next_song and current_song
These two variables are redundant, we need only one of them.
parent
bfa7da94
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
16 additions
and
16 deletions
+16
-16
decoder_api.c
src/decoder_api.c
+1
-1
decoder_control.c
src/decoder_control.c
+1
-1
decoder_control.h
src/decoder_control.h
+8
-3
decoder_thread.c
src/decoder_thread.c
+3
-2
player_thread.c
src/player_thread.c
+3
-9
No files found.
src/decoder_api.c
View file @
89893faa
...
...
@@ -86,7 +86,7 @@ char *decoder_get_uri(G_GNUC_UNUSED struct decoder *decoder)
assert
(
dc
->
pipe
!=
NULL
);
return
song_get_uri
(
dc
->
current_
song
);
return
song_get_uri
(
dc
->
song
);
}
enum
decoder_command
decoder_get_command
(
G_GNUC_UNUSED
struct
decoder
*
decoder
)
...
...
src/decoder_control.c
View file @
89893faa
...
...
@@ -89,7 +89,7 @@ dc_start(struct decoder_control *dc, struct song *song)
assert
(
dc
->
pipe
!=
NULL
);
assert
(
song
!=
NULL
);
dc
->
next_
song
=
song
;
dc
->
song
=
song
;
dc_command
(
dc
,
DECODE_COMMAND_START
);
}
...
...
src/decoder_control.h
View file @
89893faa
...
...
@@ -72,8 +72,13 @@ struct decoder_control {
/** the format being sent to the music pipe */
struct
audio_format
out_audio_format
;
const
struct
song
*
current_song
;
const
struct
song
*
next_song
;
/**
* The song currently being decoded. This attribute is set by
* the player thread, when it sends the #DECODE_COMMAND_START
* command.
*/
const
struct
song
*
song
;
float
total_time
;
/** the #music_chunk allocator */
...
...
@@ -198,7 +203,7 @@ decoder_current_song(const struct decoder_control *dc)
case
DECODE_STATE_START
:
case
DECODE_STATE_DECODE
:
return
dc
->
current_
song
;
return
dc
->
song
;
}
assert
(
false
);
...
...
src/decoder_thread.c
View file @
89893faa
...
...
@@ -268,9 +268,11 @@ decoder_run_song(struct decoder_control *dc,
static
void
decoder_run
(
struct
decoder_control
*
dc
)
{
const
struct
song
*
song
=
dc
->
next_
song
;
const
struct
song
*
song
=
dc
->
song
;
char
*
uri
;
assert
(
song
!=
NULL
);
if
(
song_is_file
(
song
))
uri
=
map_song_fs
(
song
);
else
...
...
@@ -281,7 +283,6 @@ decoder_run(struct decoder_control *dc)
return
;
}
dc
->
current_song
=
dc
->
next_song
;
/* NEED LOCK */
decoder_run_song
(
dc
,
song
,
uri
);
g_free
(
uri
);
...
...
src/player_thread.c
View file @
89893faa
...
...
@@ -160,10 +160,8 @@ player_wait_for_decoder(struct player *player)
struct
decoder_control
*
dc
=
player
->
dc
;
if
(
decoder_lock_has_failed
(
dc
))
{
assert
(
dc
->
next_song
==
NULL
||
dc
->
next_song
->
uri
!=
NULL
);
player_lock
();
pc
.
errored_song
=
dc
->
next_
song
;
pc
.
errored_song
=
dc
->
song
;
pc
.
error
=
PLAYER_ERROR_FILE
;
pc
.
next_song
=
NULL
;
player_unlock
();
...
...
@@ -210,11 +208,9 @@ player_check_decoder_startup(struct player *player)
if
(
decoder_has_failed
(
dc
))
{
/* the decoder failed */
assert
(
dc
->
next_song
==
NULL
||
dc
->
next_song
->
uri
!=
NULL
);
decoder_unlock
(
dc
);
pc
.
errored_song
=
dc
->
next_
song
;
pc
.
errored_song
=
dc
->
song
;
pc
.
error
=
PLAYER_ERROR_FILE
;
return
false
;
...
...
@@ -237,12 +233,11 @@ player_check_decoder_startup(struct player *player)
if
(
!
player
->
paused
&&
!
audio_output_all_open
(
&
dc
->
out_audio_format
,
player_buffer
))
{
char
*
uri
=
song_get_uri
(
dc
->
next_
song
);
char
*
uri
=
song_get_uri
(
dc
->
song
);
g_warning
(
"problems opening audio device "
"while playing
\"
%s
\"
"
,
uri
);
g_free
(
uri
);
assert
(
dc
->
next_song
==
NULL
||
dc
->
next_song
->
uri
!=
NULL
);
pc
.
error
=
PLAYER_ERROR_AUDIO
;
/* pause: the user may resume playback as soon
...
...
@@ -433,7 +428,6 @@ static void player_process_command(struct player *player)
}
else
{
/* the audio device has failed - rollback to
pause mode */
assert
(
dc
->
next_song
==
NULL
||
dc
->
next_song
->
uri
!=
NULL
);
pc
.
error
=
PLAYER_ERROR_AUDIO
;
player
->
paused
=
true
;
...
...
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