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
3b1efb55
Commit
3b1efb55
authored
Jun 10, 2004
by
Warren Dukes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
minor little cleanups
git-svn-id:
https://svn.musicpd.org/mpd/trunk@1439
09075e82-0dd4-0310-85a5-a0d7c8717e4f
parent
491027a5
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
18 deletions
+24
-18
decode.c
src/decode.c
+24
-17
outputBuffer.h
src/outputBuffer.h
+0
-1
No files found.
src/decode.c
View file @
3b1efb55
...
@@ -161,16 +161,16 @@ int waitOnDecode(PlayerControl * pc, DecoderControl * dc, OutputBuffer * cb,
...
@@ -161,16 +161,16 @@ int waitOnDecode(PlayerControl * pc, DecoderControl * dc, OutputBuffer * cb,
}
}
int
decodeSeek
(
PlayerControl
*
pc
,
DecoderControl
*
dc
,
OutputBuffer
*
cb
,
int
decodeSeek
(
PlayerControl
*
pc
,
DecoderControl
*
dc
,
OutputBuffer
*
cb
,
int
*
decodeWaitedOn
)
int
*
decodeWaitedOn
,
int
*
next
)
{
{
int
ret
=
-
1
;
int
ret
=
-
1
;
if
(
decode_pid
&&
*
decode_pid
>
0
)
{
if
(
decode_pid
&&
*
decode_pid
>
0
)
{
cb
->
next
=
-
1
;
if
(
dc
->
state
==
DECODE_STATE_STOP
||
dc
->
error
||
if
(
dc
->
state
==
DECODE_STATE_STOP
||
dc
->
error
||
strcmp
(
dc
->
utf8url
,
pc
->
utf8url
)
!=
0
)
strcmp
(
dc
->
utf8url
,
pc
->
utf8url
)
!=
0
)
{
{
stopDecode
(
dc
);
stopDecode
(
dc
);
*
next
=
-
1
;
cb
->
begin
=
0
;
cb
->
begin
=
0
;
cb
->
end
=
0
;
cb
->
end
=
0
;
dc
->
error
=
0
;
dc
->
error
=
0
;
...
@@ -180,6 +180,7 @@ int decodeSeek(PlayerControl * pc, DecoderControl * dc, OutputBuffer * cb,
...
@@ -180,6 +180,7 @@ int decodeSeek(PlayerControl * pc, DecoderControl * dc, OutputBuffer * cb,
if
(
*
decode_pid
>
0
&&
dc
->
state
!=
DECODE_STATE_STOP
&&
if
(
*
decode_pid
>
0
&&
dc
->
state
!=
DECODE_STATE_STOP
&&
dc
->
seekable
)
dc
->
seekable
)
{
{
*
next
=
-
1
;
dc
->
seekWhere
=
pc
->
seekWhere
>
pc
->
totalTime
-
0
.
1
?
dc
->
seekWhere
=
pc
->
seekWhere
>
pc
->
totalTime
-
0
.
1
?
pc
->
totalTime
-
0
.
1
:
pc
->
totalTime
-
0
.
1
:
pc
->
seekWhere
;
pc
->
seekWhere
;
...
@@ -230,7 +231,7 @@ int decodeSeek(PlayerControl * pc, DecoderControl * dc, OutputBuffer * cb,
...
@@ -230,7 +231,7 @@ int decodeSeek(PlayerControl * pc, DecoderControl * dc, OutputBuffer * cb,
if(pause) closeAudioDevice(); \
if(pause) closeAudioDevice(); \
} \
} \
if(pc->seek) { \
if(pc->seek) { \
if(decodeSeek(pc,dc,cb,&decodeWaitedOn) == 0) { \
if(decodeSeek(pc,dc,cb,&decodeWaitedOn
,&next
) == 0) { \
doCrossFade = 0; \
doCrossFade = 0; \
nextChunk = -1; \
nextChunk = -1; \
bbp = 0; \
bbp = 0; \
...
@@ -445,6 +446,8 @@ void decodeParent(PlayerControl * pc, DecoderControl * dc, OutputBuffer * cb) {
...
@@ -445,6 +446,8 @@ void decodeParent(PlayerControl * pc, DecoderControl * dc, OutputBuffer * cb) {
int
previousMetadataChunk
=
-
1
;
int
previousMetadataChunk
=
-
1
;
MetadataChunk
currentMetadataChunk
;
MetadataChunk
currentMetadataChunk
;
int
currentChunkSent
=
1
;
int
currentChunkSent
=
1
;
int
end
;
int
next
=
-
1
;
memset
(
silence
,
0
,
CHUNK_SIZE
);
memset
(
silence
,
0
,
CHUNK_SIZE
);
...
@@ -472,12 +475,12 @@ void decodeParent(PlayerControl * pc, DecoderControl * dc, OutputBuffer * cb) {
...
@@ -472,12 +475,12 @@ void decodeParent(PlayerControl * pc, DecoderControl * dc, OutputBuffer * cb) {
pc
->
queueState
==
PLAYER_QUEUE_FULL
&&
pc
->
queueState
==
PLAYER_QUEUE_FULL
&&
pc
->
queueLockState
==
PLAYER_QUEUE_UNLOCKED
)
pc
->
queueLockState
==
PLAYER_QUEUE_UNLOCKED
)
{
{
cb
->
next
=
cb
->
end
;
next
=
cb
->
end
;
dc
->
start
=
1
;
dc
->
start
=
1
;
pc
->
queueState
=
PLAYER_QUEUE_DECODE
;
pc
->
queueState
=
PLAYER_QUEUE_DECODE
;
kill
(
getppid
(),
SIGUSR1
);
kill
(
getppid
(),
SIGUSR1
);
}
}
if
(
cb
->
next
>=
0
&&
doCrossFade
==
0
&&
!
dc
->
start
)
{
if
(
next
>=
0
&&
doCrossFade
==
0
&&
!
dc
->
start
)
{
nextChunk
=
-
1
;
nextChunk
=
-
1
;
if
(
isCurrentAudioFormat
(
&
(
cb
->
audioFormat
)))
{
if
(
isCurrentAudioFormat
(
&
(
cb
->
audioFormat
)))
{
doCrossFade
=
1
;
doCrossFade
=
1
;
...
@@ -492,21 +495,26 @@ void decodeParent(PlayerControl * pc, DecoderControl * dc, OutputBuffer * cb) {
...
@@ -492,21 +495,26 @@ void decodeParent(PlayerControl * pc, DecoderControl * dc, OutputBuffer * cb) {
}
}
else
doCrossFade
=
-
1
;
else
doCrossFade
=
-
1
;
}
}
/* copy thse to locale variables to prevent any potential
race conditions and weirdness */
end
=
cb
->
end
;
if
(
pause
)
my_usleep
(
10000
);
if
(
pause
)
my_usleep
(
10000
);
else
if
(
cb
->
begin
!=
cb
->
end
&&
cb
->
begin
!=
cb
->
next
)
{
else
if
(
cb
->
begin
!=
end
&&
cb
->
begin
!=
next
)
{
if
(
doCrossFade
==
1
&&
cb
->
next
>=
0
&&
if
(
doCrossFade
==
1
&&
next
>=
0
&&
((
cb
->
next
>
cb
->
begin
&&
((
next
>
cb
->
begin
&&
(
fadePosition
=
cb
->
next
-
cb
->
begin
)
(
fadePosition
=
next
-
cb
->
begin
)
<=
crossFadeChunks
)
||
<=
crossFadeChunks
)
||
(
cb
->
begin
>
cb
->
next
&&
(
cb
->
begin
>
next
&&
(
fadePosition
=
cb
->
next
-
cb
->
begin
+
(
fadePosition
=
next
-
cb
->
begin
+
buffered_chunks
)
<=
crossFadeChunks
)))
buffered_chunks
)
<=
crossFadeChunks
)))
{
{
if
(
nextChunk
<
0
)
{
if
(
nextChunk
<
0
)
{
crossFadeChunks
=
fadePosition
;
crossFadeChunks
=
fadePosition
;
}
}
test
=
cb
->
end
;
test
=
end
;
if
(
cb
->
end
<
cb
->
begin
)
test
+=
buffered_chunks
;
if
(
end
<
cb
->
begin
)
test
+=
buffered_chunks
;
nextChunk
=
cb
->
begin
+
crossFadeChunks
;
nextChunk
=
cb
->
begin
+
crossFadeChunks
;
if
(
nextChunk
<
test
)
{
if
(
nextChunk
<
test
)
{
if
(
nextChunk
>=
buffered_chunks
)
if
(
nextChunk
>=
buffered_chunks
)
...
@@ -558,11 +566,11 @@ void decodeParent(PlayerControl * pc, DecoderControl * dc, OutputBuffer * cb) {
...
@@ -558,11 +566,11 @@ void decodeParent(PlayerControl * pc, DecoderControl * dc, OutputBuffer * cb) {
cb
->
begin
=
0
;
cb
->
begin
=
0
;
}
}
}
}
else
if
(
cb
->
next
==
cb
->
begin
)
{
else
if
(
next
==
cb
->
begin
)
{
if
(
doCrossFade
==
1
&&
nextChunk
>=
0
)
{
if
(
doCrossFade
==
1
&&
nextChunk
>=
0
)
{
nextChunk
=
cb
->
begin
+
crossFadeChunks
;
nextChunk
=
cb
->
begin
+
crossFadeChunks
;
test
=
cb
->
end
;
test
=
cb
->
end
;
if
(
cb
->
end
<
cb
->
begin
)
test
+=
buffered_chunks
;
if
(
end
<
cb
->
begin
)
test
+=
buffered_chunks
;
if
(
nextChunk
<
test
)
{
if
(
nextChunk
<
test
)
{
if
(
nextChunk
>=
buffered_chunks
)
if
(
nextChunk
>=
buffered_chunks
)
{
{
...
@@ -590,7 +598,7 @@ void decodeParent(PlayerControl * pc, DecoderControl * dc, OutputBuffer * cb) {
...
@@ -590,7 +598,7 @@ void decodeParent(PlayerControl * pc, DecoderControl * dc, OutputBuffer * cb) {
break
;
break
;
}
}
else
{
else
{
cb
->
next
=
-
1
;
next
=
-
1
;
if
(
waitOnDecode
(
pc
,
dc
,
cb
,
&
decodeWaitedOn
)
<
0
)
{
if
(
waitOnDecode
(
pc
,
dc
,
cb
,
&
decodeWaitedOn
)
<
0
)
{
return
;
return
;
}
}
...
@@ -633,7 +641,6 @@ void decode() {
...
@@ -633,7 +641,6 @@ void decode() {
pc
=
&
(
getPlayerData
()
->
playerControl
);
pc
=
&
(
getPlayerData
()
->
playerControl
);
dc
=
&
(
getPlayerData
()
->
decoderControl
);
dc
=
&
(
getPlayerData
()
->
decoderControl
);
dc
->
error
=
0
;
dc
->
error
=
0
;
cb
->
next
=
-
1
;
dc
->
seek
=
0
;
dc
->
seek
=
0
;
dc
->
stop
=
0
;
dc
->
stop
=
0
;
dc
->
start
=
1
;
dc
->
start
=
1
;
...
...
src/outputBuffer.h
View file @
3b1efb55
...
@@ -37,7 +37,6 @@ typedef struct _OutputBuffer {
...
@@ -37,7 +37,6 @@ typedef struct _OutputBuffer {
float
*
volatile
times
;
float
*
volatile
times
;
mpd_sint16
volatile
begin
;
mpd_sint16
volatile
begin
;
mpd_sint16
volatile
end
;
mpd_sint16
volatile
end
;
mpd_sint16
volatile
next
;
AudioFormat
audioFormat
;
AudioFormat
audioFormat
;
MetadataChunk
metadataChunks
[
BUFFERED_METACHUNKS
];
MetadataChunk
metadataChunks
[
BUFFERED_METACHUNKS
];
mpd_sint8
metaChunkSet
[
BUFFERED_METACHUNKS
];
mpd_sint8
metaChunkSet
[
BUFFERED_METACHUNKS
];
...
...
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