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
0d8b551c
Commit
0d8b551c
authored
Aug 26, 2008
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added parameter total_time to decoder_initialized()
Similar to the previous patch: pass total_time instead of manipulating dc->totalTime directly.
parent
4590a98f
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
31 additions
and
29 deletions
+31
-29
decoder_api.c
src/decoder_api.c
+4
-1
decoder_api.h
src/decoder_api.h
+2
-1
_flac_common.c
src/inputPlugins/_flac_common.c
+1
-1
_flac_common.h
src/inputPlugins/_flac_common.h
+1
-0
aac_plugin.c
src/inputPlugins/aac_plugin.c
+2
-3
audiofile_plugin.c
src/inputPlugins/audiofile_plugin.c
+4
-4
flac_plugin.c
src/inputPlugins/flac_plugin.c
+1
-1
mod_plugin.c
src/inputPlugins/mod_plugin.c
+1
-2
mp3_plugin.c
src/inputPlugins/mp3_plugin.c
+1
-3
mp4_plugin.c
src/inputPlugins/mp4_plugin.c
+4
-3
mpc_plugin.c
src/inputPlugins/mpc_plugin.c
+2
-3
oggflac_plugin.c
src/inputPlugins/oggflac_plugin.c
+1
-1
oggvorbis_plugin.c
src/inputPlugins/oggvorbis_plugin.c
+5
-4
wavpack_plugin.c
src/inputPlugins/wavpack_plugin.c
+2
-2
No files found.
src/decoder_api.c
View file @
0d8b551c
...
...
@@ -25,7 +25,8 @@
#include "gcc.h"
void
decoder_initialized
(
mpd_unused
struct
decoder
*
decoder
,
const
AudioFormat
*
audio_format
)
const
AudioFormat
*
audio_format
,
float
total_time
)
{
assert
(
dc
.
state
==
DECODE_STATE_START
);
...
...
@@ -35,6 +36,8 @@ void decoder_initialized(mpd_unused struct decoder * decoder,
&
(
ob
.
audioFormat
));
}
dc
.
totalTime
=
total_time
;
dc
.
state
=
DECODE_STATE_DECODE
;
notify_signal
(
&
pc
.
notify
);
}
...
...
src/decoder_api.h
View file @
0d8b551c
...
...
@@ -41,7 +41,8 @@ struct decoder;
* that it has read the song's meta data.
*/
void
decoder_initialized
(
struct
decoder
*
decoder
,
const
AudioFormat
*
audio_format
);
const
AudioFormat
*
audio_format
,
float
total_time
);
/**
* This function is called by the decoder plugin when it has
...
...
src/inputPlugins/_flac_common.c
View file @
0d8b551c
...
...
@@ -165,7 +165,7 @@ void flac_metadata_common_cb(const FLAC__StreamMetadata * block,
data
->
audio_format
.
bits
=
(
mpd_sint8
)
si
->
bits_per_sample
;
data
->
audio_format
.
sampleRate
=
si
->
sample_rate
;
data
->
audio_format
.
channels
=
(
mpd_sint8
)
si
->
channels
;
d
c
.
totalT
ime
=
((
float
)
si
->
total_samples
)
/
(
si
->
sample_rate
);
d
ata
->
total_t
ime
=
((
float
)
si
->
total_samples
)
/
(
si
->
sample_rate
);
break
;
case
FLAC__METADATA_TYPE_VORBIS_COMMENT
:
flacParseReplayGain
(
block
,
data
);
...
...
src/inputPlugins/_flac_common.h
View file @
0d8b551c
...
...
@@ -144,6 +144,7 @@ typedef struct {
float
time
;
unsigned
int
bitRate
;
AudioFormat
audio_format
;
float
total_time
;
FLAC__uint64
position
;
struct
decoder
*
decoder
;
InputStream
*
inStream
;
...
...
src/inputPlugins/aac_plugin.c
View file @
0d8b551c
...
...
@@ -338,8 +338,6 @@ static int aac_decode(struct decoder * mpd_decoder, char *path)
audio_format
.
bits
=
16
;
dc
.
totalTime
=
totalTime
;
file_time
=
0
.
0
;
advanceAacBuffer
(
&
b
,
bread
);
...
...
@@ -372,7 +370,8 @@ static int aac_decode(struct decoder * mpd_decoder, char *path)
if
(
dc
.
state
!=
DECODE_STATE_DECODE
)
{
audio_format
.
channels
=
frameInfo
.
channels
;
audio_format
.
sampleRate
=
sampleRate
;
decoder_initialized
(
mpd_decoder
,
&
audio_format
);
decoder_initialized
(
mpd_decoder
,
&
audio_format
,
totalTime
);
}
advanceAacBuffer
(
&
b
,
frameInfo
.
bytesconsumed
);
...
...
src/inputPlugins/audiofile_plugin.c
View file @
0d8b551c
...
...
@@ -46,6 +46,7 @@ static int audiofile_decode(struct decoder * decoder, char *path)
AFfilehandle
af_fp
;
int
bits
;
AudioFormat
audio_format
;
float
total_time
;
mpd_uint16
bitRate
;
struct
stat
st
;
...
...
@@ -71,10 +72,9 @@ static int audiofile_decode(struct decoder * decoder, char *path)
frame_count
=
afGetFrameCount
(
af_fp
,
AF_DEFAULT_TRACK
);
dc
.
totalTime
=
((
float
)
frame_count
/
(
float
)
audio_format
.
sampleRate
);
total_time
=
((
float
)
frame_count
/
(
float
)
audio_format
.
sampleRate
);
bitRate
=
(
mpd_uint16
)(
st
.
st_size
*
8
.
0
/
dc
.
totalT
ime
/
1000
.
0
+
0
.
5
);
bitRate
=
(
mpd_uint16
)(
st
.
st_size
*
8
.
0
/
total_t
ime
/
1000
.
0
+
0
.
5
);
if
(
audio_format
.
bits
!=
8
&&
audio_format
.
bits
!=
16
)
{
ERROR
(
"Only 8 and 16-bit files are supported. %s is %i-bit
\n
"
,
...
...
@@ -85,7 +85,7 @@ static int audiofile_decode(struct decoder * decoder, char *path)
fs
=
(
int
)
afGetVirtualFrameSize
(
af_fp
,
AF_DEFAULT_TRACK
,
1
);
decoder_initialized
(
decoder
,
&
audio_format
);
decoder_initialized
(
decoder
,
&
audio_format
,
total_time
);
{
int
ret
,
eof
=
0
,
current
=
0
;
...
...
src/inputPlugins/flac_plugin.c
View file @
0d8b551c
...
...
@@ -415,7 +415,7 @@ static int flac_decode_internal(struct decoder * decoder,
}
}
decoder_initialized
(
decoder
,
&
data
.
audio_format
);
decoder_initialized
(
decoder
,
&
data
.
audio_format
,
data
.
total_time
);
while
(
1
)
{
if
(
!
flac_process_single
(
flacDec
))
...
...
src/inputPlugins/mod_plugin.c
View file @
0d8b551c
...
...
@@ -176,7 +176,6 @@ static int mod_decode(struct decoder * decoder, char *path)
return
-
1
;
}
dc
.
totalTime
=
0
;
audio_format
.
bits
=
16
;
audio_format
.
sampleRate
=
44100
;
audio_format
.
channels
=
2
;
...
...
@@ -185,7 +184,7 @@ static int mod_decode(struct decoder * decoder, char *path)
1
.
0
/
((
audio_format
.
bits
*
audio_format
.
channels
/
8
.
0
)
*
(
float
)
audio_format
.
sampleRate
);
decoder_initialized
(
decoder
,
&
audio_format
);
decoder_initialized
(
decoder
,
&
audio_format
,
0
);
while
(
1
)
{
if
(
dc
.
command
==
DECODE_COMMAND_SEEK
)
{
...
...
src/inputPlugins/mp3_plugin.c
View file @
0d8b551c
...
...
@@ -1035,8 +1035,6 @@ static int mp3_decode(struct decoder * decoder, InputStream * inStream)
initAudioFormatFromMp3DecodeData
(
&
data
,
&
audio_format
);
dc
.
totalTime
=
data
.
totalTime
;
if
(
inStream
->
metaTitle
)
{
if
(
tag
)
freeMpdTag
(
tag
);
...
...
@@ -1062,7 +1060,7 @@ static int mp3_decode(struct decoder * decoder, InputStream * inStream)
freeMpdTag
(
tag
);
}
decoder_initialized
(
decoder
,
&
audio_format
);
decoder_initialized
(
decoder
,
&
audio_format
,
data
.
totalTime
);
while
(
mp3Read
(
&
data
,
decoder
,
&
replayGainInfo
)
!=
DECODE_BREAK
)
;
/* send last little bit if not DECODE_COMMAND_STOP */
...
...
src/inputPlugins/mp4_plugin.c
View file @
0d8b551c
...
...
@@ -83,7 +83,7 @@ static int mp4_decode(struct decoder * mpd_decoder, InputStream * inStream)
mp4ff_t
*
mp4fh
;
mp4ff_callback_t
*
mp4cb
;
int32_t
track
;
float
file_time
;
float
file_time
,
total_time
;
int32_t
scale
;
faacDecHandle
decoder
;
faacDecFrameInfo
frameInfo
;
...
...
@@ -170,7 +170,7 @@ static int mp4_decode(struct decoder * mpd_decoder, InputStream * inStream)
free
(
mp4cb
);
return
-
1
;
}
dc
.
totalT
ime
=
((
float
)
file_time
)
/
scale
;
total_t
ime
=
((
float
)
file_time
)
/
scale
;
numSamples
=
mp4ff_num_samples
(
mp4fh
,
track
);
...
...
@@ -248,7 +248,8 @@ static int mp4_decode(struct decoder * mpd_decoder, InputStream * inStream)
#endif
audio_format
.
sampleRate
=
scale
;
audio_format
.
channels
=
frameInfo
.
channels
;
decoder_initialized
(
mpd_decoder
,
&
audio_format
);
decoder_initialized
(
mpd_decoder
,
&
audio_format
,
total_time
);
}
if
(
channels
*
(
unsigned
long
)(
dur
+
offset
)
>
frameInfo
.
samples
)
{
...
...
src/inputPlugins/mpc_plugin.c
View file @
0d8b551c
...
...
@@ -160,8 +160,6 @@ static int mpc_decode(struct decoder * mpd_decoder, InputStream * inStream)
return
0
;
}
dc
.
totalTime
=
mpc_streaminfo_get_length
(
&
info
);
audio_format
.
bits
=
16
;
audio_format
.
channels
=
info
.
channels
;
audio_format
.
sampleRate
=
info
.
sample_freq
;
...
...
@@ -172,7 +170,8 @@ static int mpc_decode(struct decoder * mpd_decoder, InputStream * inStream)
replayGainInfo
->
trackGain
=
info
.
gain_title
*
0
.
01
;
replayGainInfo
->
trackPeak
=
info
.
peak_title
/
32767
.
0
;
decoder_initialized
(
mpd_decoder
,
&
audio_format
);
decoder_initialized
(
mpd_decoder
,
&
audio_format
,
mpc_streaminfo_get_length
(
&
info
));
while
(
!
eof
)
{
if
(
dc
.
command
==
DECODE_COMMAND_SEEK
)
{
...
...
src/inputPlugins/oggflac_plugin.c
View file @
0d8b551c
...
...
@@ -345,7 +345,7 @@ static int oggflac_decode(struct decoder * mpd_decoder, InputStream * inStream)
goto
fail
;
}
decoder_initialized
(
mpd_decoder
,
&
data
.
audio_format
);
decoder_initialized
(
mpd_decoder
,
&
data
.
audio_format
,
data
.
total_time
);
while
(
1
)
{
OggFLAC__seekable_stream_decoder_process_single
(
decoder
);
...
...
src/inputPlugins/oggvorbis_plugin.c
View file @
0d8b551c
...
...
@@ -262,9 +262,6 @@ static int oggvorbis_decode(struct decoder * decoder, InputStream * inStream)
}
return
0
;
}
dc
.
totalTime
=
ov_time_total
(
&
vf
,
-
1
);
if
(
dc
.
totalTime
<
0
)
dc
.
totalTime
=
0
;
audio_format
.
bits
=
16
;
while
(
1
)
{
...
...
@@ -285,7 +282,11 @@ static int oggvorbis_decode(struct decoder * decoder, InputStream * inStream)
audio_format
.
channels
=
vi
->
channels
;
audio_format
.
sampleRate
=
vi
->
rate
;
if
(
dc
.
state
==
DECODE_STATE_START
)
{
decoder_initialized
(
decoder
,
&
audio_format
);
float
total_time
=
ov_time_total
(
&
vf
,
-
1
);
if
(
total_time
<
0
)
total_time
=
0
;
decoder_initialized
(
decoder
,
&
audio_format
,
total_time
);
}
comments
=
ov_comment
(
&
vf
,
-
1
)
->
user_comments
;
putOggCommentsIntoOutputBuffer
(
inStream
->
metaName
,
...
...
src/inputPlugins/wavpack_plugin.c
View file @
0d8b551c
...
...
@@ -164,10 +164,10 @@ static void wavpack_decode(struct decoder * decoder,
samplesreq
=
sizeof
(
chunk
)
/
(
4
*
audio_format
.
channels
);
dc
.
totalTime
=
(
float
)
allsamples
/
audio_format
.
sampleRate
;
dc
.
seekable
=
canseek
;
decoder_initialized
(
decoder
,
&
audio_format
);
decoder_initialized
(
decoder
,
&
audio_format
,
(
float
)
allsamples
/
audio_format
.
sampleRate
);
position
=
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