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
93402561
Commit
93402561
authored
Mar 01, 2019
by
Paul B Mahol
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avcodec/imm4: add support for mid-stream size changes
parent
056a2ac1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
12 deletions
+15
-12
imm4.c
libavcodec/imm4.c
+15
-12
No files found.
libavcodec/imm4.c
View file @
93402561
...
...
@@ -41,7 +41,6 @@ typedef struct IMM4Context {
uint8_t
*
bitstream
;
int
bitstream_size
;
int
changed_size
;
int
factor
;
unsigned
lo
;
unsigned
hi
;
...
...
@@ -370,6 +369,7 @@ static int decode_frame(AVCodecContext *avctx, void *data,
IMM4Context
*
s
=
avctx
->
priv_data
;
GetBitContext
*
gb
=
&
s
->
gb
;
AVFrame
*
frame
=
data
;
int
width
,
height
;
unsigned
type
;
int
ret
,
scaled
;
...
...
@@ -391,9 +391,11 @@ static int decode_frame(AVCodecContext *avctx, void *data,
avctx
->
pix_fmt
=
AV_PIX_FMT_YUV420P
;
avctx
->
color_range
=
AVCOL_RANGE_JPEG
;
width
=
avctx
->
width
;
height
=
avctx
->
height
;
scaled
=
avpkt
->
data
[
8
];
if
(
scaled
<
2
)
{
int
width
,
height
;
int
mode
=
avpkt
->
data
[
10
];
switch
(
mode
)
{
...
...
@@ -422,18 +424,8 @@ static int decode_frame(AVCodecContext *avctx, void *data,
height
=
576
;
break
;
}
if
(
s
->
changed_size
==
1
&&
(
avctx
->
width
!=
width
||
avctx
->
height
!=
height
))
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"Frame size change is unsupported.
\n
"
);
return
AVERROR_INVALIDDATA
;
}
ret
=
ff_set_dimensions
(
avctx
,
width
,
height
);
if
(
ret
<
0
)
return
ret
;
}
s
->
changed_size
=
1
;
skip_bits_long
(
gb
,
24
*
8
);
type
=
get_bits_long
(
gb
,
32
);
s
->
hi
=
get_bits
(
gb
,
16
);
...
...
@@ -453,6 +445,17 @@ static int decode_frame(AVCodecContext *avctx, void *data,
return
AVERROR_PATCHWELCOME
;
}
if
(
!
frame
->
key_frame
&&
(
avctx
->
width
!=
width
||
avctx
->
height
!=
height
))
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"Frame size change is unsupported.
\n
"
);
return
AVERROR_INVALIDDATA
;
}
ret
=
ff_set_dimensions
(
avctx
,
width
,
height
);
if
(
ret
<
0
)
return
ret
;
if
((
ret
=
ff_get_buffer
(
avctx
,
frame
,
frame
->
key_frame
?
AV_GET_BUFFER_FLAG_REF
:
0
))
<
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