Signed-off-by: nablet developer <s...@nablet.com> --- libavcodec/qsv.c | 35 +--------------------------- libavcodec/qsv_internal.h | 5 ---- libavcodec/qsvdec.c | 1 + libavcodec/qsvenc.c | 1 + libavutil/Makefile | 1 + libavutil/qsv_internal.c | 58 +++++++++++++++++++++++++++++++++++++++++++++++ libavutil/qsv_internal.h | 27 ++++++++++++++++++++++ 7 files changed, 89 insertions(+), 39 deletions(-) create mode 100644 libavutil/qsv_internal.c create mode 100644 libavutil/qsv_internal.h
diff --git a/libavcodec/qsv.c b/libavcodec/qsv.c index 11d453d..6db4dd4 100644 --- a/libavcodec/qsv.c +++ b/libavcodec/qsv.c @@ -29,6 +29,7 @@ #include "avcodec.h" #include "qsv_internal.h" +#include "libavutil/qsv_internal.h" int ff_qsv_codec_id_to_mfx(enum AVCodecID codec_id) { @@ -51,40 +52,6 @@ int ff_qsv_codec_id_to_mfx(enum AVCodecID codec_id) return AVERROR(ENOSYS); } -int ff_qsv_error(int mfx_err) -{ - switch (mfx_err) { - case MFX_ERR_NONE: - return 0; - case MFX_ERR_MEMORY_ALLOC: - case MFX_ERR_NOT_ENOUGH_BUFFER: - return AVERROR(ENOMEM); - case MFX_ERR_INVALID_HANDLE: - return AVERROR(EINVAL); - case MFX_ERR_DEVICE_FAILED: - case MFX_ERR_DEVICE_LOST: - case MFX_ERR_LOCK_MEMORY: - return AVERROR(EIO); - case MFX_ERR_NULL_PTR: - case MFX_ERR_UNDEFINED_BEHAVIOR: - case MFX_ERR_NOT_INITIALIZED: - return AVERROR_BUG; - case MFX_ERR_UNSUPPORTED: - case MFX_ERR_NOT_FOUND: - return AVERROR(ENOSYS); - case MFX_ERR_MORE_DATA: - case MFX_ERR_MORE_SURFACE: - case MFX_ERR_MORE_BITSTREAM: - return AVERROR(EAGAIN); - case MFX_ERR_INCOMPATIBLE_VIDEO_PARAM: - case MFX_ERR_INVALID_VIDEO_PARAM: - return AVERROR(EINVAL); - case MFX_ERR_ABORTED: - case MFX_ERR_UNKNOWN: - default: - return AVERROR_UNKNOWN; - } -} static int ff_qsv_set_display_handle(AVCodecContext *avctx, QSVSession *qs) { // this code is only required for Linux. It searches for a valid diff --git a/libavcodec/qsv_internal.h b/libavcodec/qsv_internal.h index f289a2b..ce2531b 100644 --- a/libavcodec/qsv_internal.h +++ b/libavcodec/qsv_internal.h @@ -73,11 +73,6 @@ typedef struct QSVSession { #endif } QSVSession; -/** - * Convert a libmfx error code into a ffmpeg error code. - */ -int ff_qsv_error(int mfx_err); - int ff_qsv_codec_id_to_mfx(enum AVCodecID codec_id); int ff_qsv_init_internal_session(AVCodecContext *avctx, QSVSession *qs, diff --git a/libavcodec/qsvdec.c b/libavcodec/qsvdec.c index c17606d..a2a90b5 100644 --- a/libavcodec/qsvdec.c +++ b/libavcodec/qsvdec.c @@ -36,6 +36,7 @@ #include "internal.h" #include "qsv.h" #include "qsv_internal.h" +#include "libavutil/qsv_internal.h" #include "qsvdec.h" int ff_qsv_map_pixfmt(enum AVPixelFormat format) diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c index 132cf47..442ead6 100644 --- a/libavcodec/qsvenc.c +++ b/libavcodec/qsvenc.c @@ -36,6 +36,7 @@ #include "internal.h" #include "qsv.h" #include "qsv_internal.h" +#include "libavutil/qsv_internal.h" #include "qsvenc.h" static const struct { diff --git a/libavutil/Makefile b/libavutil/Makefile index a35deb6..e358767 100644 --- a/libavutil/Makefile +++ b/libavutil/Makefile @@ -154,6 +154,7 @@ OBJS-$(!HAVE_ATOMICS_NATIVE) += atomic.o \ OBJS-$(CONFIG_CUDA) += hwcontext_cuda.o OBJS-$(CONFIG_LZO) += lzo.o OBJS-$(CONFIG_OPENCL) += opencl.o opencl_internal.o +OBJS-$(CONFIG_QSV) += qsv_internal.o OBJS-$(CONFIG_VAAPI) += hwcontext_vaapi.o OBJS-$(CONFIG_VDPAU) += hwcontext_vdpau.o diff --git a/libavutil/qsv_internal.c b/libavutil/qsv_internal.c new file mode 100644 index 0000000..9ebe035 --- /dev/null +++ b/libavutil/qsv_internal.c @@ -0,0 +1,58 @@ +/* + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include <errno.h> +#include "avutil.h" +#include "qsv_internal.h" + +#include <mfx/mfxvideo.h> + +int ff_qsv_error(int mfx_err) +{ + switch (mfx_err) { + case MFX_ERR_NONE: + return 0; + case MFX_ERR_MEMORY_ALLOC: + case MFX_ERR_NOT_ENOUGH_BUFFER: + return AVERROR(ENOMEM); + case MFX_ERR_INVALID_HANDLE: + return AVERROR(EINVAL); + case MFX_ERR_DEVICE_FAILED: + case MFX_ERR_DEVICE_LOST: + case MFX_ERR_LOCK_MEMORY: + return AVERROR(EIO); + case MFX_ERR_NULL_PTR: + case MFX_ERR_UNDEFINED_BEHAVIOR: + case MFX_ERR_NOT_INITIALIZED: + return AVERROR_BUG; + case MFX_ERR_UNSUPPORTED: + case MFX_ERR_NOT_FOUND: + return AVERROR(ENOSYS); + case MFX_ERR_MORE_DATA: + case MFX_ERR_MORE_SURFACE: + case MFX_ERR_MORE_BITSTREAM: + return AVERROR(EAGAIN); + case MFX_ERR_INCOMPATIBLE_VIDEO_PARAM: + case MFX_ERR_INVALID_VIDEO_PARAM: + return AVERROR(EINVAL); + case MFX_ERR_ABORTED: + case MFX_ERR_UNKNOWN: + default: + return AVERROR_UNKNOWN; + } +} diff --git a/libavutil/qsv_internal.h b/libavutil/qsv_internal.h new file mode 100644 index 0000000..de00d09 --- /dev/null +++ b/libavutil/qsv_internal.h @@ -0,0 +1,27 @@ +/* + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_QSV_INTERNAL_H +#define AVUTIL_QSV_INTERNAL_H + +/** + * Convert a libmfx error code into a ffmpeg error code. + */ +int ff_qsv_error(int mfx_err); + +#endif /* AVUTIL_QSV_INTERNAL_H */ -- 1.8.3.1 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel