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
ab7eed13
Commit
ab7eed13
authored
Apr 14, 2018
by
Alexander Kravchenko
Committed by
Mark Thompson
Apr 15, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
amfenc: Ensure that the software format of hardware frames is valid
Signed-off-by:
Mark Thompson
<
sw@jkqxz.net
>
parent
73ed6fa9
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
3 deletions
+9
-3
amfenc.c
libavcodec/amfenc.c
+9
-3
No files found.
libavcodec/amfenc.c
View file @
ab7eed13
...
@@ -68,7 +68,6 @@ static const FormatMap format_map[] =
...
@@ -68,7 +68,6 @@ static const FormatMap format_map[] =
{
AV_PIX_FMT_GRAY8
,
AMF_SURFACE_GRAY8
},
{
AV_PIX_FMT_GRAY8
,
AMF_SURFACE_GRAY8
},
{
AV_PIX_FMT_YUV420P
,
AMF_SURFACE_YUV420P
},
{
AV_PIX_FMT_YUV420P
,
AMF_SURFACE_YUV420P
},
{
AV_PIX_FMT_YUYV422
,
AMF_SURFACE_YUY2
},
{
AV_PIX_FMT_YUYV422
,
AMF_SURFACE_YUY2
},
{
AV_PIX_FMT_D3D11
,
AMF_SURFACE_NV12
},
};
};
static
enum
AMF_SURFACE_FORMAT
amf_av_to_amf_format
(
enum
AVPixelFormat
fmt
)
static
enum
AMF_SURFACE_FORMAT
amf_av_to_amf_format
(
enum
AVPixelFormat
fmt
)
...
@@ -263,6 +262,7 @@ static int amf_init_encoder(AVCodecContext *avctx)
...
@@ -263,6 +262,7 @@ static int amf_init_encoder(AVCodecContext *avctx)
AmfContext
*
ctx
=
avctx
->
priv_data
;
AmfContext
*
ctx
=
avctx
->
priv_data
;
const
wchar_t
*
codec_id
=
NULL
;
const
wchar_t
*
codec_id
=
NULL
;
AMF_RESULT
res
=
AMF_OK
;
AMF_RESULT
res
=
AMF_OK
;
enum
AVPixelFormat
pix_fmt
;
switch
(
avctx
->
codec
->
id
)
{
switch
(
avctx
->
codec
->
id
)
{
case
AV_CODEC_ID_H264
:
case
AV_CODEC_ID_H264
:
...
@@ -276,8 +276,14 @@ static int amf_init_encoder(AVCodecContext *avctx)
...
@@ -276,8 +276,14 @@ static int amf_init_encoder(AVCodecContext *avctx)
}
}
AMF_RETURN_IF_FALSE
(
ctx
,
codec_id
!=
NULL
,
AVERROR
(
EINVAL
),
"Codec %d is not supported
\n
"
,
avctx
->
codec
->
id
);
AMF_RETURN_IF_FALSE
(
ctx
,
codec_id
!=
NULL
,
AVERROR
(
EINVAL
),
"Codec %d is not supported
\n
"
,
avctx
->
codec
->
id
);
ctx
->
format
=
amf_av_to_amf_format
(
avctx
->
pix_fmt
);
if
(
ctx
->
hw_frames_ctx
)
AMF_RETURN_IF_FALSE
(
ctx
,
ctx
->
format
!=
AMF_SURFACE_UNKNOWN
,
AVERROR
(
EINVAL
),
"Format %d is not supported
\n
"
,
avctx
->
pix_fmt
);
pix_fmt
=
((
AVHWFramesContext
*
)
ctx
->
hw_frames_ctx
->
data
)
->
sw_format
;
else
pix_fmt
=
avctx
->
pix_fmt
;
ctx
->
format
=
amf_av_to_amf_format
(
pix_fmt
);
AMF_RETURN_IF_FALSE
(
ctx
,
ctx
->
format
!=
AMF_SURFACE_UNKNOWN
,
AVERROR
(
EINVAL
),
"Format %s is not supported
\n
"
,
av_get_pix_fmt_name
(
pix_fmt
));
res
=
ctx
->
factory
->
pVtbl
->
CreateComponent
(
ctx
->
factory
,
ctx
->
context
,
codec_id
,
&
ctx
->
encoder
);
res
=
ctx
->
factory
->
pVtbl
->
CreateComponent
(
ctx
->
factory
,
ctx
->
context
,
codec_id
,
&
ctx
->
encoder
);
AMF_RETURN_IF_FALSE
(
ctx
,
res
==
AMF_OK
,
AVERROR_ENCODER_NOT_FOUND
,
"CreateComponent(%ls) failed with error %d
\n
"
,
codec_id
,
res
);
AMF_RETURN_IF_FALSE
(
ctx
,
res
==
AMF_OK
,
AVERROR_ENCODER_NOT_FOUND
,
"CreateComponent(%ls) failed with error %d
\n
"
,
codec_id
,
res
);
...
...
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