summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/media/stagefright/MetaData.h4
-rw-r--r--include/media/stagefright/OMXCodec.h3
-rw-r--r--include/media/stagefright/SkipCutBuffer.h58
3 files changed, 65 insertions, 0 deletions
diff --git a/include/media/stagefright/MetaData.h b/include/media/stagefright/MetaData.h
index 00b8679..c3ccb56 100644
--- a/include/media/stagefright/MetaData.h
+++ b/include/media/stagefright/MetaData.h
@@ -24,6 +24,7 @@
#include <utils/RefBase.h>
#include <utils/KeyedVector.h>
+#include <utils/String8.h>
namespace android {
@@ -180,6 +181,8 @@ public:
bool findData(uint32_t key, uint32_t *type,
const void **data, size_t *size) const;
+ void dumpToLog() const;
+
protected:
virtual ~MetaData();
@@ -194,6 +197,7 @@ private:
void clear();
void setData(uint32_t type, const void *data, size_t size);
void getData(uint32_t *type, const void **data, size_t *size) const;
+ String8 asString() const;
private:
uint32_t mType;
diff --git a/include/media/stagefright/OMXCodec.h b/include/media/stagefright/OMXCodec.h
index 392ea87..7c612ba 100644
--- a/include/media/stagefright/OMXCodec.h
+++ b/include/media/stagefright/OMXCodec.h
@@ -30,6 +30,7 @@ struct MediaCodecList;
class MemoryDealer;
struct OMXCodecObserver;
struct CodecProfileLevel;
+class SkipCutBuffer;
struct OMXCodec : public MediaSource,
public MediaBufferObserver {
@@ -201,6 +202,7 @@ private:
ReadOptions::SeekMode mSeekMode;
int64_t mTargetTimeUs;
bool mOutputPortSettingsChangedPending;
+ SkipCutBuffer *mSkipCutBuffer;
MediaBuffer *mLeftOverBuffer;
@@ -378,6 +380,7 @@ status_t QueryCodecs(
const char *mimeType, bool queryDecoders,
Vector<CodecCapabilities> *results);
+
} // namespace android
#endif // OMX_CODEC_H_
diff --git a/include/media/stagefright/SkipCutBuffer.h b/include/media/stagefright/SkipCutBuffer.h
new file mode 100644
index 0000000..5c7cd47
--- /dev/null
+++ b/include/media/stagefright/SkipCutBuffer.h
@@ -0,0 +1,58 @@
+/*
+ * Copyright (C) 2012 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 SKIP_CUT_BUFFER_H_
+
+#define SKIP_CUT_BUFFER_H_
+
+#include <media/stagefright/MediaBuffer.h>
+
+namespace android {
+
+/**
+ * utility class to cut the start and end off a stream of data in MediaBuffers
+ *
+ */
+class SkipCutBuffer {
+ public:
+ // 'skip' is the number of bytes to skip from the beginning
+ // 'cut' is the number of bytes to cut from the end
+ // 'output_size' is the size in bytes of the MediaBuffers that will be used
+ SkipCutBuffer(int32_t skip, int32_t cut, int32_t output_size);
+ virtual ~SkipCutBuffer();
+
+ // Submit one MediaBuffer for skipping and cutting. This may consume all or
+ // some of the data in the buffer, or it may add data to it.
+ // After this, the caller should continue processing the buffer as usual.
+ void submit(MediaBuffer *buffer);
+ void clear();
+ size_t size(); // how many bytes are currently stored in the buffer
+
+ private:
+ void write(const char *src, size_t num);
+ size_t read(char *dst, size_t num);
+ int32_t mFrontPadding;
+ int32_t mBackPadding;
+ int32_t mWriteHead;
+ int32_t mReadHead;
+ int32_t mCapacity;
+ char* mCutBuffer;
+ DISALLOW_EVIL_CONSTRUCTORS(SkipCutBuffer);
+};
+
+} // namespace android
+
+#endif // OMX_CODEC_H_