summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorChong Zhang <chz@google.com>2015-04-30 18:15:52 -0700
committerChong Zhang <chz@google.com>2015-05-01 19:06:38 -0700
commitd291c222357303b9611cab89d0c3b047584ef377 (patch)
tree953551d93d5a215cefb14470387ff7494c9b60e5 /include
parent64da6f045b1a1d1b8f01391b6e37287f77f85d1e (diff)
downloadframeworks_av-d291c222357303b9611cab89d0c3b047584ef377.zip
frameworks_av-d291c222357303b9611cab89d0c3b047584ef377.tar.gz
frameworks_av-d291c222357303b9611cab89d0c3b047584ef377.tar.bz2
MediaCodec: implement persistent input surface APIs
Bug: 19127604 Bug: 19489395 Change-Id: Idaf1cc9008016f66903e93907a676f54e342e1a3
Diffstat (limited to 'include')
-rw-r--r--include/media/IOMX.h9
-rw-r--r--include/media/stagefright/ACodec.h3
-rw-r--r--include/media/stagefright/CodecBase.h4
-rw-r--r--include/media/stagefright/MediaCodec.h6
-rw-r--r--include/media/stagefright/MediaFilter.h3
-rw-r--r--include/media/stagefright/PersistentSurface.h51
6 files changed, 76 insertions, 0 deletions
diff --git a/include/media/IOMX.h b/include/media/IOMX.h
index 6def65b..df3aeca 100644
--- a/include/media/IOMX.h
+++ b/include/media/IOMX.h
@@ -20,6 +20,7 @@
#include <binder/IInterface.h>
#include <gui/IGraphicBufferProducer.h>
+#include <gui/IGraphicBufferConsumer.h>
#include <ui/GraphicBuffer.h>
#include <utils/List.h>
#include <utils/String8.h>
@@ -113,6 +114,14 @@ public:
node_id node, OMX_U32 port_index,
sp<IGraphicBufferProducer> *bufferProducer) = 0;
+ virtual status_t createPersistentInputSurface(
+ sp<IGraphicBufferProducer> *bufferProducer,
+ sp<IGraphicBufferConsumer> *bufferConsumer) = 0;
+
+ virtual status_t usePersistentInputSurface(
+ node_id node, OMX_U32 port_index,
+ const sp<IGraphicBufferConsumer> &bufferConsumer) = 0;
+
virtual status_t signalEndOfInputStream(node_id node) = 0;
// This API clearly only makes sense if the caller lives in the
diff --git a/include/media/stagefright/ACodec.h b/include/media/stagefright/ACodec.h
index c14e6c0..f941512 100644
--- a/include/media/stagefright/ACodec.h
+++ b/include/media/stagefright/ACodec.h
@@ -44,6 +44,8 @@ struct ACodec : public AHierarchicalStateMachine, public CodecBase {
virtual void initiateAllocateComponent(const sp<AMessage> &msg);
virtual void initiateConfigureComponent(const sp<AMessage> &msg);
virtual void initiateCreateInputSurface();
+ virtual void initiateUsePersistentInputSurface(
+ const sp<PersistentSurface> &surface);
virtual void initiateStart();
virtual void initiateShutdown(bool keepComponentAllocated = false);
@@ -114,6 +116,7 @@ private:
kWhatAllocateComponent = 'allo',
kWhatConfigureComponent = 'conf',
kWhatCreateInputSurface = 'cisf',
+ kWhatUsePersistentInputSurface = 'pisf',
kWhatSignalEndOfInputStream = 'eois',
kWhatStart = 'star',
kWhatRequestIDRFrame = 'ridr',
diff --git a/include/media/stagefright/CodecBase.h b/include/media/stagefright/CodecBase.h
index 1bf27a6..ce53eda 100644
--- a/include/media/stagefright/CodecBase.h
+++ b/include/media/stagefright/CodecBase.h
@@ -26,6 +26,7 @@
namespace android {
struct ABuffer;
+struct PersistentSurface;
struct CodecBase : public AHandler {
enum {
@@ -39,6 +40,7 @@ struct CodecBase : public AHandler {
kWhatComponentAllocated = 'cAll',
kWhatComponentConfigured = 'cCon',
kWhatInputSurfaceCreated = 'isfc',
+ kWhatInputSurfaceAccepted = 'isfa',
kWhatSignaledInputEOS = 'seos',
kWhatBuffersAllocated = 'allc',
};
@@ -48,6 +50,8 @@ struct CodecBase : public AHandler {
virtual void initiateAllocateComponent(const sp<AMessage> &msg) = 0;
virtual void initiateConfigureComponent(const sp<AMessage> &msg) = 0;
virtual void initiateCreateInputSurface() = 0;
+ virtual void initiateUsePersistentInputSurface(
+ const sp<PersistentSurface> &surface) = 0;
virtual void initiateStart() = 0;
virtual void initiateShutdown(bool keepComponentAllocated = false) = 0;
diff --git a/include/media/stagefright/MediaCodec.h b/include/media/stagefright/MediaCodec.h
index e232ce6..bab1426 100644
--- a/include/media/stagefright/MediaCodec.h
+++ b/include/media/stagefright/MediaCodec.h
@@ -37,6 +37,7 @@ class IMemory;
struct MemoryDealer;
class IResourceManagerClient;
class IResourceManagerService;
+struct PersistentSurface;
struct SoftwareRenderer;
struct Surface;
@@ -67,6 +68,8 @@ struct MediaCodec : public AHandler {
static sp<MediaCodec> CreateByComponentName(
const sp<ALooper> &looper, const char *name, status_t *err = NULL);
+ static sp<PersistentSurface> CreatePersistentInputSurface();
+
status_t configure(
const sp<AMessage> &format,
const sp<Surface> &nativeWindow,
@@ -77,6 +80,8 @@ struct MediaCodec : public AHandler {
status_t createInputSurface(sp<IGraphicBufferProducer>* bufferProducer);
+ status_t usePersistentInputSurface(const sp<PersistentSurface> &surface);
+
status_t start();
// Returns to a state in which the component remains allocated but
@@ -180,6 +185,7 @@ private:
kWhatInit = 'init',
kWhatConfigure = 'conf',
kWhatCreateInputSurface = 'cisf',
+ kWhatUsePersistentInputSurface = 'pisf',
kWhatStart = 'strt',
kWhatStop = 'stop',
kWhatRelease = 'rele',
diff --git a/include/media/stagefright/MediaFilter.h b/include/media/stagefright/MediaFilter.h
index 7b3f700..fdd2a34 100644
--- a/include/media/stagefright/MediaFilter.h
+++ b/include/media/stagefright/MediaFilter.h
@@ -34,6 +34,9 @@ struct MediaFilter : public CodecBase {
virtual void initiateAllocateComponent(const sp<AMessage> &msg);
virtual void initiateConfigureComponent(const sp<AMessage> &msg);
virtual void initiateCreateInputSurface();
+ virtual void initiateUsePersistentInputSurface(
+ const sp<PersistentSurface> &surface);
+
virtual void initiateStart();
virtual void initiateShutdown(bool keepComponentAllocated = false);
diff --git a/include/media/stagefright/PersistentSurface.h b/include/media/stagefright/PersistentSurface.h
new file mode 100644
index 0000000..a35b9f1
--- /dev/null
+++ b/include/media/stagefright/PersistentSurface.h
@@ -0,0 +1,51 @@
+/*
+ * Copyright 2015 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef PERSISTENT_SURFACE_H_
+
+#define PERSISTENT_SURFACE_H_
+
+#include <gui/IGraphicBufferProducer.h>
+#include <gui/IGraphicBufferConsumer.h>
+#include <media/stagefright/foundation/ABase.h>
+
+namespace android {
+
+struct PersistentSurface : public RefBase {
+ PersistentSurface(
+ const sp<IGraphicBufferProducer>& bufferProducer,
+ const sp<IGraphicBufferConsumer>& bufferConsumer) :
+ mBufferProducer(bufferProducer),
+ mBufferConsumer(bufferConsumer) { }
+
+ sp<IGraphicBufferProducer> getBufferProducer() const {
+ return mBufferProducer;
+ }
+
+ sp<IGraphicBufferConsumer> getBufferConsumer() const {
+ return mBufferConsumer;
+ }
+
+private:
+ const sp<IGraphicBufferProducer> mBufferProducer;
+ const sp<IGraphicBufferConsumer> mBufferConsumer;
+
+ DISALLOW_EVIL_CONSTRUCTORS(PersistentSurface);
+};
+
+} // namespace android
+
+#endif // PERSISTENT_SURFACE_H_