Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
F
ffmpeg
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
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
ffmpeg
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
Show 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)
...
@@ -201,7 +201,7 @@ void ff_flac_set_channel_layout(AVCodecContext *avctx)
avctx
->
channel_layout
=
0
;
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
)
const
uint8_t
*
buffer
)
{
{
GetBitContext
gb
;
GetBitContext
gb
;
...
@@ -213,6 +213,7 @@ void ff_flac_parse_streaminfo(AVCodecContext *avctx, struct FLACStreaminfo *s,
...
@@ -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
"
,
av_log
(
avctx
,
AV_LOG_WARNING
,
"invalid max blocksize: %d
\n
"
,
s
->
max_blocksize
);
s
->
max_blocksize
);
s
->
max_blocksize
=
16
;
s
->
max_blocksize
=
16
;
return
AVERROR_INVALIDDATA
;
}
}
skip_bits
(
&
gb
,
24
);
/* skip min frame size */
skip_bits
(
&
gb
,
24
);
/* skip min frame size */
...
@@ -225,6 +226,7 @@ void ff_flac_parse_streaminfo(AVCodecContext *avctx, struct FLACStreaminfo *s,
...
@@ -225,6 +226,7 @@ void ff_flac_parse_streaminfo(AVCodecContext *avctx, struct FLACStreaminfo *s,
if
(
s
->
bps
<
4
)
{
if
(
s
->
bps
<
4
)
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"invalid bps: %d
\n
"
,
s
->
bps
);
av_log
(
avctx
,
AV_LOG_ERROR
,
"invalid bps: %d
\n
"
,
s
->
bps
);
s
->
bps
=
16
;
s
->
bps
=
16
;
return
AVERROR_INVALIDDATA
;
}
}
avctx
->
channels
=
s
->
channels
;
avctx
->
channels
=
s
->
channels
;
...
@@ -239,4 +241,6 @@ void ff_flac_parse_streaminfo(AVCodecContext *avctx, struct FLACStreaminfo *s,
...
@@ -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 */
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 {
...
@@ -95,8 +95,10 @@ typedef struct FLACFrameInfo {
* @param[out] avctx codec context to set basic stream parameters
* @param[out] avctx codec context to set basic stream parameters
* @param[out] s where parsed information is stored
* @param[out] s where parsed information is stored
* @param[in] buffer pointer to start of 34-byte streaminfo data
* @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
);
const
uint8_t
*
buffer
);
/**
/**
...
...
libavcodec/flacdec.c
View file @
6567c59c
...
@@ -109,7 +109,9 @@ static av_cold int flac_decode_init(AVCodecContext *avctx)
...
@@ -109,7 +109,9 @@ static av_cold int flac_decode_init(AVCodecContext *avctx)
return
AVERROR_INVALIDDATA
;
return
AVERROR_INVALIDDATA
;
/* initialize based on the demuxer-supplied streamdata header */
/* 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
);
ret
=
allocate_buffers
(
s
);
if
(
ret
<
0
)
if
(
ret
<
0
)
return
ret
;
return
ret
;
...
@@ -175,7 +177,9 @@ static int parse_streaminfo(FLACContext *s, const uint8_t *buf, int buf_size)
...
@@ -175,7 +177,9 @@ static int parse_streaminfo(FLACContext *s, const uint8_t *buf, int buf_size)
metadata_size
!=
FLAC_STREAMINFO_SIZE
)
{
metadata_size
!=
FLAC_STREAMINFO_SIZE
)
{
return
AVERROR_INVALIDDATA
;
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
);
ret
=
allocate_buffers
(
s
);
if
(
ret
<
0
)
if
(
ret
<
0
)
return
ret
;
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