2016-04-01 17:25:25 +00:00
|
|
|
/* GStreamer Intel MSDK plugin
|
|
|
|
* Copyright (c) 2016, Oblong Industries, Inc.
|
2018-05-16 00:32:22 +00:00
|
|
|
* Copyright (c) 2018, Intel Corporation
|
2016-04-01 17:25:25 +00:00
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions are met:
|
|
|
|
*
|
|
|
|
* 1. Redistributions of source code must retain the above copyright notice,
|
|
|
|
* this list of conditions and the following disclaimer.
|
|
|
|
*
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
|
|
* this list of conditions and the following disclaimer in the documentation
|
|
|
|
* and/or other materials provided with the distribution.
|
|
|
|
*
|
|
|
|
* 3. Neither the name of the copyright holder nor the names of its contributors
|
|
|
|
* may be used to endorse or promote products derived from this software
|
|
|
|
* without specific prior written permission.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
|
|
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
|
|
|
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
|
|
|
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
|
|
|
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
|
|
|
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
|
|
|
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
|
|
|
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
|
|
|
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
|
|
|
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
|
|
|
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
*/
|
|
|
|
|
doc: add the msdk elements
Supported elements:
msdkav1dec, msdkh264dec, msdkh264enc, msdkh265dec, msdkh265enc,
msdkmjpegdec, msdkmjpegenc, msdkmpeg2dec, msdkmpeg2enc, msdkvc1dec,
msdkvp8dec, msdkvp9dec, msdkvp9enc, msdkvpp.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2296>
2021-06-03 02:03:19 +00:00
|
|
|
/**
|
|
|
|
* SECTION: plugin-msdk
|
|
|
|
*
|
|
|
|
* Since: 1.12
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2016-04-01 17:25:25 +00:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
# include <config.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <gst/gst.h>
|
|
|
|
|
2016-11-07 20:32:38 +00:00
|
|
|
#include "gstmsdkh264dec.h"
|
2016-04-01 17:25:25 +00:00
|
|
|
#include "gstmsdkh264enc.h"
|
2016-11-29 03:14:20 +00:00
|
|
|
#include "gstmsdkh265dec.h"
|
2016-04-01 17:25:25 +00:00
|
|
|
#include "gstmsdkh265enc.h"
|
2016-11-22 21:55:00 +00:00
|
|
|
#include "gstmsdkmjpegdec.h"
|
2016-10-05 22:32:43 +00:00
|
|
|
#include "gstmsdkmjpegenc.h"
|
2018-01-10 19:40:24 +00:00
|
|
|
#include "gstmsdkmpeg2dec.h"
|
2016-04-01 17:25:25 +00:00
|
|
|
#include "gstmsdkmpeg2enc.h"
|
2017-10-30 06:06:32 +00:00
|
|
|
#include "gstmsdkvp8dec.h"
|
2020-01-15 08:02:11 +00:00
|
|
|
#ifdef USE_MSDK_VP9_ENC
|
2019-04-25 08:32:34 +00:00
|
|
|
#include "gstmsdkvp9enc.h"
|
2020-01-15 08:02:11 +00:00
|
|
|
#endif
|
2018-02-13 23:40:54 +00:00
|
|
|
#include "gstmsdkvc1dec.h"
|
2018-05-16 00:33:00 +00:00
|
|
|
#ifdef USE_MSDK_VP9_DEC
|
2018-05-16 00:32:22 +00:00
|
|
|
#include "gstmsdkvp9dec.h"
|
2018-05-16 00:33:00 +00:00
|
|
|
#endif
|
2020-07-20 02:13:13 +00:00
|
|
|
#ifdef USE_MSDK_AV1_DEC
|
|
|
|
#include "gstmsdkav1dec.h"
|
|
|
|
#endif
|
2022-03-31 06:03:36 +00:00
|
|
|
#ifdef USE_MSDK_AV1_ENC
|
|
|
|
#include "gstmsdkav1enc.h"
|
|
|
|
#endif
|
2018-03-06 13:51:05 +00:00
|
|
|
#include "gstmsdkvpp.h"
|
2016-04-01 17:25:25 +00:00
|
|
|
|
2018-03-13 22:20:50 +00:00
|
|
|
GST_DEBUG_CATEGORY (gst_msdk_debug);
|
2016-11-07 20:32:38 +00:00
|
|
|
GST_DEBUG_CATEGORY (gst_msdkdec_debug);
|
2016-04-01 17:25:25 +00:00
|
|
|
GST_DEBUG_CATEGORY (gst_msdkenc_debug);
|
2018-03-06 13:51:05 +00:00
|
|
|
GST_DEBUG_CATEGORY (gst_msdkvpp_debug);
|
2016-11-07 20:32:38 +00:00
|
|
|
GST_DEBUG_CATEGORY (gst_msdkh264dec_debug);
|
2016-04-01 17:25:25 +00:00
|
|
|
GST_DEBUG_CATEGORY (gst_msdkh264enc_debug);
|
2016-11-29 03:14:20 +00:00
|
|
|
GST_DEBUG_CATEGORY (gst_msdkh265dec_debug);
|
2016-04-01 17:25:25 +00:00
|
|
|
GST_DEBUG_CATEGORY (gst_msdkh265enc_debug);
|
2016-11-22 21:55:00 +00:00
|
|
|
GST_DEBUG_CATEGORY (gst_msdkmjpegdec_debug);
|
2016-10-05 22:32:43 +00:00
|
|
|
GST_DEBUG_CATEGORY (gst_msdkmjpegenc_debug);
|
2016-04-01 17:25:25 +00:00
|
|
|
GST_DEBUG_CATEGORY (gst_msdkmpeg2enc_debug);
|
2018-01-11 03:24:07 +00:00
|
|
|
GST_DEBUG_CATEGORY (gst_msdkmpeg2dec_debug);
|
2017-10-30 06:06:32 +00:00
|
|
|
GST_DEBUG_CATEGORY (gst_msdkvp8dec_debug);
|
2018-02-13 23:40:54 +00:00
|
|
|
GST_DEBUG_CATEGORY (gst_msdkvc1dec_debug);
|
2018-05-16 00:32:22 +00:00
|
|
|
GST_DEBUG_CATEGORY (gst_msdkvp9dec_debug);
|
2019-04-25 08:32:34 +00:00
|
|
|
GST_DEBUG_CATEGORY (gst_msdkvp9enc_debug);
|
2020-07-20 02:13:13 +00:00
|
|
|
GST_DEBUG_CATEGORY (gst_msdkav1dec_debug);
|
2022-03-31 06:03:36 +00:00
|
|
|
GST_DEBUG_CATEGORY (gst_msdkav1enc_debug);
|
2016-04-01 17:25:25 +00:00
|
|
|
|
2021-06-16 17:23:37 +00:00
|
|
|
static void
|
|
|
|
plugin_add_dependencies (GstPlugin * plugin)
|
|
|
|
{
|
|
|
|
#ifndef _WIN32
|
|
|
|
const gchar *env_vars[] = { "LIBVA_DRIVER_NAME", NULL };
|
|
|
|
const gchar *kernel_paths[] = { "/dev/dri", NULL };
|
|
|
|
const gchar *kernel_names[] = { "card", "render", NULL };
|
|
|
|
|
|
|
|
/* features get updated upon changes in /dev/dri/card* */
|
|
|
|
gst_plugin_add_dependency (plugin, NULL, kernel_paths, kernel_names,
|
|
|
|
GST_PLUGIN_DEPENDENCY_FLAG_FILE_NAME_IS_PREFIX);
|
|
|
|
|
|
|
|
/* features get updated upon changes in VA environment variables */
|
|
|
|
gst_plugin_add_dependency (plugin, env_vars, NULL, NULL,
|
|
|
|
GST_PLUGIN_DEPENDENCY_FLAG_NONE);
|
|
|
|
|
|
|
|
/* features get updated upon changes in default VA drivers
|
|
|
|
* directory */
|
|
|
|
gst_plugin_add_dependency_simple (plugin, "LIBVA_DRIVERS_PATH",
|
|
|
|
VA_DRIVERS_PATH, "_drv_video.so",
|
|
|
|
GST_PLUGIN_DEPENDENCY_FLAG_FILE_NAME_IS_SUFFIX |
|
|
|
|
GST_PLUGIN_DEPENDENCY_FLAG_PATHS_ARE_DEFAULT_ONLY);
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2023-02-22 02:24:12 +00:00
|
|
|
static gboolean
|
2023-02-22 08:46:23 +00:00
|
|
|
_register_encoder (GstPlugin * plugin,
|
|
|
|
GstMsdkContext * context, guint codec_id,
|
|
|
|
GstCaps * sink_caps, GstCaps * src_caps)
|
2023-02-22 02:24:12 +00:00
|
|
|
{
|
|
|
|
gboolean ret = TRUE;
|
|
|
|
|
|
|
|
switch (codec_id) {
|
|
|
|
case MFX_CODEC_AVC:
|
2023-02-22 08:46:23 +00:00
|
|
|
ret = gst_msdkh264enc_register (plugin,
|
|
|
|
context, sink_caps, src_caps, GST_RANK_NONE);
|
2023-02-22 02:24:12 +00:00
|
|
|
break;
|
|
|
|
case MFX_CODEC_HEVC:
|
2023-02-22 08:46:23 +00:00
|
|
|
ret = gst_msdkh265enc_register (plugin,
|
|
|
|
context, sink_caps, src_caps, GST_RANK_NONE);;
|
2023-02-22 02:24:12 +00:00
|
|
|
break;
|
|
|
|
case MFX_CODEC_MPEG2:
|
2023-02-22 08:46:23 +00:00
|
|
|
ret = gst_msdkmpeg2enc_register (plugin,
|
|
|
|
context, sink_caps, src_caps, GST_RANK_NONE);
|
2023-02-22 02:24:12 +00:00
|
|
|
break;
|
|
|
|
#ifdef USE_MSDK_VP9_ENC
|
|
|
|
case MFX_CODEC_VP9:
|
2023-02-22 08:46:23 +00:00
|
|
|
ret = gst_msdkvp9enc_register (plugin,
|
|
|
|
context, sink_caps, src_caps, GST_RANK_NONE);
|
2023-02-22 02:24:12 +00:00
|
|
|
break;
|
|
|
|
#endif
|
|
|
|
#ifdef USE_MSDK_AV1_ENC
|
|
|
|
case MFX_CODEC_AV1:
|
2023-02-22 08:46:23 +00:00
|
|
|
ret = gst_msdkav1enc_register (plugin,
|
|
|
|
context, sink_caps, src_caps, GST_RANK_NONE);
|
2023-02-22 02:24:12 +00:00
|
|
|
break;
|
|
|
|
#endif
|
|
|
|
case MFX_CODEC_JPEG:
|
2023-02-22 08:46:23 +00:00
|
|
|
ret = gst_msdkmjpegenc_register (plugin,
|
|
|
|
context, sink_caps, src_caps, GST_RANK_NONE);
|
2023-02-22 02:24:12 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
ret = FALSE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
2023-03-10 11:03:47 +00:00
|
|
|
_register_decoder (GstPlugin * plugin,
|
|
|
|
GstMsdkContext * context, guint codec_id,
|
|
|
|
GstCaps * sink_caps, GstCaps * src_caps)
|
2023-02-22 02:24:12 +00:00
|
|
|
{
|
|
|
|
gboolean ret = TRUE;
|
|
|
|
|
|
|
|
switch (codec_id) {
|
|
|
|
case MFX_CODEC_AVC:
|
2023-03-10 11:03:47 +00:00
|
|
|
ret = gst_msdkh264dec_register (plugin,
|
|
|
|
context, sink_caps, src_caps, GST_RANK_NONE);
|
2023-02-22 02:24:12 +00:00
|
|
|
break;
|
|
|
|
case MFX_CODEC_HEVC:
|
2023-03-10 11:03:47 +00:00
|
|
|
ret = gst_msdkh265dec_register (plugin,
|
|
|
|
context, sink_caps, src_caps, GST_RANK_NONE);
|
2023-02-22 02:24:12 +00:00
|
|
|
break;
|
|
|
|
case MFX_CODEC_MPEG2:
|
2023-03-10 11:03:47 +00:00
|
|
|
ret = gst_msdkmpeg2dec_register (plugin,
|
|
|
|
context, sink_caps, src_caps, GST_RANK_NONE);
|
2023-02-22 02:24:12 +00:00
|
|
|
break;
|
|
|
|
case MFX_CODEC_VP8:
|
2023-03-10 11:03:47 +00:00
|
|
|
ret = gst_msdkvp8dec_register (plugin,
|
|
|
|
context, sink_caps, src_caps, GST_RANK_NONE);
|
2023-02-22 02:24:12 +00:00
|
|
|
break;
|
|
|
|
#ifdef USE_MSDK_VP9_DEC
|
|
|
|
case MFX_CODEC_VP9:
|
2023-03-10 11:03:47 +00:00
|
|
|
ret = gst_msdkvp9dec_register (plugin,
|
|
|
|
context, sink_caps, src_caps, GST_RANK_NONE);
|
2023-02-22 02:24:12 +00:00
|
|
|
break;
|
|
|
|
#endif
|
|
|
|
#ifdef USE_MSDK_AV1_DEC
|
|
|
|
case MFX_CODEC_AV1:
|
2023-03-10 11:03:47 +00:00
|
|
|
ret = gst_msdkav1dec_register (plugin,
|
|
|
|
context, sink_caps, src_caps, GST_RANK_NONE);
|
2023-02-22 02:24:12 +00:00
|
|
|
break;
|
|
|
|
#endif
|
|
|
|
case MFX_CODEC_JPEG:
|
2023-03-10 11:03:47 +00:00
|
|
|
ret = gst_msdkmjpegdec_register (plugin,
|
|
|
|
context, sink_caps, src_caps, GST_RANK_NONE);
|
2023-02-22 02:24:12 +00:00
|
|
|
break;
|
|
|
|
case MFX_CODEC_VC1:
|
2023-03-10 11:03:47 +00:00
|
|
|
ret = gst_msdkvc1dec_register (plugin,
|
|
|
|
context, sink_caps, src_caps, GST_RANK_NONE);
|
2023-02-22 02:24:12 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
ret = FALSE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
#if (MFX_VERSION >= 2000)
|
|
|
|
|
|
|
|
static void
|
|
|
|
_register_encoders (GstPlugin * plugin,
|
|
|
|
GstMsdkContext * context, mfxEncoderDescription * enc_desc)
|
|
|
|
{
|
2023-02-22 08:46:23 +00:00
|
|
|
GstCaps *sink_caps = NULL;
|
|
|
|
GstCaps *src_caps = NULL;
|
|
|
|
|
2023-02-22 02:24:12 +00:00
|
|
|
for (guint c = 0; c < enc_desc->NumCodecs; c++) {
|
2023-02-22 08:46:23 +00:00
|
|
|
if (!gst_msdkcaps_enc_create_caps (context, enc_desc,
|
|
|
|
enc_desc->Codecs[c].CodecID, &sink_caps, &src_caps)) {
|
|
|
|
GST_WARNING ("Failed to create caps for %" GST_FOURCC_FORMAT " ENC",
|
|
|
|
GST_FOURCC_ARGS (enc_desc->Codecs[c].CodecID));
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!_register_encoder (plugin,
|
|
|
|
context, enc_desc->Codecs[c].CodecID, sink_caps, src_caps)) {
|
2023-02-22 02:24:12 +00:00
|
|
|
GST_WARNING ("Failed to register %" GST_FOURCC_FORMAT " ENC",
|
|
|
|
GST_FOURCC_ARGS (enc_desc->Codecs[c].CodecID));
|
2023-02-22 08:46:23 +00:00
|
|
|
continue;
|
2023-02-22 02:24:12 +00:00
|
|
|
}
|
2023-02-22 08:46:23 +00:00
|
|
|
|
|
|
|
gst_caps_unref (sink_caps);
|
|
|
|
gst_caps_unref (src_caps);
|
2023-02-22 02:24:12 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_register_decoders (GstPlugin * plugin,
|
|
|
|
GstMsdkContext * context, mfxDecoderDescription * dec_desc)
|
|
|
|
{
|
2023-03-10 11:03:47 +00:00
|
|
|
GstCaps *sink_caps = NULL;
|
|
|
|
GstCaps *src_caps = NULL;
|
|
|
|
|
2023-02-22 02:24:12 +00:00
|
|
|
for (guint c = 0; c < dec_desc->NumCodecs; c++) {
|
2023-03-10 11:03:47 +00:00
|
|
|
if (!gst_msdkcaps_dec_create_caps (context, dec_desc,
|
|
|
|
dec_desc->Codecs[c].CodecID, &sink_caps, &src_caps)) {
|
|
|
|
GST_WARNING ("Failed to create caps for %" GST_FOURCC_FORMAT " DEC",
|
|
|
|
GST_FOURCC_ARGS (dec_desc->Codecs[c].CodecID));
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!_register_decoder (plugin,
|
|
|
|
context, dec_desc->Codecs[c].CodecID, sink_caps, src_caps)) {
|
2023-02-22 02:24:12 +00:00
|
|
|
GST_WARNING ("Failed to register %" GST_FOURCC_FORMAT " DEC",
|
|
|
|
GST_FOURCC_ARGS (dec_desc->Codecs[c].CodecID));
|
2023-03-10 11:03:47 +00:00
|
|
|
continue;
|
2023-02-22 02:24:12 +00:00
|
|
|
}
|
2023-03-10 11:03:47 +00:00
|
|
|
|
|
|
|
gst_caps_unref (sink_caps);
|
|
|
|
gst_caps_unref (src_caps);
|
2023-02-22 02:24:12 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_register_vpp (GstPlugin * plugin,
|
|
|
|
GstMsdkContext * context, mfxVPPDescription * vpp_desc)
|
|
|
|
{
|
2023-03-20 12:42:41 +00:00
|
|
|
GstCaps *sink_caps = NULL;
|
|
|
|
GstCaps *src_caps = NULL;
|
|
|
|
|
|
|
|
if (!gst_msdkcaps_vpp_create_caps (context, vpp_desc, &sink_caps, &src_caps)) {
|
|
|
|
GST_WARNING ("Failed to create caps for VPP");
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!gst_msdkvpp_register (plugin,
|
|
|
|
context, sink_caps, src_caps, GST_RANK_NONE)) {
|
|
|
|
GST_WARNING ("Failed to register VPP");
|
|
|
|
}
|
|
|
|
|
|
|
|
gst_caps_unref (sink_caps);
|
|
|
|
gst_caps_unref (src_caps);
|
2023-02-22 02:24:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
static const guint enc_codecs[] = {
|
|
|
|
MFX_CODEC_AVC,
|
|
|
|
MFX_CODEC_HEVC,
|
|
|
|
MFX_CODEC_MPEG2,
|
|
|
|
#ifdef USE_MSDK_VP9_ENC
|
|
|
|
MFX_CODEC_VP9,
|
|
|
|
#endif
|
|
|
|
#ifdef USE_MSDK_AV1_ENC
|
|
|
|
MFX_CODEC_AV1,
|
|
|
|
#endif
|
|
|
|
MFX_CODEC_JPEG
|
|
|
|
};
|
|
|
|
|
|
|
|
static const guint dec_codecs[] = {
|
|
|
|
MFX_CODEC_AVC,
|
|
|
|
MFX_CODEC_HEVC,
|
|
|
|
MFX_CODEC_MPEG2,
|
|
|
|
MFX_CODEC_VP8,
|
|
|
|
#ifdef USE_MSDK_VP9_DEC
|
|
|
|
MFX_CODEC_VP9,
|
|
|
|
#endif
|
|
|
|
#ifdef USE_MSDK_AV1_DEC
|
|
|
|
MFX_CODEC_AV1,
|
|
|
|
#endif
|
|
|
|
MFX_CODEC_JPEG,
|
|
|
|
MFX_CODEC_VC1
|
|
|
|
};
|
|
|
|
|
|
|
|
static void
|
|
|
|
_register_encoders (GstPlugin * plugin, GstMsdkContext * context)
|
|
|
|
{
|
2023-02-22 08:46:23 +00:00
|
|
|
GstCaps *sink_caps = NULL;
|
|
|
|
GstCaps *src_caps = NULL;
|
|
|
|
|
2023-02-22 02:24:12 +00:00
|
|
|
for (guint c = 0; c < G_N_ELEMENTS (enc_codecs); c++) {
|
2023-02-22 08:46:23 +00:00
|
|
|
if (!gst_msdkcaps_enc_create_caps (context,
|
|
|
|
NULL, enc_codecs[c], &sink_caps, &src_caps)) {
|
|
|
|
GST_WARNING ("Failed to create caps for %" GST_FOURCC_FORMAT " ENC",
|
|
|
|
GST_FOURCC_ARGS (enc_codecs[c]));
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!_register_encoder (plugin, context,
|
|
|
|
enc_codecs[c], sink_caps, src_caps)) {
|
2023-02-22 02:24:12 +00:00
|
|
|
GST_WARNING ("Failed to register %" GST_FOURCC_FORMAT " ENC",
|
|
|
|
GST_FOURCC_ARGS (enc_codecs[c]));
|
2023-02-22 08:46:23 +00:00
|
|
|
continue;
|
2023-02-22 02:24:12 +00:00
|
|
|
}
|
2023-02-22 08:46:23 +00:00
|
|
|
|
|
|
|
gst_caps_unref (sink_caps);
|
|
|
|
gst_caps_unref (src_caps);
|
2023-02-22 02:24:12 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_register_decoders (GstPlugin * plugin, GstMsdkContext * context)
|
|
|
|
{
|
2023-03-10 11:03:47 +00:00
|
|
|
GstCaps *sink_caps = NULL;
|
|
|
|
GstCaps *src_caps = NULL;
|
|
|
|
|
2023-02-22 02:24:12 +00:00
|
|
|
for (guint c = 0; c < G_N_ELEMENTS (dec_codecs); c++) {
|
2023-03-10 11:03:47 +00:00
|
|
|
if (!gst_msdkcaps_dec_create_caps (context,
|
|
|
|
NULL, dec_codecs[c], &sink_caps, &src_caps)) {
|
|
|
|
GST_WARNING ("Failed to create caps for %" GST_FOURCC_FORMAT " DEC",
|
|
|
|
GST_FOURCC_ARGS (dec_codecs[c]));
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!_register_decoder (plugin, context,
|
|
|
|
dec_codecs[c], sink_caps, src_caps)) {
|
2023-02-22 02:24:12 +00:00
|
|
|
GST_WARNING ("Failed to register %" GST_FOURCC_FORMAT " DEC",
|
|
|
|
GST_FOURCC_ARGS (dec_codecs[c]));
|
2023-03-10 11:03:47 +00:00
|
|
|
continue;
|
2023-02-22 02:24:12 +00:00
|
|
|
}
|
2023-03-10 11:03:47 +00:00
|
|
|
|
|
|
|
gst_caps_unref (sink_caps);
|
|
|
|
gst_caps_unref (src_caps);
|
2023-02-22 02:24:12 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_register_vpp (GstPlugin * plugin, GstMsdkContext * context)
|
|
|
|
{
|
2023-03-20 12:42:41 +00:00
|
|
|
GstCaps *sink_caps = NULL;
|
|
|
|
GstCaps *src_caps = NULL;
|
|
|
|
|
|
|
|
if (!gst_msdkcaps_vpp_create_caps (context, NULL, &sink_caps, &src_caps)) {
|
|
|
|
GST_WARNING ("Failed to create caps for VPP");
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!gst_msdkvpp_register (plugin, context,
|
|
|
|
sink_caps, src_caps, GST_RANK_NONE)) {
|
|
|
|
GST_WARNING ("Failed to register VPP");
|
|
|
|
}
|
|
|
|
|
|
|
|
gst_caps_unref (sink_caps);
|
|
|
|
gst_caps_unref (src_caps);
|
2023-02-22 02:24:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
2016-04-01 17:25:25 +00:00
|
|
|
static gboolean
|
|
|
|
plugin_init (GstPlugin * plugin)
|
|
|
|
{
|
2023-04-07 06:09:40 +00:00
|
|
|
GstMsdkContext *context;
|
2016-04-01 17:25:25 +00:00
|
|
|
|
2018-03-13 22:20:50 +00:00
|
|
|
GST_DEBUG_CATEGORY_INIT (gst_msdk_debug, "msdk", 0, "msdk");
|
2016-11-07 20:32:38 +00:00
|
|
|
GST_DEBUG_CATEGORY_INIT (gst_msdkdec_debug, "msdkdec", 0, "msdkdec");
|
2016-04-01 17:25:25 +00:00
|
|
|
GST_DEBUG_CATEGORY_INIT (gst_msdkenc_debug, "msdkenc", 0, "msdkenc");
|
2016-11-07 20:32:38 +00:00
|
|
|
GST_DEBUG_CATEGORY_INIT (gst_msdkh264dec_debug, "msdkh264dec", 0,
|
|
|
|
"msdkh264dec");
|
2016-04-01 17:25:25 +00:00
|
|
|
GST_DEBUG_CATEGORY_INIT (gst_msdkh264enc_debug, "msdkh264enc", 0,
|
|
|
|
"msdkh264enc");
|
2018-03-06 13:51:05 +00:00
|
|
|
GST_DEBUG_CATEGORY_INIT (gst_msdkvpp_debug, "msdkvpp", 0, "msdkvpp");
|
2016-11-29 03:14:20 +00:00
|
|
|
GST_DEBUG_CATEGORY_INIT (gst_msdkh265dec_debug, "msdkh265dec", 0,
|
|
|
|
"msdkh265dec");
|
2016-04-01 17:25:25 +00:00
|
|
|
GST_DEBUG_CATEGORY_INIT (gst_msdkh265enc_debug, "msdkh265enc", 0,
|
|
|
|
"msdkh265enc");
|
2016-11-22 21:55:00 +00:00
|
|
|
GST_DEBUG_CATEGORY_INIT (gst_msdkmjpegdec_debug, "msdkmjpegdec", 0,
|
|
|
|
"msdkmjpegdec");
|
2016-10-05 22:32:43 +00:00
|
|
|
GST_DEBUG_CATEGORY_INIT (gst_msdkmjpegenc_debug, "msdkmjpegenc", 0,
|
|
|
|
"msdkmjpegenc");
|
2016-04-01 17:25:25 +00:00
|
|
|
GST_DEBUG_CATEGORY_INIT (gst_msdkmpeg2enc_debug, "msdkmpeg2enc", 0,
|
|
|
|
"msdkmpeg2enc");
|
2018-01-11 03:24:07 +00:00
|
|
|
GST_DEBUG_CATEGORY_INIT (gst_msdkmpeg2dec_debug, "msdkmpeg2dec", 0,
|
|
|
|
"msdkmpeg2dec");
|
2017-10-30 06:06:32 +00:00
|
|
|
GST_DEBUG_CATEGORY_INIT (gst_msdkvp8dec_debug, "msdkvp8dec", 0, "msdkvp8dec");
|
2018-02-13 23:40:54 +00:00
|
|
|
GST_DEBUG_CATEGORY_INIT (gst_msdkvc1dec_debug, "msdkvc1dec", 0, "msdkvc1dec");
|
2019-04-26 00:40:28 +00:00
|
|
|
GST_DEBUG_CATEGORY_INIT (gst_msdkvp9dec_debug, "msdkvp9dec", 0, "msdkvp9dec");
|
2019-04-25 08:32:34 +00:00
|
|
|
GST_DEBUG_CATEGORY_INIT (gst_msdkvp9enc_debug, "msdkvp9enc", 0, "msdkvp9enc");
|
2020-07-20 02:13:13 +00:00
|
|
|
GST_DEBUG_CATEGORY_INIT (gst_msdkav1dec_debug, "msdkav1dec", 0, "msdkav1dec");
|
2023-02-17 06:56:20 +00:00
|
|
|
GST_DEBUG_CATEGORY_INIT (gst_msdkav1enc_debug, "msdkav1enc", 0, "msdkav1enc");
|
2016-04-01 17:25:25 +00:00
|
|
|
|
2021-06-16 17:23:37 +00:00
|
|
|
plugin_add_dependencies (plugin);
|
|
|
|
|
2023-04-07 06:09:40 +00:00
|
|
|
context = gst_msdk_context_new (TRUE);
|
|
|
|
if (!context)
|
2021-06-16 17:23:37 +00:00
|
|
|
return TRUE; /* return TRUE to avoid getting blacklisted */
|
2016-04-01 17:25:25 +00:00
|
|
|
|
2023-02-22 02:24:12 +00:00
|
|
|
#if (MFX_VERSION >= 2000)
|
|
|
|
mfxImplDescription *desc = (mfxImplDescription *)
|
|
|
|
msdk_get_impl_description (gst_msdk_context_get_loader (context),
|
|
|
|
gst_msdk_context_get_impl_idx (context));
|
2018-01-10 19:40:24 +00:00
|
|
|
|
2023-02-22 02:24:12 +00:00
|
|
|
if (desc) {
|
|
|
|
_register_encoders (plugin, context, &desc->Enc);
|
|
|
|
_register_decoders (plugin, context, &desc->Dec);
|
|
|
|
_register_vpp (plugin, context, &desc->VPP);
|
2016-04-01 17:25:25 +00:00
|
|
|
|
2023-02-22 02:24:12 +00:00
|
|
|
msdk_release_impl_description (gst_msdk_context_get_loader (context), desc);
|
|
|
|
}
|
|
|
|
#else
|
|
|
|
_register_encoders (plugin, context);
|
|
|
|
_register_decoders (plugin, context);
|
|
|
|
_register_vpp (plugin, context);
|
2018-05-16 00:33:00 +00:00
|
|
|
#endif
|
2018-03-06 13:51:05 +00:00
|
|
|
|
2023-04-07 06:09:40 +00:00
|
|
|
gst_object_unref (context);
|
|
|
|
|
2023-02-22 02:24:12 +00:00
|
|
|
return TRUE;
|
2016-04-01 17:25:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
|
|
|
|
GST_VERSION_MINOR,
|
|
|
|
msdk,
|
2021-08-24 09:59:59 +00:00
|
|
|
"MFX API (" MFX_API_SDK ") based elements",
|
2019-03-14 08:37:13 +00:00
|
|
|
plugin_init, VERSION, "LGPL", GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN)
|