[FFmpeg-devel] [PATCH 06/24] ffmpeg: Enable generic hwaccel support for VAAPI
Michael Niedermayer
michael at niedermayer.cc
Tue Jun 13 23:19:22 EEST 2017
On Mon, Jun 12, 2017 at 11:40:23PM +0100, Mark Thompson wrote:
> (cherry picked from commit 62a1ef9f26c654a3e988aa465c4ac1d776c4c356)
> ---
> Makefile | 1 -
> ffmpeg.h | 2 -
> ffmpeg_opt.c | 20 ++++-
> ffmpeg_vaapi.c | 233 ---------------------------------------------------------
> 4 files changed, 16 insertions(+), 240 deletions(-)
> delete mode 100644 ffmpeg_vaapi.c
>
> diff --git a/Makefile b/Makefile
> index 913a890a78..26f9d93d85 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -34,7 +34,6 @@ $(foreach prog,$(AVBASENAMES),$(eval OBJS-$(prog)-$(CONFIG_OPENCL) += cmdutils_o
> OBJS-ffmpeg += ffmpeg_opt.o ffmpeg_filter.o ffmpeg_hw.o
> OBJS-ffmpeg-$(CONFIG_VIDEOTOOLBOX) += ffmpeg_videotoolbox.o
> OBJS-ffmpeg-$(CONFIG_LIBMFX) += ffmpeg_qsv.o
> -OBJS-ffmpeg-$(CONFIG_VAAPI) += ffmpeg_vaapi.o
> ifndef CONFIG_VIDEOTOOLBOX
> OBJS-ffmpeg-$(CONFIG_VDA) += ffmpeg_videotoolbox.o
> endif
> diff --git a/ffmpeg.h b/ffmpeg.h
> index 5c115cf9a3..231d362f5f 100644
> --- a/ffmpeg.h
> +++ b/ffmpeg.h
> @@ -665,8 +665,6 @@ int dxva2_init(AVCodecContext *s);
> int vda_init(AVCodecContext *s);
> int videotoolbox_init(AVCodecContext *s);
> int qsv_init(AVCodecContext *s);
> -int vaapi_decode_init(AVCodecContext *avctx);
> -int vaapi_device_init(const char *device);
> int cuvid_init(AVCodecContext *s);
>
> HWDevice *hw_device_get_by_name(const char *name);
> diff --git a/ffmpeg_opt.c b/ffmpeg_opt.c
> index 6755e09e47..51671e0dd4 100644
> --- a/ffmpeg_opt.c
> +++ b/ffmpeg_opt.c
> @@ -87,8 +87,8 @@ const HWAccel hwaccels[] = {
> AV_HWDEVICE_TYPE_NONE },
> #endif
> #if CONFIG_VAAPI
> - { "vaapi", vaapi_decode_init, HWACCEL_VAAPI, AV_PIX_FMT_VAAPI,
> - AV_HWDEVICE_TYPE_NONE },
> + { "vaapi", hwaccel_decode_init, HWACCEL_VAAPI, AV_PIX_FMT_VAAPI,
> + AV_HWDEVICE_TYPE_VAAPI },
> #endif
> #if CONFIG_CUVID
> { "cuvid", cuvid_init, HWACCEL_CUVID, AV_PIX_FMT_CUDA,
> @@ -462,10 +462,22 @@ static int opt_sdp_file(void *optctx, const char *opt, const char *arg)
> #if CONFIG_VAAPI
> static int opt_vaapi_device(void *optctx, const char *opt, const char *arg)
> {
> + HWDevice *dev;
> + const char *prefix = "vaapi:";
> + char *tmp;
> int err;
> - err = vaapi_device_init(arg);
> + tmp = av_malloc(strlen(prefix) + strlen(arg) + 1);
> + if (!tmp)
> + return AVERROR(ENOMEM);
> + strcpy(tmp, prefix);
> + strcat(tmp, arg);
You can simplify this with av_asprintf()
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
If you fake or manipulate statistics in a paper in physics you will never
get a job again.
If you fake or manipulate statistics in a paper in medicin you will get
a job for life at the pharma industry.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20170613/2e2c3e95/attachment.sig>
More information about the ffmpeg-devel
mailing list