Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
FFmpeg
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
libremedia
Tethys
FFmpeg
Commits
c3bbd0b5
Commit
c3bbd0b5
authored
13 years ago
by
Ronald S. Bultje
Browse files
Options
Downloads
Patches
Plain Diff
alac: convert extradata reading to bytestream2.
parent
62ce9def
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
libavcodec/alac.c
+20
-19
20 additions, 19 deletions
libavcodec/alac.c
with
20 additions
and
19 deletions
libavcodec/alac.c
+
20
−
19
View file @
c3bbd0b5
...
@@ -571,29 +571,30 @@ buf_alloc_fail:
...
@@ -571,29 +571,30 @@ buf_alloc_fail:
static
int
alac_set_info
(
ALACContext
*
alac
)
static
int
alac_set_info
(
ALACContext
*
alac
)
{
{
const
unsigned
char
*
ptr
=
alac
->
avctx
->
extradata
;
GetByteContext
gb
;
ptr
+=
4
;
/* size */
bytestream2_init
(
&
gb
,
alac
->
avctx
->
extradata
,
ptr
+=
4
;
/* alac */
alac
->
avctx
->
extradata_size
);
ptr
+=
4
;
/* version */
if
(
AV_RB32
(
ptr
)
>=
UINT_MAX
/
4
){
bytestream2_skipu
(
&
gb
,
12
);
// size:4, alac:4, version:4
av_log
(
alac
->
avctx
,
AV_LOG_ERROR
,
"setinfo_max_samples_per_frame too large
\n
"
);
return
-
1
;
}
/* buffer size / 2 ? */
/* buffer size / 2 ? */
alac
->
setinfo_max_samples_per_frame
=
bytestream_get_be32
(
&
ptr
);
alac
->
setinfo_max_samples_per_frame
=
bytestream2_get_be32u
(
&
gb
);
ptr
++
;
/* compatible version */
if
(
alac
->
setinfo_max_samples_per_frame
>=
UINT_MAX
/
4
){
alac
->
setinfo_sample_size
=
*
ptr
++
;
av_log
(
alac
->
avctx
,
AV_LOG_ERROR
,
alac
->
setinfo_rice_historymult
=
*
ptr
++
;
"setinfo_max_samples_per_frame too large
\n
"
);
alac
->
setinfo_rice_initialhistory
=
*
ptr
++
;
return
AVERROR_INVALIDDATA
;
alac
->
setinfo_rice_kmodifier
=
*
ptr
++
;
}
alac
->
numchannels
=
*
ptr
++
;
bytestream2_skipu
(
&
gb
,
1
);
// compatible version
bytestream_get_be16
(
&
ptr
);
/* maxRun */
alac
->
setinfo_sample_size
=
bytestream2_get_byteu
(
&
gb
);
bytestream_get_be32
(
&
ptr
);
/* max coded frame size */
alac
->
setinfo_rice_historymult
=
bytestream2_get_byteu
(
&
gb
);
bytestream_get_be32
(
&
ptr
);
/* average bitrate */
alac
->
setinfo_rice_initialhistory
=
bytestream2_get_byteu
(
&
gb
);
bytestream_get_be32
(
&
ptr
);
/* samplerate */
alac
->
setinfo_rice_kmodifier
=
bytestream2_get_byteu
(
&
gb
);
alac
->
numchannels
=
bytestream2_get_byteu
(
&
gb
);
bytestream2_get_be16u
(
&
gb
);
// maxRun
bytestream2_get_be32u
(
&
gb
);
// max coded frame size
bytestream2_get_be32u
(
&
gb
);
// average bitrate
bytestream2_get_be32u
(
&
gb
);
// samplerate
return
0
;
return
0
;
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment