You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-08-04 22:03:09 +02:00
avutil/hwcontext: Add ohcodec device and pixel format
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
This commit is contained in:
5
configure
vendored
5
configure
vendored
@ -322,6 +322,7 @@ External library support:
|
|||||||
--enable-mediafoundation enable encoding via MediaFoundation [auto]
|
--enable-mediafoundation enable encoding via MediaFoundation [auto]
|
||||||
--disable-metal disable Apple Metal framework [autodetect]
|
--disable-metal disable Apple Metal framework [autodetect]
|
||||||
--enable-libmysofa enable libmysofa, needed for sofalizer filter [no]
|
--enable-libmysofa enable libmysofa, needed for sofalizer filter [no]
|
||||||
|
--enable-ohcodec enable OpenHarmony Codec support [no]
|
||||||
--enable-openal enable OpenAL 1.1 capture support [no]
|
--enable-openal enable OpenAL 1.1 capture support [no]
|
||||||
--enable-opencl enable OpenCL processing [no]
|
--enable-opencl enable OpenCL processing [no]
|
||||||
--enable-opengl enable OpenGL rendering [no]
|
--enable-opengl enable OpenGL rendering [no]
|
||||||
@ -1997,6 +1998,7 @@ EXTERNAL_LIBRARY_LIST="
|
|||||||
libzvbi
|
libzvbi
|
||||||
lv2
|
lv2
|
||||||
mediacodec
|
mediacodec
|
||||||
|
ohcodec
|
||||||
openal
|
openal
|
||||||
opengl
|
opengl
|
||||||
openssl
|
openssl
|
||||||
@ -7171,6 +7173,9 @@ enabled mmal && { check_lib mmal interface/mmal/mmal.h mmal_port_co
|
|||||||
check_lib mmal interface/mmal/mmal.h mmal_port_connect -lmmal_core -lmmal_util -lmmal_vc_client -lbcm_host; } ||
|
check_lib mmal interface/mmal/mmal.h mmal_port_connect -lmmal_core -lmmal_util -lmmal_vc_client -lbcm_host; } ||
|
||||||
die "ERROR: mmal not found" &&
|
die "ERROR: mmal not found" &&
|
||||||
check_func_headers interface/mmal/mmal.h "MMAL_PARAMETER_VIDEO_MAX_NUM_CALLBACKS"; }
|
check_func_headers interface/mmal/mmal.h "MMAL_PARAMETER_VIDEO_MAX_NUM_CALLBACKS"; }
|
||||||
|
enabled ohcodec && { check_lib ohcodec "multimedia/player_framework/native_avcodec_videodecoder.h" \
|
||||||
|
OH_VideoDecoder_CreateByName -lnative_media_codecbase -lnative_media_core -lnative_media_vdec ||
|
||||||
|
die "ERROR: missing native_media libs"; }
|
||||||
enabled openal && { check_pkg_config openal "openal >= 1.1" "AL/al.h" alGetError ||
|
enabled openal && { check_pkg_config openal "openal >= 1.1" "AL/al.h" alGetError ||
|
||||||
{ for al_extralibs in "${OPENAL_LIBS}" "-lopenal" "-lOpenAL32"; do
|
{ for al_extralibs in "${OPENAL_LIBS}" "-lopenal" "-lOpenAL32"; do
|
||||||
check_lib openal 'AL/al.h' alGetError "${al_extralibs}" && break; done } ||
|
check_lib openal 'AL/al.h' alGetError "${al_extralibs}" && break; done } ||
|
||||||
|
@ -2,6 +2,12 @@ The last version increases of all libraries were on 2025-03-28
|
|||||||
|
|
||||||
API changes, most recent first:
|
API changes, most recent first:
|
||||||
|
|
||||||
|
2025-07-18 - xxxxxxxxxx - lavu 60.5.100 - pixfmt.h
|
||||||
|
Add AV_PIX_FMT_OHCODEC.
|
||||||
|
|
||||||
|
2025-07-18 - xxxxxxxxxx - lavu 60.5.100 - hwcontext.h
|
||||||
|
Add AV_HWDEVICE_TYPE_OHCODEC and AVOHCodecDeviceContext.
|
||||||
|
|
||||||
2025-07-xx - xxxxxxxxxd - lavfi 11.2.100 - avfilter.h
|
2025-07-xx - xxxxxxxxxd - lavfi 11.2.100 - avfilter.h
|
||||||
Add AVFilterGraph->max_buffered_frames.
|
Add AVFilterGraph->max_buffered_frames.
|
||||||
|
|
||||||
|
@ -51,6 +51,7 @@ HEADERS = adler32.h \
|
|||||||
hwcontext_qsv.h \
|
hwcontext_qsv.h \
|
||||||
hwcontext_mediacodec.h \
|
hwcontext_mediacodec.h \
|
||||||
hwcontext_opencl.h \
|
hwcontext_opencl.h \
|
||||||
|
hwcontext_oh.h \
|
||||||
hwcontext_vaapi.h \
|
hwcontext_vaapi.h \
|
||||||
hwcontext_videotoolbox.h \
|
hwcontext_videotoolbox.h \
|
||||||
hwcontext_vdpau.h \
|
hwcontext_vdpau.h \
|
||||||
@ -210,6 +211,7 @@ OBJS-$(CONFIG_AMF) += hwcontext_amf.o
|
|||||||
OBJS-$(CONFIG_LIBDRM) += hwcontext_drm.o
|
OBJS-$(CONFIG_LIBDRM) += hwcontext_drm.o
|
||||||
OBJS-$(CONFIG_MACOS_KPERF) += macos_kperf.o
|
OBJS-$(CONFIG_MACOS_KPERF) += macos_kperf.o
|
||||||
OBJS-$(CONFIG_MEDIACODEC) += hwcontext_mediacodec.o
|
OBJS-$(CONFIG_MEDIACODEC) += hwcontext_mediacodec.o
|
||||||
|
OBJS-$(CONFIG_OHCODEC) += hwcontext_oh.o
|
||||||
OBJS-$(CONFIG_OPENCL) += hwcontext_opencl.o
|
OBJS-$(CONFIG_OPENCL) += hwcontext_opencl.o
|
||||||
OBJS-$(CONFIG_QSV) += hwcontext_qsv.o
|
OBJS-$(CONFIG_QSV) += hwcontext_qsv.o
|
||||||
OBJS-$(CONFIG_VAAPI) += hwcontext_vaapi.o
|
OBJS-$(CONFIG_VAAPI) += hwcontext_vaapi.o
|
||||||
|
@ -68,6 +68,9 @@ static const HWContextType * const hw_table[] = {
|
|||||||
#endif
|
#endif
|
||||||
#if CONFIG_AMF
|
#if CONFIG_AMF
|
||||||
&ff_hwcontext_type_amf,
|
&ff_hwcontext_type_amf,
|
||||||
|
#endif
|
||||||
|
#if CONFIG_OHCODEC
|
||||||
|
&ff_hwcontext_type_oh,
|
||||||
#endif
|
#endif
|
||||||
NULL,
|
NULL,
|
||||||
};
|
};
|
||||||
@ -86,6 +89,7 @@ static const char *const hw_type_names[] = {
|
|||||||
[AV_HWDEVICE_TYPE_MEDIACODEC] = "mediacodec",
|
[AV_HWDEVICE_TYPE_MEDIACODEC] = "mediacodec",
|
||||||
[AV_HWDEVICE_TYPE_VULKAN] = "vulkan",
|
[AV_HWDEVICE_TYPE_VULKAN] = "vulkan",
|
||||||
[AV_HWDEVICE_TYPE_AMF] = "amf",
|
[AV_HWDEVICE_TYPE_AMF] = "amf",
|
||||||
|
[AV_HWDEVICE_TYPE_OHCODEC] = "ohcodec",
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct FFHWDeviceContext {
|
typedef struct FFHWDeviceContext {
|
||||||
|
@ -39,6 +39,8 @@ enum AVHWDeviceType {
|
|||||||
AV_HWDEVICE_TYPE_VULKAN,
|
AV_HWDEVICE_TYPE_VULKAN,
|
||||||
AV_HWDEVICE_TYPE_D3D12VA,
|
AV_HWDEVICE_TYPE_D3D12VA,
|
||||||
AV_HWDEVICE_TYPE_AMF,
|
AV_HWDEVICE_TYPE_AMF,
|
||||||
|
/* OpenHarmony Codec device */
|
||||||
|
AV_HWDEVICE_TYPE_OHCODEC,
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -164,5 +164,6 @@ extern const HWContextType ff_hwcontext_type_videotoolbox;
|
|||||||
extern const HWContextType ff_hwcontext_type_mediacodec;
|
extern const HWContextType ff_hwcontext_type_mediacodec;
|
||||||
extern const HWContextType ff_hwcontext_type_vulkan;
|
extern const HWContextType ff_hwcontext_type_vulkan;
|
||||||
extern const HWContextType ff_hwcontext_type_amf;
|
extern const HWContextType ff_hwcontext_type_amf;
|
||||||
|
extern const HWContextType ff_hwcontext_type_oh;
|
||||||
|
|
||||||
#endif /* AVUTIL_HWCONTEXT_INTERNAL_H */
|
#endif /* AVUTIL_HWCONTEXT_INTERNAL_H */
|
||||||
|
47
libavutil/hwcontext_oh.c
Normal file
47
libavutil/hwcontext_oh.c
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
/*
|
||||||
|
* This file is part of FFmpeg.
|
||||||
|
*
|
||||||
|
* Copyright (c) 2025 Zhao Zhili <quinkblack@foxmail.com>
|
||||||
|
*
|
||||||
|
* 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 <multimedia/player_framework/native_avcodec_base.h>
|
||||||
|
|
||||||
|
#include "hwcontext.h"
|
||||||
|
#include "hwcontext_internal.h"
|
||||||
|
#include "hwcontext_oh.h"
|
||||||
|
|
||||||
|
static int oh_device_create(AVHWDeviceContext *ctx, const char *device,
|
||||||
|
AVDictionary *opts, int flags)
|
||||||
|
{
|
||||||
|
if (device && device[0]) {
|
||||||
|
av_log(ctx, AV_LOG_ERROR, "Device selection unsupported.\n");
|
||||||
|
return AVERROR_UNKNOWN;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
const HWContextType ff_hwcontext_type_oh = {
|
||||||
|
.type = AV_HWDEVICE_TYPE_OHCODEC,
|
||||||
|
.name = "ohcodec",
|
||||||
|
.device_hwctx_size = sizeof(AVOHCodecDeviceContext),
|
||||||
|
.device_create = oh_device_create,
|
||||||
|
.pix_fmts = (const enum AVPixelFormat[]) {
|
||||||
|
AV_PIX_FMT_OHCODEC,
|
||||||
|
AV_PIX_FMT_NONE
|
||||||
|
},
|
||||||
|
};
|
34
libavutil/hwcontext_oh.h
Normal file
34
libavutil/hwcontext_oh.h
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
/*
|
||||||
|
* This file is part of FFmpeg.
|
||||||
|
*
|
||||||
|
* Copyright (c) 2025 Zhao Zhili <quinkblack@foxmail.com>
|
||||||
|
*
|
||||||
|
* 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_HWCONTEXT_OH_H
|
||||||
|
#define AVUTIL_HWCONTEXT_OH_H
|
||||||
|
|
||||||
|
/**
|
||||||
|
* OpenHarmony codec device
|
||||||
|
*/
|
||||||
|
typedef struct AVOHCodecDeviceContext {
|
||||||
|
/**
|
||||||
|
* Pointer to OHNativeWindow
|
||||||
|
*/
|
||||||
|
void *native_window;
|
||||||
|
} AVOHCodecDeviceContext;
|
||||||
|
|
||||||
|
#endif /* AVUTIL_HWCONTEXT_OH_H */
|
@ -3263,6 +3263,10 @@ static const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
|
|||||||
},
|
},
|
||||||
.flags = AV_PIX_FMT_FLAG_BE,
|
.flags = AV_PIX_FMT_FLAG_BE,
|
||||||
},
|
},
|
||||||
|
[AV_PIX_FMT_OHCODEC] = {
|
||||||
|
.name = "ohcodec",
|
||||||
|
.flags = AV_PIX_FMT_FLAG_HWACCEL,
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
static const char * const color_range_names[] = {
|
static const char * const color_range_names[] = {
|
||||||
|
@ -497,6 +497,8 @@ enum AVPixelFormat {
|
|||||||
AV_PIX_FMT_GBRP12MSBBE, ///< planar GBR 4:4:4 36bpp, lowest bits zero, big-endian
|
AV_PIX_FMT_GBRP12MSBBE, ///< planar GBR 4:4:4 36bpp, lowest bits zero, big-endian
|
||||||
AV_PIX_FMT_GBRP12MSBLE, ///< planar GBR 4:4:4 36bpp, lowest bits zero, little-endian
|
AV_PIX_FMT_GBRP12MSBLE, ///< planar GBR 4:4:4 36bpp, lowest bits zero, little-endian
|
||||||
|
|
||||||
|
AV_PIX_FMT_OHCODEC, /// hardware decoding through openharmony
|
||||||
|
|
||||||
AV_PIX_FMT_NB ///< number of pixel formats, DO NOT USE THIS if you want to link with shared libav* because the number of formats might differ between versions
|
AV_PIX_FMT_NB ///< number of pixel formats, DO NOT USE THIS if you want to link with shared libav* because the number of formats might differ between versions
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -79,8 +79,8 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#define LIBAVUTIL_VERSION_MAJOR 60
|
#define LIBAVUTIL_VERSION_MAJOR 60
|
||||||
#define LIBAVUTIL_VERSION_MINOR 4
|
#define LIBAVUTIL_VERSION_MINOR 5
|
||||||
#define LIBAVUTIL_VERSION_MICRO 101
|
#define LIBAVUTIL_VERSION_MICRO 100
|
||||||
|
|
||||||
#define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
|
#define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
|
||||||
LIBAVUTIL_VERSION_MINOR, \
|
LIBAVUTIL_VERSION_MINOR, \
|
||||||
|
Reference in New Issue
Block a user