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
e65fb6e1
Commit
e65fb6e1
authored
Jul 25, 2006
by
J. Alexander Treuman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Reworking xing parsing so lame tags will fit in better
git-svn-id:
https://svn.musicpd.org/mpd/trunk@4456
09075e82-0dd4-0310-85a5-a0d7c8717e4f
parent
0979b0f7
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
20 deletions
+19
-20
mp3_plugin.c
src/inputPlugins/mp3_plugin.c
+19
-20
No files found.
src/inputPlugins/mp3_plugin.c
View file @
e65fb6e1
...
...
@@ -453,14 +453,14 @@ enum {
XING_SCALE
=
0x00000008L
,
};
static
int
parse_xing
(
struct
xing
*
xing
,
struct
mad_bitptr
*
ptr
,
int
bitlen
)
static
int
parse_xing
(
struct
xing
*
xing
,
struct
mad_bitptr
*
ptr
,
int
*
old
bitlen
)
{
unsigned
long
bits
;
int
old
bitlen
;
int
bitlen
;
int
bitsleft
;
int
i
;
oldbitlen
=
bitlen
;
bitlen
=
*
old
bitlen
;
if
(
bitlen
<
16
)
goto
fail
;
bits
=
mad_bit_read
(
ptr
,
16
);
...
...
@@ -511,38 +511,31 @@ static int parse_xing(struct xing *xing, struct mad_bitptr *ptr, int bitlen)
/* Make sure we consume no less than 120 bytes (960 bits) in hopes that
* the LAME tag is found there, and not right after the Xing header */
bitsleft
=
960
-
(
oldbitlen
-
bitlen
);
bitsleft
=
960
-
(
(
*
oldbitlen
)
-
bitlen
);
if
(
bitsleft
<
0
)
goto
fail
;
else
if
(
bitsleft
>
0
)
{
mad_bit_read
(
ptr
,
bitsleft
);
bitlen
-=
bitsleft
;
}
return
bitlen
;
fail:
xing
->
flags
=
0
;
return
-
1
;
}
static
int
parse_extensions
(
struct
xing
*
xing
,
struct
mad_bitptr
ptr
,
int
bitlen
)
{
bitlen
=
parse_xing
(
xing
,
&
ptr
,
bitlen
);
if
(
bitlen
<
0
)
return
0
;
*
oldbitlen
=
bitlen
;
return
1
;
fail:
xing
->
flags
=
0
;
return
0
;
}
static
int
decodeFirstFrame
(
mp3DecodeData
*
data
,
DecoderControl
*
dc
,
MpdTag
**
tag
,
ReplayGainInfo
**
replayGainInfo
)
{
struct
xing
xing
;
struct
mad_bitptr
ptr
;
int
bitlen
;
int
found_xing
;
int
ret
;
int
skip
;
memset
(
&
xing
,
0
,
sizeof
(
struct
xing
));
xing
.
flags
=
0
;
while
(
1
)
{
skip
=
0
;
while
((
ret
=
decodeNextFrameHeader
(
data
,
tag
,
replayGainInfo
))
==
DECODE_CONT
&&
...
...
@@ -558,9 +551,15 @@ static int decodeFirstFrame(mp3DecodeData * data, DecoderControl * dc,
if
(
!
skip
&&
ret
==
DECODE_OK
)
break
;
}
if
(
parse_extensions
(
&
xing
,
data
->
stream
.
anc_ptr
,
(
int
)
data
->
stream
.
anc_bitlen
))
{
ptr
=
data
->
stream
.
anc_ptr
;
bitlen
=
data
->
stream
.
anc_bitlen
;
found_xing
=
parse_xing
(
&
xing
,
&
ptr
,
&
bitlen
);
if
(
found_xing
)
{
DEBUG
(
"yay xing works!
\n
"
);
if
(
xing
.
flags
&
XING_FRAMES
)
{
DEBUG
(
"yay we got frames from xing!
\n
"
);
mad_timer_t
duration
=
data
->
frame
.
header
.
duration
;
mad_timer_multiply
(
&
duration
,
xing
.
frames
);
data
->
muteFrame
=
MUTEFRAME_SKIP
;
...
...
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