mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-12 18:35:35 +00:00
subpicture: add premultiplied-alpha and global-alpha feature flags.
Add premultiplied-alpha and global-alpha feature flags, along with converters between VA-API and gstreamer-vaapi definitions. Another round of helpers is also necessary for GstVideoOverlayComposition API.
This commit is contained in:
parent
fc1f9a64e4
commit
1307a5b4ef
3 changed files with 68 additions and 0 deletions
|
@ -58,6 +58,21 @@ typedef struct _GstVaapiSubpicture GstVaapiSubpicture;
|
|||
typedef struct _GstVaapiSubpicturePrivate GstVaapiSubpicturePrivate;
|
||||
typedef struct _GstVaapiSubpictureClass GstVaapiSubpictureClass;
|
||||
|
||||
/**
|
||||
* GstVaapiSubpictureFlags:
|
||||
* @GST_VAAPI_SUBPICTURE_FLAG_PREMULTIPLIED_ALPHA:
|
||||
* subpicture has RGB pixels with pre-multiplied alpha
|
||||
* @GST_VAAPI_SUBPICTURE_FLAG_GLOBAL_ALPHA:
|
||||
* subpicture needs to be blended with some global-alpha value at
|
||||
* rendering time
|
||||
*
|
||||
* The set of all subpicture rendering flags for #GstVaapiSubpicture.
|
||||
*/
|
||||
typedef enum {
|
||||
GST_VAAPI_SUBPICTURE_FLAG_PREMULTIPLIED_ALPHA = (1 << 0),
|
||||
GST_VAAPI_SUBPICTURE_FLAG_GLOBAL_ALPHA = (1 << 1),
|
||||
} GstVaapiSubpictureFlags;
|
||||
|
||||
/**
|
||||
* GstVaapiSubpicture:
|
||||
*
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
#include "gstvaapicompat.h"
|
||||
#include "gstvaapiutils.h"
|
||||
#include "gstvaapisurface.h"
|
||||
#include "gstvaapisubpicture.h"
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
|
@ -202,6 +203,50 @@ string_of_VADisplayAttributeType(VADisplayAttribType attribute_type)
|
|||
return "<unknown>";
|
||||
}
|
||||
|
||||
/**
|
||||
* from_GstVaapiSubpictureFlags:
|
||||
* @flags: the #GstVaapiSubpictureFlags
|
||||
*
|
||||
* Converts #GstVaapiSubpictureFlags to flags suitable for
|
||||
* vaAssociateSubpicture().
|
||||
*/
|
||||
guint
|
||||
from_GstVaapiSubpictureFlags(guint flags)
|
||||
{
|
||||
guint va_flags = 0;
|
||||
|
||||
if (flags & GST_VAAPI_SUBPICTURE_FLAG_GLOBAL_ALPHA)
|
||||
va_flags |= VA_SUBPICTURE_GLOBAL_ALPHA;
|
||||
#ifdef VA_SUBPICTURE_PREMULTIPLIED_ALPHA
|
||||
if (flags & GST_VAAPI_SUBPICTURE_FLAG_PREMULTIPLIED_ALPHA)
|
||||
flags |= VA_SUBPICTURE_PREMULTIPLIED_ALPHA;
|
||||
#endif
|
||||
return va_flags;
|
||||
}
|
||||
|
||||
/**
|
||||
* to_GstVaapiSubpictureFlags:
|
||||
* @flags: the #GstVaapiSubpictureFlags flags to translate
|
||||
*
|
||||
* Converts vaQuerySubpictureFormats() @flags to #GstVaapiSubpictureFlags
|
||||
* flags.
|
||||
*
|
||||
* Return value: the #GstVaapiSubpictureFlags flags
|
||||
*/
|
||||
guint
|
||||
to_GstVaapiSubpictureFlags(guint va_flags)
|
||||
{
|
||||
guint flags = 0;
|
||||
|
||||
if (va_flags & VA_SUBPICTURE_GLOBAL_ALPHA)
|
||||
flags |= GST_VAAPI_SUBPICTURE_FLAG_GLOBAL_ALPHA;
|
||||
#ifdef VA_SUBPICTURE_PREMULTIPLIED_ALPHA
|
||||
if (va_flags & VA_SUBPICTURE_PREMULTIPLIED_ALPHA)
|
||||
flags |= GST_VAAPI_SUBPICTURE_FLAG_PREMULTIPLIED_ALPHA;
|
||||
#endif
|
||||
return flags;
|
||||
}
|
||||
|
||||
/**
|
||||
* from_GstVaapiSurfaceRenderFlags:
|
||||
* @flags: the #GstVaapiSurfaceRenderFlags
|
||||
|
|
|
@ -73,6 +73,14 @@ G_GNUC_INTERNAL
|
|||
const char *
|
||||
string_of_VADisplayAttributeType(VADisplayAttribType attribute_type);
|
||||
|
||||
G_GNUC_INTERNAL
|
||||
guint
|
||||
from_GstVaapiSubpictureFlags(guint flags);
|
||||
|
||||
G_GNUC_INTERNAL
|
||||
guint
|
||||
to_GstVaapiSubpictureFlags(guint va_flags);
|
||||
|
||||
G_GNUC_INTERNAL
|
||||
guint
|
||||
from_GstVaapiSurfaceRenderFlags(guint flags);
|
||||
|
|
Loading…
Reference in a new issue