Merge tizen patch based on 1.12.2
[platform/upstream/gstreamer.git] / omx / gstomx.h
old mode 100644 (file)
new mode 100755 (executable)
index 6e8398f..97141bc
 # endif
 #endif
 
+/* If the component may signal EOS before it has finished pushing
+ * out all of its buffers. Happens with egl_render on the rpi.
+ */
+#define GST_OMX_HACK_SIGNALS_PREMATURE_EOS                            G_GUINT64_CONSTANT (0x0000000000000400)
+
 #include <OMX_Core.h>
 #include <OMX_Component.h>
 
-#ifdef USE_OMX_TARGET_EXYNOS
+#ifdef TIZEN_FEATURE_OMX
 #include <tbm_type.h>
 #include <tbm_surface.h>
 #include <tbm_bufmgr.h>
+#include <unistd.h>
 #endif
 
 #ifdef USE_OMX_TARGET_RPI
@@ -78,6 +84,15 @@ G_BEGIN_DECLS
   (st)->nVersion.s.nStep = OMX_VERSION_STEP; \
 } G_STMT_END
 
+#if defined(USE_OMX_TARGET_EXYNOS) || defined(USE_OMX_TARGET_EXYNOS64)
+#define OMX_INIT_PARAM(param) G_STMT_START { \
+  memset (&(param), 0, sizeof ((param))); \
+  (param).nSize = sizeof (param); \
+  (param).nVersion.s.nVersionMajor = 1; \
+  (param).nVersion.s.nVersionMinor = 1; \
+} G_STMT_END
+#endif
+
 /* Different hacks that are required to work around
  * bugs in different OpenMAX implementations
  */
@@ -123,6 +138,18 @@ G_BEGIN_DECLS
  */
 #define GST_OMX_HACK_NO_DISABLE_OUTPORT                               G_GUINT64_CONSTANT (0x0000000000000100)
 
+/* If the encoder requires input buffers that have a height
+ * which is a multiple of 16 pixels
+ */
+#define GST_OMX_HACK_HEIGHT_MULTIPLE_16             G_GUINT64_CONSTANT (0x0000000000000200)
+
+/* If we should pass the profile/level information from upstream to the
+ * OMX decoder. This is a violation of the OMX spec as
+ * OMX_IndexParamVideoProfileLevelCurrent is supposed to be r-o so
+ * do it as a platform specific hack.
+ */
+#define GST_OMX_HACK_PASS_PROFILE_TO_DECODER        G_GUINT64_CONSTANT (0x0000000000000800)
+
 typedef struct _GstOMXCore GstOMXCore;
 typedef struct _GstOMXPort GstOMXPort;
 typedef enum _GstOMXPortDirection GstOMXPortDirection;
@@ -134,17 +161,21 @@ typedef struct _GstOMXMessage GstOMXMessage;
 /* MODIFICATION */
 typedef enum GOmxVendor GOmxVendor; /* check omx vender */
 
-#ifdef GST_TIZEN_MODIFICATION
+#ifdef TIZEN_FEATURE_OMX
 
 #define MFC_INPUT_BUFFER_PLANE      1
 #define MFC_OUTPUT_BUFFER_PLANE     2
+#define MAX_BUFFER_PLANE            3
 
 #define MAX_INPUT_BUFFER            16
 #define MAX_OUTPUT_BUFFER           16
 
+#define ALIGN(x, a)       (((x) + (a) - 1) & ~((a) - 1))
+
 typedef struct _TBMBuffer TBMBuffer;
 typedef struct _TBMInputBuffer TBMInputBuffer;
 typedef struct _TBMOutputBuffer TBMOutputBuffer;
+typedef struct _EnableGemBuffersParams EnableGemBuffersParams;
 
 struct _TBMBuffer
 {
@@ -168,8 +199,6 @@ struct _TBMOutputBuffer
     GList *buffers;
 };
 
