mirror of
https://gitlab.uni-freiburg.de/opensourcevdi/spice
synced 2026-08-06 15:34:29 +00:00
fix: improve find_best_hw_plugin
This commit is contained in:
parent
cabbac5794
commit
8250cc3aee
@ -1011,47 +1011,46 @@ int getRenderNum(const char *rendernode) {
|
||||
#endif
|
||||
}
|
||||
|
||||
static gchar *find_best_hw_plugin(const gchar *codec_name, const char *rendernode)
|
||||
{
|
||||
static gchar *find_best_hw_plugin(const gchar *codec_name, const char *rendernode) {
|
||||
// first plugin is also va but for a specific render
|
||||
char plugins[][16] = {"", "va", "msdk", "vaapi"};
|
||||
char plugins[][20] = {"", "va", "msdk", "vaapi"};
|
||||
const char *postproc[] = {"postproc", "postproc", "vpp", "postproc"};
|
||||
|
||||
int renderNum = getRenderNum(rendernode);
|
||||
gchar *feature_name = NULL;
|
||||
int i = 1;
|
||||
|
||||
// If a specific render node is provided, setup slot 0
|
||||
int renderNum = getRenderNum(rendernode);
|
||||
if (renderNum != -1 && renderNum != 128) {
|
||||
|
||||
snprintf(plugins[0], sizeof(plugins[0]), "varenderD%d", renderNum);
|
||||
i = 0;
|
||||
i = 0; // Start at our custom "varenderDXX" slot
|
||||
}
|
||||
|
||||
|
||||
for (; i < G_N_ELEMENTS(plugins); i++) {
|
||||
for (; i < G_N_ELEMENTS(plugins); i++) {
|
||||
gchar *feature_name = NULL;
|
||||
|
||||
if (codec_name == NULL) {
|
||||
// Non-codec/post-processing lookup
|
||||
feature_name = g_strdup_printf("%s%s", plugins[i], postproc[i]);
|
||||
if (!gst_features_lookup(feature_name)) {
|
||||
g_free(feature_name);
|
||||
continue;
|
||||
if (gst_features_lookup(feature_name)) {
|
||||
return feature_name;
|
||||
}
|
||||
g_free(feature_name);
|
||||
} else {
|
||||
feature_name = g_strconcat(plugins[i], codec_name, "enc", NULL);
|
||||
if (!gst_features_lookup(feature_name)) {
|
||||
g_free(feature_name);
|
||||
|
||||
// Fallback to low-power encoder alternative
|
||||
feature_name = g_strconcat(plugins[i], codec_name, "lpenc", NULL);
|
||||
if (!gst_features_lookup(feature_name)) {
|
||||
g_free(feature_name);
|
||||
continue;
|
||||
}
|
||||
if (gst_features_lookup(feature_name)) {
|
||||
return feature_name;
|
||||
}
|
||||
g_free(feature_name);
|
||||
|
||||
// Fallback to low-power encoder
|
||||
feature_name = g_strconcat(plugins[i], codec_name, "lpenc", NULL);
|
||||
if (gst_features_lookup(feature_name)) {
|
||||
return feature_name;
|
||||
}
|
||||
g_free(feature_name);
|
||||
}
|
||||
return feature_name;
|
||||
}
|
||||
return NULL;
|
||||
|
||||
return NULL; // No compatible plugin found
|
||||
}
|
||||
|
||||
static gchar *get_hw_gstenc_opts(const gchar *encoder, const gchar *codec_name)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user