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
b4450608
Commit
b4450608
authored
Apr 14, 2008
by
Eric Wong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
decode.c: make the crossfade state variable self-documenting
git-svn-id:
https://svn.musicpd.org/mpd/trunk@7358
09075e82-0dd4-0310-85a5-a0d7c8717e4f
parent
93fee6fc
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
15 deletions
+18
-15
decode.c
src/decode.c
+18
-15
No files found.
src/decode.c
View file @
b4450608
...
...
@@ -26,6 +26,12 @@
#include "ls.h"
#include "main_notify.h"
enum
xfade_state
{
XFADE_DISABLED
=
1
,
XFADE_UNKNOWN
=
0
,
XFADE_ENABLED
=
1
};
/* called inside decoder_task (inputPlugins) */
void
decoder_wakeup_player
(
void
)
{
...
...
@@ -149,7 +155,7 @@ static int decodeSeek(int *decodeWaitedOn, int *next)
}
static
void
processDecodeInput
(
int
*
pause_r
,
unsigned
int
*
bbp_r
,
int
*
doCrossF
ade_r
,
enum
xfade_state
*
do_xf
ade_r
,
int
*
decodeWaitedOn_r
,
int
*
next_r
)
{
...
...
@@ -192,7 +198,7 @@ static void processDecodeInput(int *pause_r, unsigned int *bbp_r,
if
(
pc
.
seek
)
{
dropBufferedAudio
();
if
(
decodeSeek
(
decodeWaitedOn_r
,
next_r
)
==
0
)
{
*
do
CrossFade_r
=
0
;
*
do
_xfade_r
=
XFADE_UNKNOWN
;
*
bbp_r
=
0
;
}
}
...
...
@@ -383,9 +389,7 @@ static void decodeParent(void)
int
do_pause
=
0
;
int
buffering
=
1
;
unsigned
int
bbp
=
buffered_before_play
;
/** cross fading enabled for the current song? 0=must check;
1=enabled; -1=disabled */
int
doCrossFade
=
0
;
enum
xfade_state
do_xfade
=
XFADE_UNKNOWN
;
unsigned
int
crossFadeChunks
=
0
;
/** the position of the next cross-faded chunk in the next
song */
...
...
@@ -405,7 +409,7 @@ static void decodeParent(void)
wakeup_main_task
();
while
(
1
)
{
processDecodeInput
(
&
do_pause
,
&
bbp
,
&
do
CrossF
ade
,
processDecodeInput
(
&
do_pause
,
&
bbp
,
&
do
_xf
ade
,
&
decodeWaitedOn
,
&
next
);
if
(
pc
.
stop
)
{
dropBufferedAudio
();
...
...
@@ -473,7 +477,7 @@ static void decodeParent(void)
wakeup_main_task
();
player_wakeup_decoder_nb
();
}
if
(
next
>=
0
&&
do
CrossFade
==
0
&&
!
dc
.
start
&&
if
(
next
>=
0
&&
do
_xfade
==
XFADE_UNKNOWN
&&
!
dc
.
start
&&
dc
.
state
!=
DECODE_STATE_START
)
{
/* enable cross fading in this song? if yes,
calculate how many chunks will be required
...
...
@@ -482,21 +486,20 @@ static void decodeParent(void)
calculateCrossFadeChunks
(
&
(
ob
.
audioFormat
),
dc
.
totalTime
);
if
(
crossFadeChunks
>
0
)
{
do
CrossFade
=
1
;
do
_xfade
=
XFADE_ENABLED
;
nextChunk
=
-
1
;
}
else
/* cross fading is disabled or the
next song is too short */
do
CrossFade
=
-
1
;
do
_xfade
=
XFADE_DISABLED
;
}
if
(
do_pause
)
player_sleep
();
else
if
(
!
ob_is_empty
()
&&
(
int
)
ob
.
begin
!=
next
)
{
ob_chunk
*
beginChunk
=
ob_get_chunk
(
ob
.
begin
);
ob_chunk
*
beginChunk
=
ob_get_chunk
(
ob
.
begin
);
unsigned
int
fadePosition
;
if
(
do
CrossFade
==
1
&&
next
>=
0
&&
if
(
do
_xfade
==
XFADE_ENABLED
&&
next
>=
0
&&
(
fadePosition
=
ob_relative
(
next
))
<=
crossFadeChunks
)
{
/* perform cross fade */
...
...
@@ -522,7 +525,7 @@ static void decodeParent(void)
/* the decoder isn't
running, abort
cross fading */
do
CrossFade
=
-
1
;
do
_xfade
=
XFADE_DISABLED
;
}
else
{
/* wait for the
decoder */
...
...
@@ -541,14 +544,14 @@ static void decodeParent(void)
}
else
if
(
!
ob_is_empty
()
&&
(
int
)
ob
.
begin
==
next
)
{
/* at the beginning of a new song */
if
(
do
CrossFade
==
1
&&
nextChunk
>=
0
)
{
if
(
do
_xfade
==
XFADE_ENABLED
&&
nextChunk
>=
0
)
{
/* the cross-fade is finished; skip
the section which was cross-faded
(and thus already played) */
ob_skip
(
crossFadeChunks
);
}
do
CrossFade
=
0
;
do
_xfade
=
XFADE_UNKNOWN
;
/* wait for the decoder to work on the new song */
if
(
pc
.
queueState
==
PLAYER_QUEUE_DECODE
||
...
...
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