Skip to content

Commit

Permalink
nvdec: show gfxcard name in plugin description
Browse files Browse the repository at this point in the history
  • Loading branch information
farindk committed Sep 13, 2024
1 parent 808fbd7 commit 3608adf
Showing 1 changed file with 19 additions and 5 deletions.
24 changes: 19 additions & 5 deletions libheif/plugins/decoder_nvdec.cc
Original file line number Diff line number Diff line change
Expand Up @@ -48,17 +48,31 @@ static char plugin_name[MAX_PLUGIN_NAME_LENGTH];

static const char *nvdec_plugin_name()
{
snprintf(plugin_name, MAX_PLUGIN_NAME_LENGTH, "NVIDIA Video Decoder (Hardware)");

// make sure that the string is null-terminated
plugin_name[MAX_PLUGIN_NAME_LENGTH - 1] = 0;

return plugin_name;
}

static void nvdec_init_plugin()
{
cuInit(0);

CUdevice cuDevice = 0;
CUresult result;
result = cuDeviceGet(&cuDevice, 0);
if (result != CUDA_SUCCESS)
{
return;
}

char szDeviceName[50];
result = cuDeviceGetName(szDeviceName, sizeof(szDeviceName), cuDevice);
if (result != CUDA_SUCCESS) {
return;
}

snprintf(plugin_name, MAX_PLUGIN_NAME_LENGTH, "NVIDIA Video Decoder (%s)", szDeviceName);

// make sure that the string is null-terminated
plugin_name[MAX_PLUGIN_NAME_LENGTH - 1] = 0;
}

static void nvdec_deinit_plugin()
Expand Down

0 comments on commit 3608adf

Please sign in to comment.