-typedef struct _EnableGemBuffersParams EnableGemBuffersParams;
-
 struct _EnableGemBuffersParams
 {
   OMX_U32 nSize;
@@ -179,40 +208,6 @@ struct _EnableGemBuffersParams
 };
 #endif
 
-enum
-{
-    BUF_SHARE_METHOD_PADDR = 0,
-    BUF_SHARE_METHOD_FD = 1,
-    BUF_SHARE_METHOD_TIZEN_BUFFER = 2,
-    BUF_SHARE_METHOD_FLUSH_BUFFER = 3,
-}; /* buf_share_method */
-
-/* Extended color formats */
-enum {
-    OMX_EXT_COLOR_FormatNV12TPhysicalAddress = 0x7F000001, /**< Reserved region for introducing Vendor Extensions */
-    OMX_EXT_COLOR_FormatNV12LPhysicalAddress = 0x7F000002,
-    OMX_EXT_COLOR_FormatNV12Tiled = 0x7FC00002,
-    OMX_EXT_COLOR_FormatNV12TFdValue = 0x7F000012,
-    OMX_EXT_COLOR_FormatNV12LFdValue = 0x7F000013
-};
-
-#ifdef GST_TIZEN_MODIFICATION
-/* Extended port settings. */
-enum {
-    OMX_IndexParamEnablePlatformSpecificBuffers = 0x7F000011
-};
-#endif
-
-/* modification: Add_component_vendor */
-enum GOmxVendor
-{
-    GOMX_VENDOR_DEFAULT,
-    GOMX_VENDOR_SLSI_SEC,
-    GOMX_VENDOR_SLSI_EXYNOS,
-    GOMX_VENDOR_QCT,
-    GOMX_VENDOR_SPRD
-};
-
 typedef enum {
   /* Everything good and the buffer is valid */
   GST_OMX_ACQUIRE_BUFFER_OK = 0,
@@ -236,7 +231,6 @@ struct _GstOMXCore {
   gint user_count; /* LOCK */
 
   /* MODIFICATION */
-  GOmxVendor component_vendor; /* to check omx vender */
   gboolean secure; /* trust zone */
 
   /* OpenMAX core library functions, protected with LOCK */
@@ -311,6 +305,10 @@ struct _GstOMXPort {
   gboolean enabled_pending;  /* TRUE after OMX_Command{En,Dis}able */
   gboolean disabled_pending; /* was done until it took effect */
   gboolean eos; /* TRUE after a buffer with EOS flag was received */
+#ifdef TIZEN_FEATURE_OMX
+  gboolean use_buffer;
+  gboolean flush_start;
+#endif
 
   /* Increased whenever the settings of these port change.
    * If settings_cookie != configured_settings_cookie
@@ -368,7 +366,7 @@ struct _GstOMXBuffer {
   /* TRUE if this is an EGLImage */
   gboolean eglimage;
 
-#ifdef GST_TIZEN_MODIFICATION
+#ifdef TIZEN_FEATURE_OMX
   /* MMVideoBuffer array to use TBM buffers */
    MMVideoBuffer *mm_vbuffer;
 #endif
@@ -383,6 +381,9 @@ struct _GstOMXClassData {
   const gchar *default_sink_template_caps;
 
   guint32 in_port_index, out_port_index;
+#ifdef TIZEN_FEATURE_OMX
+  guint32 in_port_usebuffer, out_port_usebuffer;
+#endif
 
   guint64 hacks;
 
@@ -433,9 +434,11 @@ OMX_ERRORTYPE     gst_omx_port_set_flushing (GstOMXPort *port, GstClockTime time
 gboolean          gst_omx_port_is_flushing (GstOMXPort *port);
 
 OMX_ERRORTYPE     gst_omx_port_allocate_buffers (GstOMXPort *port);
-#ifdef GST_TIZEN_MODIFICATION
-OMX_ERRORTYPE     gst_omx_port_tbm_allocate_dec_buffers (GstOMXPort * port, tbm_bufmgr  bufMgr, int eCompressionFormat);
-OMX_ERRORTYPE     gst_omx_port_tbm_allocate_enc_buffers (GstOMXPort * port, tbm_bufmgr  bufMgr, int eCompressionFormat);
+#ifdef TIZEN_FEATURE_OMX
+OMX_ERRORTYPE     gst_omx_port_tbm_allocate_dec_buffers (GstOMXPort * port, tbm_bufmgr  bufmgr, gboolean use_buffer);
+OMX_ERRORTYPE     gst_omx_port_tbm_allocate_enc_buffers (GstOMXPort * port, tbm_bufmgr  bufmgr, gboolean use_buffer);
+OMX_ERRORTYPE     gst_omx_component_get_extension_index (GstOMXComponent * comp, OMX_STRING name, gpointer index);
+void              gst_omx_port_flush_start (GstOMXPort * port, gboolean flush);
 #endif
 OMX_ERRORTYPE     gst_omx_port_use_buffers (GstOMXPort *port, const GList *buffers);
 OMX_ERRORTYPE     gst_omx_port_use_eglimages (GstOMXPort *port, const GList *images);
@@ -452,50 +455,6 @@ gboolean          gst_omx_port_is_enabled (GstOMXPort * port);
 
 void              gst_omx_set_default_role (GstOMXClassData *class_data, const gchar *default_role);
 
-#ifdef GST_TIZEN_MODIFICATION
-
-/*MFC Buffer alignment macros*/
-#define S5P_FIMV_DEC_BUF_ALIGN                  (8 * 1024)
-#define S5P_FIMV_ENC_BUF_ALIGN                  (8 * 1024)
-#define S5P_FIMV_NV12M_HALIGN                   16
-#define S5P_FIMV_NV12M_LVALIGN                  16
-#define S5P_FIMV_NV12M_CVALIGN                  8
-#define S5P_FIMV_NV12MT_HALIGN                  128
-#define S5P_FIMV_NV12MT_VALIGN                  64
-#define S5P_FIMV_NV12M_SALIGN                   2048
-#define S5P_FIMV_NV12MT_SALIGN                  8192
-
-#define ALIGN(x, a)       (((x) + (a) - 1) & ~((a) - 1))
-
-/* Buffer alignment defines */
-#define SZ_1M                                   0x00100000
-#define S5P_FIMV_D_ALIGN_PLANE_SIZE             64
-
-#define S5P_FIMV_MAX_FRAME_SIZE                 (2 * SZ_1M)
-#define S5P_FIMV_NUM_PIXELS_IN_MB_ROW           16
-#define S5P_FIMV_NUM_PIXELS_IN_MB_COL           16
-
-/* Macro */
-#define ALIGN_TO_4KB(x)   ((((x) + (1 << 12) - 1) >> 12) << 12)
-#define DIV_ROUND_UP(n,d) (((n) + (d) - 1) / (d))
-#define CHOOSE_MAX_SIZE(a,b) ((a) > (b) ? (a) : (b))
-
-int new_calc_plane(int width, int height);
-int new_calc_yplane(int width, int height);
-int new_calc_uvplane(int width, int height);
-
-int calc_plane(int width, int height);
-int calc_yplane(int width, int height);
-int calc_uvplane(int width, int height);
-int gst_omx_calculate_y_size(int compressionFormat, int width, int height);
-int gst_omx_calculate_uv_size(int compressionFormat, int width, int height);
-
-tbm_bo            gst_omx_tbm_allocate_bo(tbm_bufmgr hBufmgr, int size);
-void              gst_omx_tbm_deallocate_bo(tbm_bo bo);
-OMX_U32           gst_omx_tbm_get_bo_fd(tbm_bo bo);
-OMX_PTR           gst_omx_tbm_get_bo_ptr(tbm_bo bo);
-
-#endif
 /* refered by plugin_init */
 GST_DEBUG_CATEGORY_EXTERN (gst_omx_video_debug_category);