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
0f8d7719
Commit
0f8d7719
authored
Oct 14, 2011
by
JULIAN GARDNER
Committed by
Michael Niedermayer
Oct 14, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dvbsubdec: add version checking
Signed-off-by:
Michael Niedermayer
<
michaelni@gmx.at
>
parent
1fc7b0ed
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
1 deletion
+27
-1
dvbsubdec.c
libavcodec/dvbsubdec.c
+27
-1
No files found.
libavcodec/dvbsubdec.c
View file @
0f8d7719
...
...
@@ -154,6 +154,7 @@ static void png_save2(const char *filename, uint32_t *bitmap, int w, int h)
typedef
struct
DVBSubCLUT
{
int
id
;
int
version
;
uint32_t
clut4
[
4
];
uint32_t
clut16
[
16
];
...
...
@@ -180,6 +181,7 @@ typedef struct DVBSubObjectDisplay {
typedef
struct
DVBSubObject
{
int
id
;
int
version
;
int
type
;
...
...
@@ -199,6 +201,7 @@ typedef struct DVBSubRegionDisplay {
typedef
struct
DVBSubRegion
{
int
id
;
int
version
;
int
width
;
int
height
;
...
...
@@ -229,6 +232,7 @@ typedef struct DVBSubContext {
int
composition_id
;
int
ancillary_id
;
int
version
;
int
time_out
;
DVBSubRegion
*
region_list
;
DVBSubCLUT
*
clut_list
;
...
...
@@ -375,6 +379,8 @@ static av_cold int dvbsub_init_decoder(AVCodecContext *avctx)
ctx
->
ancillary_id
=
AV_RB16
(
avctx
->
extradata
+
2
);
}
ctx
->
version
=
-
1
;
default_clut
.
id
=
-
1
;
default_clut
.
next
=
NULL
;
...
...
@@ -928,6 +934,7 @@ static void dvbsub_parse_clut_segment(AVCodecContext *avctx,
const
uint8_t
*
buf_end
=
buf
+
buf_size
;
int
i
,
clut_id
;
int
version
;
DVBSubCLUT
*
clut
;
int
entry_id
,
depth
,
full_range
;
int
y
,
cr
,
cb
,
alpha
;
...
...
@@ -945,6 +952,7 @@ static void dvbsub_parse_clut_segment(AVCodecContext *avctx,
av_dlog
(
avctx
,
"
\n
"
);
clut_id
=
*
buf
++
;
version
=
((
*
buf
)
>>
4
)
&
15
;
buf
+=
1
;
clut
=
get_clut
(
ctx
,
clut_id
);
...
...
@@ -955,11 +963,16 @@ static void dvbsub_parse_clut_segment(AVCodecContext *avctx,
memcpy
(
clut
,
&
default_clut
,
sizeof
(
DVBSubCLUT
));
clut
->
id
=
clut_id
;
clut
->
version
=
-
1
;
clut
->
next
=
ctx
->
clut_list
;
ctx
->
clut_list
=
clut
;
}
if
(
clut
->
version
!=
version
)
{
clut
->
version
=
version
;
while
(
buf
+
4
<
buf_end
)
{
entry_id
=
*
buf
++
;
...
...
@@ -1001,6 +1014,7 @@ static void dvbsub_parse_clut_segment(AVCodecContext *avctx,
if
(
depth
&
0x20
)
clut
->
clut256
[
entry_id
]
=
RGBA
(
r
,
g
,
b
,
255
-
alpha
);
}
}
}
...
...
@@ -1011,6 +1025,7 @@ static void dvbsub_parse_region_segment(AVCodecContext *avctx,
const
uint8_t
*
buf_end
=
buf
+
buf_size
;
int
region_id
,
object_id
;
int
version
;
DVBSubRegion
*
region
;
DVBSubObject
*
object
;
DVBSubObjectDisplay
*
display
;
...
...
@@ -1027,11 +1042,13 @@ static void dvbsub_parse_region_segment(AVCodecContext *avctx,
region
=
av_mallocz
(
sizeof
(
DVBSubRegion
));
region
->
id
=
region_id
;
region
->
version
=
-
1
;
region
->
next
=
ctx
->
region_list
;
ctx
->
region_list
=
region
;
}
version
=
((
*
buf
)
>>
4
)
&
15
;
fill
=
((
*
buf
++
)
>>
3
)
&
1
;
region
->
width
=
AV_RB16
(
buf
);
...
...
@@ -1127,13 +1144,21 @@ static void dvbsub_parse_page_segment(AVCodecContext *avctx,
const
uint8_t
*
buf_end
=
buf
+
buf_size
;
int
region_id
;
int
page_state
;
int
timeout
;
int
version
;
if
(
buf_size
<
1
)
return
;
ctx
->
time_out
=
*
buf
++
;
timeout
=
*
buf
++
;
version
=
((
*
buf
)
>>
4
)
&
15
;
page_state
=
((
*
buf
++
)
>>
2
)
&
3
;
if
(
ctx
->
version
!=
version
)
{
ctx
->
time_out
=
timeout
;
ctx
->
version
=
version
;
av_dlog
(
avctx
,
"Page time out %ds, state %d
\n
"
,
ctx
->
time_out
,
page_state
);
if
(
page_state
==
1
||
page_state
==
2
)
{
...
...
@@ -1184,6 +1209,7 @@ static void dvbsub_parse_page_segment(AVCodecContext *avctx,
av_free
(
display
);
}
}
}
...
...
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