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
d6d78518
Commit
d6d78518
authored
Oct 21, 2013
by
Maxim Poliakovski
Committed by
Kostya Shishkov
Feb 11, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
g2meet: factor out seeking to the chunk end
Signed-off-by:
Kostya Shishkov
<
kostya.shishkov@gmail.com
>
parent
77bb0004
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
13 deletions
+8
-13
g2meet.c
libavcodec/g2meet.c
+8
-13
No files found.
libavcodec/g2meet.c
View file @
d6d78518
...
...
@@ -645,7 +645,7 @@ static int g2m_decode_frame(AVCodecContext *avctx, void *data,
int
magic
;
int
got_header
=
0
;
uint32_t
chunk_size
;
int
chunk_type
;
int
chunk_type
,
chunk_start
;
int
i
;
int
ret
;
...
...
@@ -673,6 +673,7 @@ static int g2m_decode_frame(AVCodecContext *avctx, void *data,
while
(
bytestream2_get_bytes_left
(
&
bc
)
>
5
)
{
chunk_size
=
bytestream2_get_le32
(
&
bc
)
-
1
;
chunk_type
=
bytestream2_get_byte
(
&
bc
);
chunk_start
=
bytestream2_tell
(
&
bc
);
if
(
chunk_size
>
bytestream2_get_bytes_left
(
&
bc
))
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"Invalid chunk size %d type %02X
\n
"
,
chunk_size
,
chunk_type
);
...
...
@@ -718,8 +719,6 @@ static int g2m_decode_frame(AVCodecContext *avctx, void *data,
c
->
tiles_x
=
(
c
->
width
+
c
->
tile_width
-
1
)
/
c
->
tile_width
;
c
->
tiles_y
=
(
c
->
height
+
c
->
tile_height
-
1
)
/
c
->
tile_height
;
c
->
bpp
=
bytestream2_get_byte
(
&
bc
);
chunk_size
-=
21
;
bytestream2_skip
(
&
bc
,
chunk_size
);
if
(
g2m_init_buffers
(
c
))
{
ret
=
AVERROR
(
ENOMEM
);
goto
header_fail
;
...
...
@@ -730,7 +729,6 @@ static int g2m_decode_frame(AVCodecContext *avctx, void *data,
if
(
!
c
->
tiles_x
||
!
c
->
tiles_y
)
{
av_log
(
avctx
,
AV_LOG_WARNING
,
"No display info - skipping tile
\n
"
);
bytestream2_skip
(
&
bc
,
bytestream2_get_bytes_left
(
&
bc
));
break
;
}
if
(
chunk_size
<
2
)
{
...
...
@@ -746,7 +744,6 @@ static int g2m_decode_frame(AVCodecContext *avctx, void *data,
c
->
tile_x
,
c
->
tile_y
,
c
->
tiles_x
,
c
->
tiles_y
);
break
;
}
chunk_size
-=
2
;
ret
=
0
;
switch
(
c
->
compression
)
{
case
COMPR_EPIC_J_B
:
...
...
@@ -756,13 +753,12 @@ static int g2m_decode_frame(AVCodecContext *avctx, void *data,
case
COMPR_KEMPF_J_B
:
ret
=
kempf_decode_tile
(
c
,
c
->
tile_x
,
c
->
tile_y
,
buf
+
bytestream2_tell
(
&
bc
),
chunk_size
);
chunk_size
-
2
);
break
;
}
if
(
ret
&&
c
->
framebuf
)
av_log
(
avctx
,
AV_LOG_ERROR
,
"Error decoding tile %d,%d
\n
"
,
c
->
tile_x
,
c
->
tile_y
);
bytestream2_skip
(
&
bc
,
chunk_size
);
break
;
case
CURSOR_POS
:
if
(
chunk_size
<
5
)
{
...
...
@@ -772,7 +768,6 @@ static int g2m_decode_frame(AVCodecContext *avctx, void *data,
}
c
->
cursor_x
=
bytestream2_get_be16
(
&
bc
);
c
->
cursor_y
=
bytestream2_get_be16
(
&
bc
);
bytestream2_skip
(
&
bc
,
chunk_size
-
4
);
break
;
case
CURSOR_SHAPE
:
if
(
chunk_size
<
8
)
{
...
...
@@ -783,17 +778,17 @@ static int g2m_decode_frame(AVCodecContext *avctx, void *data,
bytestream2_init
(
&
tbc
,
buf
+
bytestream2_tell
(
&
bc
),
chunk_size
-
4
);
g2m_load_cursor
(
avctx
,
c
,
&
tbc
);
bytestream2_skip
(
&
bc
,
chunk_size
);
break
;
case
CHUNK_CC
:
case
CHUNK_CD
:
bytestream2_skip
(
&
bc
,
chunk_size
);
break
;
default:
av_log
(
avctx
,
AV_LOG_WARNING
,
"Skipping chunk type %02X
\n
"
,
chunk_type
);
bytestream2_skip
(
&
bc
,
chunk_size
);
}
/* navigate to next chunk */
bytestream2_skip
(
&
bc
,
chunk_start
+
chunk_size
-
bytestream2_tell
(
&
bc
));
}
if
(
got_header
)
c
->
got_header
=
1
;
...
...
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