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
3f1eaf59
Commit
3f1eaf59
authored
Nov 14, 2014
by
Benoit Fouet
Committed by
Michael Niedermayer
Nov 14, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avcodec/pngdec: create a function to decode pHYs chunk.
Signed-off-by:
Michael Niedermayer
<
michaelni@gmx.at
>
parent
1523d148
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
9 deletions
+18
-9
pngdec.c
libavcodec/pngdec.c
+18
-9
No files found.
libavcodec/pngdec.c
View file @
3f1eaf59
...
@@ -543,6 +543,23 @@ static int decode_ihdr_chunk(AVCodecContext *avctx, PNGDecContext *s,
...
@@ -543,6 +543,23 @@ static int decode_ihdr_chunk(AVCodecContext *avctx, PNGDecContext *s,
"compression_type=%d filter_type=%d interlace_type=%d
\n
"
,
"compression_type=%d filter_type=%d interlace_type=%d
\n
"
,
s
->
width
,
s
->
height
,
s
->
bit_depth
,
s
->
color_type
,
s
->
width
,
s
->
height
,
s
->
bit_depth
,
s
->
color_type
,
s
->
compression_type
,
s
->
filter_type
,
s
->
interlace_type
);
s
->
compression_type
,
s
->
filter_type
,
s
->
interlace_type
);
return
0
;
}
static
int
decode_phys_chunk
(
AVCodecContext
*
avctx
,
PNGDecContext
*
s
)
{
if
(
s
->
state
&
PNG_IDAT
)
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"pHYs after IDAT
\n
"
);
return
AVERROR_INVALIDDATA
;
}
avctx
->
sample_aspect_ratio
.
num
=
bytestream2_get_be32
(
&
s
->
gb
);
avctx
->
sample_aspect_ratio
.
den
=
bytestream2_get_be32
(
&
s
->
gb
);
if
(
avctx
->
sample_aspect_ratio
.
num
<
0
||
avctx
->
sample_aspect_ratio
.
den
<
0
)
avctx
->
sample_aspect_ratio
=
(
AVRational
){
0
,
1
};
bytestream2_skip
(
&
s
->
gb
,
1
);
/* unit specifier */
bytestream2_skip
(
&
s
->
gb
,
4
);
/* crc */
return
0
;
return
0
;
}
}
...
@@ -611,16 +628,8 @@ static int decode_frame_png(AVCodecContext *avctx,
...
@@ -611,16 +628,8 @@ static int decode_frame_png(AVCodecContext *avctx,
goto
fail
;
goto
fail
;
break
;
break
;
case
MKTAG
(
'p'
,
'H'
,
'Y'
,
's'
):
case
MKTAG
(
'p'
,
'H'
,
'Y'
,
's'
):
if
(
s
->
state
&
PNG_IDAT
)
{
if
(
decode_phys_chunk
(
avctx
,
s
)
<
0
)
av_log
(
avctx
,
AV_LOG_ERROR
,
"pHYs after IDAT
\n
"
);
goto
fail
;
goto
fail
;
}
avctx
->
sample_aspect_ratio
.
num
=
bytestream2_get_be32
(
&
s
->
gb
);
avctx
->
sample_aspect_ratio
.
den
=
bytestream2_get_be32
(
&
s
->
gb
);
if
(
avctx
->
sample_aspect_ratio
.
num
<
0
||
avctx
->
sample_aspect_ratio
.
den
<
0
)
avctx
->
sample_aspect_ratio
=
(
AVRational
){
0
,
1
};
bytestream2_skip
(
&
s
->
gb
,
1
);
/* unit specifier */
bytestream2_skip
(
&
s
->
gb
,
4
);
/* crc */
break
;
break
;
case
MKTAG
(
'I'
,
'D'
,
'A'
,
'T'
)
:
case
MKTAG
(
'I'
,
'D'
,
'A'
,
'T'
)
:
if
(
!
(
s
->
state
&
PNG_IHDR
))
{
if
(
!
(
s
->
state
&
PNG_IHDR
))
{
...
...
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