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
62d4fa93
Commit
62d4fa93
authored
Oct 30, 2008
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
decoder: use bool for return values and flags
Don't return 0/-1 on success/error, but true/false. Instead of int, use bool for storing flags.
parent
d29bad44
Show whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
148 additions
and
144 deletions
+148
-144
aac_plugin.c
src/decoder/aac_plugin.c
+20
-19
audiofile_plugin.c
src/decoder/audiofile_plugin.c
+6
-5
ffmpeg_plugin.c
src/decoder/ffmpeg_plugin.c
+6
-6
flac_plugin.c
src/decoder/flac_plugin.c
+15
-14
mod_plugin.c
src/decoder/mod_plugin.c
+16
-15
mp3_plugin.c
src/decoder/mp3_plugin.c
+14
-14
mp4_plugin.c
src/decoder/mp4_plugin.c
+8
-8
mpc_plugin.c
src/decoder/mpc_plugin.c
+9
-9
oggflac_plugin.c
src/decoder/oggflac_plugin.c
+1
-1
oggvorbis_plugin.c
src/decoder/oggvorbis_plugin.c
+12
-12
wavpack_plugin.c
src/decoder/wavpack_plugin.c
+12
-11
decoder_api.c
src/decoder_api.c
+2
-2
decoder_api.h
src/decoder_api.h
+4
-4
decoder_control.c
src/decoder_control.c
+5
-5
decoder_control.h
src/decoder_control.h
+5
-5
decoder_list.c
src/decoder_list.c
+1
-1
decoder_thread.c
src/decoder_thread.c
+8
-9
player_thread.c
src/player_thread.c
+4
-4
No files found.
src/decoder/aac_plugin.c
View file @
62d4fa93
...
@@ -34,7 +34,7 @@ typedef struct {
...
@@ -34,7 +34,7 @@ typedef struct {
size_t
bytesConsumed
;
size_t
bytesConsumed
;
off_t
fileOffset
;
off_t
fileOffset
;
unsigned
char
*
buffer
;
unsigned
char
*
buffer
;
int
atEof
;
bool
atEof
;
}
AacBuffer
;
}
AacBuffer
;
static
void
aac_buffer_shift
(
AacBuffer
*
b
,
size_t
length
)
static
void
aac_buffer_shift
(
AacBuffer
*
b
,
size_t
length
)
...
@@ -68,7 +68,7 @@ static void fillAacBuffer(AacBuffer * b)
...
@@ -68,7 +68,7 @@ static void fillAacBuffer(AacBuffer * b)
(
void
*
)(
b
->
buffer
+
b
->
bytesIntoBuffer
),
(
void
*
)(
b
->
buffer
+
b
->
bytesIntoBuffer
),
rest
);
rest
);
if
(
bread
==
0
&&
input_stream_eof
(
b
->
inStream
))
if
(
bread
==
0
&&
input_stream_eof
(
b
->
inStream
))
b
->
atEof
=
1
;
b
->
atEof
=
true
;
b
->
bytesIntoBuffer
+=
bread
;
b
->
bytesIntoBuffer
+=
bread
;
}
}
...
@@ -301,8 +301,8 @@ static int getAacTotalTime(char *file)
...
@@ -301,8 +301,8 @@ static int getAacTotalTime(char *file)
return
file_time
;
return
file_time
;
}
}
static
int
aac_stream_decode
(
struct
decoder
*
mpd_decoder
,
static
bool
struct
input_stream
*
inStream
)
aac_stream_decode
(
struct
decoder
*
mpd_decoder
,
struct
input_stream
*
inStream
)
{
{
float
file_time
;
float
file_time
;
float
totalTime
=
0
;
float
totalTime
=
0
;
...
@@ -318,7 +318,7 @@ static int aac_stream_decode(struct decoder * mpd_decoder,
...
@@ -318,7 +318,7 @@ static int aac_stream_decode(struct decoder * mpd_decoder,
size_t
sampleBufferLen
;
size_t
sampleBufferLen
;
uint16_t
bitRate
=
0
;
uint16_t
bitRate
=
0
;
AacBuffer
b
;
AacBuffer
b
;
int
initialized
=
0
;
bool
initialized
=
false
;
initAacBuffer
(
&
b
,
mpd_decoder
,
inStream
);
initAacBuffer
(
&
b
,
mpd_decoder
,
inStream
);
...
@@ -354,7 +354,7 @@ static int aac_stream_decode(struct decoder * mpd_decoder,
...
@@ -354,7 +354,7 @@ static int aac_stream_decode(struct decoder * mpd_decoder,
faacDecClose
(
decoder
);
faacDecClose
(
decoder
);
if
(
b
.
buffer
)
if
(
b
.
buffer
)
free
(
b
.
buffer
);
free
(
b
.
buffer
);
return
-
1
;
return
false
;
}
}
audio_format
.
bits
=
16
;
audio_format
.
bits
=
16
;
...
@@ -363,7 +363,7 @@ static int aac_stream_decode(struct decoder * mpd_decoder,
...
@@ -363,7 +363,7 @@ static int aac_stream_decode(struct decoder * mpd_decoder,
advanceAacBuffer
(
&
b
,
bread
);
advanceAacBuffer
(
&
b
,
bread
);
while
(
1
)
{
while
(
true
)
{
fillAacBuffer
(
&
b
);
fillAacBuffer
(
&
b
);
adts_find_frame
(
&
b
);
adts_find_frame
(
&
b
);
fillAacBuffer
(
&
b
);
fillAacBuffer
(
&
b
);
...
@@ -392,7 +392,7 @@ static int aac_stream_decode(struct decoder * mpd_decoder,
...
@@ -392,7 +392,7 @@ static int aac_stream_decode(struct decoder * mpd_decoder,
audio_format
.
channels
=
frameInfo
.
channels
;
audio_format
.
channels
=
frameInfo
.
channels
;
audio_format
.
sample_rate
=
sample_rate
;
audio_format
.
sample_rate
=
sample_rate
;
decoder_initialized
(
mpd_decoder
,
&
audio_format
,
totalTime
);
decoder_initialized
(
mpd_decoder
,
&
audio_format
,
totalTime
);
initialized
=
1
;
initialized
=
true
;
}
}
advanceAacBuffer
(
&
b
,
frameInfo
.
bytesconsumed
);
advanceAacBuffer
(
&
b
,
frameInfo
.
bytesconsumed
);
...
@@ -424,17 +424,18 @@ static int aac_stream_decode(struct decoder * mpd_decoder,
...
@@ -424,17 +424,18 @@ static int aac_stream_decode(struct decoder * mpd_decoder,
free
(
b
.
buffer
);
free
(
b
.
buffer
);
if
(
!
initialized
)
if
(
!
initialized
)
return
-
1
;
return
false
;
if
(
decoder_get_command
(
mpd_decoder
)
==
DECODE_COMMAND_SEEK
)
{
if
(
decoder_get_command
(
mpd_decoder
)
==
DECODE_COMMAND_SEEK
)
{
decoder_seek_error
(
mpd_decoder
);
decoder_seek_error
(
mpd_decoder
);
}
}
return
0
;
return
true
;
}
}
static
int
aac_decode
(
struct
decoder
*
mpd_decoder
,
char
*
path
)
static
bool
aac_decode
(
struct
decoder
*
mpd_decoder
,
char
*
path
)
{
{
float
file_time
;
float
file_time
;
float
totalTime
;
float
totalTime
;
...
@@ -454,13 +455,13 @@ static int aac_decode(struct decoder * mpd_decoder, char *path)
...
@@ -454,13 +455,13 @@ static int aac_decode(struct decoder * mpd_decoder, char *path)
uint16_t
bitRate
=
0
;
uint16_t
bitRate
=
0
;
AacBuffer
b
;
AacBuffer
b
;
struct
input_stream
inStream
;
struct
input_stream
inStream
;
int
initialized
=
0
;
bool
initialized
=
false
;
if
((
totalTime
=
getAacFloatTotalTime
(
path
))
<
0
)
if
((
totalTime
=
getAacFloatTotalTime
(
path
))
<
0
)
return
-
1
;
return
false
;
if
(
!
input_stream_open
(
&
inStream
,
path
))
if
(
!
input_stream_open
(
&
inStream
,
path
))
return
-
1
;
return
false
;
initAacBuffer
(
&
b
,
mpd_decoder
,
&
inStream
);
initAacBuffer
(
&
b
,
mpd_decoder
,
&
inStream
);
aac_parse_header
(
&
b
,
NULL
);
aac_parse_header
(
&
b
,
NULL
);
...
@@ -490,7 +491,7 @@ static int aac_decode(struct decoder * mpd_decoder, char *path)
...
@@ -490,7 +491,7 @@ static int aac_decode(struct decoder * mpd_decoder, char *path)
faacDecClose
(
decoder
);
faacDecClose
(
decoder
);
if
(
b
.
buffer
)
if
(
b
.
buffer
)
free
(
b
.
buffer
);
free
(
b
.
buffer
);
return
-
1
;
return
false
;
}
}
audio_format
.
bits
=
16
;
audio_format
.
bits
=
16
;
...
@@ -499,7 +500,7 @@ static int aac_decode(struct decoder * mpd_decoder, char *path)
...
@@ -499,7 +500,7 @@ static int aac_decode(struct decoder * mpd_decoder, char *path)
advanceAacBuffer
(
&
b
,
bread
);
advanceAacBuffer
(
&
b
,
bread
);
while
(
1
)
{
while
(
true
)
{
fillAacBuffer
(
&
b
);
fillAacBuffer
(
&
b
);
if
(
b
.
bytesIntoBuffer
==
0
)
if
(
b
.
bytesIntoBuffer
==
0
)
...
@@ -527,7 +528,7 @@ static int aac_decode(struct decoder * mpd_decoder, char *path)
...
@@ -527,7 +528,7 @@ static int aac_decode(struct decoder * mpd_decoder, char *path)
audio_format
.
sample_rate
=
sample_rate
;
audio_format
.
sample_rate
=
sample_rate
;
decoder_initialized
(
mpd_decoder
,
&
audio_format
,
decoder_initialized
(
mpd_decoder
,
&
audio_format
,
totalTime
);
totalTime
);
initialized
=
1
;
initialized
=
true
;
}
}
advanceAacBuffer
(
&
b
,
frameInfo
.
bytesconsumed
);
advanceAacBuffer
(
&
b
,
frameInfo
.
bytesconsumed
);
...
@@ -559,13 +560,13 @@ static int aac_decode(struct decoder * mpd_decoder, char *path)
...
@@ -559,13 +560,13 @@ static int aac_decode(struct decoder * mpd_decoder, char *path)
free
(
b
.
buffer
);
free
(
b
.
buffer
);
if
(
!
initialized
)
if
(
!
initialized
)
return
-
1
;
return
false
;
if
(
decoder_get_command
(
mpd_decoder
)
==
DECODE_COMMAND_SEEK
)
{
if
(
decoder_get_command
(
mpd_decoder
)
==
DECODE_COMMAND_SEEK
)
{
decoder_seek_error
(
mpd_decoder
);
decoder_seek_error
(
mpd_decoder
);
}
}
return
0
;
return
true
;
}
}
static
struct
tag
*
aacTagDup
(
char
*
file
)
static
struct
tag
*
aacTagDup
(
char
*
file
)
...
...
src/decoder/audiofile_plugin.c
View file @
62d4fa93
...
@@ -41,7 +41,8 @@ static int getAudiofileTotalTime(char *file)
...
@@ -41,7 +41,8 @@ static int getAudiofileTotalTime(char *file)
return
total_time
;
return
total_time
;
}
}
static
int
audiofile_decode
(
struct
decoder
*
decoder
,
char
*
path
)
static
bool
audiofile_decode
(
struct
decoder
*
decoder
,
char
*
path
)
{
{
int
fs
,
frame_count
;
int
fs
,
frame_count
;
AFfilehandle
af_fp
;
AFfilehandle
af_fp
;
...
@@ -55,13 +56,13 @@ static int audiofile_decode(struct decoder * decoder, char *path)
...
@@ -55,13 +56,13 @@ static int audiofile_decode(struct decoder * decoder, char *path)
if
(
stat
(
path
,
&
st
)
<
0
)
{
if
(
stat
(
path
,
&
st
)
<
0
)
{
ERROR
(
"failed to stat: %s
\n
"
,
path
);
ERROR
(
"failed to stat: %s
\n
"
,
path
);
return
-
1
;
return
false
;
}
}
af_fp
=
afOpenFile
(
path
,
"r"
,
NULL
);
af_fp
=
afOpenFile
(
path
,
"r"
,
NULL
);
if
(
af_fp
==
AF_NULL_FILEHANDLE
)
{
if
(
af_fp
==
AF_NULL_FILEHANDLE
)
{
ERROR
(
"failed to open: %s
\n
"
,
path
);
ERROR
(
"failed to open: %s
\n
"
,
path
);
return
-
1
;
return
false
;
}
}
afSetVirtualSampleFormat
(
af_fp
,
AF_DEFAULT_TRACK
,
afSetVirtualSampleFormat
(
af_fp
,
AF_DEFAULT_TRACK
,
...
@@ -83,7 +84,7 @@ static int audiofile_decode(struct decoder * decoder, char *path)
...
@@ -83,7 +84,7 @@ static int audiofile_decode(struct decoder * decoder, char *path)
ERROR
(
"Only 8 and 16-bit files are supported. %s is %i-bit
\n
"
,
ERROR
(
"Only 8 and 16-bit files are supported. %s is %i-bit
\n
"
,
path
,
audio_format
.
bits
);
path
,
audio_format
.
bits
);
afCloseFile
(
af_fp
);
afCloseFile
(
af_fp
);
return
-
1
;
return
false
;
}
}
fs
=
(
int
)
afGetVirtualFrameSize
(
af_fp
,
AF_DEFAULT_TRACK
,
1
);
fs
=
(
int
)
afGetVirtualFrameSize
(
af_fp
,
AF_DEFAULT_TRACK
,
1
);
...
@@ -111,7 +112,7 @@ static int audiofile_decode(struct decoder * decoder, char *path)
...
@@ -111,7 +112,7 @@ static int audiofile_decode(struct decoder * decoder, char *path)
}
while
(
decoder_get_command
(
decoder
)
!=
DECODE_COMMAND_STOP
);
}
while
(
decoder_get_command
(
decoder
)
!=
DECODE_COMMAND_STOP
);
afCloseFile
(
af_fp
);
afCloseFile
(
af_fp
);
return
0
;
return
true
;
}
}
static
struct
tag
*
audiofileTagDup
(
char
*
file
)
static
struct
tag
*
audiofileTagDup
(
char
*
file
)
...
...
src/decoder/ffmpeg_plugin.c
View file @
62d4fa93
...
@@ -84,7 +84,7 @@ static int mpdurl_read(URLContext *h, unsigned char *buf, int size)
...
@@ -84,7 +84,7 @@ static int mpdurl_read(URLContext *h, unsigned char *buf, int size)
{
{
int
ret
;
int
ret
;
FopsHelper
*
base
=
(
FopsHelper
*
)
h
->
priv_data
;
FopsHelper
*
base
=
(
FopsHelper
*
)
h
->
priv_data
;
while
(
1
)
{
while
(
true
)
{
ret
=
input_stream_read
(
base
->
input
,
(
void
*
)
buf
,
size
);
ret
=
input_stream_read
(
base
->
input
,
(
void
*
)
buf
,
size
);
if
(
ret
==
0
)
{
if
(
ret
==
0
)
{
DEBUG
(
"ret 0
\n
"
);
DEBUG
(
"ret 0
\n
"
);
...
@@ -130,11 +130,11 @@ static URLProtocol mpdurl_fileops = {
...
@@ -130,11 +130,11 @@ static URLProtocol mpdurl_fileops = {
.
url_close
=
mpdurl_close
,
.
url_close
=
mpdurl_close
,
};
};
static
int
ffmpeg_init
(
void
)
static
bool
ffmpeg_init
(
void
)
{
{
av_register_all
();
av_register_all
();
register_protocol
(
&
mpdurl_fileops
);
register_protocol
(
&
mpdurl_fileops
);
return
0
;
return
true
;
}
}
static
int
static
int
...
@@ -318,18 +318,18 @@ static int ffmpeg_decode_internal(BasePtrs *base)
...
@@ -318,18 +318,18 @@ static int ffmpeg_decode_internal(BasePtrs *base)
return
0
;
return
0
;
}
}
static
int
static
bool
ffmpeg_decode
(
struct
decoder
*
decoder
,
struct
input_stream
*
input
)
ffmpeg_decode
(
struct
decoder
*
decoder
,
struct
input_stream
*
input
)
{
{
BasePtrs
base
;
BasePtrs
base
;
int
ret
;
bool
ret
;
DEBUG
(
"decode start
\n
"
);
DEBUG
(
"decode start
\n
"
);
base
.
input
=
input
;
base
.
input
=
input
;
base
.
decoder
=
decoder
;
base
.
decoder
=
decoder
;
ret
=
ffmpeg_helper
(
input
,
ffmpeg_decode_internal
,
&
base
);
ret
=
ffmpeg_helper
(
input
,
ffmpeg_decode_internal
,
&
base
)
==
0
;
DEBUG
(
"decode finish
\n
"
);
DEBUG
(
"decode finish
\n
"
);
...
...
src/decoder/flac_plugin.c
View file @
62d4fa93
...
@@ -219,13 +219,14 @@ static FLAC__StreamDecoderWriteStatus flacWrite(const flac_decoder *dec,
...
@@ -219,13 +219,14 @@ static FLAC__StreamDecoderWriteStatus flacWrite(const flac_decoder *dec,
return
flac_common_write
(
data
,
frame
,
buf
);
return
flac_common_write
(
data
,
frame
,
buf
);
}
}
static
struct
tag
*
flacMetadataDup
(
char
*
file
,
int
*
vorbisCommentFound
)
static
struct
tag
*
flacMetadataDup
(
char
*
file
,
bool
*
vorbisCommentFound
)
{
{
struct
tag
*
ret
=
NULL
;
struct
tag
*
ret
=
NULL
;
FLAC__Metadata_SimpleIterator
*
it
;
FLAC__Metadata_SimpleIterator
*
it
;
FLAC__StreamMetadata
*
block
=
NULL
;
FLAC__StreamMetadata
*
block
=
NULL
;
*
vorbisCommentFound
=
0
;
*
vorbisCommentFound
=
false
;
it
=
FLAC__metadata_simple_iterator_new
();
it
=
FLAC__metadata_simple_iterator_new
();
if
(
!
FLAC__metadata_simple_iterator_init
(
it
,
file
,
1
,
0
))
{
if
(
!
FLAC__metadata_simple_iterator_init
(
it
,
file
,
1
,
0
))
{
...
@@ -262,7 +263,7 @@ static struct tag *flacMetadataDup(char *file, int *vorbisCommentFound)
...
@@ -262,7 +263,7 @@ static struct tag *flacMetadataDup(char *file, int *vorbisCommentFound)
ret
=
copyVorbisCommentBlockToMpdTag
(
block
,
ret
);
ret
=
copyVorbisCommentBlockToMpdTag
(
block
,
ret
);
if
(
ret
)
if
(
ret
)
*
vorbisCommentFound
=
1
;
*
vorbisCommentFound
=
true
;
}
else
if
(
block
->
type
==
FLAC__METADATA_TYPE_STREAMINFO
)
{
}
else
if
(
block
->
type
==
FLAC__METADATA_TYPE_STREAMINFO
)
{
if
(
!
ret
)
if
(
!
ret
)
ret
=
tag_new
();
ret
=
tag_new
();
...
@@ -280,7 +281,7 @@ static struct tag *flacMetadataDup(char *file, int *vorbisCommentFound)
...
@@ -280,7 +281,7 @@ static struct tag *flacMetadataDup(char *file, int *vorbisCommentFound)
static
struct
tag
*
flacTagDup
(
char
*
file
)
static
struct
tag
*
flacTagDup
(
char
*
file
)
{
{
struct
tag
*
ret
=
NULL
;
struct
tag
*
ret
=
NULL
;
int
foundVorbisComment
=
0
;
bool
foundVorbisComment
=
false
;
ret
=
flacMetadataDup
(
file
,
&
foundVorbisComment
);
ret
=
flacMetadataDup
(
file
,
&
foundVorbisComment
);
if
(
!
ret
)
{
if
(
!
ret
)
{
...
@@ -300,16 +301,16 @@ static struct tag *flacTagDup(char *file)
...
@@ -300,16 +301,16 @@ static struct tag *flacTagDup(char *file)
return
ret
;
return
ret
;
}
}
static
int
static
bool
flac_decode_internal
(
struct
decoder
*
decoder
,
struct
input_stream
*
inStream
,
flac_decode_internal
(
struct
decoder
*
decoder
,
struct
input_stream
*
inStream
,
int
is_ogg
)
bool
is_ogg
)
{
{
flac_decoder
*
flacDec
;
flac_decoder
*
flacDec
;
FlacData
data
;
FlacData
data
;
const
char
*
err
=
NULL
;
const
char
*
err
=
NULL
;
if
(
!
(
flacDec
=
flac_new
()))
if
(
!
(
flacDec
=
flac_new
()))
return
-
1
;
return
false
;
init_FlacData
(
&
data
,
decoder
,
inStream
);
init_FlacData
(
&
data
,
decoder
,
inStream
);
#if defined(FLAC_API_VERSION_CURRENT) && FLAC_API_VERSION_CURRENT > 7
#if defined(FLAC_API_VERSION_CURRENT) && FLAC_API_VERSION_CURRENT > 7
...
@@ -342,7 +343,7 @@ flac_decode_internal(struct decoder * decoder, struct input_stream *inStream,
...
@@ -342,7 +343,7 @@ flac_decode_internal(struct decoder * decoder, struct input_stream *inStream,
decoder_initialized
(
decoder
,
&
data
.
audio_format
,
data
.
total_time
);
decoder_initialized
(
decoder
,
&
data
.
audio_format
,
data
.
total_time
);
while
(
1
)
{
while
(
true
)
{
if
(
!
flac_process_single
(
flacDec
))
if
(
!
flac_process_single
(
flacDec
))
break
;
break
;
if
(
decoder_get_command
(
decoder
)
==
DECODE_COMMAND_SEEK
)
{
if
(
decoder_get_command
(
decoder
)
==
DECODE_COMMAND_SEEK
)
{
...
@@ -372,15 +373,15 @@ fail:
...
@@ -372,15 +373,15 @@ fail:
if
(
err
)
{
if
(
err
)
{
ERROR
(
"flac %s
\n
"
,
err
);
ERROR
(
"flac %s
\n
"
,
err
);
return
-
1
;
return
false
;
}
}
return
0
;
return
true
;
}
}
static
int
static
bool
flac_decode
(
struct
decoder
*
decoder
,
struct
input_stream
*
inStream
)
flac_decode
(
struct
decoder
*
decoder
,
struct
input_stream
*
inStream
)
{
{
return
flac_decode_internal
(
decoder
,
inStream
,
0
);
return
flac_decode_internal
(
decoder
,
inStream
,
false
);
}
}
#if defined(FLAC_API_VERSION_CURRENT) && FLAC_API_VERSION_CURRENT > 7 && \
#if defined(FLAC_API_VERSION_CURRENT) && FLAC_API_VERSION_CURRENT > 7 && \
...
@@ -415,10 +416,10 @@ out:
...
@@ -415,10 +416,10 @@ out:
return
ret
;
return
ret
;
}
}
static
int
static
bool
oggflac_decode
(
struct
decoder
*
decoder
,
struct
input_stream
*
inStream
)
oggflac_decode
(
struct
decoder
*
decoder
,
struct
input_stream
*
inStream
)
{
{
return
flac_decode_internal
(
decoder
,
inStream
,
1
);
return
flac_decode_internal
(
decoder
,
inStream
,
true
);
}
}
static
bool
static
bool
...
...
src/decoder/mod_plugin.c
View file @
62d4fa93
...
@@ -91,18 +91,18 @@ static MDRIVER drv_mpd = {
...
@@ -91,18 +91,18 @@ static MDRIVER drv_mpd = {
VC_VoiceRealVolume
VC_VoiceRealVolume
};
};
static
int
mod_mikModInitiated
;
static
bool
mod_mikModInitiated
;
static
int
mod_mikModInitError
;
static
bool
mod_mikModInitError
;
static
int
mod_initMikMod
(
void
)
static
bool
mod_initMikMod
(
void
)
{
{
static
char
params
[]
=
""
;
static
char
params
[]
=
""
;
if
(
mod_mikModInitError
)
if
(
mod_mikModInitError
)
return
-
1
;
return
false
;
if
(
!
mod_mikModInitiated
)
{
if
(
!
mod_mikModInitiated
)
{
mod_mikModInitiated
=
1
;
mod_mikModInitiated
=
true
;
md_device
=
0
;
md_device
=
0
;
md_reverb
=
0
;
md_reverb
=
0
;
...
@@ -119,11 +119,11 @@ static int mod_initMikMod(void)
...
@@ -119,11 +119,11 @@ static int mod_initMikMod(void)
if
(
MikMod_Init
(
params
))
{
if
(
MikMod_Init
(
params
))
{
ERROR
(
"Could not init MikMod: %s
\n
"
,
ERROR
(
"Could not init MikMod: %s
\n
"
,
MikMod_strerror
(
MikMod_errno
));
MikMod_strerror
(
MikMod_errno
));
mod_mikModInitError
=
1
;
mod_mikModInitError
=
true
;
return
-
1
;
return
false
;
}
}
return
0
;
return
true
;
}
}
static
void
mod_finishMikMod
(
void
)
static
void
mod_finishMikMod
(
void
)
...
@@ -165,7 +165,8 @@ static void mod_close(mod_Data * data)
...
@@ -165,7 +165,8 @@ static void mod_close(mod_Data * data)
free
(
data
);
free
(
data
);
}
}
static
int
mod_decode
(
struct
decoder
*
decoder
,
char
*
path
)
static
bool
mod_decode
(
struct
decoder
*
decoder
,
char
*
path
)
{
{
mod_Data
*
data
;
mod_Data
*
data
;
struct
audio_format
audio_format
;
struct
audio_format
audio_format
;
...
@@ -173,13 +174,13 @@ static int mod_decode(struct decoder * decoder, char *path)
...
@@ -173,13 +174,13 @@ static int mod_decode(struct decoder * decoder, char *path)
int
ret
;
int
ret
;
float
secPerByte
;
float
secPerByte
;
if
(
mod_initMikMod
()
<
0
)
if
(
!
mod_initMikMod
()
)
return
-
1
;
return
false
;
if
(
!
(
data
=
mod_open
(
path
)))
{
if
(
!
(
data
=
mod_open
(
path
)))
{
ERROR
(
"failed to open mod: %s
\n
"
,
path
);
ERROR
(
"failed to open mod: %s
\n
"
,
path
);
MikMod_Exit
();
MikMod_Exit
();
return
-
1
;
return
false
;
}
}
audio_format
.
bits
=
16
;
audio_format
.
bits
=
16
;
...
@@ -192,7 +193,7 @@ static int mod_decode(struct decoder * decoder, char *path)
...
@@ -192,7 +193,7 @@ static int mod_decode(struct decoder * decoder, char *path)
decoder_initialized
(
decoder
,
&
audio_format
,
0
);
decoder_initialized
(
decoder
,
&
audio_format
,
0
);
while
(
1
)
{
while
(
true
)
{
if
(
decoder_get_command
(
decoder
)
==
DECODE_COMMAND_SEEK
)
{
if
(
decoder_get_command
(
decoder
)
==
DECODE_COMMAND_SEEK
)
{
decoder_seek_error
(
decoder
);
decoder_seek_error
(
decoder
);
}
}
...
@@ -214,7 +215,7 @@ static int mod_decode(struct decoder * decoder, char *path)
...
@@ -214,7 +215,7 @@ static int mod_decode(struct decoder * decoder, char *path)
MikMod_Exit
();
MikMod_Exit
();
return
0
;
return
true
;
}
}
static
struct
tag
*
modTagDup
(
char
*
file
)
static
struct
tag
*
modTagDup
(
char
*
file
)
...
@@ -223,7 +224,7 @@ static struct tag *modTagDup(char *file)
...
@@ -223,7 +224,7 @@ static struct tag *modTagDup(char *file)
MODULE
*
moduleHandle
;
MODULE
*
moduleHandle
;
char
*
title
;
char
*
title
;
if
(
mod_initMikMod
()
<
0
)
{
if
(
!
mod_initMikMod
()
)
{
DEBUG
(
"modTagDup: Failed to initialize MikMod
\n
"
);
DEBUG
(
"modTagDup: Failed to initialize MikMod
\n
"
);
return
NULL
;
return
NULL
;
}
}
...
...
src/decoder/mp3_plugin.c
View file @
62d4fa93
...
@@ -90,13 +90,13 @@ mad_fixed_to_24_buffer(int32_t *dest, const struct mad_synth *synth,
...
@@ -90,13 +90,13 @@ mad_fixed_to_24_buffer(int32_t *dest, const struct mad_synth *synth,
}
}
}
}
static
int
mp3_plugin_init
(
void
)
static
bool
mp3_plugin_init
(
void
)
{
{
int
ret
=
getBoolConfigParam
(
CONF_GAPLESS_MP3_PLAYBACK
,
true
);
int
ret
=
getBoolConfigParam
(
CONF_GAPLESS_MP3_PLAYBACK
,
true
);
gapless_playback
=
ret
!=
CONF_BOOL_UNSET
gapless_playback
=
ret
!=
CONF_BOOL_UNSET
?
!!
ret
?
!!
ret
:
DEFAULT_GAPLESS_MP3_PLAYBACK
;
:
DEFAULT_GAPLESS_MP3_PLAYBACK
;
return
1
;
return
true
;
}
}
#define MP3_DATA_OUTPUT_BUFFER_SIZE 2048
#define MP3_DATA_OUTPUT_BUFFER_SIZE 2048
...
@@ -210,7 +210,7 @@ static ReplayGainInfo *parse_id3_replay_gain_info(struct id3_tag *tag)
...
@@ -210,7 +210,7 @@ static ReplayGainInfo *parse_id3_replay_gain_info(struct id3_tag *tag)
char
*
key
;
char
*
key
;
char
*
value
;
char
*
value
;
struct
id3_frame
*
frame
;
struct
id3_frame
*
frame
;
int
found
=
0
;
bool
found
=
false
;
ReplayGainInfo
*
replay_gain_info
;
ReplayGainInfo
*
replay_gain_info
;
replay_gain_info
=
newReplayGainInfo
();
replay_gain_info
=
newReplayGainInfo
();
...
@@ -228,16 +228,16 @@ static ReplayGainInfo *parse_id3_replay_gain_info(struct id3_tag *tag)
...
@@ -228,16 +228,16 @@ static ReplayGainInfo *parse_id3_replay_gain_info(struct id3_tag *tag)
if
(
strcasecmp
(
key
,
"replaygain_track_gain"
)
==
0
)
{
if
(
strcasecmp
(
key
,
"replaygain_track_gain"
)
==
0
)
{
replay_gain_info
->
trackGain
=
atof
(
value
);
replay_gain_info
->
trackGain
=
atof
(
value
);
found
=
1
;
found
=
true
;
}
else
if
(
strcasecmp
(
key
,
"replaygain_album_gain"
)
==
0
)
{
}
else
if
(
strcasecmp
(
key
,
"replaygain_album_gain"
)
==
0
)
{
replay_gain_info
->
albumGain
=
atof
(
value
);
replay_gain_info
->
albumGain
=
atof
(
value
);
found
=
1
;
found
=
true
;
}
else
if
(
strcasecmp
(
key
,
"replaygain_track_peak"
)
==
0
)
{
}
else
if
(
strcasecmp
(
key
,
"replaygain_track_peak"
)
==
0
)
{
replay_gain_info
->
trackPeak
=
atof
(
value
);
replay_gain_info
->
trackPeak
=
atof
(
value
);
found
=
1
;
found
=
true
;
}
else
if
(
strcasecmp
(
key
,
"replaygain_album_peak"
)
==
0
)
{
}
else
if
(
strcasecmp
(
key
,
"replaygain_album_peak"
)
==
0
)
{
replay_gain_info
->
albumPeak
=
atof
(
value
);
replay_gain_info
->
albumPeak
=
atof
(
value
);
found
=
1
;
found
=
true
;
}
}
free
(
key
);
free
(
key
);
...
@@ -989,7 +989,6 @@ mp3_read(struct mp3_data *data, ReplayGainInfo **replay_gain_info_r)
...
@@ -989,7 +989,6 @@ mp3_read(struct mp3_data *data, ReplayGainInfo **replay_gain_info_r)
{
{
struct
decoder
*
decoder
=
data
->
decoder
;
struct
decoder
*
decoder
=
data
->
decoder
;
int
ret
;
int
ret
;
int
skip
;
enum
decoder_command
cmd
;
enum
decoder_command
cmd
;
mp3_update_timer_next_frame
(
data
);
mp3_update_timer_next_frame
(
data
);
...
@@ -1031,7 +1030,8 @@ mp3_read(struct mp3_data *data, ReplayGainInfo **replay_gain_info_r)
...
@@ -1031,7 +1030,8 @@ mp3_read(struct mp3_data *data, ReplayGainInfo **replay_gain_info_r)
}
}
while
(
true
)
{
while
(
true
)
{
skip
=
0
;
bool
skip
=
false
;
while
((
ret
=
while
((
ret
=
decode_next_frame_header
(
data
,
NULL
,
decode_next_frame_header
(
data
,
NULL
,
replay_gain_info_r
))
==
DECODE_CONT
replay_gain_info_r
))
==
DECODE_CONT
...
@@ -1039,7 +1039,7 @@ mp3_read(struct mp3_data *data, ReplayGainInfo **replay_gain_info_r)
...
@@ -1039,7 +1039,7 @@ mp3_read(struct mp3_data *data, ReplayGainInfo **replay_gain_info_r)
if
(
ret
==
DECODE_BREAK
||
decoder_get_command
(
decoder
)
!=
DECODE_COMMAND_NONE
)
if
(
ret
==
DECODE_BREAK
||
decoder_get_command
(
decoder
)
!=
DECODE_COMMAND_NONE
)
return
false
;
return
false
;
else
if
(
ret
==
DECODE_SKIP
)
else
if
(
ret
==
DECODE_SKIP
)
skip
=
1
;
skip
=
true
;
if
(
data
->
mute_frame
==
MUTEFRAME_NONE
)
{
if
(
data
->
mute_frame
==
MUTEFRAME_NONE
)
{
while
((
ret
=
decodeNextFrame
(
data
))
==
DECODE_CONT
&&
while
((
ret
=
decodeNextFrame
(
data
))
==
DECODE_CONT
&&
decoder_get_command
(
decoder
)
==
DECODE_COMMAND_NONE
)
;
decoder_get_command
(
decoder
)
==
DECODE_COMMAND_NONE
)
;
...
@@ -1061,7 +1061,7 @@ static void mp3_audio_format(struct mp3_data *data, struct audio_format *af)
...
@@ -1061,7 +1061,7 @@ static void mp3_audio_format(struct mp3_data *data, struct audio_format *af)
af
->
channels
=
MAD_NCHANNELS
(
&
(
data
->
frame
).
header
);
af
->
channels
=
MAD_NCHANNELS
(
&
(
data
->
frame
).
header
);
}
}
static
int
static
bool
mp3_decode
(
struct
decoder
*
decoder
,
struct
input_stream
*
input_stream
)
mp3_decode
(
struct
decoder
*
decoder
,
struct
input_stream
*
input_stream
)
{
{
struct
mp3_data
data
;
struct
mp3_data
data
;
...
@@ -1073,9 +1073,9 @@ mp3_decode(struct decoder *decoder, struct input_stream *input_stream)
...
@@ -1073,9 +1073,9 @@ mp3_decode(struct decoder *decoder, struct input_stream *input_stream)
if
(
decoder_get_command
(
decoder
)
==
DECODE_COMMAND_NONE
)
{
if
(
decoder_get_command
(
decoder
)
==
DECODE_COMMAND_NONE
)
{
ERROR
ERROR
(
"Input does not appear to be a mp3 bit stream.
\n
"
);
(
"Input does not appear to be a mp3 bit stream.
\n
"
);
return
-
1
;
return
false
;
}
}
return
0
;
return
true
;
}
}
mp3_audio_format
(
&
data
,
&
audio_format
);
mp3_audio_format
(
&
data
,
&
audio_format
);
...
@@ -1120,7 +1120,7 @@ mp3_decode(struct decoder *decoder, struct input_stream *input_stream)
...
@@ -1120,7 +1120,7 @@ mp3_decode(struct decoder *decoder, struct input_stream *input_stream)
decoder_command_finished
(
decoder
);
decoder_command_finished
(
decoder
);
mp3_data_finish
(
&
data
);
mp3_data_finish
(
&
data
);
return
0
;
return
true
;
}
}
static
struct
tag
*
mp3_tag_dup
(
char
*
file
)
static
struct
tag
*
mp3_tag_dup
(
char
*
file
)
...
...
src/decoder/mp4_plugin.c
View file @
62d4fa93
...
@@ -79,7 +79,7 @@ static uint32_t mp4_inputStreamSeekCallback(void *inStream, uint64_t position)
...
@@ -79,7 +79,7 @@ static uint32_t mp4_inputStreamSeekCallback(void *inStream, uint64_t position)
?
0
:
-
1
;
?
0
:
-
1
;
}
}
static
int
static
bool
mp4_decode
(
struct
decoder
*
mpd_decoder
,
struct
input_stream
*
inStream
)
mp4_decode
(
struct
decoder
*
mpd_decoder
,
struct
input_stream
*
inStream
)
{
{
mp4ff_t
*
mp4fh
;
mp4ff_t
*
mp4fh
;
...
@@ -120,7 +120,7 @@ mp4_decode(struct decoder *mpd_decoder, struct input_stream *inStream)
...
@@ -120,7 +120,7 @@ mp4_decode(struct decoder *mpd_decoder, struct input_stream *inStream)
if
(
!
mp4fh
)
{
if
(
!
mp4fh
)
{
ERROR
(
"Input does not appear to be a mp4 stream.
\n
"
);
ERROR
(
"Input does not appear to be a mp4 stream.
\n
"
);
free
(
mp4cb
);
free
(
mp4cb
);
return
-
1
;
return
false
;
}
}
track
=
mp4_getAACTrack
(
mp4fh
);
track
=
mp4_getAACTrack
(
mp4fh
);
...
@@ -128,7 +128,7 @@ mp4_decode(struct decoder *mpd_decoder, struct input_stream *inStream)
...
@@ -128,7 +128,7 @@ mp4_decode(struct decoder *mpd_decoder, struct input_stream *inStream)
ERROR
(
"No AAC track found in mp4 stream.
\n
"
);
ERROR
(
"No AAC track found in mp4 stream.
\n
"
);
mp4ff_close
(
mp4fh
);
mp4ff_close
(
mp4fh
);
free
(
mp4cb
);
free
(
mp4cb
);
return
-
1
;
return
false
;
}
}
decoder
=
faacDecOpen
();
decoder
=
faacDecOpen
();
...
@@ -155,7 +155,7 @@ mp4_decode(struct decoder *mpd_decoder, struct input_stream *inStream)
...
@@ -155,7 +155,7 @@ mp4_decode(struct decoder *mpd_decoder, struct input_stream *inStream)
faacDecClose
(
decoder
);
faacDecClose
(
decoder
);
mp4ff_close
(
mp4fh
);
mp4ff_close
(
mp4fh
);
free
(
mp4cb
);
free
(
mp4cb
);
return
-
1
;
return
false
;
}
}
audio_format
.
sample_rate
=
sample_rate
;
audio_format
.
sample_rate
=
sample_rate
;
...
@@ -171,7 +171,7 @@ mp4_decode(struct decoder *mpd_decoder, struct input_stream *inStream)
...
@@ -171,7 +171,7 @@ mp4_decode(struct decoder *mpd_decoder, struct input_stream *inStream)
faacDecClose
(
decoder
);
faacDecClose
(
decoder
);
mp4ff_close
(
mp4fh
);
mp4ff_close
(
mp4fh
);
free
(
mp4cb
);
free
(
mp4cb
);
return
-
1
;
return
false
;
}
}
total_time
=
((
float
)
file_time
)
/
scale
;
total_time
=
((
float
)
file_time
)
/
scale
;
...
@@ -181,7 +181,7 @@ mp4_decode(struct decoder *mpd_decoder, struct input_stream *inStream)
...
@@ -181,7 +181,7 @@ mp4_decode(struct decoder *mpd_decoder, struct input_stream *inStream)
faacDecClose
(
decoder
);
faacDecClose
(
decoder
);
mp4ff_close
(
mp4fh
);
mp4ff_close
(
mp4fh
);
free
(
mp4cb
);
free
(
mp4cb
);
return
-
1
;
return
false
;
}
}
file_time
=
0
.
0
;
file_time
=
0
.
0
;
...
@@ -293,12 +293,12 @@ mp4_decode(struct decoder *mpd_decoder, struct input_stream *inStream)
...
@@ -293,12 +293,12 @@ mp4_decode(struct decoder *mpd_decoder, struct input_stream *inStream)
free
(
mp4cb
);
free
(
mp4cb
);
if
(
!
initialized
)
if
(
!
initialized
)
return
-
1
;
return
false
;
if
(
decoder_get_command
(
mpd_decoder
)
==
DECODE_COMMAND_SEEK
&&
seeking
)
if
(
decoder_get_command
(
mpd_decoder
)
==
DECODE_COMMAND_SEEK
&&
seeking
)
decoder_command_finished
(
mpd_decoder
);
decoder_command_finished
(
mpd_decoder
);
return
0
;
return
true
;
}
}
static
struct
tag
*
mp4DataDup
(
char
*
file
,
int
*
mp4MetadataFound
)
static
struct
tag
*
mp4DataDup
(
char
*
file
,
int
*
mp4MetadataFound
)
...
...
src/decoder/mpc_plugin.c
View file @
62d4fa93
...
@@ -94,7 +94,7 @@ static inline int16_t convertSample(MPC_SAMPLE_FORMAT sample)
...
@@ -94,7 +94,7 @@ static inline int16_t convertSample(MPC_SAMPLE_FORMAT sample)
return
val
;
return
val
;
}
}
static
int
static
bool
mpc_decode
(
struct
decoder
*
mpd_decoder
,
struct
input_stream
*
inStream
)
mpc_decode
(
struct
decoder
*
mpd_decoder
,
struct
input_stream
*
inStream
)
{
{
mpc_decoder
decoder
;
mpc_decoder
decoder
;
...
@@ -106,7 +106,7 @@ mpc_decode(struct decoder *mpd_decoder, struct input_stream *inStream)
...
@@ -106,7 +106,7 @@ mpc_decode(struct decoder *mpd_decoder, struct input_stream *inStream)
MPC_SAMPLE_FORMAT
sample_buffer
[
MPC_DECODER_BUFFER_LENGTH
];
MPC_SAMPLE_FORMAT
sample_buffer
[
MPC_DECODER_BUFFER_LENGTH
];
int
eof
=
0
;
bool
eof
=
false
;
long
ret
;
long
ret
;
#define MPC_CHUNK_SIZE 4096
#define MPC_CHUNK_SIZE 4096
char
chunk
[
MPC_CHUNK_SIZE
];
char
chunk
[
MPC_CHUNK_SIZE
];
...
@@ -135,9 +135,9 @@ mpc_decode(struct decoder *mpd_decoder, struct input_stream *inStream)
...
@@ -135,9 +135,9 @@ mpc_decode(struct decoder *mpd_decoder, struct input_stream *inStream)
if
((
ret
=
mpc_streaminfo_read
(
&
info
,
&
reader
))
!=
ERROR_CODE_OK
)
{
if
((
ret
=
mpc_streaminfo_read
(
&
info
,
&
reader
))
!=
ERROR_CODE_OK
)
{
if
(
decoder_get_command
(
mpd_decoder
)
!=
DECODE_COMMAND_STOP
)
{
if
(
decoder_get_command
(
mpd_decoder
)
!=
DECODE_COMMAND_STOP
)
{
ERROR
(
"Not a valid musepack stream
\n
"
);
ERROR
(
"Not a valid musepack stream
\n
"
);
return
-
1
;
return
false
;
}
}
return
0
;
return
true
;
}
}
mpc_decoder_setup
(
&
decoder
,
&
reader
);
mpc_decoder_setup
(
&
decoder
,
&
reader
);
...
@@ -145,9 +145,9 @@ mpc_decode(struct decoder *mpd_decoder, struct input_stream *inStream)
...
@@ -145,9 +145,9 @@ mpc_decode(struct decoder *mpd_decoder, struct input_stream *inStream)
if
(
!
mpc_decoder_initialize
(
&
decoder
,
&
info
))
{
if
(
!
mpc_decoder_initialize
(
&
decoder
,
&
info
))
{
if
(
decoder_get_command
(
mpd_decoder
)
!=
DECODE_COMMAND_STOP
)
{
if
(
decoder_get_command
(
mpd_decoder
)
!=
DECODE_COMMAND_STOP
)
{
ERROR
(
"Not a valid musepack stream
\n
"
);
ERROR
(
"Not a valid musepack stream
\n
"
);
return
-
1
;
return
false
;
}
}
return
0
;
return
true
;
}
}
audio_format
.
bits
=
16
;
audio_format
.
bits
=
16
;
...
@@ -181,7 +181,7 @@ mpc_decode(struct decoder *mpd_decoder, struct input_stream *inStream)
...
@@ -181,7 +181,7 @@ mpc_decode(struct decoder *mpd_decoder, struct input_stream *inStream)
&
vbrUpdateAcc
,
&
vbrUpdateBits
);
&
vbrUpdateAcc
,
&
vbrUpdateBits
);
if
(
ret
<=
0
||
decoder_get_command
(
mpd_decoder
)
==
DECODE_COMMAND_STOP
)
{
if
(
ret
<=
0
||
decoder_get_command
(
mpd_decoder
)
==
DECODE_COMMAND_STOP
)
{
eof
=
1
;
eof
=
true
;
break
;
break
;
}
}
...
@@ -212,7 +212,7 @@ mpc_decode(struct decoder *mpd_decoder, struct input_stream *inStream)
...
@@ -212,7 +212,7 @@ mpc_decode(struct decoder *mpd_decoder, struct input_stream *inStream)
chunkpos
=
0
;
chunkpos
=
0
;
s16
=
(
int16_t
*
)
chunk
;
s16
=
(
int16_t
*
)
chunk
;
if
(
decoder_get_command
(
mpd_decoder
)
==
DECODE_COMMAND_STOP
)
{
if
(
decoder_get_command
(
mpd_decoder
)
==
DECODE_COMMAND_STOP
)
{
eof
=
1
;
eof
=
true
;
break
;
break
;
}
}
}
}
...
@@ -233,7 +233,7 @@ mpc_decode(struct decoder *mpd_decoder, struct input_stream *inStream)
...
@@ -233,7 +233,7 @@ mpc_decode(struct decoder *mpd_decoder, struct input_stream *inStream)
freeReplayGainInfo
(
replayGainInfo
);
freeReplayGainInfo
(
replayGainInfo
);
return
0
;
return
true
;
}
}
static
float
mpcGetTime
(
char
*
file
)
static
float
mpcGetTime
(
char
*
file
)
...
...
src/decoder/oggflac_plugin.c
View file @
62d4fa93
...
@@ -304,7 +304,7 @@ static int oggflac_decode(struct decoder * mpd_decoder, InputStream * inStream)
...
@@ -304,7 +304,7 @@ static int oggflac_decode(struct decoder * mpd_decoder, InputStream * inStream)
decoder_initialized
(
mpd_decoder
,
&
data
.
audio_format
,
data
.
total_time
);
decoder_initialized
(
mpd_decoder
,
&
data
.
audio_format
,
data
.
total_time
);
while
(
1
)
{
while
(
true
)
{
OggFLAC__seekable_stream_decoder_process_single
(
decoder
);
OggFLAC__seekable_stream_decoder_process_single
(
decoder
);
if
(
OggFLAC__seekable_stream_decoder_get_state
(
decoder
)
!=
if
(
OggFLAC__seekable_stream_decoder_get_state
(
decoder
)
!=
OggFLAC__SEEKABLE_STREAM_DECODER_OK
)
{
OggFLAC__SEEKABLE_STREAM_DECODER_OK
)
{
...
...
src/decoder/oggvorbis_plugin.c
View file @
62d4fa93
...
@@ -96,7 +96,7 @@ static const char *ogg_parseComment(const char *comment, const char *needle)
...
@@ -96,7 +96,7 @@ static const char *ogg_parseComment(const char *comment, const char *needle)
static
void
ogg_getReplayGainInfo
(
char
**
comments
,
ReplayGainInfo
**
infoPtr
)
static
void
ogg_getReplayGainInfo
(
char
**
comments
,
ReplayGainInfo
**
infoPtr
)
{
{
const
char
*
temp
;
const
char
*
temp
;
int
found
=
0
;
bool
found
=
false
;
if
(
*
infoPtr
)
if
(
*
infoPtr
)
freeReplayGainInfo
(
*
infoPtr
);
freeReplayGainInfo
(
*
infoPtr
);
...
@@ -106,19 +106,19 @@ static void ogg_getReplayGainInfo(char **comments, ReplayGainInfo ** infoPtr)
...
@@ -106,19 +106,19 @@ static void ogg_getReplayGainInfo(char **comments, ReplayGainInfo ** infoPtr)
if
((
temp
=
if
((
temp
=
ogg_parseComment
(
*
comments
,
"replaygain_track_gain"
)))
{
ogg_parseComment
(
*
comments
,
"replaygain_track_gain"
)))
{
(
*
infoPtr
)
->
trackGain
=
atof
(
temp
);
(
*
infoPtr
)
->
trackGain
=
atof
(
temp
);
found
=
1
;
found
=
true
;
}
else
if
((
temp
=
ogg_parseComment
(
*
comments
,
}
else
if
((
temp
=
ogg_parseComment
(
*
comments
,
"replaygain_album_gain"
)))
{
"replaygain_album_gain"
)))
{
(
*
infoPtr
)
->
albumGain
=
atof
(
temp
);
(
*
infoPtr
)
->
albumGain
=
atof
(
temp
);
found
=
1
;
found
=
true
;
}
else
if
((
temp
=
ogg_parseComment
(
*
comments
,
}
else
if
((
temp
=
ogg_parseComment
(
*
comments
,
"replaygain_track_peak"
)))
{
"replaygain_track_peak"
)))
{
(
*
infoPtr
)
->
trackPeak
=
atof
(
temp
);
(
*
infoPtr
)
->
trackPeak
=
atof
(
temp
);
found
=
1
;
found
=
true
;
}
else
if
((
temp
=
ogg_parseComment
(
*
comments
,
}
else
if
((
temp
=
ogg_parseComment
(
*
comments
,
"replaygain_album_peak"
)))
{
"replaygain_album_peak"
)))
{
(
*
infoPtr
)
->
albumPeak
=
atof
(
temp
);
(
*
infoPtr
)
->
albumPeak
=
atof
(
temp
);
found
=
1
;
found
=
true
;
}
}
comments
++
;
comments
++
;
...
@@ -200,7 +200,7 @@ static void putOggCommentsIntoOutputBuffer(char *streamName,
...
@@ -200,7 +200,7 @@ static void putOggCommentsIntoOutputBuffer(char *streamName,
}
}
/* public */
/* public */
static
int
static
bool
oggvorbis_decode
(
struct
decoder
*
decoder
,
struct
input_stream
*
inStream
)
oggvorbis_decode
(
struct
decoder
*
decoder
,
struct
input_stream
*
inStream
)
{
{
OggVorbis_File
vf
;
OggVorbis_File
vf
;
...
@@ -218,7 +218,7 @@ oggvorbis_decode(struct decoder *decoder, struct input_stream *inStream)
...
@@ -218,7 +218,7 @@ oggvorbis_decode(struct decoder *decoder, struct input_stream *inStream)
ReplayGainInfo
*
replayGainInfo
=
NULL
;
ReplayGainInfo
*
replayGainInfo
=
NULL
;
char
**
comments
;
char
**
comments
;
const
char
*
errorStr
;
const
char
*
errorStr
;
int
initialized
=
0
;
bool
initialized
=
false
;
data
.
inStream
=
inStream
;
data
.
inStream
=
inStream
;
data
.
decoder
=
decoder
;
data
.
decoder
=
decoder
;
...
@@ -229,7 +229,7 @@ oggvorbis_decode(struct decoder *decoder, struct input_stream *inStream)
...
@@ -229,7 +229,7 @@ oggvorbis_decode(struct decoder *decoder, struct input_stream *inStream)
callbacks
.
tell_func
=
ogg_tell_cb
;
callbacks
.
tell_func
=
ogg_tell_cb
;
if
((
ret
=
ov_open_callbacks
(
&
data
,
&
vf
,
NULL
,
0
,
callbacks
))
<
0
)
{
if
((
ret
=
ov_open_callbacks
(
&
data
,
&
vf
,
NULL
,
0
,
callbacks
))
<
0
)
{
if
(
decoder_get_command
(
decoder
)
!=
DECODE_COMMAND_NONE
)
if
(
decoder_get_command
(
decoder
)
!=
DECODE_COMMAND_NONE
)
return
0
;
return
true
;
switch
(
ret
)
{
switch
(
ret
)
{
case
OV_EREAD
:
case
OV_EREAD
:
...
@@ -253,11 +253,11 @@ oggvorbis_decode(struct decoder *decoder, struct input_stream *inStream)
...
@@ -253,11 +253,11 @@ oggvorbis_decode(struct decoder *decoder, struct input_stream *inStream)
}
}
ERROR
(
"Error decoding Ogg Vorbis stream: %s
\n
"
,
ERROR
(
"Error decoding Ogg Vorbis stream: %s
\n
"
,
errorStr
);
errorStr
);
return
-
1
;
return
false
;
}
}
audio_format
.
bits
=
16
;
audio_format
.
bits
=
16
;
while
(
1
)
{
while
(
true
)
{
if
(
decoder_get_command
(
decoder
)
==
DECODE_COMMAND_SEEK
)
{
if
(
decoder_get_command
(
decoder
)
==
DECODE_COMMAND_SEEK
)
{
double
seek_where
=
decoder_seek_where
(
decoder
);
double
seek_where
=
decoder_seek_where
(
decoder
);
if
(
0
==
ov_time_seek_page
(
&
vf
,
seek_where
))
{
if
(
0
==
ov_time_seek_page
(
&
vf
,
seek_where
))
{
...
@@ -280,7 +280,7 @@ oggvorbis_decode(struct decoder *decoder, struct input_stream *inStream)
...
@@ -280,7 +280,7 @@ oggvorbis_decode(struct decoder *decoder, struct input_stream *inStream)
total_time
=
0
;
total_time
=
0
;
decoder_initialized
(
decoder
,
&
audio_format
,
decoder_initialized
(
decoder
,
&
audio_format
,
total_time
);
total_time
);
initialized
=
1
;
initialized
=
true
;
}
}
comments
=
ov_comment
(
&
vf
,
-
1
)
->
user_comments
;
comments
=
ov_comment
(
&
vf
,
-
1
)
->
user_comments
;
putOggCommentsIntoOutputBuffer
(
inStream
->
meta_name
,
putOggCommentsIntoOutputBuffer
(
inStream
->
meta_name
,
...
@@ -326,7 +326,7 @@ oggvorbis_decode(struct decoder *decoder, struct input_stream *inStream)
...
@@ -326,7 +326,7 @@ oggvorbis_decode(struct decoder *decoder, struct input_stream *inStream)
freeReplayGainInfo
(
replayGainInfo
);
freeReplayGainInfo
(
replayGainInfo
);
ov_clear
(
&
vf
);
ov_clear
(
&
vf
);
return
0
;
return
true
;
}
}
static
struct
tag
*
oggvorbis_TagDup
(
char
*
file
)
static
struct
tag
*
oggvorbis_TagDup
(
char
*
file
)
...
...
src/decoder/wavpack_plugin.c
View file @
62d4fa93
...
@@ -232,7 +232,7 @@ static ReplayGainInfo *wavpack_replaygain(WavpackContext *wpc)
...
@@ -232,7 +232,7 @@ static ReplayGainInfo *wavpack_replaygain(WavpackContext *wpc)
static
char
replaygain_track_peak
[]
=
"replaygain_track_peak"
;
static
char
replaygain_track_peak
[]
=
"replaygain_track_peak"
;
static
char
replaygain_album_peak
[]
=
"replaygain_album_peak"
;
static
char
replaygain_album_peak
[]
=
"replaygain_album_peak"
;
ReplayGainInfo
*
replayGainInfo
;
ReplayGainInfo
*
replayGainInfo
;
int
found
=
0
;
bool
found
=
false
;
char
*
value
;
char
*
value
;
replayGainInfo
=
newReplayGainInfo
();
replayGainInfo
=
newReplayGainInfo
();
...
@@ -241,28 +241,28 @@ static ReplayGainInfo *wavpack_replaygain(WavpackContext *wpc)
...
@@ -241,28 +241,28 @@ static ReplayGainInfo *wavpack_replaygain(WavpackContext *wpc)
if
(
value
)
{
if
(
value
)
{
replayGainInfo
->
trackGain
=
atof
(
value
);
replayGainInfo
->
trackGain
=
atof
(
value
);
free
(
value
);
free
(
value
);
found
=
1
;
found
=
true
;
}
}
value
=
wavpack_tag
(
wpc
,
replaygain_album_gain
);
value
=
wavpack_tag
(
wpc
,
replaygain_album_gain
);
if
(
value
)
{
if
(
value
)
{
replayGainInfo
->
albumGain
=
atof
(
value
);
replayGainInfo
->
albumGain
=
atof
(
value
);
free
(
value
);
free
(
value
);
found
=
1
;
found
=
true
;
}
}
value
=
wavpack_tag
(
wpc
,
replaygain_track_peak
);
value
=
wavpack_tag
(
wpc
,
replaygain_track_peak
);
if
(
value
)
{
if
(
value
)
{
replayGainInfo
->
trackPeak
=
atof
(
value
);
replayGainInfo
->
trackPeak
=
atof
(
value
);
free
(
value
);
free
(
value
);
found
=
1
;
found
=
true
;
}
}
value
=
wavpack_tag
(
wpc
,
replaygain_album_peak
);
value
=
wavpack_tag
(
wpc
,
replaygain_album_peak
);
if
(
value
)
{
if
(
value
)
{
replayGainInfo
->
albumPeak
=
atof
(
value
);
replayGainInfo
->
albumPeak
=
atof
(
value
);
free
(
value
);
free
(
value
);
found
=
1
;
found
=
true
;
}
}
...
@@ -496,7 +496,7 @@ static int wavpack_open_wvc(struct decoder *decoder,
...
@@ -496,7 +496,7 @@ static int wavpack_open_wvc(struct decoder *decoder,
/*
/*
* Decodes a stream.
* Decodes a stream.
*/
*/
static
int
static
bool
wavpack_streamdecode
(
struct
decoder
*
decoder
,
struct
input_stream
*
is
)
wavpack_streamdecode
(
struct
decoder
*
decoder
,
struct
input_stream
*
is
)
{
{
char
error
[
ERRORLEN
];
char
error
[
ERRORLEN
];
...
@@ -516,7 +516,7 @@ wavpack_streamdecode(struct decoder * decoder, struct input_stream *is)
...
@@ -516,7 +516,7 @@ wavpack_streamdecode(struct decoder * decoder, struct input_stream *is)
if
(
wpc
==
NULL
)
{
if
(
wpc
==
NULL
)
{
ERROR
(
"failed to open WavPack stream: %s
\n
"
,
error
);
ERROR
(
"failed to open WavPack stream: %s
\n
"
,
error
);
return
-
1
;
return
false
;
}
}
wavpack_decode
(
decoder
,
wpc
,
can_seek
(
&
isp
),
NULL
);
wavpack_decode
(
decoder
,
wpc
,
can_seek
(
&
isp
),
NULL
);
...
@@ -526,13 +526,14 @@ wavpack_streamdecode(struct decoder * decoder, struct input_stream *is)
...
@@ -526,13 +526,14 @@ wavpack_streamdecode(struct decoder * decoder, struct input_stream *is)
input_stream_close
(
&
is_wvc
);
input_stream_close
(
&
is_wvc
);
input_stream_close
(
is
);
input_stream_close
(
is
);
return
0
;
return
true
;
}
}
/*
/*
* Decodes a file.
* Decodes a file.
*/
*/
static
int
wavpack_filedecode
(
struct
decoder
*
decoder
,
char
*
fname
)
static
bool
wavpack_filedecode
(
struct
decoder
*
decoder
,
char
*
fname
)
{
{
char
error
[
ERRORLEN
];
char
error
[
ERRORLEN
];
WavpackContext
*
wpc
;
WavpackContext
*
wpc
;
...
@@ -543,7 +544,7 @@ static int wavpack_filedecode(struct decoder * decoder, char *fname)
...
@@ -543,7 +544,7 @@ static int wavpack_filedecode(struct decoder * decoder, char *fname)
OPEN_2CH_MAX
|
OPEN_NORMALIZE
,
15
);
OPEN_2CH_MAX
|
OPEN_NORMALIZE
,
15
);
if
(
wpc
==
NULL
)
{
if
(
wpc
==
NULL
)
{
ERROR
(
"failed to open WavPack file
\"
%s
\"
: %s
\n
"
,
fname
,
error
);
ERROR
(
"failed to open WavPack file
\"
%s
\"
: %s
\n
"
,
fname
,
error
);
return
-
1
;
return
false
;
}
}
replayGainInfo
=
wavpack_replaygain
(
wpc
);
replayGainInfo
=
wavpack_replaygain
(
wpc
);
...
@@ -555,7 +556,7 @@ static int wavpack_filedecode(struct decoder * decoder, char *fname)
...
@@ -555,7 +556,7 @@ static int wavpack_filedecode(struct decoder * decoder, char *fname)
WavpackCloseFile
(
wpc
);
WavpackCloseFile
(
wpc
);
return
0
;
return
true
;
}
}
static
char
const
*
wavpackSuffixes
[]
=
{
"wv"
,
NULL
};
static
char
const
*
wavpackSuffixes
[]
=
{
"wv"
,
NULL
};
...
...
src/decoder_api.c
View file @
62d4fa93
...
@@ -96,7 +96,7 @@ void decoder_seek_error(struct decoder * decoder)
...
@@ -96,7 +96,7 @@ void decoder_seek_error(struct decoder * decoder)
{
{
assert
(
dc
.
command
==
DECODE_COMMAND_SEEK
);
assert
(
dc
.
command
==
DECODE_COMMAND_SEEK
);
dc
.
seekError
=
1
;
dc
.
seekError
=
true
;
decoder_command_finished
(
decoder
);
decoder_command_finished
(
decoder
);
}
}
...
@@ -109,7 +109,7 @@ size_t decoder_read(struct decoder *decoder,
...
@@ -109,7 +109,7 @@ size_t decoder_read(struct decoder *decoder,
assert
(
inStream
!=
NULL
);
assert
(
inStream
!=
NULL
);
assert
(
buffer
!=
NULL
);
assert
(
buffer
!=
NULL
);
while
(
1
)
{
while
(
true
)
{
/* XXX don't allow decoder==NULL */
/* XXX don't allow decoder==NULL */
if
(
decoder
!=
NULL
&&
if
(
decoder
!=
NULL
&&
(
dc
.
command
!=
DECODE_COMMAND_SEEK
||
(
dc
.
command
!=
DECODE_COMMAND_SEEK
||
...
...
src/decoder_api.h
View file @
62d4fa93
...
@@ -58,7 +58,7 @@ struct decoder_plugin {
...
@@ -58,7 +58,7 @@ struct decoder_plugin {
* have/need one this must return < 0 if there is an error and
* have/need one this must return < 0 if there is an error and
* >= 0 otherwise
* >= 0 otherwise
*/
*/
int
(
*
init
)(
void
);
bool
(
*
init
)(
void
);
/**
/**
* optional, set this to NULL if the InputPlugin doesn't have/need one
* optional, set this to NULL if the InputPlugin doesn't have/need one
...
@@ -75,9 +75,9 @@ struct decoder_plugin {
...
@@ -75,9 +75,9 @@ struct decoder_plugin {
* this will be used to decode InputStreams, and is
* this will be used to decode InputStreams, and is
* recommended for files and networked (HTTP) connections.
* recommended for files and networked (HTTP) connections.
*
*
* returns
-1 on error, 0
on success
* returns
false on error, true
on success
*/
*/
int
(
*
stream_decode
)(
struct
decoder
*
,
struct
input_stream
*
);
bool
(
*
stream_decode
)(
struct
decoder
*
,
struct
input_stream
*
);
/**
/**
* use this if and only if your InputPlugin can only be passed
* use this if and only if your InputPlugin can only be passed
...
@@ -86,7 +86,7 @@ struct decoder_plugin {
...
@@ -86,7 +86,7 @@ struct decoder_plugin {
*
*
* returns -1 on error, 0 on success
* returns -1 on error, 0 on success
*/
*/
int
(
*
file_decode
)(
struct
decoder
*
,
char
*
path
);
bool
(
*
file_decode
)(
struct
decoder
*
,
char
*
path
);
/**
/**
* file should be the full path! Returns NULL if a tag cannot
* file should be the full path! Returns NULL if a tag cannot
...
...
src/decoder_control.c
View file @
62d4fa93
...
@@ -85,20 +85,20 @@ dc_stop(struct notify *notify)
...
@@ -85,20 +85,20 @@ dc_stop(struct notify *notify)
dc_command
(
notify
,
DECODE_COMMAND_STOP
);
dc_command
(
notify
,
DECODE_COMMAND_STOP
);
}
}
int
bool
dc_seek
(
struct
notify
*
notify
,
double
where
)
dc_seek
(
struct
notify
*
notify
,
double
where
)
{
{
assert
(
where
>=
0
.
0
);
assert
(
where
>=
0
.
0
);
if
(
dc
.
state
==
DECODE_STATE_STOP
||
!
dc
.
seekable
)
if
(
dc
.
state
==
DECODE_STATE_STOP
||
!
dc
.
seekable
)
return
-
1
;
return
false
;
dc
.
seekWhere
=
where
;
dc
.
seekWhere
=
where
;
dc
.
seekError
=
0
;
dc
.
seekError
=
false
;
dc_command
(
notify
,
DECODE_COMMAND_SEEK
);
dc_command
(
notify
,
DECODE_COMMAND_SEEK
);
if
(
dc
.
seekError
)
if
(
dc
.
seekError
)
return
-
1
;
return
false
;
return
0
;
return
true
;
}
}
src/decoder_control.h
View file @
62d4fa93
...
@@ -44,8 +44,8 @@ struct decoder_control {
...
@@ -44,8 +44,8 @@ struct decoder_control {
volatile
enum
decoder_state
state
;
volatile
enum
decoder_state
state
;
volatile
enum
decoder_command
command
;
volatile
enum
decoder_command
command
;
volatile
uint16_t
error
;
volatile
uint16_t
error
;
volatile
int8_t
seekError
;
bool
seekError
;
volatile
int8_t
seekable
;
bool
seekable
;
volatile
double
seekWhere
;
volatile
double
seekWhere
;
struct
audio_format
audioFormat
;
struct
audio_format
audioFormat
;
struct
song
*
current_song
;
struct
song
*
current_song
;
...
@@ -59,13 +59,13 @@ void dc_init(void);
...
@@ -59,13 +59,13 @@ void dc_init(void);
void
dc_deinit
(
void
);
void
dc_deinit
(
void
);
static
inline
int
decoder_is_idle
(
void
)
static
inline
bool
decoder_is_idle
(
void
)
{
{
return
dc
.
state
==
DECODE_STATE_STOP
&&
return
dc
.
state
==
DECODE_STATE_STOP
&&
dc
.
command
!=
DECODE_COMMAND_START
;
dc
.
command
!=
DECODE_COMMAND_START
;
}
}
static
inline
int
decoder_is_starting
(
void
)
static
inline
bool
decoder_is_starting
(
void
)
{
{
return
dc
.
command
==
DECODE_COMMAND_START
||
return
dc
.
command
==
DECODE_COMMAND_START
||
dc
.
state
==
DECODE_STATE_START
;
dc
.
state
==
DECODE_STATE_START
;
...
@@ -93,7 +93,7 @@ dc_start_async(struct song *song);
...
@@ -93,7 +93,7 @@ dc_start_async(struct song *song);
void
void
dc_stop
(
struct
notify
*
notify
);
dc_stop
(
struct
notify
*
notify
);
int
bool
dc_seek
(
struct
notify
*
notify
,
double
where
);
dc_seek
(
struct
notify
*
notify
,
double
where
);
#endif
#endif
src/decoder_list.c
View file @
62d4fa93
...
@@ -41,7 +41,7 @@ void decoder_plugin_load(struct decoder_plugin * inputPlugin)
...
@@ -41,7 +41,7 @@ void decoder_plugin_load(struct decoder_plugin * inputPlugin)
if
(
!
inputPlugin
->
name
)
if
(
!
inputPlugin
->
name
)
return
;
return
;
if
(
inputPlugin
->
init
!=
NULL
&&
inputPlugin
->
init
()
<
0
)
if
(
inputPlugin
->
init
!=
NULL
&&
!
inputPlugin
->
init
()
)
return
;
return
;
insertInList
(
inputPlugin_list
,
inputPlugin
->
name
,
(
void
*
)
inputPlugin
);
insertInList
(
inputPlugin_list
,
inputPlugin
->
name
,
(
void
*
)
inputPlugin
);
...
...
src/decoder_thread.c
View file @
62d4fa93
...
@@ -73,12 +73,12 @@ static void decodeStart(void)
...
@@ -73,12 +73,12 @@ static void decodeStart(void)
if
(
dc
.
command
==
DECODE_COMMAND_STOP
)
if
(
dc
.
command
==
DECODE_COMMAND_STOP
)
goto
stop
;
goto
stop
;
ret
=
DECODE_ERROR_UNKTYPE
;
ret
=
false
;
if
(
!
song_is_file
(
song
))
{
if
(
!
song_is_file
(
song
))
{
unsigned
int
next
=
0
;
unsigned
int
next
=
0
;
/* first we try mime types: */
/* first we try mime types: */
while
(
ret
&&
(
plugin
=
decoder_plugin_from_mime_type
(
inStream
.
mime
,
next
++
)))
{
while
((
plugin
=
decoder_plugin_from_mime_type
(
inStream
.
mime
,
next
++
)))
{
if
(
plugin
->
stream_decode
==
NULL
)
if
(
plugin
->
stream_decode
==
NULL
)
continue
;
continue
;
if
(
!
(
plugin
->
stream_types
&
INPUT_PLUGIN_STREAM_URL
))
if
(
!
(
plugin
->
stream_types
&
INPUT_PLUGIN_STREAM_URL
))
...
@@ -94,7 +94,7 @@ static void decodeStart(void)
...
@@ -94,7 +94,7 @@ static void decodeStart(void)
if
(
plugin
==
NULL
)
{
if
(
plugin
==
NULL
)
{
const
char
*
s
=
getSuffix
(
path_max_fs
);
const
char
*
s
=
getSuffix
(
path_max_fs
);
next
=
0
;
next
=
0
;
while
(
ret
&&
(
plugin
=
decoder_plugin_from_suffix
(
s
,
next
++
)))
{
while
((
plugin
=
decoder_plugin_from_suffix
(
s
,
next
++
)))
{
if
(
plugin
->
stream_decode
==
NULL
)
if
(
plugin
->
stream_decode
==
NULL
)
continue
;
continue
;
if
(
!
(
plugin
->
stream_types
&
if
(
!
(
plugin
->
stream_types
&
...
@@ -124,7 +124,7 @@ static void decodeStart(void)
...
@@ -124,7 +124,7 @@ static void decodeStart(void)
}
else
{
}
else
{
unsigned
int
next
=
0
;
unsigned
int
next
=
0
;
const
char
*
s
=
getSuffix
(
path_max_fs
);
const
char
*
s
=
getSuffix
(
path_max_fs
);
while
(
ret
&&
(
plugin
=
decoder_plugin_from_suffix
(
s
,
next
++
)))
{
while
((
plugin
=
decoder_plugin_from_suffix
(
s
,
next
++
)))
{
if
(
!
plugin
->
stream_types
&
INPUT_PLUGIN_STREAM_FILE
)
if
(
!
plugin
->
stream_types
&
INPUT_PLUGIN_STREAM_FILE
)
continue
;
continue
;
...
@@ -150,11 +150,10 @@ static void decodeStart(void)
...
@@ -150,11 +150,10 @@ static void decodeStart(void)
ob_flush
();
ob_flush
();
if
(
ret
<
0
||
ret
==
DECODE_ERROR_UNKTYPE
)
{
if
(
!
ret
)
{
if
(
ret
!=
DECODE_ERROR_UNKTYPE
)
dc
.
error
=
plugin
==
NULL
dc
.
error
=
DECODE_ERROR_FILE
;
?
DECODE_ERROR_UNKTYPE
else
:
DECODE_ERROR_FILE
;
dc
.
error
=
DECODE_ERROR_UNKTYPE
;
}
}
stop:
stop:
...
...
src/player_thread.c
View file @
62d4fa93
...
@@ -105,10 +105,10 @@ static int waitOnDecode(struct player *player)
...
@@ -105,10 +105,10 @@ static int waitOnDecode(struct player *player)
return
0
;
return
0
;
}
}
static
int
decodeSeek
(
struct
player
*
player
)
static
bool
decodeSeek
(
struct
player
*
player
)
{
{
int
ret
=
-
1
;
double
where
;
double
where
;
bool
ret
;
if
(
decoder_current_song
()
!=
pc
.
next_song
)
{
if
(
decoder_current_song
()
!=
pc
.
next_song
)
{
dc_stop
(
&
pc
.
notify
);
dc_stop
(
&
pc
.
notify
);
...
@@ -125,7 +125,7 @@ static int decodeSeek(struct player *player)
...
@@ -125,7 +125,7 @@ static int decodeSeek(struct player *player)
where
=
0
.
0
;
where
=
0
.
0
;
ret
=
dc_seek
(
&
pc
.
notify
,
where
);
ret
=
dc_seek
(
&
pc
.
notify
,
where
);
if
(
ret
==
0
)
if
(
ret
)
pc
.
elapsedTime
=
where
;
pc
.
elapsedTime
=
where
;
player_command_finished
();
player_command_finished
();
...
@@ -173,7 +173,7 @@ static void processDecodeInput(struct player *player)
...
@@ -173,7 +173,7 @@ static void processDecodeInput(struct player *player)
case
PLAYER_COMMAND_SEEK
:
case
PLAYER_COMMAND_SEEK
:
dropBufferedAudio
();
dropBufferedAudio
();
if
(
decodeSeek
(
player
)
==
0
)
{
if
(
decodeSeek
(
player
))
{
player
->
xfade
=
XFADE_UNKNOWN
;
player
->
xfade
=
XFADE_UNKNOWN
;
/* abort buffering when the user has requested
/* abort buffering when the user has requested
...
...
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