omx: guard some omx enums with IL version
authorGurkirpal Singh <gurkirpal204@gmail.com>
Fri, 28 Apr 2017 21:23:26 +0000 (02:53 +0530)
committerNicolas Dufresne <nicolas.dufresne@collabora.com>
Wed, 5 Jul 2017 21:27:27 +0000 (17:27 -0400)
Some enums that existed in 1.1.2 just do not exit in 1.2.0
See https://www.khronos.org/registry/OpenMAX-IL/specs/OpenMAX_IL_1_2_0_Specification_redline.pdf

https://bugzilla.gnome.org/show_bug.cgi?id=782800

omx/gstomx.c
omx/gstomx.h

index 90bc059..2fef361 100644 (file)
@@ -1872,7 +1872,11 @@ gst_omx_port_set_enabled_unlocked (GstOMXPort * port, gboolean enabled)
   if (port->enabled_pending || port->disabled_pending) {
     GST_ERROR_OBJECT (comp->parent, "%s port %d enabled/disabled pending "
         "already", comp->name, port->index);
+#if OMX_VERSION_MINOR == 2
+    err = OMX_ErrorBadParameter;
+#else
     err = OMX_ErrorInvalidState;
+#endif
     goto done;
   }
 
@@ -2322,8 +2326,6 @@ gst_omx_error_to_string (OMX_ERRORTYPE err)
       return "Invalid component name";
     case OMX_ErrorComponentNotFound:
       return "Component not found";
-    case OMX_ErrorInvalidComponent:
-      return "Invalid component";
     case OMX_ErrorBadParameter:
       return "Bad parameter";
     case OMX_ErrorNotImplemented:
@@ -2334,8 +2336,6 @@ gst_omx_error_to_string (OMX_ERRORTYPE err)
       return "Overflow";
     case OMX_ErrorHardware:
       return "Hardware";
-    case OMX_ErrorInvalidState:
-      return "Invalid state";
     case OMX_ErrorStreamCorrupt:
       return "Stream corrupt";
     case OMX_ErrorPortsNotCompatible:
@@ -2354,12 +2354,6 @@ gst_omx_error_to_string (OMX_ERRORTYPE err)
       return "Same state";
     case OMX_ErrorResourcesPreempted:
       return "Resources preempted";
-    case OMX_ErrorPortUnresponsiveDuringAllocation:
-      return "Port unresponsive during allocation";
-    case OMX_ErrorPortUnresponsiveDuringDeallocation:
-      return "Port unresponsive during deallocation";
-    case OMX_ErrorPortUnresponsiveDuringStop:
-      return "Port unresponsive during stop";
     case OMX_ErrorIncorrectStateTransition:
       return "Incorrect state transition";
     case OMX_ErrorIncorrectStateOperation:
@@ -2380,14 +2374,26 @@ gst_omx_error_to_string (OMX_ERRORTYPE err)
       return "Macroblock errors in frame";
     case OMX_ErrorFormatNotDetected:
       return "Format not detected";
-    case OMX_ErrorContentPipeOpenFailed:
-      return "Content pipe open failed";
-    case OMX_ErrorContentPipeCreationFailed:
-      return "Content pipe creation failed";
     case OMX_ErrorSeperateTablesUsed:
       return "Separate tables used";
     case OMX_ErrorTunnelingUnsupported:
       return "Tunneling unsupported";
+#if OMX_VERSION_MINOR == 1
+    case OMX_ErrorInvalidComponent:
+      return "Invalid component";
+    case OMX_ErrorInvalidState:
+      return "Invalid state";
+    case OMX_ErrorPortUnresponsiveDuringAllocation:
+      return "Port unresponsive during allocation";
+    case OMX_ErrorPortUnresponsiveDuringDeallocation:
+      return "Port unresponsive during deallocation";
+    case OMX_ErrorPortUnresponsiveDuringStop:
+      return "Port unresponsive during stop";
+    case OMX_ErrorContentPipeOpenFailed:
+      return "Content pipe open failed";
+    case OMX_ErrorContentPipeCreationFailed:
+      return "Content pipe creation failed";
+#endif
     default:
       if (err_u >= (guint) OMX_ErrorKhronosExtensions
           && err_u < (guint) OMX_ErrorVendorStartUnused) {
index cafed89..74357f8 100644 (file)
@@ -89,6 +89,17 @@ G_BEGIN_DECLS
 } G_STMT_END
 #endif
 
+/* OMX_StateInvalid does not exist in 1.2.0 spec. The initial state is now
+ * StateLoaded. Problem is that gst-omx still needs an initial state different
+ * than StateLoaded. Otherwise gst_omx_component_set_state(StateLoaded) will
+ * early return because it will think it is already in StateLoaded. Also note
+ * that there is no call to gst_omx_component_set_state(StateInvalid) so this
+ * also shows that StateInvalid is used as a helper in gst-omx.
+ */
+#if OMX_VERSION_MINOR == 2
+#define OMX_StateInvalid OMX_StateReserved_0x00000000
+#endif
+
 /* Different hacks that are required to work around
  * bugs in different OpenMAX implementations
  */