mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-10 19:31:12 +00:00
nvcodec: Add plugin status message
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6167>
This commit is contained in:
parent
fa477a4a25
commit
5d62f408f2
1 changed files with 37 additions and 2 deletions
|
@ -54,6 +54,8 @@
|
||||||
#include "gstnvcodecutils.h"
|
#include "gstnvcodecutils.h"
|
||||||
#include "gstnvjpegenc.h"
|
#include "gstnvjpegenc.h"
|
||||||
|
|
||||||
|
#include <glib/gi18n-lib.h>
|
||||||
|
|
||||||
GST_DEBUG_CATEGORY (gst_nvcodec_debug);
|
GST_DEBUG_CATEGORY (gst_nvcodec_debug);
|
||||||
GST_DEBUG_CATEGORY (gst_nvdec_debug);
|
GST_DEBUG_CATEGORY (gst_nvdec_debug);
|
||||||
GST_DEBUG_CATEGORY (gst_nvenc_debug);
|
GST_DEBUG_CATEGORY (gst_nvenc_debug);
|
||||||
|
@ -65,6 +67,22 @@ GST_DEBUG_CATEGORY (gst_cuda_nvmm_debug);
|
||||||
|
|
||||||
#define GST_CAT_DEFAULT gst_nvcodec_debug
|
#define GST_CAT_DEFAULT gst_nvcodec_debug
|
||||||
|
|
||||||
|
#ifdef G_OS_WIN32
|
||||||
|
#define CUDA_LIBNAME "nvcuda.dll"
|
||||||
|
#define NVCUVID_LIBNAME "nvcuvid.dll"
|
||||||
|
#ifdef _WIN64
|
||||||
|
#define NVENC_LIBNAME "nvEncodeAPI64.dll"
|
||||||
|
#else
|
||||||
|
#define NVENC_LIBNAME "nvEncodeAPI.dll"
|
||||||
|
#endif
|
||||||
|
#define NVRTC_LIBNAME "nvrtc64_*_0.dll"
|
||||||
|
#else /* G_OS_WIN32 */
|
||||||
|
#define CUDA_LIBNAME "libcuda.so.1"
|
||||||
|
#define NVCUVID_LIBNAME "libnvcuvid.so.1"
|
||||||
|
#define NVENC_LIBNAME "libnvidia-encode.so.1"
|
||||||
|
#define NVRTC_LIBNAME "libnvrtc.so"
|
||||||
|
#endif /* G_OS_WIN32 */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
plugin_deinit (gpointer data)
|
plugin_deinit (gpointer data)
|
||||||
{
|
{
|
||||||
|
@ -120,20 +138,24 @@ plugin_init (GstPlugin * plugin)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!gst_cuda_load_library ()) {
|
if (!gst_cuda_load_library ()) {
|
||||||
GST_WARNING ("Failed to load cuda library");
|
gst_plugin_add_status_warning (plugin,
|
||||||
|
"CUDA library \"" CUDA_LIBNAME "\" was not found.");
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* get available API version from nvenc and it will be passed to
|
/* get available API version from nvenc and it will be passed to
|
||||||
* nvdec */
|
* nvdec */
|
||||||
if (!gst_nvenc_load_library (&api_major_ver, &api_minor_ver)) {
|
if (!gst_nvenc_load_library (&api_major_ver, &api_minor_ver)) {
|
||||||
GST_WARNING ("Failed to load nvenc library");
|
gst_plugin_add_status_warning (plugin,
|
||||||
|
"NVENC library \"" NVENC_LIBNAME "\" was not found.");
|
||||||
nvenc_available = FALSE;
|
nvenc_available = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!gst_cuvid_load_library (api_major_ver, api_minor_ver)) {
|
if (!gst_cuvid_load_library (api_major_ver, api_minor_ver)) {
|
||||||
GST_WARNING ("Failed to load nvdec library version %u.%u", api_major_ver,
|
GST_WARNING ("Failed to load nvdec library version %u.%u", api_major_ver,
|
||||||
api_minor_ver);
|
api_minor_ver);
|
||||||
|
gst_plugin_add_status_warning (plugin,
|
||||||
|
"NVDEC library \"" NVCUVID_LIBNAME "\" was not found.");
|
||||||
nvdec_available = FALSE;
|
nvdec_available = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -149,6 +171,10 @@ plugin_init (GstPlugin * plugin)
|
||||||
|
|
||||||
/* to abort if GST_CUDA_CRITICAL_ERRORS is configured */
|
/* to abort if GST_CUDA_CRITICAL_ERRORS is configured */
|
||||||
gst_cuda_result (CUDA_ERROR_NO_DEVICE);
|
gst_cuda_result (CUDA_ERROR_NO_DEVICE);
|
||||||
|
|
||||||
|
gst_plugin_add_status_error (plugin,
|
||||||
|
N_("Unable to initialize CUDA library."));
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -158,10 +184,19 @@ plugin_init (GstPlugin * plugin)
|
||||||
CuGetErrorString (cuda_ret, &err_desc);
|
CuGetErrorString (cuda_ret, &err_desc);
|
||||||
GST_ERROR ("No available device, cuDeviceGetCount ret: 0x%x: %s %s",
|
GST_ERROR ("No available device, cuDeviceGetCount ret: 0x%x: %s %s",
|
||||||
(int) cuda_ret, err_name, err_desc);
|
(int) cuda_ret, err_name, err_desc);
|
||||||
|
|
||||||
|
gst_plugin_add_status_warning (plugin,
|
||||||
|
N_("No NVIDIA graphics cards detected!"));
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
have_nvrtc = check_runtime_compiler ();
|
have_nvrtc = check_runtime_compiler ();
|
||||||
|
if (!have_nvrtc) {
|
||||||
|
gst_plugin_add_status_info (plugin,
|
||||||
|
"CUDA runtime compilation library \"" NVRTC_LIBNAME "\" was not found, "
|
||||||
|
"check CUDA toolkit package installation");
|
||||||
|
}
|
||||||
|
|
||||||
for (i = 0; i < dev_count; i++) {
|
for (i = 0; i < dev_count; i++) {
|
||||||
GstCudaContext *context = gst_cuda_context_new (i);
|
GstCudaContext *context = gst_cuda_context_new (i);
|
||||||
|
|
Loading…
Reference in a new issue