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
1bf747ae
Commit
1bf747ae
authored
Jan 10, 2015
by
Michael Niedermayer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avcodec/dvbsubdec: Return proper error codes from more functions
Signed-off-by:
Michael Niedermayer
<
michaelni@gmx.at
>
parent
ebe3a41e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
11 deletions
+16
-11
dvbsubdec.c
libavcodec/dvbsubdec.c
+16
-11
No files found.
libavcodec/dvbsubdec.c
View file @
1bf747ae
...
@@ -1149,7 +1149,7 @@ static int dvbsub_parse_clut_segment(AVCodecContext *avctx,
...
@@ -1149,7 +1149,7 @@ static int dvbsub_parse_clut_segment(AVCodecContext *avctx,
}
}
static
void
dvbsub_parse_region_segment
(
AVCodecContext
*
avctx
,
static
int
dvbsub_parse_region_segment
(
AVCodecContext
*
avctx
,
const
uint8_t
*
buf
,
int
buf_size
)
const
uint8_t
*
buf
,
int
buf_size
)
{
{
DVBSubContext
*
ctx
=
avctx
->
priv_data
;
DVBSubContext
*
ctx
=
avctx
->
priv_data
;
...
@@ -1163,7 +1163,7 @@ static void dvbsub_parse_region_segment(AVCodecContext *avctx,
...
@@ -1163,7 +1163,7 @@ static void dvbsub_parse_region_segment(AVCodecContext *avctx,
int
fill
;
int
fill
;
if
(
buf_size
<
10
)
if
(
buf_size
<
10
)
return
;
return
AVERROR_INVALIDDATA
;
region_id
=
*
buf
++
;
region_id
=
*
buf
++
;
...
@@ -1172,7 +1172,7 @@ static void dvbsub_parse_region_segment(AVCodecContext *avctx,
...
@@ -1172,7 +1172,7 @@ static void dvbsub_parse_region_segment(AVCodecContext *avctx,
if
(
!
region
)
{
if
(
!
region
)
{
region
=
av_mallocz
(
sizeof
(
DVBSubRegion
));
region
=
av_mallocz
(
sizeof
(
DVBSubRegion
));
if
(
!
region
)
if
(
!
region
)
return
;
return
AVERROR
(
ENOMEM
)
;
region
->
id
=
region_id
;
region
->
id
=
region_id
;
region
->
version
=
-
1
;
region
->
version
=
-
1
;
...
@@ -1265,9 +1265,11 @@ static void dvbsub_parse_region_segment(AVCodecContext *avctx,
...
@@ -1265,9 +1265,11 @@ static void dvbsub_parse_region_segment(AVCodecContext *avctx,
display
->
object_list_next
=
object
->
display_list
;
display
->
object_list_next
=
object
->
display_list
;
object
->
display_list
=
display
;
object
->
display_list
=
display
;
}
}
return
0
;
}
}
static
void
dvbsub_parse_page_segment
(
AVCodecContext
*
avctx
,
static
int
dvbsub_parse_page_segment
(
AVCodecContext
*
avctx
,
const
uint8_t
*
buf
,
int
buf_size
,
AVSubtitle
*
sub
,
int
*
got_output
)
const
uint8_t
*
buf
,
int
buf_size
,
AVSubtitle
*
sub
,
int
*
got_output
)
{
{
DVBSubContext
*
ctx
=
avctx
->
priv_data
;
DVBSubContext
*
ctx
=
avctx
->
priv_data
;
...
@@ -1281,14 +1283,14 @@ static void dvbsub_parse_page_segment(AVCodecContext *avctx,
...
@@ -1281,14 +1283,14 @@ static void dvbsub_parse_page_segment(AVCodecContext *avctx,
int
version
;
int
version
;
if
(
buf_size
<
1
)
if
(
buf_size
<
1
)
return
;
return
AVERROR_INVALIDDATA
;
timeout
=
*
buf
++
;
timeout
=
*
buf
++
;
version
=
((
*
buf
)
>>
4
)
&
15
;
version
=
((
*
buf
)
>>
4
)
&
15
;
page_state
=
((
*
buf
++
)
>>
2
)
&
3
;
page_state
=
((
*
buf
++
)
>>
2
)
&
3
;
if
(
ctx
->
version
==
version
)
{
if
(
ctx
->
version
==
version
)
{
return
;
return
0
;
}
}
ctx
->
time_out
=
timeout
;
ctx
->
time_out
=
timeout
;
...
@@ -1346,6 +1348,7 @@ static void dvbsub_parse_page_segment(AVCodecContext *avctx,
...
@@ -1346,6 +1348,7 @@ static void dvbsub_parse_page_segment(AVCodecContext *avctx,
av_freep
(
&
display
);
av_freep
(
&
display
);
}
}
return
0
;
}
}
...
@@ -1444,7 +1447,7 @@ static void save_display_set(DVBSubContext *ctx)
...
@@ -1444,7 +1447,7 @@ static void save_display_set(DVBSubContext *ctx)
}
}
#endif
#endif
static
void
dvbsub_parse_display_definition_segment
(
AVCodecContext
*
avctx
,
static
int
dvbsub_parse_display_definition_segment
(
AVCodecContext
*
avctx
,
const
uint8_t
*
buf
,
const
uint8_t
*
buf
,
int
buf_size
)
int
buf_size
)
{
{
...
@@ -1453,19 +1456,19 @@ static void dvbsub_parse_display_definition_segment(AVCodecContext *avctx,
...
@@ -1453,19 +1456,19 @@ static void dvbsub_parse_display_definition_segment(AVCodecContext *avctx,
int
dds_version
,
info_byte
;
int
dds_version
,
info_byte
;
if
(
buf_size
<
5
)
if
(
buf_size
<
5
)
return
;
return
AVERROR_INVALIDDATA
;
info_byte
=
bytestream_get_byte
(
&
buf
);
info_byte
=
bytestream_get_byte
(
&
buf
);
dds_version
=
info_byte
>>
4
;
dds_version
=
info_byte
>>
4
;
if
(
display_def
&&
display_def
->
version
==
dds_version
)
if
(
display_def
&&
display_def
->
version
==
dds_version
)
return
;
// already have this display definition version
return
0
;
// already have this display definition version
if
(
!
display_def
)
{
if
(
!
display_def
)
{
display_def
=
av_mallocz
(
sizeof
(
*
display_def
));
display_def
=
av_mallocz
(
sizeof
(
*
display_def
));
ctx
->
display_definition
=
display_def
;
ctx
->
display_definition
=
display_def
;
}
}
if
(
!
display_def
)
if
(
!
display_def
)
return
;
return
AVERROR
(
ENOMEM
)
;
display_def
->
version
=
dds_version
;
display_def
->
version
=
dds_version
;
display_def
->
x
=
0
;
display_def
->
x
=
0
;
...
@@ -1478,7 +1481,7 @@ static void dvbsub_parse_display_definition_segment(AVCodecContext *avctx,
...
@@ -1478,7 +1481,7 @@ static void dvbsub_parse_display_definition_segment(AVCodecContext *avctx,
}
}
if
(
buf_size
<
13
)
if
(
buf_size
<
13
)
return
;
return
0
;
if
(
info_byte
&
1
<<
3
)
{
// display_window_flag
if
(
info_byte
&
1
<<
3
)
{
// display_window_flag
display_def
->
x
=
bytestream_get_be16
(
&
buf
);
display_def
->
x
=
bytestream_get_be16
(
&
buf
);
...
@@ -1486,6 +1489,8 @@ static void dvbsub_parse_display_definition_segment(AVCodecContext *avctx,
...
@@ -1486,6 +1489,8 @@ static void dvbsub_parse_display_definition_segment(AVCodecContext *avctx,
display_def
->
y
=
bytestream_get_be16
(
&
buf
);
display_def
->
y
=
bytestream_get_be16
(
&
buf
);
display_def
->
height
=
bytestream_get_be16
(
&
buf
)
-
display_def
->
y
+
1
;
display_def
->
height
=
bytestream_get_be16
(
&
buf
)
-
display_def
->
y
+
1
;
}
}
return
0
;
}
}
static
void
dvbsub_display_end_segment
(
AVCodecContext
*
avctx
,
const
uint8_t
*
buf
,
static
void
dvbsub_display_end_segment
(
AVCodecContext
*
avctx
,
const
uint8_t
*
buf
,
...
...
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