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
66512edb
Commit
66512edb
authored
Aug 13, 2006
by
J. Alexander Treuman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Presume that the Xing frame count is accurate, and stop decoding when we hit the last frame
git-svn-id:
https://svn.musicpd.org/mpd/trunk@4618
09075e82-0dd4-0310-85a5-a0d7c8717e4f
parent
0511e14d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
2 deletions
+9
-2
mp3_plugin.c
src/inputPlugins/mp3_plugin.c
+9
-2
No files found.
src/inputPlugins/mp3_plugin.c
View file @
66512edb
...
...
@@ -138,6 +138,7 @@ typedef struct _mp3DecodeData {
int
dropFramesAtEnd
;
int
dropSamplesAtStart
;
int
dropSamplesAtEnd
;
int
foundXing
;
int
foundFirstFrame
;
int
decodedFirstFrame
;
int
flush
;
...
...
@@ -161,6 +162,7 @@ static void initMp3DecodeData(mp3DecodeData * data, InputStream * inStream)
data
->
dropFramesAtEnd
=
0
;
data
->
dropSamplesAtStart
=
0
;
data
->
dropSamplesAtEnd
=
0
;
data
->
foundXing
=
0
;
data
->
foundFirstFrame
=
0
;
data
->
decodedFirstFrame
=
0
;
data
->
flush
=
1
;
...
...
@@ -640,6 +642,7 @@ static int decodeFirstFrame(mp3DecodeData * data, DecoderControl * dc,
bitlen
=
data
->
stream
.
anc_bitlen
;
if
(
parse_xing
(
&
xing
,
&
ptr
,
&
bitlen
))
{
data
->
foundXing
=
1
;
data
->
muteFrame
=
MUTEFRAME_SKIP
;
if
(
parse_lame
(
&
lame
,
&
ptr
,
&
bitlen
))
{
...
...
@@ -737,9 +740,12 @@ static int mp3Read(mp3DecodeData * data, OutputBuffer * cb, DecoderControl * dc,
mad_timer_add
(
&
data
->
timer
,
(
data
->
frame
).
header
.
duration
);
data
->
bitRate
=
(
data
->
frame
).
header
.
bitrate
;
if
(
data
->
currentFrame
>=
data
->
maxFrames
)
{
/* stop decoding, since Xing maxFrames is accurate */
if
(
data
->
foundXing
)
return
DECODE_BREAK
;
data
->
currentFrame
=
data
->
maxFrames
-
1
;
}
else
}
else
{
data
->
highestFrame
++
;
}
data
->
frameOffset
[
data
->
currentFrame
]
=
data
->
inStream
->
offset
;
if
(
data
->
stream
.
this_frame
!=
NULL
)
{
data
->
frameOffset
[
data
->
currentFrame
]
-=
...
...
@@ -749,8 +755,9 @@ static int mp3Read(mp3DecodeData * data, OutputBuffer * cb, DecoderControl * dc,
data
->
stream
.
bufend
-
data
->
stream
.
buffer
;
}
data
->
times
[
data
->
currentFrame
]
=
data
->
timer
;
}
else
}
else
{
data
->
timer
=
data
->
times
[
data
->
currentFrame
];
}
data
->
currentFrame
++
;
data
->
elapsedTime
=
((
float
)
mad_timer_count
(
data
->
timer
,
MAD_UNITS_MILLISECONDS
))
/
...
...
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