mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-25 01:30:38 +00:00
Add VA entrypoint abstraction.
This commit is contained in:
parent
508edba9a0
commit
30fbcb1ee8
2 changed files with 94 additions and 7 deletions
|
@ -29,6 +29,7 @@
|
|||
#include "gstvaapiprofile.h"
|
||||
|
||||
typedef struct _GstVaapiProfileMap GstVaapiProfileMap;
|
||||
typedef struct _GstVaapiEntrypointMap GstVaapiEntrypointMap;
|
||||
|
||||
struct _GstVaapiProfileMap {
|
||||
GstVaapiProfile profile;
|
||||
|
@ -36,6 +37,11 @@ struct _GstVaapiProfileMap {
|
|||
const char *caps_str;
|
||||
};
|
||||
|
||||
struct _GstVaapiEntrypointMap {
|
||||
GstVaapiEntrypoint entrypoint;
|
||||
VAEntrypoint va_entrypoint;
|
||||
};
|
||||
|
||||
/* Profiles */
|
||||
static const GstVaapiProfileMap gst_vaapi_profiles[] = {
|
||||
{ GST_VAAPI_PROFILE_MPEG2_SIMPLE, VAProfileMPEG2Simple,
|
||||
|
@ -79,8 +85,16 @@ static const GstVaapiProfileMap gst_vaapi_profiles[] = {
|
|||
{ 0, }
|
||||
};
|
||||
|
||||
/* Entry-points */
|
||||
static const GstVaapiEntrypointMap gst_vaapi_entrypoints[] = {
|
||||
{ GST_VAAPI_ENTRYPOINT_VLD, VAEntrypointVLD },
|
||||
{ GST_VAAPI_ENTRYPOINT_IDCT, VAEntrypointIDCT },
|
||||
{ GST_VAAPI_ENTRYPOINT_MOCO, VAEntrypointMoComp },
|
||||
{ 0, }
|
||||
};
|
||||
|
||||
static const GstVaapiProfileMap *
|
||||
get_map(GstVaapiProfile profile)
|
||||
get_profiles_map(GstVaapiProfile profile)
|
||||
{
|
||||
const GstVaapiProfileMap *m;
|
||||
|
||||
|
@ -90,13 +104,26 @@ get_map(GstVaapiProfile profile)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
static const GstVaapiEntrypointMap *
|
||||
get_entrypoints_map(GstVaapiEntrypoint entrypoint)
|
||||
{
|
||||
const GstVaapiEntrypointMap *m;
|
||||
|
||||
for (m = gst_vaapi_entrypoints; m->entrypoint; m++)
|
||||
if (m->entrypoint == entrypoint)
|
||||
return m;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_vaapi_profile:
|
||||
* @va_profile: a #VAProfile
|
||||
* @profile: a #VAProfile
|
||||
*
|
||||
* Converts a VA profile into the corresponding #GstVaapiProfile. If the profile cannot be represented by #GstVaapiProfile, then zero is returned.
|
||||
* Converts a VA profile into the corresponding #GstVaapiProfile. If
|
||||
* the profile cannot be represented by #GstVaapiProfile, then zero is
|
||||
* returned.
|
||||
*
|
||||
* Return value: the #GstVaapiProfile describing the @va_profile
|
||||
* Return value: the #GstVaapiProfile describing the @profile
|
||||
*/
|
||||
GstVaapiProfile
|
||||
gst_vaapi_profile(VAProfile profile)
|
||||
|
@ -163,7 +190,7 @@ gst_vaapi_profile_from_caps(GstCaps *caps)
|
|||
VAProfile
|
||||
gst_vaapi_profile_get_va_profile(GstVaapiProfile profile)
|
||||
{
|
||||
const GstVaapiProfileMap * const m = get_map(profile);
|
||||
const GstVaapiProfileMap * const m = get_profiles_map(profile);
|
||||
|
||||
return m ? m->va_profile : (VAProfile)-1;
|
||||
}
|
||||
|
@ -180,7 +207,7 @@ gst_vaapi_profile_get_va_profile(GstVaapiProfile profile)
|
|||
GstCaps *
|
||||
gst_vaapi_profile_get_caps(GstVaapiProfile profile)
|
||||
{
|
||||
const GstVaapiProfileMap * const m = get_map(profile);
|
||||
const GstVaapiProfileMap * const m = get_profiles_map(profile);
|
||||
|
||||
return m ? gst_caps_from_string(m->caps_str) : NULL;
|
||||
}
|
||||
|
@ -198,3 +225,42 @@ gst_vaapi_profile_get_codec(GstVaapiProfile profile)
|
|||
{
|
||||
return (GstVaapiCodec)(((guint32)profile) & 0xffffff00);
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_vaapi_entrypoint:
|
||||
* @entryprofile: a #VAEntrypoint
|
||||
*
|
||||
* Converts a VA entry-point into the corresponding #GstVaapiEntrypoint.
|
||||
* If the entry-point cannot be represented by #GstVaapiEntrypoint,
|
||||
* then zero is returned.
|
||||
*
|
||||
* Return value: the #GstVaapiEntrypoint describing the @entrypoint
|
||||
*/
|
||||
GstVaapiEntrypoint
|
||||
gst_vaapi_entrypoint(VAEntrypoint entrypoint)
|
||||
{
|
||||
const GstVaapiEntrypointMap *m;
|
||||
|
||||
for (m = gst_vaapi_entrypoints; m->entrypoint; m++)
|
||||
if (m->va_entrypoint == entrypoint)
|
||||
return m->entrypoint;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_vaapi_entrypoint_get_va_entrypoint:
|
||||
* @entrypoint: a #GstVaapiEntrypoint
|
||||
*
|
||||
* Converts a #GstVaapiEntrypoint into the corresponding VA
|
||||
* entry-point. If no matching VA entry-point was found, -1 is
|
||||
* returned and this error must be reported to be fixed.
|
||||
*
|
||||
* Return value: the VA entry-point, or -1 if none was found
|
||||
*/
|
||||
VAEntrypoint
|
||||
gst_vaapi_entrypoint_get_va_entrypoint(GstVaapiEntrypoint entrypoint)
|
||||
{
|
||||
const GstVaapiEntrypointMap * const m = get_entrypoints_map(entrypoint);
|
||||
|
||||
return m ? m->va_entrypoint : (VAEntrypoint)-1;
|
||||
}
|
||||
|
|
|
@ -27,6 +27,7 @@ G_BEGIN_DECLS
|
|||
|
||||
typedef enum _GstVaapiCodec GstVaapiCodec;
|
||||
typedef enum _GstVaapiProfile GstVaapiProfile;
|
||||
typedef enum _GstVaapiEntrypoint GstVaapiEntrypoint;
|
||||
|
||||
/**
|
||||
* GstVaapiCodec:
|
||||
|
@ -77,7 +78,7 @@ enum _GstVaapiCodec {
|
|||
* @GST_VAAPI_PROFILE_VC1_ADVANCED:
|
||||
* VC-1 advanced profile
|
||||
*
|
||||
* The set of all profile for #GstVaapiProfile.
|
||||
* The set of all profiles for #GstVaapiProfile.
|
||||
*/
|
||||
enum _GstVaapiProfile {
|
||||
GST_VAAPI_PROFILE_MPEG1 = GST_VAAPI_CODEC_MPEG1|1,
|
||||
|
@ -95,6 +96,20 @@ enum _GstVaapiProfile {
|
|||
GST_VAAPI_PROFILE_VC1_ADVANCED = GST_VAAPI_CODEC_VC1|3,
|
||||
};
|
||||
|
||||
/**
|
||||
* GstVaapiEntrypoint:
|
||||
* @GST_VAAPI_ENTRYPOINT_VLD: Variable Length Decoding
|
||||
* @GST_VAAPI_ENTRYPOINT_IDCT: Inverse Decrete Cosine Transform
|
||||
* @GST_VAAPI_ENTRYPOINT_MOCO: Motion Compensation
|
||||
*
|
||||
* The set of all entrypoints for #GstVaapiEntrypoint
|
||||
*/
|
||||
enum _GstVaapiEntrypoint {
|
||||
GST_VAAPI_ENTRYPOINT_VLD = 1,
|
||||
GST_VAAPI_ENTRYPOINT_IDCT,
|
||||
GST_VAAPI_ENTRYPOINT_MOCO
|
||||
};
|
||||
|
||||
GstVaapiProfile
|
||||
gst_vaapi_profile(VAProfile profile);
|
||||
|
||||
|
@ -110,6 +125,12 @@ gst_vaapi_profile_get_caps(GstVaapiProfile profile);
|
|||
GstVaapiCodec
|
||||
gst_vaapi_profile_get_codec(GstVaapiProfile profile);
|
||||
|
||||
GstVaapiEntrypoint
|
||||
gst_vaapi_entrypoint(VAEntrypoint entrypoint);
|
||||
|
||||
VAEntrypoint
|
||||
gst_vaapi_entrypoint_get_va_entrypoint(GstVaapiEntrypoint entrypoint);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* GST_GST_VAAPI_IMAGE_H */
|
||||
|
|
Loading…
Reference in a new issue