Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
F
ffmpeg.wasm-core
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Linshizhi
ffmpeg.wasm-core
Commits
6567c59c
Commit
6567c59c
authored
Dec 03, 2016
by
Michael Niedermayer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avcodec/flac: forward errors from ff_flac_parse_streaminfo()
Signed-off-by:
Michael Niedermayer
<
michael@niedermayer.cc
>
parent
020d53eb
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
4 deletions
+14
-4
flac.c
libavcodec/flac.c
+5
-1
flac.h
libavcodec/flac.h
+3
-1
flacdec.c
libavcodec/flacdec.c
+6
-2
No files found.
libavcodec/flac.c
View file @
6567c59c
...
...
@@ -201,7 +201,7 @@ void ff_flac_set_channel_layout(AVCodecContext *avctx)
avctx
->
channel_layout
=
0
;
}
void
ff_flac_parse_streaminfo
(
AVCodecContext
*
avctx
,
struct
FLACStreaminfo
*
s
,
int
ff_flac_parse_streaminfo
(
AVCodecContext
*
avctx
,
struct
FLACStreaminfo
*
s
,
const
uint8_t
*
buffer
)
{
GetBitContext
gb
;
...
...
@@ -213,6 +213,7 @@ void ff_flac_parse_streaminfo(AVCodecContext *avctx, struct FLACStreaminfo *s,
av_log
(
avctx
,
AV_LOG_WARNING
,
"invalid max blocksize: %d
\n
"
,
s
->
max_blocksize
);
s
->
max_blocksize
=
16
;
return
AVERROR_INVALIDDATA
;
}
skip_bits
(
&
gb
,
24
);
/* skip min frame size */
...
...
@@ -225,6 +226,7 @@ void ff_flac_parse_streaminfo(AVCodecContext *avctx, struct FLACStreaminfo *s,
if
(
s
->
bps
<
4
)
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"invalid bps: %d
\n
"
,
s
->
bps
);
s
->
bps
=
16
;
return
AVERROR_INVALIDDATA
;
}
avctx
->
channels
=
s
->
channels
;
...
...
@@ -239,4 +241,6 @@ void ff_flac_parse_streaminfo(AVCodecContext *avctx, struct FLACStreaminfo *s,
skip_bits_long
(
&
gb
,
64
);
/* md5 sum */
skip_bits_long
(
&
gb
,
64
);
/* md5 sum */
return
0
;
}
libavcodec/flac.h
View file @
6567c59c
...
...
@@ -95,8 +95,10 @@ typedef struct FLACFrameInfo {
* @param[out] avctx codec context to set basic stream parameters
* @param[out] s where parsed information is stored
* @param[in] buffer pointer to start of 34-byte streaminfo data
*
* @return negative error code on faiure or >= 0 on success
*/
void
ff_flac_parse_streaminfo
(
AVCodecContext
*
avctx
,
struct
FLACStreaminfo
*
s
,
int
ff_flac_parse_streaminfo
(
AVCodecContext
*
avctx
,
struct
FLACStreaminfo
*
s
,
const
uint8_t
*
buffer
);
/**
...
...
libavcodec/flacdec.c
View file @
6567c59c
...
...
@@ -109,7 +109,9 @@ static av_cold int flac_decode_init(AVCodecContext *avctx)
return
AVERROR_INVALIDDATA
;
/* initialize based on the demuxer-supplied streamdata header */
ff_flac_parse_streaminfo
(
avctx
,
&
s
->
flac_stream_info
,
streaminfo
);
ret
=
ff_flac_parse_streaminfo
(
avctx
,
&
s
->
flac_stream_info
,
streaminfo
);
if
(
ret
<
0
)
return
ret
;
ret
=
allocate_buffers
(
s
);
if
(
ret
<
0
)
return
ret
;
...
...
@@ -175,7 +177,9 @@ static int parse_streaminfo(FLACContext *s, const uint8_t *buf, int buf_size)
metadata_size
!=
FLAC_STREAMINFO_SIZE
)
{
return
AVERROR_INVALIDDATA
;
}
ff_flac_parse_streaminfo
(
s
->
avctx
,
&
s
->
flac_stream_info
,
&
buf
[
8
]);
ret
=
ff_flac_parse_streaminfo
(
s
->
avctx
,
&
s
->
flac_stream_info
,
&
buf
[
8
]);
if
(
ret
<
0
)
return
ret
;
ret
=
allocate_buffers
(
s
);
if
(
ret
<
0
)
return
ret
;
...
...
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