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
00c47b3c
Commit
00c47b3c
authored
Aug 26, 2008
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
find AAC frames
Find AAC frames in the input and skip invalid data. This prepares AAC streaming.
parent
f43e3904
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
1 deletion
+35
-1
aac_plugin.c
src/inputPlugins/aac_plugin.c
+35
-1
No files found.
src/inputPlugins/aac_plugin.c
View file @
00c47b3c
...
...
@@ -111,6 +111,40 @@ static size_t adts_check_frame(AacBuffer * b)
(
b
->
buffer
[
5
]
>>
5
);
}
/**
* Find the next AAC frame in the buffer. Returns 0 if no frame is
* found or if not enough data is available.
*/
static
size_t
adts_find_frame
(
AacBuffer
*
b
)
{
const
unsigned
char
*
p
;
size_t
frame_length
;
while
((
p
=
memchr
(
b
->
buffer
,
0xff
,
b
->
bytesIntoBuffer
))
!=
NULL
)
{
/* discard data before 0xff */
if
(
p
>
b
->
buffer
)
aac_buffer_shift
(
b
,
p
-
b
->
buffer
);
if
(
b
->
bytesIntoBuffer
<=
7
)
/* not enough data yet */
return
0
;
/* is it a frame? */
frame_length
=
adts_check_frame
(
b
);
if
(
frame_length
>
0
)
/* yes, it is */
return
frame_length
;
/* it's just some random 0xff byte; discard and and
continue searching */
aac_buffer_shift
(
b
,
1
);
}
/* nothing at all; discard the whole buffer */
aac_buffer_shift
(
b
,
b
->
bytesIntoBuffer
);
return
0
;
}
static
void
adtsParse
(
AacBuffer
*
b
,
float
*
length
)
{
unsigned
int
frames
,
frameLength
;
...
...
@@ -121,7 +155,7 @@ static void adtsParse(AacBuffer * b, float *length)
for
(
frames
=
0
;;
frames
++
)
{
fillAacBuffer
(
b
);
frameLength
=
adts_
check
_frame
(
b
);
frameLength
=
adts_
find
_frame
(
b
);
if
(
frameLength
>
0
)
{
if
(
frames
==
0
)
{
sampleRate
=
adtsSampleRates
[(
b
->
...
...
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