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
b95426f5
Commit
b95426f5
authored
Feb 01, 2005
by
Warren Dukes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
some minor changes, still doesn't quite work
git-svn-id:
https://svn.musicpd.org/mpd/trunk@2922
09075e82-0dd4-0310-85a5-a0d7c8717e4f
parent
4422fae2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
5 deletions
+25
-5
mpc_plugin.c
src/inputPlugins/mpc_plugin.c
+25
-5
No files found.
src/inputPlugins/mpc_plugin.c
View file @
b95426f5
...
@@ -26,6 +26,7 @@
...
@@ -26,6 +26,7 @@
#include "../pcm_utils.h"
#include "../pcm_utils.h"
#include "../inputStream.h"
#include "../inputStream.h"
#include "../outputBuffer.h"
#include "../outputBuffer.h"
#include "../replayGain.h"
#include <stdio.h>
#include <stdio.h>
#include <unistd.h>
#include <unistd.h>
...
@@ -44,7 +45,7 @@ mpc_int32_t mpc_read_cb(void * vdata, void * ptr, mpc_int32_t size) {
...
@@ -44,7 +45,7 @@ mpc_int32_t mpc_read_cb(void * vdata, void * ptr, mpc_int32_t size) {
MpcCallbackData
*
data
=
(
MpcCallbackData
*
)
vdata
;
MpcCallbackData
*
data
=
(
MpcCallbackData
*
)
vdata
;
while
(
1
)
{
while
(
1
)
{
ret
=
readFromInputStream
(
data
->
inStream
,
ptr
,
size
,
1
);
ret
=
readFromInputStream
(
data
->
inStream
,
ptr
,
1
,
size
);
if
(
ret
==
0
&&
!
inputStreamAtEOF
(
data
->
inStream
)
&&
if
(
ret
==
0
&&
!
inputStreamAtEOF
(
data
->
inStream
)
&&
!
data
->
dc
->
stop
)
!
data
->
dc
->
stop
)
{
{
...
@@ -131,6 +132,7 @@ int mpc_decode(OutputBuffer * cb, DecoderControl * dc, InputStream * inStream)
...
@@ -131,6 +132,7 @@ int mpc_decode(OutputBuffer * cb, DecoderControl * dc, InputStream * inStream)
mpc_uint32_t
vbrUpdateBits
;
mpc_uint32_t
vbrUpdateBits
;
float
time
;
float
time
;
int
i
;
int
i
;
ReplayGainInfo
*
replayGainInfo
;
data
.
inStream
=
inStream
;
data
.
inStream
=
inStream
;
data
.
dc
=
dc
;
data
.
dc
=
dc
;
...
@@ -142,12 +144,17 @@ int mpc_decode(OutputBuffer * cb, DecoderControl * dc, InputStream * inStream)
...
@@ -142,12 +144,17 @@ int mpc_decode(OutputBuffer * cb, DecoderControl * dc, InputStream * inStream)
reader
.
canseek
=
mpc_canseek_cb
;
reader
.
canseek
=
mpc_canseek_cb
;
reader
.
data
=
&
data
;
reader
.
data
=
&
data
;
DEBUG
(
"HERE 1
\n
"
);
mpc_streaminfo_init
(
&
info
);
mpc_streaminfo_init
(
&
info
);
if
(
mpc_streaminfo_read
(
&
info
,
&
reader
)
!=
ERROR_CODE_OK
)
{
DEBUG
(
"HERE 2
\n
"
);
if
((
ret
=
mpc_streaminfo_read
(
&
info
,
&
reader
))
!=
ERROR_CODE_OK
)
{
closeInputStream
(
inStream
);
closeInputStream
(
inStream
);
if
(
!
dc
->
stop
)
{
if
(
!
dc
->
stop
)
{
ERROR
(
"Not a valid musepack stream"
);
ERROR
(
"Not a valid musepack stream"
);
DEBUG
(
"ret: %i
\n
"
,
ret
);
return
-
1
;
}
}
else
{
else
{
dc
->
state
=
DECODE_STATE_STOP
;
dc
->
state
=
DECODE_STATE_STOP
;
...
@@ -156,7 +163,9 @@ int mpc_decode(OutputBuffer * cb, DecoderControl * dc, InputStream * inStream)
...
@@ -156,7 +163,9 @@ int mpc_decode(OutputBuffer * cb, DecoderControl * dc, InputStream * inStream)
return
0
;
return
0
;
}
}
DEBUG
(
"HERE 3
\n
"
);
mpc_decoder_setup
(
&
decoder
,
&
reader
);
mpc_decoder_setup
(
&
decoder
,
&
reader
);
DEBUG
(
"HERE 4
\n
"
);
if
(
!
mpc_decoder_initialize
(
&
decoder
,
&
info
))
{
if
(
!
mpc_decoder_initialize
(
&
decoder
,
&
info
))
{
closeInputStream
(
inStream
);
closeInputStream
(
inStream
);
if
(
!
dc
->
stop
)
{
if
(
!
dc
->
stop
)
{
...
@@ -168,11 +177,16 @@ int mpc_decode(OutputBuffer * cb, DecoderControl * dc, InputStream * inStream)
...
@@ -168,11 +177,16 @@ int mpc_decode(OutputBuffer * cb, DecoderControl * dc, InputStream * inStream)
}
}
}
}
DEBUG
(
"HERE 5
\n
"
);
dc
->
totalTime
=
mpc_streaminfo_get_length
(
&
info
);
dc
->
totalTime
=
mpc_streaminfo_get_length
(
&
info
);
dc
->
audioFormat
.
bits
=
16
;
dc
->
audioFormat
.
bits
=
16
;
dc
->
audioFormat
.
channels
=
16
;
dc
->
audioFormat
.
sampleRate
=
info
.
sample_freq
;
dc
->
audioFormat
.
sampleRate
=
info
.
sample_freq
;
replayGainInfo
=
newReplayGainInfo
();
DEBUG
(
"HERE 6
\n
"
);
while
(
!
eof
)
{
while
(
!
eof
)
{
if
(
dc
->
seek
)
{
if
(
dc
->
seek
)
{
samplePos
=
dc
->
seekWhere
*
dc
->
audioFormat
.
sampleRate
;
samplePos
=
dc
->
seekWhere
*
dc
->
audioFormat
.
sampleRate
;
...
@@ -183,7 +197,7 @@ int mpc_decode(OutputBuffer * cb, DecoderControl * dc, InputStream * inStream)
...
@@ -183,7 +197,7 @@ int mpc_decode(OutputBuffer * cb, DecoderControl * dc, InputStream * inStream)
else
dc
->
seekError
=
1
;
else
dc
->
seekError
=
1
;
dc
->
seek
=
0
;
dc
->
seek
=
0
;
}
}
ret
=
mpc_decoder_decode
(
&
decoder
,
sample_buffer
,
ret
=
mpc_decoder_decode
(
&
decoder
,
sample_buffer
,
&
vbrUpdateAcc
,
&
vbrUpdateBits
);
&
vbrUpdateAcc
,
&
vbrUpdateBits
);
if
(
ret
<=
0
)
{
if
(
ret
<=
0
)
{
...
@@ -215,7 +229,7 @@ int mpc_decode(OutputBuffer * cb, DecoderControl * dc, InputStream * inStream)
...
@@ -215,7 +229,7 @@ int mpc_decode(OutputBuffer * cb, DecoderControl * dc, InputStream * inStream)
chunk
,
chunkpos
,
chunk
,
chunkpos
,
time
,
time
,
bitRate
,
bitRate
,
NULL
);
replayGainInfo
);
chunkpos
=
0
;
chunkpos
=
0
;
s16
=
(
mpd_sint16
*
)
chunk
;
s16
=
(
mpd_sint16
*
)
chunk
;
if
(
dc
->
stop
)
break
;
if
(
dc
->
stop
)
break
;
...
@@ -223,6 +237,7 @@ int mpc_decode(OutputBuffer * cb, DecoderControl * dc, InputStream * inStream)
...
@@ -223,6 +237,7 @@ int mpc_decode(OutputBuffer * cb, DecoderControl * dc, InputStream * inStream)
}
}
}
}
DEBUG
(
"HERE 7
\n
"
);
if
(
!
dc
->
stop
&&
chunkpos
>
0
)
{
if
(
!
dc
->
stop
&&
chunkpos
>
0
)
{
time
=
((
float
)
samplePos
)
/
dc
->
audioFormat
.
sampleRate
;
time
=
((
float
)
samplePos
)
/
dc
->
audioFormat
.
sampleRate
;
...
@@ -230,13 +245,18 @@ int mpc_decode(OutputBuffer * cb, DecoderControl * dc, InputStream * inStream)
...
@@ -230,13 +245,18 @@ int mpc_decode(OutputBuffer * cb, DecoderControl * dc, InputStream * inStream)
chunkpos
;
chunkpos
;
sendDataToOutputBuffer
(
cb
,
NULL
,
dc
,
inStream
->
seekable
,
sendDataToOutputBuffer
(
cb
,
NULL
,
dc
,
inStream
->
seekable
,
chunk
,
chunkpos
,
time
,
bitRate
,
NULL
);
chunk
,
chunkpos
,
time
,
bitRate
,
replayGainInfo
);
}
}
DEBUG
(
"HERE 8
\n
"
);
closeInputStream
(
inStream
);
closeInputStream
(
inStream
);
DEBUG
(
"HERE 9
\n
"
);
flushOutputBuffer
(
cb
);
flushOutputBuffer
(
cb
);
freeReplayGainInfo
(
replayGainInfo
);
if
(
dc
->
stop
)
{
if
(
dc
->
stop
)
{
dc
->
state
=
DECODE_STATE_STOP
;
dc
->
state
=
DECODE_STATE_STOP
;
dc
->
stop
=
0
;
dc
->
stop
=
0
;
...
...
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