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
bac8d38c
Commit
bac8d38c
authored
Apr 09, 2013
by
Anton Khirnov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rv10: return meaningful error codes.
Also improve some error messages.
parent
69f6f03c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
26 deletions
+26
-26
rv10.c
libavcodec/rv10.c
+26
-26
No files found.
libavcodec/rv10.c
View file @
bac8d38c
...
...
@@ -257,14 +257,14 @@ static int rv10_decode_picture_header(MpegEncContext *s)
av_dlog
(
s
->
avctx
,
"pict_type=%d pb_frame=%d
\n
"
,
s
->
pict_type
,
pb_frame
);
if
(
pb_frame
)
{
av
_log
(
s
->
avctx
,
AV_LOG_ERROR
,
"pb frame not supported
\n
"
);
return
-
1
;
av
priv_request_sample
(
s
->
avctx
,
"pb frame
"
);
return
AVERROR_PATCHWELCOME
;
}
s
->
qscale
=
get_bits
(
&
s
->
gb
,
5
);
if
(
s
->
qscale
==
0
)
{
av_log
(
s
->
avctx
,
AV_LOG_ERROR
,
"
error, qscale:
0
\n
"
);
return
-
1
;
av_log
(
s
->
avctx
,
AV_LOG_ERROR
,
"
Invalid qscale value:
0
\n
"
);
return
AVERROR_INVALIDDATA
;
}
if
(
s
->
pict_type
==
AV_PICTURE_TYPE_I
)
{
...
...
@@ -300,7 +300,7 @@ static int rv10_decode_picture_header(MpegEncContext *s)
static
int
rv20_decode_picture_header
(
RVDecContext
*
rv
)
{
MpegEncContext
*
s
=
&
rv
->
m
;
int
seq
,
mb_pos
,
i
;
int
seq
,
mb_pos
,
i
,
ret
;
int
rpr_bits
;
i
=
get_bits
(
&
s
->
gb
,
2
);
...
...
@@ -311,23 +311,23 @@ static int rv20_decode_picture_header(RVDecContext *rv)
case
3
:
s
->
pict_type
=
AV_PICTURE_TYPE_B
;
break
;
default:
av_log
(
s
->
avctx
,
AV_LOG_ERROR
,
"unknown frame type
\n
"
);
return
-
1
;
return
AVERROR_INVALIDDATA
;
}
if
(
s
->
last_picture_ptr
==
NULL
&&
s
->
pict_type
==
AV_PICTURE_TYPE_B
)
{
av_log
(
s
->
avctx
,
AV_LOG_ERROR
,
"early B
pix
\n
"
);
return
-
1
;
av_log
(
s
->
avctx
,
AV_LOG_ERROR
,
"early B
-frame
\n
"
);
return
AVERROR_INVALIDDATA
;
}
if
(
get_bits1
(
&
s
->
gb
))
{
av_log
(
s
->
avctx
,
AV_LOG_ERROR
,
"reserved bit set
\n
"
);
return
-
1
;
return
AVERROR_INVALIDDATA
;
}
s
->
qscale
=
get_bits
(
&
s
->
gb
,
5
);
if
(
s
->
qscale
==
0
)
{
av_log
(
s
->
avctx
,
AV_LOG_ERROR
,
"
error, qscale:
0
\n
"
);
return
-
1
;
av_log
(
s
->
avctx
,
AV_LOG_ERROR
,
"
Invalid qscale value:
0
\n
"
);
return
AVERROR_INVALIDDATA
;
}
if
(
RV_GET_MINOR_VER
(
rv
->
sub_id
)
>=
2
)
...
...
@@ -356,13 +356,13 @@ static int rv20_decode_picture_header(RVDecContext *rv)
av_log
(
s
->
avctx
,
AV_LOG_DEBUG
,
"attempting to change resolution to %dx%d
\n
"
,
new_w
,
new_h
);
if
(
av_image_check_size
(
new_w
,
new_h
,
0
,
s
->
avctx
)
<
0
)
return
-
1
;
return
AVERROR_INVALIDDATA
;
ff_MPV_common_end
(
s
);
avcodec_set_dimensions
(
s
->
avctx
,
new_w
,
new_h
);
s
->
width
=
new_w
;
s
->
height
=
new_h
;
if
(
ff_MPV_common_init
(
s
)
<
0
)
return
-
1
;
if
(
(
ret
=
ff_MPV_common_init
(
s
)
)
<
0
)
return
ret
;
}
if
(
s
->
avctx
->
debug
&
FF_DEBUG_PICT_INFO
)
{
...
...
@@ -423,11 +423,11 @@ static av_cold int rv10_decode_init(AVCodecContext *avctx)
RVDecContext
*
rv
=
avctx
->
priv_data
;
MpegEncContext
*
s
=
&
rv
->
m
;
static
int
done
=
0
;
int
major_ver
,
minor_ver
,
micro_ver
;
int
major_ver
,
minor_ver
,
micro_ver
,
ret
;
if
(
avctx
->
extradata_size
<
8
)
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"Extradata is too small.
\n
"
);
return
-
1
;
return
AVERROR_INVALIDDATA
;
}
ff_MPV_decode_defaults
(
s
);
...
...
@@ -472,8 +472,8 @@ static av_cold int rv10_decode_init(AVCodecContext *avctx)
avctx
->
pix_fmt
=
AV_PIX_FMT_YUV420P
;
if
(
ff_MPV_common_init
(
s
)
<
0
)
return
-
1
;
if
(
(
ret
=
ff_MPV_common_init
(
s
)
)
<
0
)
return
ret
;
ff_h263_decode_init_vlc
();
...
...
@@ -504,7 +504,7 @@ static int rv10_decode_packet(AVCodecContext *avctx,
{
RVDecContext
*
rv
=
avctx
->
priv_data
;
MpegEncContext
*
s
=
&
rv
->
m
;
int
mb_count
,
mb_pos
,
left
,
start_mb_x
,
active_bits_size
;
int
mb_count
,
mb_pos
,
left
,
start_mb_x
,
active_bits_size
,
ret
;
active_bits_size
=
buf_size
*
8
;
init_get_bits
(
&
s
->
gb
,
buf
,
FFMAX
(
buf_size
,
buf_size2
)
*
8
);
...
...
@@ -514,19 +514,19 @@ static int rv10_decode_packet(AVCodecContext *avctx,
mb_count
=
rv20_decode_picture_header
(
rv
);
if
(
mb_count
<
0
)
{
av_log
(
s
->
avctx
,
AV_LOG_ERROR
,
"HEADER ERROR
\n
"
);
return
-
1
;
return
AVERROR_INVALIDDATA
;
}
if
(
s
->
mb_x
>=
s
->
mb_width
||
s
->
mb_y
>=
s
->
mb_height
)
{
av_log
(
s
->
avctx
,
AV_LOG_ERROR
,
"POS ERROR %d %d
\n
"
,
s
->
mb_x
,
s
->
mb_y
);
return
-
1
;
return
AVERROR_INVALIDDATA
;
}
mb_pos
=
s
->
mb_y
*
s
->
mb_width
+
s
->
mb_x
;
left
=
s
->
mb_width
*
s
->
mb_height
-
mb_pos
;
if
(
mb_count
>
left
)
{
av_log
(
s
->
avctx
,
AV_LOG_ERROR
,
"COUNT ERROR
\n
"
);
return
-
1
;
return
AVERROR_INVALIDDATA
;
}
if
((
s
->
mb_x
==
0
&&
s
->
mb_y
==
0
)
||
s
->
current_picture_ptr
==
NULL
)
{
...
...
@@ -535,13 +535,13 @@ static int rv10_decode_packet(AVCodecContext *avctx,
ff_MPV_frame_end
(
s
);
s
->
mb_x
=
s
->
mb_y
=
s
->
resync_mb_x
=
s
->
resync_mb_y
=
0
;
}
if
(
ff_MPV_frame_start
(
s
,
avctx
)
<
0
)
return
-
1
;
if
(
(
ret
=
ff_MPV_frame_start
(
s
,
avctx
)
)
<
0
)
return
ret
;
ff_mpeg_er_frame_start
(
s
);
}
else
{
if
(
s
->
current_picture_ptr
->
f
.
pict_type
!=
s
->
pict_type
)
{
av_log
(
s
->
avctx
,
AV_LOG_ERROR
,
"Slice type mismatch
\n
"
);
return
-
1
;
return
AVERROR_INVALIDDATA
;
}
}
...
...
@@ -610,7 +610,7 @@ static int rv10_decode_packet(AVCodecContext *avctx,
if
(
ret
==
SLICE_ERROR
||
active_bits_size
<
get_bits_count
(
&
s
->
gb
))
{
av_log
(
s
->
avctx
,
AV_LOG_ERROR
,
"ERROR at MB %d %d
\n
"
,
s
->
mb_x
,
s
->
mb_y
);
return
-
1
;
return
AVERROR_INVALIDDATA
;
}
if
(
s
->
pict_type
!=
AV_PICTURE_TYPE_B
)
ff_h263_update_motion_val
(
s
);
...
...
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