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
1bb75913
Commit
1bb75913
authored
Mar 21, 2004
by
Warren Dukes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
begin parsing work on AAC info parsing
git-svn-id:
https://svn.musicpd.org/mpd/trunk@345
09075e82-0dd4-0310-85a5-a0d7c8717e4f
parent
9ab67e75
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
105 additions
and
1 deletion
+105
-1
tag.c
src/tag.c
+105
-1
No files found.
src/tag.c
View file @
1bb75913
...
...
@@ -173,7 +173,111 @@ MpdTag * mp3TagDup(char * utf8file) {
#endif
#ifdef HAVE_FAAD
/* copied from FAAD2 frontend */
typedef
struct
{
long
bytesIntoBuffer
;
long
bytesConsumed
;
long
fileOffset
;
unsigned
char
*
buffer
;
int
atEof
;
FILE
*
infile
;
}
AacBuffer
;
void
fillAacBuffer
(
AacBuffer
*
b
)
{
if
(
b
->
bytesConsumed
>
0
)
{
int
bread
;
if
(
b
->
bytesIntoBuffer
)
{
memmove
((
void
*
)
b
->
buffer
,(
void
*
)(
b
->
buffer
+
b
->
bytesConsumed
),
b
->
bytesIntoBuffer
);
}
if
(
!
b
->
atEof
)
{
bread
=
fread
((
void
*
)(
b
->
buffer
+
b
->
bytesIntoBuffer
),
1
,
b
->
bytesConsumed
,
b
->
infile
);
if
(
bread
!=
b
->
bytesConsumed
)
b
->
atEof
=
1
;
b
->
bytesIntoBuffer
+=
bread
;
}
b
->
bytesConsumed
=
0
;
if
(
b
->
bytesIntoBuffer
>
3
)
{
if
(
memcmp
(
b
->
buffer
,
"TAG"
,
3
)
==
0
)
b
->
bytesIntoBuffer
=
0
;
}
if
(
b
->
bytesIntoBuffer
>
11
)
{
if
(
memcmp
(
b
->
buffer
,
"LYRICSBEGIN"
,
11
)
==
0
)
{
b
->
bytesIntoBuffer
=
0
;
}
}
if
(
b
->
bytesIntoBuffer
>
8
)
{
if
(
memcmp
(
b
->
buffer
,
"APETAGEX"
,
8
)
==
0
)
{
b
->
bytesIntoBuffer
=
0
;
}
}
}
}
void
advanceAacBuffer
(
AacBuffer
*
b
,
int
bytes
)
{
b
->
fileOffset
+=
bytes
;
b
->
bytesConsumed
=
bytes
;
b
->
bytesIntoBuffer
-=
bytes
;
}
static
int
adtsSampleRates
[]
=
{
96000
,
88200
,
64000
,
48000
,
44100
,
32000
,
24000
,
22050
,
16000
,
12000
,
11025
,
8000
,
7350
,
0
,
0
,
0
};
int
adtsParse
(
AacBuffer
*
b
,
float
*
length
)
{
int
frames
,
frameLength
;
int
tFrameLength
=
0
;
int
sampleRate
=
0
;
float
framesPerSec
,
bytesPerFrame
;
/* Read all frames to ensure correct time and bitrate */
for
(
frames
=
0
;
;
frames
++
)
{
fillAacBuffer
(
b
);
if
(
b
->
bytesIntoBuffer
>
7
)
{
/* check syncword */
if
(
!
((
b
->
buffer
[
0
]
==
0xFF
)
&&
((
b
->
buffer
[
1
]
&
0xF6
)
==
0xF0
)))
{
break
;
}
if
(
frames
==
0
)
{
sampleRate
=
adtsSampleRates
[
(
b
->
buffer
[
2
]
&
0x3c
)
>>
2
];
}
frameLength
=
((((
unsigned
int
)
b
->
buffer
[
3
]
&
0x3
))
<<
11
)
|
(((
unsigned
int
)
b
->
buffer
[
4
])
<<
3
)
|
(
b
->
buffer
[
5
]
>>
5
);
tFrameLength
+=
frameLength
;
if
(
frameLength
>
b
->
bytesIntoBuffer
)
break
;
advanceAacBuffer
(
b
,
frameLength
);
}
else
break
;
}
framesPerSec
=
(
float
)
sampleRate
/
1024
.
0
;
if
(
frames
!=
0
)
{
bytesPerFrame
=
(
float
)
tFrameLength
/
(
float
)(
frames
*
1000
);
}
else
bytesPerFrame
=
0
;
if
(
framesPerSec
!=
0
)
*
length
=
(
float
)
frames
/
framesPerSec
;
else
*
length
=
1
;
return
1
;
}
MpdTag
*
aacTagDup
(
char
*
utf8file
)
{
MpdTag
*
ret
=
NULL
;
return
ret
;
}
MpdTag
*
mp4DataDup
(
char
*
utf8file
,
int
*
mp4MetadataFound
)
{
MpdTag
*
ret
=
NULL
;
FILE
*
fh
;
...
...
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