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
0032ca45
Commit
0032ca45
authored
May 07, 2020
by
Limin Wang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avcodec/mpeg12enc: return more specific error codes for encode_init()
Signed-off-by:
Limin Wang
<
lance.lmwang@gmail.com
>
parent
14285e4c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
6 deletions
+7
-6
mpeg12enc.c
libavcodec/mpeg12enc.c
+7
-6
No files found.
libavcodec/mpeg12enc.c
View file @
0032ca45
...
...
@@ -139,16 +139,17 @@ static int find_frame_rate_index(MpegEncContext *s)
static
av_cold
int
encode_init
(
AVCodecContext
*
avctx
)
{
int
ret
;
MpegEncContext
*
s
=
avctx
->
priv_data
;
if
(
ff_mpv_encode_init
(
avctx
)
<
0
)
return
-
1
;
if
(
(
ret
=
ff_mpv_encode_init
(
avctx
)
)
<
0
)
return
ret
;
if
(
find_frame_rate_index
(
s
)
<
0
)
{
if
(
s
->
strict_std_compliance
>
FF_COMPLIANCE_EXPERIMENTAL
)
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"MPEG-1/2 does not support %d/%d fps
\n
"
,
avctx
->
time_base
.
den
,
avctx
->
time_base
.
num
);
return
-
1
;
return
AVERROR
(
EINVAL
)
;
}
else
{
av_log
(
avctx
,
AV_LOG_INFO
,
"MPEG-1/2 does not support %d/%d fps, there may be AV sync issues
\n
"
,
...
...
@@ -159,7 +160,7 @@ static av_cold int encode_init(AVCodecContext *avctx)
if
(
avctx
->
profile
==
FF_PROFILE_UNKNOWN
)
{
if
(
avctx
->
level
!=
FF_LEVEL_UNKNOWN
)
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"Set profile and level
\n
"
);
return
-
1
;
return
AVERROR
(
EINVAL
)
;
}
/* Main or 4:2:2 */
avctx
->
profile
=
s
->
chroma_format
==
CHROMA_420
?
FF_PROFILE_MPEG2_MAIN
:
FF_PROFILE_MPEG2_422
;
...
...
@@ -175,7 +176,7 @@ static av_cold int encode_init(AVCodecContext *avctx)
if
(
avctx
->
profile
!=
FF_PROFILE_MPEG2_HIGH
&&
s
->
chroma_format
!=
CHROMA_420
)
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"Only High(1) and 4:2:2(0) profiles support 4:2:2 color sampling
\n
"
);
return
-
1
;
return
AVERROR
(
EINVAL
)
;
}
if
(
avctx
->
width
<=
720
&&
avctx
->
height
<=
576
)
avctx
->
level
=
8
;
/* Main */
...
...
@@ -205,7 +206,7 @@ static av_cold int encode_init(AVCodecContext *avctx)
if
(
s
->
drop_frame_timecode
&&
s
->
frame_rate_index
!=
4
)
{
av_log
(
avctx
,
AV_LOG_ERROR
,
"Drop frame time code only allowed with 1001/30000 fps
\n
"
);
return
-
1
;
return
AVERROR
(
EINVAL
)
;
}
#if FF_API_PRIVATE_OPT
...
...
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