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
0f7fce87
Commit
0f7fce87
authored
Oct 04, 2016
by
Matthieu Bouron
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lavc: add vp8/vp9 mediacodec decoders
parent
b8c158a4
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
99 additions
and
4 deletions
+99
-4
Changelog
Changelog
+2
-2
configure
configure
+4
-0
Makefile
libavcodec/Makefile
+2
-0
allcodecs.c
libavcodec/allcodecs.c
+4
-0
mediacodecdec.c
libavcodec/mediacodecdec.c
+14
-0
mediacodecdec_h2645.c
libavcodec/mediacodecdec_h2645.c
+72
-1
version.h
libavcodec/version.h
+1
-1
No files found.
Changelog
View file @
0f7fce87
...
...
@@ -10,7 +10,7 @@ version <next>:
- curves filter doesn't automatically insert points at x=0 and x=1 anymore
- 16-bit support in curves filter and selectivecolor filter
- OpenH264 decoder wrapper
- MediaCodec H.264
and HEVC
hwaccel
- MediaCodec H.264
/HEVC/VP8/VP9
hwaccel
- True Audio (TTA) muxer
- crystalizer audio filter
- acrusher audio filter
...
...
@@ -28,7 +28,7 @@ version <next>:
- gblur filter
- avgblur filter
- sobel and prewitt filter
- MediaCodec HEVC decoding
- MediaCodec HEVC
/VP8/VP9
decoding
- Meridian Lossless Packing (MLP) / TrueHD encoder
- Non-Local Means (nlmeans) denoising filter
- sdl2 output device and ffplay support
...
...
configure
View file @
0f7fce87
...
...
@@ -2662,10 +2662,14 @@ vc1_vdpau_hwaccel_deps="vdpau"
vc1_vdpau_hwaccel_select
=
"vc1_decoder"
vp8_cuvid_hwaccel_deps
=
"cuda cuvid"
vp9_cuvid_hwaccel_deps
=
"cuda cuvid"
vp8_mediacodec_decoder_deps
=
"mediacodec"
vp8_mediacodec_hwaccel_deps
=
"mediacodec"
vp9_d3d11va_hwaccel_deps
=
"d3d11va DXVA_PicParams_VP9"
vp9_d3d11va_hwaccel_select
=
"vp9_decoder"
vp9_dxva2_hwaccel_deps
=
"dxva2 DXVA_PicParams_VP9"
vp9_dxva2_hwaccel_select
=
"vp9_decoder"
vp9_mediacodec_decoder_deps
=
"mediacodec"
vp9_mediacodec_hwaccel_deps
=
"mediacodec"
vp9_vaapi_hwaccel_deps
=
"vaapi VADecPictureParameterBufferVP9"
vp9_vaapi_hwaccel_select
=
"vp9_decoder"
wmv3_crystalhd_decoder_select
=
"crystalhd"
...
...
libavcodec/Makefile
View file @
0f7fce87
...
...
@@ -595,9 +595,11 @@ OBJS-$(CONFIG_VP6_DECODER) += vp6.o vp56.o vp56data.o \
OBJS-$(CONFIG_VP7_DECODER)
+=
vp8.o
vp56rac.o
OBJS-$(CONFIG_VP8_DECODER)
+=
vp8.o
vp56rac.o
OBJS-$(CONFIG_VP8_CUVID_DECODER)
+=
cuvid.o
OBJS-$(CONFIG_VP8_MEDIACODEC_DECODER)
+=
mediacodecdec_h2645.o
OBJS-$(CONFIG_VP9_DECODER)
+=
vp9.o
vp9dsp.o
vp56rac.o
vp9dsp_8bpp.o
\
vp9dsp_10bpp.o
vp9dsp_12bpp.o
OBJS-$(CONFIG_VP9_CUVID_DECODER)
+=
cuvid.o
OBJS-$(CONFIG_VP9_MEDIACODEC_DECODER)
+=
mediacodecdec_h2645.o
OBJS-$(CONFIG_VPLAYER_DECODER)
+=
textdec.o
ass.o
OBJS-$(CONFIG_VQA_DECODER)
+=
vqavideo.o
OBJS-$(CONFIG_WAVPACK_DECODER)
+=
wavpack.o
...
...
libavcodec/allcodecs.c
View file @
0f7fce87
...
...
@@ -115,9 +115,11 @@ void avcodec_register_all(void)
REGISTER_HWACCEL
(
VC1_MMAL
,
vc1_mmal
);
REGISTER_HWACCEL
(
VC1_QSV
,
vc1_qsv
);
REGISTER_HWACCEL
(
VP8_CUVID
,
vp8_cuvid
);
REGISTER_HWACCEL
(
VP8_MEDIACODEC
,
vp8_mediacodec
);
REGISTER_HWACCEL
(
VP9_CUVID
,
vp9_cuvid
);
REGISTER_HWACCEL
(
VP9_D3D11VA
,
vp9_d3d11va
);
REGISTER_HWACCEL
(
VP9_DXVA2
,
vp9_dxva2
);
REGISTER_HWACCEL
(
VP9_MEDIACODEC
,
vp9_mediacodec
);
REGISTER_HWACCEL
(
VP9_VAAPI
,
vp9_vaapi
);
REGISTER_HWACCEL
(
WMV3_D3D11VA
,
wmv3_d3d11va
);
REGISTER_HWACCEL
(
WMV3_DXVA2
,
wmv3_dxva2
);
...
...
@@ -657,7 +659,9 @@ void avcodec_register_all(void)
REGISTER_DECODER
(
MPEG4_CUVID
,
mpeg4_cuvid
);
REGISTER_DECODER
(
VC1_CUVID
,
vc1_cuvid
);
REGISTER_DECODER
(
VP8_CUVID
,
vp8_cuvid
);
REGISTER_DECODER
(
VP8_MEDIACODEC
,
vp8_mediacodec
);
REGISTER_DECODER
(
VP9_CUVID
,
vp9_cuvid
);
REGISTER_DECODER
(
VP9_MEDIACODEC
,
vp9_mediacodec
);
/* parsers */
REGISTER_PARSER
(
AAC
,
aac
);
...
...
libavcodec/mediacodecdec.c
View file @
0f7fce87
...
...
@@ -766,3 +766,17 @@ AVHWAccel ff_hevc_mediacodec_hwaccel = {
.
id
=
AV_CODEC_ID_HEVC
,
.
pix_fmt
=
AV_PIX_FMT_MEDIACODEC
,
};
AVHWAccel
ff_vp8_mediacodec_hwaccel
=
{
.
name
=
"mediacodec"
,
.
type
=
AVMEDIA_TYPE_VIDEO
,
.
id
=
AV_CODEC_ID_VP8
,
.
pix_fmt
=
AV_PIX_FMT_MEDIACODEC
,
};
AVHWAccel
ff_vp9_mediacodec_hwaccel
=
{
.
name
=
"mediacodec"
,
.
type
=
AVMEDIA_TYPE_VIDEO
,
.
id
=
AV_CODEC_ID_VP9
,
.
pix_fmt
=
AV_PIX_FMT_MEDIACODEC
,
};
libavcodec/mediacodecdec_h2645.c
View file @
0f7fce87
/*
* Android MediaCodec H.264 / H.265 decoders
* Android MediaCodec H.264 / H.265
/ VP8 / VP9
decoders
*
* Copyright (c) 2015-2016 Matthieu Bouron <matthieu.bouron stupeflix.com>
*
...
...
@@ -65,6 +65,7 @@ static av_cold int mediacodec_decode_close(AVCodecContext *avctx)
return
0
;
}
#if CONFIG_H264_MEDIACODEC_DECODER || CONFIG_HEVC_MEDIACODEC_DECODER
static
int
h2645_ps_to_nalu
(
const
uint8_t
*
src
,
int
src_size
,
uint8_t
**
out
,
int
*
out_size
)
{
int
i
;
...
...
@@ -116,6 +117,7 @@ done:
return
ret
;
}
#endif
#if CONFIG_H264_MEDIACODEC_DECODER
static
int
h264_set_extradata
(
AVCodecContext
*
avctx
,
FFAMediaFormat
*
format
)
...
...
@@ -264,6 +266,19 @@ done:
}
#endif
#if CONFIG_VP8_MEDIACODEC_DECODER || CONFIG_VP9_MEDIACODEC_DECODER
static
int
vpx_set_extradata
(
AVCodecContext
*
avctx
,
FFAMediaFormat
*
format
)
{
int
ret
=
0
;
if
(
avctx
->
extradata
)
{
ff_AMediaFormat_setBuffer
(
format
,
"csd-0"
,
avctx
->
extradata
,
avctx
->
extradata_size
);
}
return
ret
;
}
#endif
static
av_cold
int
mediacodec_decode_init
(
AVCodecContext
*
avctx
)
{
int
ret
;
...
...
@@ -303,6 +318,24 @@ static av_cold int mediacodec_decode_init(AVCodecContext *avctx)
if
(
ret
<
0
)
goto
done
;
break
;
#endif
#if CONFIG_VP8_MEDIACODEC_DECODER
case
AV_CODEC_ID_VP8
:
codec_mime
=
"video/x-vnd.on2.vp8"
;
ret
=
vpx_set_extradata
(
avctx
,
format
);
if
(
ret
<
0
)
goto
done
;
break
;
#endif
#if CONFIG_VP9_MEDIACODEC_DECODER
case
AV_CODEC_ID_VP9
:
codec_mime
=
"video/x-vnd.on2.vp9"
;
ret
=
vpx_set_extradata
(
avctx
,
format
);
if
(
ret
<
0
)
goto
done
;
break
;
#endif
default:
av_assert0
(
0
);
...
...
@@ -332,6 +365,7 @@ static av_cold int mediacodec_decode_init(AVCodecContext *avctx)
goto
done
;
}
if
(
bsf_name
)
{
bsf
=
av_bsf_get_by_name
(
bsf_name
);
if
(
!
bsf
)
{
ret
=
AVERROR_BSF_NOT_FOUND
;
...
...
@@ -346,6 +380,7 @@ static av_cold int mediacodec_decode_init(AVCodecContext *avctx)
((
ret
=
av_bsf_init
(
s
->
bsf
))
<
0
))
{
goto
done
;
}
}
av_init_packet
(
&
s
->
filtered_pkt
);
...
...
@@ -436,6 +471,7 @@ static int mediacodec_decode_frame(AVCodecContext *avctx, void *data,
av_fifo_generic_read
(
s
->
fifo
,
&
input_pkt
,
sizeof
(
input_pkt
),
NULL
);
if
(
s
->
bsf
)
{
ret
=
av_bsf_send_packet
(
s
->
bsf
,
&
input_pkt
);
if
(
ret
<
0
)
{
return
ret
;
...
...
@@ -445,6 +481,9 @@ static int mediacodec_decode_frame(AVCodecContext *avctx, void *data,
if
(
ret
==
AVERROR
(
EAGAIN
))
{
goto
done
;
}
}
else
{
av_packet_move_ref
(
&
s
->
filtered_pkt
,
&
input_pkt
);
}
/* {h264,hevc}_mp4toannexb are used here and do not require flushing */
av_assert0
(
ret
!=
AVERROR_EOF
);
...
...
@@ -512,3 +551,35 @@ AVCodec ff_hevc_mediacodec_decoder = {
.
caps_internal
=
FF_CODEC_CAP_SETS_PKT_DTS
,
};
#endif
#if CONFIG_VP8_MEDIACODEC_DECODER
AVCodec
ff_vp8_mediacodec_decoder
=
{
.
name
=
"vp8_mediacodec"
,
.
long_name
=
NULL_IF_CONFIG_SMALL
(
"VP8 Android MediaCodec decoder"
),
.
type
=
AVMEDIA_TYPE_VIDEO
,
.
id
=
AV_CODEC_ID_VP8
,
.
priv_data_size
=
sizeof
(
MediaCodecH264DecContext
),
.
init
=
mediacodec_decode_init
,
.
decode
=
mediacodec_decode_frame
,
.
flush
=
mediacodec_decode_flush
,
.
close
=
mediacodec_decode_close
,
.
capabilities
=
CODEC_CAP_DELAY
,
.
caps_internal
=
FF_CODEC_CAP_SETS_PKT_DTS
,
};
#endif
#if CONFIG_VP9_MEDIACODEC_DECODER
AVCodec
ff_vp9_mediacodec_decoder
=
{
.
name
=
"vp9_mediacodec"
,
.
long_name
=
NULL_IF_CONFIG_SMALL
(
"VP9 Android MediaCodec decoder"
),
.
type
=
AVMEDIA_TYPE_VIDEO
,
.
id
=
AV_CODEC_ID_VP9
,
.
priv_data_size
=
sizeof
(
MediaCodecH264DecContext
),
.
init
=
mediacodec_decode_init
,
.
decode
=
mediacodec_decode_frame
,
.
flush
=
mediacodec_decode_flush
,
.
close
=
mediacodec_decode_close
,
.
capabilities
=
CODEC_CAP_DELAY
,
.
caps_internal
=
FF_CODEC_CAP_SETS_PKT_DTS
,
};
#endif
libavcodec/version.h
View file @
0f7fce87
...
...
@@ -28,7 +28,7 @@
#include "libavutil/version.h"
#define LIBAVCODEC_VERSION_MAJOR 57
#define LIBAVCODEC_VERSION_MINOR 6
1
#define LIBAVCODEC_VERSION_MINOR 6
2
#define LIBAVCODEC_VERSION_MICRO 103
#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
...
...
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