libs: profile: add gst_vaapi_profile_get_va_name()

gst_vaapi_profile_get_name() returns a proper name for
GstCaps. Nonetheless, there are many profiles which don't have a name
representation for that realm.

gst_vaapi_profile_get_va_name() returns the name of the profile
according to its VAProfile name.

This new funtion is used in the encoder error message.
This commit is contained in:
Víctor Manuel Jáquez Leal 2019-08-16 18:07:43 +02:00
parent f7c1ac036d
commit 1c73dc969c
9 changed files with 29 additions and 8 deletions

View file

@ -1145,7 +1145,7 @@ ensure_hw_profile (GstVaapiEncoderH264 * encoder)
error_unsupported_profile: error_unsupported_profile:
{ {
GST_ERROR ("unsupported HW profile %s", GST_ERROR ("unsupported HW profile %s",
gst_vaapi_profile_get_name (encoder->profile)); gst_vaapi_profile_get_va_name (encoder->profile));
return FALSE; return FALSE;
} }
} }

View file

@ -954,7 +954,7 @@ ensure_hw_profile (GstVaapiEncoderH265 * encoder)
error_unsupported_profile: error_unsupported_profile:
{ {
GST_ERROR ("unsupported HW profile %s", GST_ERROR ("unsupported HW profile %s",
gst_vaapi_profile_get_name (encoder->profile)); gst_vaapi_profile_get_va_name (encoder->profile));
return FALSE; return FALSE;
} }
} }

View file

@ -164,7 +164,7 @@ ensure_hw_profile (GstVaapiEncoderJpeg * encoder)
error_unsupported_profile: error_unsupported_profile:
{ {
GST_ERROR ("unsupported HW profile %s", GST_ERROR ("unsupported HW profile %s",
gst_vaapi_profile_get_name (encoder->profile)); gst_vaapi_profile_get_va_name (encoder->profile));
return FALSE; return FALSE;
} }
} }

View file

@ -101,7 +101,7 @@ ensure_hw_profile (GstVaapiEncoderMpeg2 * encoder)
error_unsupported_profile: error_unsupported_profile:
{ {
GST_ERROR ("unsupported HW profile %s", GST_ERROR ("unsupported HW profile %s",
gst_vaapi_profile_get_name (encoder->profile)); gst_vaapi_profile_get_va_name (encoder->profile));
return FALSE; return FALSE;
} }
} }

View file

@ -109,7 +109,7 @@ ensure_hw_profile (GstVaapiEncoderVP8 * encoder)
error_unsupported_profile: error_unsupported_profile:
{ {
GST_ERROR ("unsupported HW profile %s", GST_ERROR ("unsupported HW profile %s",
gst_vaapi_profile_get_name (encoder->profile)); gst_vaapi_profile_get_va_name (encoder->profile));
return FALSE; return FALSE;
} }
} }

View file

@ -196,7 +196,7 @@ ensure_hw_profile (GstVaapiEncoderVP9 * encoder)
error_unsupported_profile: error_unsupported_profile:
{ {
GST_ERROR ("unsupported HW profile %s", GST_ERROR ("unsupported HW profile %s",
gst_vaapi_profile_get_name (encoder->profile)); gst_vaapi_profile_get_va_name (encoder->profile));
return FALSE; return FALSE;
} }
} }

View file

@ -31,6 +31,7 @@
#include <gst/gstbuffer.h> #include <gst/gstbuffer.h>
#include "gstvaapicompat.h" #include "gstvaapicompat.h"
#include "gstvaapiprofile.h" #include "gstvaapiprofile.h"
#include "gstvaapiutils.h"
#include "gstvaapiworkarounds.h" #include "gstvaapiworkarounds.h"
typedef struct _GstVaapiCodecMap GstVaapiCodecMap; typedef struct _GstVaapiCodecMap GstVaapiCodecMap;
@ -242,9 +243,26 @@ gst_vaapi_profile_get_name (GstVaapiProfile profile)
} }
/** /**
* gst_vaapi_profile_get_media_type_name: * gst_vaapi_profile_get_va_name:
* @profile: a #GstVaapiProfile * @profile: a #GstVaapiProfile
* *
* Returns a string representation for the supplied @profile as VAProfile.
*
* Return value: the statically allocated string representation of
* @profile as VAProfile
*/
const gchar *
gst_vaapi_profile_get_va_name (GstVaapiProfile profile)
{
const GstVaapiProfileMap *const m = get_profiles_map (profile);
return m ? string_of_VAProfile (m->va_profile) : NULL;
}
/**
* gst_vaapi_profile_get_media_type_name:
* @profile: a #GstVaapiProfileo
*
* Returns a string representation for the media type of the supplied * Returns a string representation for the media type of the supplied
* @profile. * @profile.
* *

View file

@ -221,6 +221,9 @@ gst_vaapi_profile_from_caps(const GstCaps *caps);
const gchar * const gchar *
gst_vaapi_profile_get_name(GstVaapiProfile profile); gst_vaapi_profile_get_name(GstVaapiProfile profile);
const gchar *
gst_vaapi_profile_get_va_name(GstVaapiProfile profile);
const gchar * const gchar *
gst_vaapi_profile_get_media_type_name(GstVaapiProfile profile); gst_vaapi_profile_get_media_type_name(GstVaapiProfile profile);

View file

@ -84,7 +84,7 @@ print_profiles (GArray * profiles, const gchar * name)
if (!codec_name) if (!codec_name)
continue; continue;
profile_name = gst_vaapi_profile_get_name (profile); profile_name = gst_vaapi_profile_get_va_name (profile);
if (!profile_name) if (!profile_name)
continue; continue;