stagefright: remove OMXNodeInstance usage from GraphicBufferSource

This is a preliminary to separate GraphicBufferSource from IOMX.

- Use IOMX instead of internal OMXNodeInstance.

- Keep track of codec buffers by buffer_id, do not write to the
  OMX buffer headers directly

- Upon data space change, notify IOMX to handle it

bug: 31399200

Change-Id: I86534d7602294f70da582457b5af2eb9b6a58eda
diff --git a/include/media/IOMX.h b/include/media/IOMX.h
index 15d691f..88371ed 100644
--- a/include/media/IOMX.h
+++ b/include/media/IOMX.h
@@ -39,6 +39,7 @@
 class IOMXRenderer;
 class NativeHandle;
 class Surface;
+struct omx_message;
 
 class IOMX : public IInterface {
 public:
@@ -179,6 +180,12 @@
             OMX_U32 range_offset, OMX_U32 range_length,
             OMX_U32 flags, OMX_TICKS timestamp, int fenceFd = -1) = 0;
 
+    virtual status_t emptyGraphicBuffer(
+            node_id node,
+            buffer_id buffer,
+            const sp<GraphicBuffer> &graphicBuffer,
+            OMX_U32 flags, OMX_TICKS timestamp, int fenceFd) = 0;
+
     virtual status_t getExtensionIndex(
             node_id node,
             const char *parameter_name,
@@ -199,6 +206,8 @@
             InternalOptionType type,
             const void *data,
             size_t size) = 0;
+
+    virtual status_t dispatchMessage(const omx_message &msg) = 0;
 };
 
 struct omx_message {
@@ -218,6 +227,8 @@
             OMX_EVENTTYPE event;
             OMX_U32 data1;
             OMX_U32 data2;
+            OMX_U32 data3;
+            OMX_U32 data4;
         } event_data;
 
         // if type == EMPTY_BUFFER_DONE