summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHe Junyan <junyan.he@hotmail.com>2019-12-27 18:49:02 +0100
committerVíctor Manuel Jáquez Leal <vjaquez@igalia.com>2019-12-29 17:58:36 +0100
commit4f43d28bebf6803e1bf124c1f1aeef421ac2ffb2 (patch)
tree761275e8771bff1ef8859ef066e4c632c96e8009
parentc05ce4481540cb74ca6e126f5d16a24d3fcb4732 (diff)
libs: context: add invalid entrypoint symbol
The symbol GST_VAAPI_ENTRYPOINT_INVALID is just a representation of zero, which was already used as an invalid value tacitly. This patch only makes it explicit. Signed-off-by: Víctor Manuel Jáquez Leal <vjaquez@igalia.com>
-rw-r--r--gst-libs/gst/vaapi/gstvaapicontext.c13
-rw-r--r--gst-libs/gst/vaapi/gstvaapiprofile.h4
2 files changed, 13 insertions, 4 deletions
diff --git a/gst-libs/gst/vaapi/gstvaapicontext.c b/gst-libs/gst/vaapi/gstvaapicontext.c
index b26bb52f..7c07cce1 100644
--- a/gst-libs/gst/vaapi/gstvaapicontext.c
+++ b/gst-libs/gst/vaapi/gstvaapicontext.c
@@ -221,7 +221,8 @@ config_create (GstVaapiContext * context)
guint value, va_chroma_format, attrib_index;
/* Reset profile and entrypoint */
- if (!cip->profile || !cip->entrypoint)
+ if (cip->profile == GST_VAAPI_PROFILE_UNKNOWN
+ || cip->entrypoint == GST_VAAPI_ENTRYPOINT_INVALID)
goto cleanup;
context->va_profile = gst_vaapi_profile_get_va_profile (cip->profile);
context->va_entrypoint =
@@ -409,10 +410,12 @@ gst_vaapi_context_new (GstVaapiDisplay * display,
{
GstVaapiContext *context;
- g_return_val_if_fail (cip->profile, NULL);
- g_return_val_if_fail (cip->entrypoint, NULL);
g_return_val_if_fail (display, NULL);
+ if (cip->profile == GST_VAAPI_PROFILE_UNKNOWN
+ || cip->entrypoint == GST_VAAPI_ENTRYPOINT_INVALID)
+ return NULL;
+
context = g_slice_new (GstVaapiContext);
if (!context)
return NULL;
@@ -470,6 +473,10 @@ gst_vaapi_context_reset (GstVaapiContext * context,
gboolean grow_surfaces = FALSE;
GstVaapiChromaType chroma_type;
+ if (new_cip->profile == GST_VAAPI_PROFILE_UNKNOWN
+ || new_cip->entrypoint == GST_VAAPI_ENTRYPOINT_INVALID)
+ return FALSE;
+
chroma_type = new_cip->chroma_type ? new_cip->chroma_type :
DEFAULT_CHROMA_TYPE;
if (cip->chroma_type != chroma_type) {
diff --git a/gst-libs/gst/vaapi/gstvaapiprofile.h b/gst-libs/gst/vaapi/gstvaapiprofile.h
index 8f0039c5..72ffd55c 100644
--- a/gst-libs/gst/vaapi/gstvaapiprofile.h
+++ b/gst-libs/gst/vaapi/gstvaapiprofile.h
@@ -188,6 +188,7 @@ typedef enum {
/**
* GstVaapiEntrypoint:
+ * @GST_VAAPI_ENTRYPOINT_INVALID: Invalid entrypoint
* @GST_VAAPI_ENTRYPOINT_VLD: Variable Length Decoding
* @GST_VAAPI_ENTRYPOINT_IDCT: Inverse Decrete Cosine Transform
* @GST_VAAPI_ENTRYPOINT_MOCO: Motion Compensation
@@ -200,7 +201,8 @@ typedef enum {
* The set of all entrypoints for #GstVaapiEntrypoint
*/
typedef enum {
- GST_VAAPI_ENTRYPOINT_VLD = 1,
+ GST_VAAPI_ENTRYPOINT_INVALID,
+ GST_VAAPI_ENTRYPOINT_VLD,
GST_VAAPI_ENTRYPOINT_IDCT,
GST_VAAPI_ENTRYPOINT_MOCO,
GST_VAAPI_ENTRYPOINT_SLICE_ENCODE,