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
52d4200c
Commit
52d4200c
authored
May 20, 2004
by
Warren Dukes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix some seeking stuff for mp3's
git-svn-id:
https://svn.musicpd.org/mpd/trunk@1106
09075e82-0dd4-0310-85a5-a0d7c8717e4f
parent
4db5224b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
18 deletions
+22
-18
TODO
TODO
+3
-5
mp3_decode.c
src/mp3_decode.c
+19
-13
No files found.
TODO
View file @
52d4200c
...
...
@@ -2,8 +2,7 @@
a) make seekings non-blocking:
1) player:
a) first check that seekWhere isn't already buffered
2) check that stream is seekable before seeking forward!
3) deal with seeking forward better by calling seek function
2) deal with seeking forward better by calling seek function
(for mp3 and mp4)!
b) bufferInput in outputBuffer waiting!
1) implement some sort of callback mechanism for this
...
...
@@ -15,12 +14,11 @@
3) if not seekable, reset buffer, and elapsedTime when
unpaused
d) put some sort of error reporting for streaming/inputStream!
e) ogg streams
f) fetch metadata and store in DecoderControl and pass to
e) fetch metadata and store in DecoderControl and pass to
PlayerControl
1) eventually deal with icy-metadata
2) parse metadata on the fly in decoders
g
) command for dealing with the changing metadata, currentsonginfo
f
) command for dealing with the changing metadata, currentsonginfo
or something
2) how to deal with streams and the db
...
...
src/mp3_decode.c
View file @
52d4200c
...
...
@@ -55,6 +55,9 @@
#define DECODE_CONT -1
#define DECODE_OK 0
#define MUTEFRAME_SKIP 1
#define MUTEFRAME_SEEK 2
/* this is stolen from mpg321! */
struct
audio_dither
{
mad_fixed_t
error
[
3
];
...
...
@@ -356,7 +359,7 @@ int decodeFirstFrame(mp3DecodeData * data, DecoderControl * dc) {
if
(
xing
.
flags
&
XING_FRAMES
)
{
mad_timer_t
duration
=
data
->
frame
.
header
.
duration
;
mad_timer_multiply
(
&
duration
,
xing
.
frames
);
data
->
muteFrame
=
1
;
data
->
muteFrame
=
MUTEFRAME_SKIP
;
data
->
totalTime
=
((
float
)
mad_timer_count
(
duration
,
MAD_UNITS_MILLISECONDS
))
/
1000
;
data
->
maxFrames
=
xing
.
frames
;
...
...
@@ -429,10 +432,10 @@ int openMp3FromInputStream(InputStream * inStream, mp3DecodeData * data,
}
int
mp3Read
(
mp3DecodeData
*
data
,
OutputBuffer
*
cb
,
DecoderControl
*
dc
)
{
static
int
i
;
static
int
ret
;
st
atic
st
ruct
audio_dither
dither
;
static
int
skip
;
int
i
;
int
ret
;
struct
audio_dither
dither
;
int
skip
;
if
(
data
->
currentFrame
>=
data
->
highestFrame
)
{
mad_timer_add
(
&
data
->
timer
,(
data
->
frame
).
header
.
duration
);
...
...
@@ -457,18 +460,19 @@ int mp3Read(mp3DecodeData * data, OutputBuffer * cb, DecoderControl * dc) {
data
->
currentFrame
++
;
data
->
elapsedTime
=
((
float
)
mad_timer_count
(
data
->
timer
,
MAD_UNITS_MILLISECONDS
))
/
1000
;
if
(
data
->
muteFrame
)
{
if
(
!
dc
->
seek
)
data
->
muteFrame
=
0
;
else
if
(
dc
->
seekWhere
<=
data
->
elapsedTime
)
{
switch
(
data
->
muteFrame
)
{
case
MUTEFRAME_SKIP
:
data
->
muteFrame
=
0
;
break
;
case
MUTEFRAME_SEEK
:
if
(
dc
->
seekWhere
<=
data
->
elapsedTime
)
{
clearOutputBuffer
(
cb
);
dc
->
seekChunk
=
cb
->
end
;
data
->
muteFrame
=
0
;
dc
->
seek
=
0
;
}
}
else
{
long
ret
;
break
;
default:
mad_synth_frame
(
&
data
->
synth
,
&
data
->
frame
);
for
(
i
=
0
;
i
<
(
data
->
synth
).
pcm
.
length
;
i
++
)
{
...
...
@@ -489,6 +493,7 @@ int mp3Read(mp3DecodeData * data, OutputBuffer * cb, DecoderControl * dc) {
}
if
(
data
->
outputPtr
==
data
->
outputBufferEnd
)
{
long
ret
;
ret
=
sendDataToOutputBuffer
(
cb
,
dc
,
data
->
outputBuffer
,
MP3_DATA_OUTPUT_BUFFER_SIZE
,
...
...
@@ -506,7 +511,7 @@ int mp3Read(mp3DecodeData * data, OutputBuffer * cb, DecoderControl * dc) {
if
(
dc
->
seek
)
{
long
i
=
0
;
data
->
muteFrame
=
1
;
data
->
muteFrame
=
MUTEFRAME_SEEK
;
while
(
i
<
data
->
highestFrame
&&
dc
->
seekWhere
>
((
float
)
mad_timer_count
(
data
->
times
[
i
],
MAD_UNITS_MILLISECONDS
))
/
1000
)
...
...
@@ -524,6 +529,7 @@ int mp3Read(mp3DecodeData * data, OutputBuffer * cb, DecoderControl * dc) {
}
dc
->
seek
=
0
;
}
else
if
(
!
data
->
inStream
->
seekable
)
dc
->
seek
=
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