type_info.class_data = cdata;
- type_name = g_strdup ("GstVaAV1Dec");
- feature_name = g_strdup ("vaav1dec");
-
/* The first decoder to be registered should use a constant name,
* like vaav1dec, for any additional decoders, we create unique
* names, using inserting the render device name. */
- if (g_type_from_name (type_name)) {
+ if (device->index == 0) {
+ type_name = g_strdup ("GstVaAV1Dec");
+ feature_name = g_strdup ("vaav1dec");
+ } else {
gchar *basename = g_path_get_basename (device->render_device_path);
- g_free (type_name);
- g_free (feature_name);
type_name = g_strdup_printf ("GstVa%sAV1Dec", basename);
feature_name = g_strdup_printf ("va%sav1dec", basename);
cdata->description = basename;
}
static GstVaDevice *
-gst_va_device_new (GstVaDisplay * display, const gchar * render_device_path)
+gst_va_device_new (GstVaDisplay * display, const gchar * render_device_path,
+ gint index)
{
GstVaDevice *device = g_new0 (GstVaDevice, 1);
/* take ownership */
device->display = display;
device->render_device_path = g_strdup (render_device_path);
+ device->index = index;
return device;
}
{
const GstVaDevice *pa = a, *pb = b;
- return strcmp (pa->render_device_path, pb->render_device_path);
+ return g_strcmp0 (pa->render_device_path, pb->render_device_path);
}
#if HAVE_GUDEV
GUdevClient *client;
GList *udev_devices, *dev;
GQueue devices = G_QUEUE_INIT;
+ gint i = 0;
client = g_udev_client_new (NULL);
udev_devices = g_udev_client_query_by_subsystem (client, "drm");
continue;
GST_INFO ("Found VA-API device: %s", path);
- g_queue_push_head (&devices, gst_va_device_new (dpy, path));
+ g_queue_push_head (&devices, gst_va_device_new (dpy, path, i++));
}
g_queue_sort (&devices, compare_device_path, NULL);
GstVaDisplay *dpy;
GQueue devices = G_QUEUE_INIT;
gchar path[64];
- guint i;
+ guint i, j = 0;
for (i = 0; i < 8; i++) {
g_snprintf (path, sizeof (path), "/dev/dri/renderD%d", 128 + i);
continue;
GST_INFO ("Found VA-API device: %s", path);
- g_queue_push_head (&devices, gst_va_device_new (dpy, path));
+ g_queue_push_head (&devices, gst_va_device_new (dpy, path, j++));
}
g_queue_sort (&devices, compare_device_path, NULL);
GstVaDisplay *display;
gchar *render_device_path;
+ gint index;
} GstVaDevice;
GType gst_va_device_get_type (void);
type_info.class_data = cdata;
- type_name = g_strdup ("GstVaH264Dec");
- feature_name = g_strdup ("vah264dec");
-
/* The first decoder to be registered should use a constant name,
* like vah264dec, for any additional decoders, we create unique
* names, using inserting the render device name. */
- if (g_type_from_name (type_name)) {
+ if (device->index == 0) {
+ type_name = g_strdup ("GstVaH264Dec");
+ feature_name = g_strdup ("vah264dec");
+ } else {
gchar *basename = g_path_get_basename (device->render_device_path);
- g_free (type_name);
- g_free (feature_name);
type_name = g_strdup_printf ("GstVa%sH264Dec", basename);
feature_name = g_strdup_printf ("va%sh264dec", basename);
cdata->description = basename;
GST_MINI_OBJECT_FLAG_MAY_BE_LEAKED);
type_info.class_data = cdata;
- if (entrypoint == VAEntrypointEncSlice) {
- type_name = g_strdup ("GstVaH264Enc");
- feature_name = g_strdup ("vah264enc");
- } else {
- type_name = g_strdup ("GstVaH264LPEnc");
- feature_name = g_strdup ("vah264lpenc");
- }
/* The first encoder to be registered should use a constant name,
* like vah264enc, for any additional encoders, we create unique
* names, using inserting the render device name. */
- if (g_type_from_name (type_name)) {
+ if (device->index == 0) {
+ if (entrypoint == VAEntrypointEncSlice) {
+ type_name = g_strdup ("GstVaH264Enc");
+ feature_name = g_strdup ("vah264enc");
+ } else {
+ type_name = g_strdup ("GstVaH264LPEnc");
+ feature_name = g_strdup ("vah264lpenc");
+ }
+ } else {
gchar *basename = g_path_get_basename (device->render_device_path);
- g_free (type_name);
- g_free (feature_name);
if (entrypoint == VAEntrypointEncSlice) {
type_name = g_strdup_printf ("GstVa%sH264Enc", basename);
feature_name = g_strdup_printf ("va%sh264enc", basename);
type_info.class_data = cdata;
- type_name = g_strdup ("GstVaH265Dec");
- feature_name = g_strdup ("vah265dec");
-
/* The first decoder to be registered should use a constant name,
* like vah265dec, for any additional decoders, we create unique
* names, using inserting the render device name. */
- if (g_type_from_name (type_name)) {
+ if (device->index == 0) {
+ type_name = g_strdup ("GstVaH265Dec");
+ feature_name = g_strdup ("vah265dec");
+ } else {
gchar *basename = g_path_get_basename (device->render_device_path);
- g_free (type_name);
- g_free (feature_name);
type_name = g_strdup_printf ("GstVa%sH265Dec", basename);
feature_name = g_strdup_printf ("va%sh265dec", basename);
cdata->description = basename;
GST_MINI_OBJECT_FLAG_MAY_BE_LEAKED);
type_info.class_data = cdata;
- if (entrypoint == VAEntrypointEncSlice) {
- type_name = g_strdup ("GstVaH265Enc");
- feature_name = g_strdup ("vah265enc");
- } else {
- type_name = g_strdup ("GstVaH265LPEnc");
- feature_name = g_strdup ("vah265lpenc");
- }
/* The first encoder to be registered should use a constant name,
* like vah265enc, for any additional encoders, we create unique
* names, using inserting the render device name. */
- if (g_type_from_name (type_name)) {
+ if (device->index == 0) {
+ if (entrypoint == VAEntrypointEncSlice) {
+ type_name = g_strdup ("GstVaH265Enc");
+ feature_name = g_strdup ("vah265enc");
+ } else {
+ type_name = g_strdup ("GstVaH265LPEnc");
+ feature_name = g_strdup ("vah265lpenc");
+ }
+ } else {
gchar *basename = g_path_get_basename (device->render_device_path);
- g_free (type_name);
- g_free (feature_name);
if (entrypoint == VAEntrypointEncSlice) {
type_name = g_strdup_printf ("GstVa%sH265Enc", basename);
feature_name = g_strdup_printf ("va%sh265enc", basename);
feature_name = g_strdup_printf ("va%sh265lpenc", basename);
}
cdata->description = basename;
+
/* lower rank for non-first device */
if (rank > 0)
rank--;
type_info.class_data = cdata;
- type_name = g_strdup ("GstVaJpegDec");
- feature_name = g_strdup ("vajpegdec");
/* The first decoder to be registered should use a constant name,
* like vajpegdec, for any additional decoders, we create unique
* names, using inserting the render device name. */
- if (g_type_from_name (type_name)) {
+ if (device->index == 0) {
+ type_name = g_strdup ("GstVaJpegDec");
+ feature_name = g_strdup ("vajpegdec");
+ } else {
gchar *basename = g_path_get_basename (device->render_device_path);
- g_free (type_name);
- g_free (feature_name);
type_name = g_strdup_printf ("GstVa%sJpegDec", basename);
feature_name = g_strdup_printf ("va%sjpegdec", basename);
cdata->description = basename;
type_info.class_data = cdata;
- type_name = g_strdup ("GstVaMpeg2Dec");
- feature_name = g_strdup ("vampeg2dec");
-
/* The first decoder to be registered should use a constant name,
* like vampeg2dec, for any additional decoders, we create unique
* names, using inserting the render device name. */
- if (g_type_from_name (type_name)) {
+ if (device->index == 0) {
+ type_name = g_strdup ("GstVaMpeg2Dec");
+ feature_name = g_strdup ("vampeg2dec");
+ } else {
gchar *basename = g_path_get_basename (device->render_device_path);
- g_free (type_name);
- g_free (feature_name);
type_name = g_strdup_printf ("GstVa%sMpeg2Dec", basename);
feature_name = g_strdup_printf ("va%smpeg2dec", basename);
cdata->description = basename;
type_info.class_data = cdata;
- type_name = g_strdup ("GstVaVp8Dec");
- feature_name = g_strdup ("vavp8dec");
-
/* The first decoder to be registered should use a constant name,
* like vavp8dec, for any additional decoders, we create unique
* names, using inserting the render device name. */
- if (g_type_from_name (type_name)) {
+ if (device->index == 0) {
+ type_name = g_strdup ("GstVaVp8Dec");
+ feature_name = g_strdup ("vavp8dec");
+ } else {
gchar *basename = g_path_get_basename (device->render_device_path);
- g_free (type_name);
- g_free (feature_name);
type_name = g_strdup_printf ("GstVa%sVp8Dec", basename);
feature_name = g_strdup_printf ("va%svp8dec", basename);
cdata->description = basename;
type_info.class_data = cdata;
- type_name = g_strdup ("GstVaVp9Dec");
- feature_name = g_strdup ("vavp9dec");
-
/* The first decoder to be registered should use a constant name,
* like vavp9dec, for any additional decoders, we create unique
* names, using inserting the render device name. */
- if (g_type_from_name (type_name)) {
+ if (device->index == 0) {
+ type_name = g_strdup ("GstVaVp9Dec");
+ feature_name = g_strdup ("vavp9dec");
+ } else {
gchar *basename = g_path_get_basename (device->render_device_path);
- g_free (type_name);
- g_free (feature_name);
type_name = g_strdup_printf ("GstVa%sVp9Dec", basename);
feature_name = g_strdup_printf ("va%svp9dec", basename);
cdata->description = basename;