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
226d52b3
Commit
226d52b3
authored
Sep 29, 2008
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
switch to C99 types, part II
Do full C99 integer type conversion in all modules which were not touched by Eric's merged patch.
parent
0352766d
Show whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
82 additions
and
58 deletions
+82
-58
audioOutput_shout_mp3.c
src/audioOutputs/audioOutput_shout_mp3.c
+1
-1
audioOutput_shout_ogg.c
src/audioOutputs/audioOutput_shout_ogg.c
+1
-1
audio_format.h
src/audio_format.h
+3
-3
command.c
src/command.c
+3
-3
decoder_api.c
src/decoder_api.c
+1
-1
decoder_api.h
src/decoder_api.h
+1
-1
decoder_control.h
src/decoder_control.h
+3
-3
_flac_common.c
src/inputPlugins/_flac_common.c
+2
-2
audiofile_plugin.c
src/inputPlugins/audiofile_plugin.c
+4
-4
mpc_plugin.c
src/inputPlugins/mpc_plugin.c
+5
-5
mpd_types.h
src/mpd_types.h
+37
-12
outputBuffer.c
src/outputBuffer.c
+2
-2
outputBuffer.h
src/outputBuffer.h
+3
-4
player_control.h
src/player_control.h
+7
-7
playlist.c
src/playlist.c
+4
-4
playlist.h
src/playlist.h
+4
-4
song.h
src/song.h
+1
-1
No files found.
src/audioOutputs/audioOutput_shout_mp3.c
View file @
226d52b3
...
@@ -153,7 +153,7 @@ static int shout_mp3_encoder_encode(struct shout_data *sd,
...
@@ -153,7 +153,7 @@ static int shout_mp3_encoder_encode(struct shout_data *sd,
for
(
i
=
0
;
i
<
samples
;
i
++
)
{
for
(
i
=
0
;
i
<
samples
;
i
++
)
{
for
(
j
=
0
;
j
<
sd
->
audio_format
.
channels
;
j
++
)
{
for
(
j
=
0
;
j
<
sd
->
audio_format
.
channels
;
j
++
)
{
lamebuf
[
j
][
i
]
=
*
((
const
mpd_sint16
*
)
chunk
);
lamebuf
[
j
][
i
]
=
*
((
const
int16_t
*
)
chunk
);
chunk
+=
bytes
;
chunk
+=
bytes
;
}
}
}
}
...
...
src/audioOutputs/audioOutput_shout_ogg.c
View file @
226d52b3
...
@@ -267,7 +267,7 @@ static int shout_ogg_encoder_encode(struct shout_data *sd,
...
@@ -267,7 +267,7 @@ static int shout_ogg_encoder_encode(struct shout_data *sd,
for
(
i
=
0
;
i
<
samples
;
i
++
)
{
for
(
i
=
0
;
i
<
samples
;
i
++
)
{
for
(
j
=
0
;
j
<
sd
->
audio_format
.
channels
;
j
++
)
{
for
(
j
=
0
;
j
<
sd
->
audio_format
.
channels
;
j
++
)
{
vorbbuf
[
j
][
i
]
=
(
*
((
const
mpd_sint16
*
)
chunk
))
/
32768
.
0
;
vorbbuf
[
j
][
i
]
=
(
*
((
const
int16_t
*
)
chunk
))
/
32768
.
0
;
chunk
+=
bytes
;
chunk
+=
bytes
;
}
}
}
}
...
...
src/audio_format.h
View file @
226d52b3
...
@@ -22,9 +22,9 @@
...
@@ -22,9 +22,9 @@
#include "mpd_types.h"
#include "mpd_types.h"
struct
audio_format
{
struct
audio_format
{
mpd_uint32
sampleRate
;
uint32_t
sampleRate
;
mpd_sint8
bits
;
int8_t
bits
;
mpd_sint8
channels
;
int8_t
channels
;
};
};
static
inline
void
audio_format_clear
(
struct
audio_format
*
af
)
static
inline
void
audio_format_clear
(
struct
audio_format
*
af
)
...
...
src/command.c
View file @
226d52b3
...
@@ -197,7 +197,7 @@ mpd_fprintf_ void command_error(struct client *client, int error,
...
@@ -197,7 +197,7 @@ mpd_fprintf_ void command_error(struct client *client, int error,
va_end
(
args
);
va_end
(
args
);
}
}
static
int
mpd_fprintf__
check_uint32
(
struct
client
*
client
,
mpd_uint32
*
dst
,
static
int
mpd_fprintf__
check_uint32
(
struct
client
*
client
,
uint32_t
*
dst
,
const
char
*
s
,
const
char
*
fmt
,
...)
const
char
*
s
,
const
char
*
fmt
,
...)
{
{
char
*
test
;
char
*
test
;
...
@@ -627,7 +627,7 @@ static int handleRename(struct client *client,
...
@@ -627,7 +627,7 @@ static int handleRename(struct client *client,
static
int
handlePlaylistChanges
(
struct
client
*
client
,
static
int
handlePlaylistChanges
(
struct
client
*
client
,
mpd_unused
int
argc
,
char
*
argv
[])
mpd_unused
int
argc
,
char
*
argv
[])
{
{
mpd_uint32
version
;
uint32_t
version
;
if
(
check_uint32
(
client
,
&
version
,
argv
[
1
],
need_positive
)
<
0
)
if
(
check_uint32
(
client
,
&
version
,
argv
[
1
],
need_positive
)
<
0
)
return
-
1
;
return
-
1
;
...
@@ -637,7 +637,7 @@ static int handlePlaylistChanges(struct client *client,
...
@@ -637,7 +637,7 @@ static int handlePlaylistChanges(struct client *client,
static
int
handlePlaylistChangesPosId
(
struct
client
*
client
,
static
int
handlePlaylistChangesPosId
(
struct
client
*
client
,
mpd_unused
int
argc
,
char
*
argv
[])
mpd_unused
int
argc
,
char
*
argv
[])
{
{
mpd_uint32
version
;
uint32_t
version
;
if
(
check_uint32
(
client
,
&
version
,
argv
[
1
],
need_positive
)
<
0
)
if
(
check_uint32
(
client
,
&
version
,
argv
[
1
],
need_positive
)
<
0
)
return
-
1
;
return
-
1
;
...
...
src/decoder_api.c
View file @
226d52b3
...
@@ -152,7 +152,7 @@ need_chunks(struct decoder *decoder, InputStream * inStream, int seekable)
...
@@ -152,7 +152,7 @@ need_chunks(struct decoder *decoder, InputStream * inStream, int seekable)
enum
decoder_command
enum
decoder_command
decoder_data
(
struct
decoder
*
decoder
,
InputStream
*
inStream
,
int
seekable
,
decoder_data
(
struct
decoder
*
decoder
,
InputStream
*
inStream
,
int
seekable
,
void
*
dataIn
,
size_t
dataInLen
,
void
*
dataIn
,
size_t
dataInLen
,
float
data_time
,
mpd_uint16
bitRate
,
float
data_time
,
uint16_t
bitRate
,
ReplayGainInfo
*
replayGainInfo
)
ReplayGainInfo
*
replayGainInfo
)
{
{
size_t
nbytes
;
size_t
nbytes
;
...
...
src/decoder_api.h
View file @
226d52b3
...
@@ -149,7 +149,7 @@ size_t decoder_read(struct decoder *decoder,
...
@@ -149,7 +149,7 @@ size_t decoder_read(struct decoder *decoder,
*/
*/
enum
decoder_command
enum
decoder_command
decoder_data
(
struct
decoder
*
decoder
,
InputStream
*
inStream
,
int
seekable
,
decoder_data
(
struct
decoder
*
decoder
,
InputStream
*
inStream
,
int
seekable
,
void
*
data
,
size_t
datalen
,
float
data_time
,
mpd_uint16
bitRate
,
void
*
data
,
size_t
datalen
,
float
data_time
,
uint16_t
bitRate
,
ReplayGainInfo
*
replayGainInfo
);
ReplayGainInfo
*
replayGainInfo
);
void
decoder_flush
(
struct
decoder
*
decoder
);
void
decoder_flush
(
struct
decoder
*
decoder
);
...
...
src/decoder_control.h
View file @
226d52b3
...
@@ -44,9 +44,9 @@ struct decoder_control {
...
@@ -44,9 +44,9 @@ struct decoder_control {
volatile
enum
decoder_state
state
;
volatile
enum
decoder_state
state
;
volatile
enum
decoder_command
command
;
volatile
enum
decoder_command
command
;
volatile
mpd_uint16
error
;
volatile
uint16_t
error
;
volatile
mpd_sint8
seekError
;
volatile
int8_t
seekError
;
volatile
mpd_sint8
seekable
;
volatile
int8_t
seekable
;
volatile
double
seekWhere
;
volatile
double
seekWhere
;
struct
audio_format
audioFormat
;
struct
audio_format
audioFormat
;
Song
*
current_song
;
Song
*
current_song
;
...
...
src/inputPlugins/_flac_common.c
View file @
226d52b3
...
@@ -161,9 +161,9 @@ void flac_metadata_common_cb(const FLAC__StreamMetadata * block,
...
@@ -161,9 +161,9 @@ void flac_metadata_common_cb(const FLAC__StreamMetadata * block,
switch
(
block
->
type
)
{
switch
(
block
->
type
)
{
case
FLAC__METADATA_TYPE_STREAMINFO
:
case
FLAC__METADATA_TYPE_STREAMINFO
:
data
->
audio_format
.
bits
=
(
mpd_sint8
)
si
->
bits_per_sample
;
data
->
audio_format
.
bits
=
(
int8_t
)
si
->
bits_per_sample
;
data
->
audio_format
.
sampleRate
=
si
->
sample_rate
;
data
->
audio_format
.
sampleRate
=
si
->
sample_rate
;
data
->
audio_format
.
channels
=
(
mpd_sint8
)
si
->
channels
;
data
->
audio_format
.
channels
=
(
int8_t
)
si
->
channels
;
data
->
total_time
=
((
float
)
si
->
total_samples
)
/
(
si
->
sample_rate
);
data
->
total_time
=
((
float
)
si
->
total_samples
)
/
(
si
->
sample_rate
);
break
;
break
;
case
FLAC__METADATA_TYPE_VORBIS_COMMENT
:
case
FLAC__METADATA_TYPE_VORBIS_COMMENT
:
...
...
src/inputPlugins/audiofile_plugin.c
View file @
226d52b3
...
@@ -50,7 +50,7 @@ static int audiofile_decode(struct decoder * decoder, char *path)
...
@@ -50,7 +50,7 @@ static int audiofile_decode(struct decoder * decoder, char *path)
int
bits
;
int
bits
;
struct
audio_format
audio_format
;
struct
audio_format
audio_format
;
float
total_time
;
float
total_time
;
mpd_uint16
bitRate
;
uint16_t
bitRate
;
struct
stat
st
;
struct
stat
st
;
int
ret
,
current
=
0
;
int
ret
,
current
=
0
;
char
chunk
[
CHUNK_SIZE
];
char
chunk
[
CHUNK_SIZE
];
...
@@ -69,17 +69,17 @@ static int audiofile_decode(struct decoder * decoder, char *path)
...
@@ -69,17 +69,17 @@ static int audiofile_decode(struct decoder * decoder, char *path)
afSetVirtualSampleFormat
(
af_fp
,
AF_DEFAULT_TRACK
,
afSetVirtualSampleFormat
(
af_fp
,
AF_DEFAULT_TRACK
,
AF_SAMPFMT_TWOSCOMP
,
16
);
AF_SAMPFMT_TWOSCOMP
,
16
);
afGetVirtualSampleFormat
(
af_fp
,
AF_DEFAULT_TRACK
,
&
fs
,
&
bits
);
afGetVirtualSampleFormat
(
af_fp
,
AF_DEFAULT_TRACK
,
&
fs
,
&
bits
);
audio_format
.
bits
=
(
mpd_uint8
)
bits
;
audio_format
.
bits
=
(
uint8_t
)
bits
;
audio_format
.
sampleRate
=
audio_format
.
sampleRate
=
(
unsigned
int
)
afGetRate
(
af_fp
,
AF_DEFAULT_TRACK
);
(
unsigned
int
)
afGetRate
(
af_fp
,
AF_DEFAULT_TRACK
);
audio_format
.
channels
=
audio_format
.
channels
=
(
mpd_uint8
)
afGetVirtualChannels
(
af_fp
,
AF_DEFAULT_TRACK
);
(
uint8_t
)
afGetVirtualChannels
(
af_fp
,
AF_DEFAULT_TRACK
);
frame_count
=
afGetFrameCount
(
af_fp
,
AF_DEFAULT_TRACK
);
frame_count
=
afGetFrameCount
(
af_fp
,
AF_DEFAULT_TRACK
);
total_time
=
((
float
)
frame_count
/
(
float
)
audio_format
.
sampleRate
);
total_time
=
((
float
)
frame_count
/
(
float
)
audio_format
.
sampleRate
);
bitRate
=
(
mpd_uint16
)(
st
.
st_size
*
8
.
0
/
total_time
/
1000
.
0
+
0
.
5
);
bitRate
=
(
uint16_t
)(
st
.
st_size
*
8
.
0
/
total_time
/
1000
.
0
+
0
.
5
);
if
(
audio_format
.
bits
!=
8
&&
audio_format
.
bits
!=
16
)
{
if
(
audio_format
.
bits
!=
8
&&
audio_format
.
bits
!=
16
)
{
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
"
,
...
...
src/inputPlugins/mpc_plugin.c
View file @
226d52b3
...
@@ -66,10 +66,10 @@ static mpc_int32_t mpc_getsize_cb(void *vdata)
...
@@ -66,10 +66,10 @@ static mpc_int32_t mpc_getsize_cb(void *vdata)
}
}
/* this _looks_ performance-critical, don't de-inline -- eric */
/* this _looks_ performance-critical, don't de-inline -- eric */
static
inline
mpd_sint16
convertSample
(
MPC_SAMPLE_FORMAT
sample
)
static
inline
int16_t
convertSample
(
MPC_SAMPLE_FORMAT
sample
)
{
{
/* only doing 16-bit audio for now */
/* only doing 16-bit audio for now */
mpd_sint32
val
;
int32_t
val
;
const
int
clip_min
=
-
1
<<
(
16
-
1
);
const
int
clip_min
=
-
1
<<
(
16
-
1
);
const
int
clip_max
=
(
1
<<
(
16
-
1
))
-
1
;
const
int
clip_max
=
(
1
<<
(
16
-
1
))
-
1
;
...
@@ -114,7 +114,7 @@ static int mpc_decode(struct decoder * mpd_decoder, InputStream * inStream)
...
@@ -114,7 +114,7 @@ static int mpc_decode(struct decoder * mpd_decoder, InputStream * inStream)
char
chunk
[
MPC_CHUNK_SIZE
];
char
chunk
[
MPC_CHUNK_SIZE
];
int
chunkpos
=
0
;
int
chunkpos
=
0
;
long
bitRate
=
0
;
long
bitRate
=
0
;
mpd_sint16
*
s16
=
(
mpd_sint16
*
)
chunk
;
int16_t
*
s16
=
(
int16_t
*
)
chunk
;
unsigned
long
samplePos
=
0
;
unsigned
long
samplePos
=
0
;
mpc_uint32_t
vbrUpdateAcc
;
mpc_uint32_t
vbrUpdateAcc
;
mpc_uint32_t
vbrUpdateBits
;
mpc_uint32_t
vbrUpdateBits
;
...
@@ -171,7 +171,7 @@ static int mpc_decode(struct decoder * mpd_decoder, InputStream * inStream)
...
@@ -171,7 +171,7 @@ static int mpc_decode(struct decoder * mpd_decoder, InputStream * inStream)
audio_format
.
sampleRate
;
audio_format
.
sampleRate
;
if
(
mpc_decoder_seek_sample
(
&
decoder
,
samplePos
))
{
if
(
mpc_decoder_seek_sample
(
&
decoder
,
samplePos
))
{
decoder_clear
(
mpd_decoder
);
decoder_clear
(
mpd_decoder
);
s16
=
(
mpd_sint16
*
)
chunk
;
s16
=
(
int16_t
*
)
chunk
;
chunkpos
=
0
;
chunkpos
=
0
;
decoder_command_finished
(
mpd_decoder
);
decoder_command_finished
(
mpd_decoder
);
}
else
}
else
...
@@ -213,7 +213,7 @@ static int mpc_decode(struct decoder * mpd_decoder, InputStream * inStream)
...
@@ -213,7 +213,7 @@ static int mpc_decode(struct decoder * mpd_decoder, InputStream * inStream)
bitRate
,
replayGainInfo
);
bitRate
,
replayGainInfo
);
chunkpos
=
0
;
chunkpos
=
0
;
s16
=
(
mpd_sint16
*
)
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
=
1
;
break
;
break
;
...
...
src/mpd_types.h
View file @
226d52b3
...
@@ -21,24 +21,49 @@
...
@@ -21,24 +21,49 @@
#include "../config.h"
#include "../config.h"
typedef
unsigned
char
mpd_uint8
;
#if defined(HAVE_INTTYPES_H)
typedef
signed
char
mpd_sint8
;
/*
* inttypes.h pulls in stdint.h on C99 systems, needed for older systems
* that didn't provide stdint.h but still defined equivalent types.
*/
# include <inttypes.h>
#elif defined(HAVE_STDINT_H)
# include <stdint.h>
#elif defined(HAVE_SYS_INTTYPES_H)
# include <sys/inttypes.h>
/* some ancient systems had this, untested */
#endif
/* C99-ish type headers */
#include <sys/types.h>
#if (!defined(HAVE_STDINT_H) && !defined(HAVE_INTTYPES_H))
/*
* this only includes a partial subset of what is expected in a C99
* stdint.h or inttypes.h; but includes enough of what is needed for mpd
* to function on older platforms
* (especially Linux ones still using gcc 2.95)
*/
typedef
unsigned
char
uint8_t
;
typedef
signed
char
int8_t
;
#if SIZEOF_SHORT == 2
#if SIZEOF_SHORT == 2
typedef
unsigned
short
mpd_uint16
;
typedef
unsigned
short
uint16_t
;
typedef
signed
short
mpd_sint16
;
typedef
signed
short
int16_t
;
#elif SIZEOF_INT == 2
#elif SIZEOF_INT == 2
typedef
unsigned
int
mpd_uint16
;
typedef
unsigned
int
uint16_t
;
typedef
signed
int
mpd_sint16
;
typedef
signed
int
int16_t
;
#endif
#endif
/* (u)int_16_t */
#if SIZEOF_INT == 4
#if SIZEOF_INT == 4
typedef
unsigned
int
mpd_uint32
;
typedef
unsigned
int
uint32_t
;
typedef
signed
int
mpd_sint32
;
typedef
signed
int
int32_t
;
#elif SIZEOF_LONG == 4
#elif SIZEOF_LONG == 4
typedef
unsigned
long
mpd_uint32
;
typedef
unsigned
long
uint32_t
;
typedef
signed
long
mpd_sint32
;
typedef
signed
long
int32_t
;
#endif
#endif
/* (u)int_32 */
#endif
/* !HAVE_STDINT_H && !HAVE_INTTYPES_H */
union
const_hack
{
union
const_hack
{
const
char
*
in
;
const
char
*
in
;
...
...
src/outputBuffer.c
View file @
226d52b3
...
@@ -153,7 +153,7 @@ ob_chunk * ob_get_chunk(const unsigned i)
...
@@ -153,7 +153,7 @@ ob_chunk * ob_get_chunk(const unsigned i)
* @return the chunk which has room for more data; NULL if there is no
* @return the chunk which has room for more data; NULL if there is no
* room.
* room.
*/
*/
static
ob_chunk
*
tail_chunk
(
float
data_time
,
mpd_uint16
bitRate
)
static
ob_chunk
*
tail_chunk
(
float
data_time
,
uint16_t
bitRate
)
{
{
unsigned
int
next
;
unsigned
int
next
;
ob_chunk
*
chunk
;
ob_chunk
*
chunk
;
...
@@ -184,7 +184,7 @@ static ob_chunk *tail_chunk(float data_time, mpd_uint16 bitRate)
...
@@ -184,7 +184,7 @@ static ob_chunk *tail_chunk(float data_time, mpd_uint16 bitRate)
}
}
size_t
ob_append
(
const
void
*
data0
,
size_t
datalen
,
size_t
ob_append
(
const
void
*
data0
,
size_t
datalen
,
float
data_time
,
mpd_uint16
bitRate
)
float
data_time
,
uint16_t
bitRate
)
{
{
const
unsigned
char
*
data
=
data0
;
const
unsigned
char
*
data
=
data0
;
size_t
ret
=
0
,
dataToSend
;
size_t
ret
=
0
,
dataToSend
;
...
...
src/outputBuffer.h
View file @
226d52b3
...
@@ -26,8 +26,8 @@
...
@@ -26,8 +26,8 @@
#define CHUNK_SIZE 1020
#define CHUNK_SIZE 1020
typedef
struct
_OutputBufferChunk
{
typedef
struct
_OutputBufferChunk
{
mpd_uint16
chunkSize
;
uint16_t
chunkSize
;
mpd_uint16
bitRate
;
uint16_t
bitRate
;
float
times
;
float
times
;
char
data
[
CHUNK_SIZE
];
char
data
[
CHUNK_SIZE
];
}
ob_chunk
;
}
ob_chunk
;
...
@@ -102,9 +102,8 @@ ob_chunk * ob_get_chunk(const unsigned i);
...
@@ -102,9 +102,8 @@ ob_chunk * ob_get_chunk(const unsigned i);
* @return the number of bytes actually written
* @return the number of bytes actually written
*/
*/
size_t
ob_append
(
const
void
*
data
,
size_t
datalen
,
size_t
ob_append
(
const
void
*
data
,
size_t
datalen
,
float
data_time
,
mpd_uint16
bitRate
);
float
data_time
,
uint16_t
bitRate
);
void
ob_skip
(
unsigned
num
);
void
ob_skip
(
unsigned
num
);
#endif
#endif
src/player_control.h
View file @
226d52b3
...
@@ -85,21 +85,21 @@ struct player_control {
...
@@ -85,21 +85,21 @@ struct player_control {
Notify
notify
;
Notify
notify
;
volatile
enum
player_command
command
;
volatile
enum
player_command
command
;
volatile
enum
player_state
state
;
volatile
enum
player_state
state
;
volatile
mpd_sint8
error
;
volatile
int8_t
error
;
volatile
mpd_uint16
bitRate
;
volatile
uint16_t
bitRate
;
volatile
mpd_sint8
bits
;
volatile
int8_t
bits
;
volatile
mpd_sint8
channels
;
volatile
int8_t
channels
;
volatile
mpd_uint32
sampleRate
;
volatile
uint32_t
sampleRate
;
volatile
float
totalTime
;
volatile
float
totalTime
;
volatile
float
elapsedTime
;
volatile
float
elapsedTime
;
volatile
float
fileTime
;
volatile
float
fileTime
;
Song
*
volatile
next_song
;
Song
*
volatile
next_song
;
Song
*
errored_song
;
Song
*
errored_song
;
volatile
enum
player_queue_state
queueState
;
volatile
enum
player_queue_state
queueState
;
volatile
mpd_sint8
queueLockState
;
volatile
int8_t
queueLockState
;
volatile
double
seekWhere
;
volatile
double
seekWhere
;
volatile
float
crossFade
;
volatile
float
crossFade
;
volatile
mpd_uint16
softwareVolume
;
volatile
uint16_t
softwareVolume
;
volatile
double
totalPlayTime
;
volatile
double
totalPlayTime
;
};
};
...
...
src/playlist.c
View file @
226d52b3
...
@@ -73,7 +73,7 @@ static void randomizeOrder(int start, int end);
...
@@ -73,7 +73,7 @@ static void randomizeOrder(int start, int end);
static
void
incrPlaylistVersion
(
void
)
static
void
incrPlaylistVersion
(
void
)
{
{
static
unsigned
long
max
=
((
mpd_uint32
)
1
<<
31
)
-
1
;
static
unsigned
long
max
=
((
uint32_t
)
1
<<
31
)
-
1
;
playlist
.
version
++
;
playlist
.
version
++
;
if
(
playlist
.
version
>=
max
)
{
if
(
playlist
.
version
>=
max
)
{
int
i
;
int
i
;
...
@@ -141,7 +141,7 @@ void initPlaylist(void)
...
@@ -141,7 +141,7 @@ void initPlaylist(void)
DEFAULT_PLAYLIST_SAVE_ABSOLUTE_PATHS
;
DEFAULT_PLAYLIST_SAVE_ABSOLUTE_PATHS
;
playlist
.
songs
=
xmalloc
(
sizeof
(
Song
*
)
*
playlist_max_length
);
playlist
.
songs
=
xmalloc
(
sizeof
(
Song
*
)
*
playlist_max_length
);
playlist
.
songMod
=
xmalloc
(
sizeof
(
mpd_uint32
)
*
playlist_max_length
);
playlist
.
songMod
=
xmalloc
(
sizeof
(
uint32_t
)
*
playlist_max_length
);
playlist
.
order
=
xmalloc
(
sizeof
(
int
)
*
playlist_max_length
);
playlist
.
order
=
xmalloc
(
sizeof
(
int
)
*
playlist_max_length
);
playlist
.
idToPosition
=
xmalloc
(
sizeof
(
int
)
*
playlist_max_length
*
playlist
.
idToPosition
=
xmalloc
(
sizeof
(
int
)
*
playlist_max_length
*
PLAYLIST_HASH_MULT
);
PLAYLIST_HASH_MULT
);
...
@@ -369,7 +369,7 @@ static void printPlaylistSongInfo(struct client *client, int song)
...
@@ -369,7 +369,7 @@ static void printPlaylistSongInfo(struct client *client, int song)
client_printf
(
client
,
"Pos: %i
\n
Id: %i
\n
"
,
song
,
playlist
.
positionToId
[
song
]);
client_printf
(
client
,
"Pos: %i
\n
Id: %i
\n
"
,
song
,
playlist
.
positionToId
[
song
]);
}
}
int
playlistChanges
(
struct
client
*
client
,
mpd_uint32
version
)
int
playlistChanges
(
struct
client
*
client
,
uint32_t
version
)
{
{
int
i
;
int
i
;
...
@@ -384,7 +384,7 @@ int playlistChanges(struct client *client, mpd_uint32 version)
...
@@ -384,7 +384,7 @@ int playlistChanges(struct client *client, mpd_uint32 version)
return
0
;
return
0
;
}
}
int
playlistChangesPosId
(
struct
client
*
client
,
mpd_uint32
version
)
int
playlistChangesPosId
(
struct
client
*
client
,
uint32_t
version
)
{
{
int
i
;
int
i
;
...
...
src/playlist.h
View file @
226d52b3
...
@@ -39,7 +39,7 @@ enum playlist_result {
...
@@ -39,7 +39,7 @@ enum playlist_result {
typedef
struct
_Playlist
{
typedef
struct
_Playlist
{
Song
**
songs
;
Song
**
songs
;
/* holds version a song was modified on */
/* holds version a song was modified on */
mpd_uint32
*
songMod
;
uint32_t
*
songMod
;
int
*
order
;
int
*
order
;
int
*
positionToId
;
int
*
positionToId
;
int
*
idToPosition
;
int
*
idToPosition
;
...
@@ -48,7 +48,7 @@ typedef struct _Playlist {
...
@@ -48,7 +48,7 @@ typedef struct _Playlist {
int
queued
;
int
queued
;
int
repeat
;
int
repeat
;
int
random
;
int
random
;
mpd_uint32
version
;
uint32_t
version
;
}
Playlist
;
}
Playlist
;
extern
int
playlist_saveAbsolutePaths
;
extern
int
playlist_saveAbsolutePaths
;
...
@@ -137,9 +137,9 @@ enum playlist_result seekSongInPlaylistById(int id, float seek_time);
...
@@ -137,9 +137,9 @@ enum playlist_result seekSongInPlaylistById(int id, float seek_time);
void
playlistVersionChange
(
void
);
void
playlistVersionChange
(
void
);
int
playlistChanges
(
struct
client
*
client
,
mpd_uint32
version
);
int
playlistChanges
(
struct
client
*
client
,
uint32_t
version
);
int
playlistChangesPosId
(
struct
client
*
client
,
mpd_uint32
version
);
int
playlistChangesPosId
(
struct
client
*
client
,
uint32_t
version
);
int
PlaylistInfo
(
struct
client
*
client
,
const
char
*
utf8file
,
int
detail
);
int
PlaylistInfo
(
struct
client
*
client
,
const
char
*
utf8file
,
int
detail
);
...
...
src/song.h
View file @
226d52b3
...
@@ -35,7 +35,7 @@ struct client;
...
@@ -35,7 +35,7 @@ struct client;
typedef
struct
_Song
{
typedef
struct
_Song
{
char
*
url
;
char
*
url
;
mpd_sint8
type
;
int8_t
type
;
struct
tag
*
tag
;
struct
tag
*
tag
;
struct
_Directory
*
parentDir
;
struct
_Directory
*
parentDir
;
time_t
mtime
;
time_t
mtime
;
...
...
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