summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/media/stagefright/AMRExtractor.h54
-rw-r--r--include/media/stagefright/CachingDataSource.h4
-rw-r--r--include/media/stagefright/CameraSource.h26
-rw-r--r--include/media/stagefright/ColorConverter.h67
-rw-r--r--include/media/stagefright/DataSource.h4
-rw-r--r--include/media/stagefright/ESDS.h64
-rw-r--r--include/media/stagefright/FileSource.h8
-rw-r--r--include/media/stagefright/HTTPDataSource.h15
-rw-r--r--include/media/stagefright/HTTPStream.h74
-rw-r--r--include/media/stagefright/MP3Extractor.h55
-rw-r--r--include/media/stagefright/MPEG4Extractor.h68
-rw-r--r--include/media/stagefright/MediaDefs.h1
-rw-r--r--include/media/stagefright/MediaErrors.h3
-rw-r--r--include/media/stagefright/MediaExtractor.h10
-rw-r--r--include/media/stagefright/MediaSource.h3
-rw-r--r--include/media/stagefright/MetaData.h20
-rw-r--r--include/media/stagefright/MmapSource.h9
-rw-r--r--include/media/stagefright/OMXCodec.h19
-rw-r--r--include/media/stagefright/SampleTable.h109
-rw-r--r--include/media/stagefright/ShoutcastSource.h4
-rw-r--r--include/media/stagefright/SoftwareRenderer.h66
-rw-r--r--include/media/stagefright/TimedEventQueue.h106
-rw-r--r--include/media/stagefright/stagefright_string.h54
23 files changed, 151 insertions, 692 deletions
diff --git a/include/media/stagefright/AMRExtractor.h b/include/media/stagefright/AMRExtractor.h
deleted file mode 100644
index c8710d3..0000000
--- a/include/media/stagefright/AMRExtractor.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Copyright (C) 2009 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 AMR_EXTRACTOR_H_
-
-#define AMR_EXTRACTOR_H_
-
-#include <media/stagefright/MediaExtractor.h>
-
-namespace android {
-
-class String8;
-
-class AMRExtractor : public MediaExtractor {
-public:
- AMRExtractor(const sp<DataSource> &source);
-
- virtual size_t countTracks();
- virtual sp<MediaSource> getTrack(size_t index);
- virtual sp<MetaData> getTrackMetaData(size_t index);
-
- static sp<MetaData> makeAMRFormat(bool isWide);
-
-protected:
- virtual ~AMRExtractor();
-
-private:
- sp<DataSource> mDataSource;
- status_t mInitCheck;
- bool mIsWide;
-
- AMRExtractor(const AMRExtractor &);
- AMRExtractor &operator=(const AMRExtractor &);
-};
-
-bool SniffAMR(
- const sp<DataSource> &source, String8 *mimeType, float *confidence);
-
-} // namespace android
-
-#endif // AMR_EXTRACTOR_H_
diff --git a/include/media/stagefright/CachingDataSource.h b/include/media/stagefright/CachingDataSource.h
index e35e19e..b0fc4b2 100644
--- a/include/media/stagefright/CachingDataSource.h
+++ b/include/media/stagefright/CachingDataSource.h
@@ -29,9 +29,9 @@ public:
CachingDataSource(
const sp<DataSource> &source, size_t pageSize, int numPages);
- status_t InitCheck() const;
+ virtual status_t initCheck() const;
- virtual ssize_t read_at(off_t offset, void *data, size_t size);
+ virtual ssize_t readAt(off_t offset, void *data, size_t size);
protected:
virtual ~CachingDataSource();
diff --git a/include/media/stagefright/CameraSource.h b/include/media/stagefright/CameraSource.h
index 7042e1a..ff3ea05 100644
--- a/include/media/stagefright/CameraSource.h
+++ b/include/media/stagefright/CameraSource.h
@@ -26,12 +26,11 @@
namespace android {
-class ICamera;
-class ICameraClient;
class IMemory;
+class ISurface;
+class Camera;
-class CameraSource : public MediaSource,
- public MediaBufferObserver {
+class CameraSource : public MediaSource {
public:
static CameraSource *Create();
@@ -45,24 +44,25 @@ public:
virtual status_t read(
MediaBuffer **buffer, const ReadOptions *options = NULL);
- virtual void notifyCallback(int32_t msgType, int32_t ext1, int32_t ext2);
- virtual void dataCallback(int32_t msgType, const sp<IMemory>& data);
-
- virtual void signalBufferReturned(MediaBuffer *buffer);
-
private:
- CameraSource(const sp<ICamera> &camera, const sp<ICameraClient> &client);
+ friend class CameraSourceListener;
- sp<ICamera> mCamera;
- sp<ICameraClient> mCameraClient;
+ sp<Camera> mCamera;
Mutex mLock;
Condition mFrameAvailableCondition;
List<sp<IMemory> > mFrames;
+ List<int64_t> mFrameTimes;
- int mNumFrames;
+ int mWidth, mHeight;
+ int64_t mFirstFrameTimeUs;
+ int32_t mNumFrames;
bool mStarted;
+ CameraSource(const sp<Camera> &camera);
+
+ void dataCallback(int32_t msgType, const sp<IMemory> &data);
+
CameraSource(const CameraSource &);
CameraSource &operator=(const CameraSource &);
};
diff --git a/include/media/stagefright/ColorConverter.h b/include/media/stagefright/ColorConverter.h
new file mode 100644
index 0000000..1e341b9
--- /dev/null
+++ b/include/media/stagefright/ColorConverter.h
@@ -0,0 +1,67 @@
+/*
+ * Copyright (C) 2009 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 COLOR_CONVERTER_H_
+
+#define COLOR_CONVERTER_H_
+
+#include <sys/types.h>
+
+#include <stdint.h>
+
+#include <OMX_Video.h>
+
+namespace android {
+
+struct ColorConverter {
+ ColorConverter(OMX_COLOR_FORMATTYPE from, OMX_COLOR_FORMATTYPE to);
+ ~ColorConverter();
+
+ bool isValid() const;
+
+ void convert(
+ size_t width, size_t height,
+ const void *srcBits, size_t srcSkip,
+ void *dstBits, size_t dstSkip);
+
+private:
+ OMX_COLOR_FORMATTYPE mSrcFormat, mDstFormat;
+ uint8_t *mClip;
+
+ uint8_t *initClip();
+
+ void convertCbYCrY(
+ size_t width, size_t height,
+ const void *srcBits, size_t srcSkip,
+ void *dstBits, size_t dstSkip);
+
+ void convertYUV420Planar(
+ size_t width, size_t height,
+ const void *srcBits, size_t srcSkip,
+ void *dstBits, size_t dstSkip);
+
+ void convertQCOMYUV420SemiPlanar(
+ size_t width, size_t height,
+ const void *srcBits, size_t srcSkip,
+ void *dstBits, size_t dstSkip);
+
+ ColorConverter(const ColorConverter &);
+ ColorConverter &operator=(const ColorConverter &);
+};
+
+} // namespace android
+
+#endif // COLOR_CONVERTER_H_
diff --git a/include/media/stagefright/DataSource.h b/include/media/stagefright/DataSource.h
index f46f0af..b843cd9 100644
--- a/include/media/stagefright/DataSource.h
+++ b/include/media/stagefright/DataSource.h
@@ -33,7 +33,9 @@ class DataSource : public RefBase {
public:
DataSource() {}
- virtual ssize_t read_at(off_t offset, void *data, size_t size) = 0;
+ virtual status_t initCheck() const = 0;
+
+ virtual ssize_t readAt(off_t offset, void *data, size_t size) = 0;
// Convenience methods:
bool getUInt16(off_t offset, uint16_t *x);
diff --git a/include/media/stagefright/ESDS.h b/include/media/stagefright/ESDS.h
deleted file mode 100644
index 01bcd18..0000000
--- a/include/media/stagefright/ESDS.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Copyright (C) 2009 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 ESDS_H_
-
-#define ESDS_H_
-
-#include <stdint.h>
-
-#include <media/stagefright/MediaErrors.h>
-
-namespace android {
-
-class ESDS {
-public:
- ESDS(const void *data, size_t size);
- ~ESDS();
-
- status_t InitCheck() const;
-
- status_t getCodecSpecificInfo(const void **data, size_t *size) const;
-
-private:
- enum {
- kTag_ESDescriptor = 0x03,
- kTag_DecoderConfigDescriptor = 0x04,
- kTag_DecoderSpecificInfo = 0x05
- };
-
- uint8_t *mData;
- size_t mSize;
-
- status_t mInitCheck;
-
- size_t mDecoderSpecificOffset;
- size_t mDecoderSpecificLength;
-
- status_t skipDescriptorHeader(
- size_t offset, size_t size,
- uint8_t *tag, size_t *data_offset, size_t *data_size) const;
-
- status_t parse();
- status_t parseESDescriptor(size_t offset, size_t size);
- status_t parseDecoderConfigDescriptor(size_t offset, size_t size);
-
- ESDS(const ESDS &);
- ESDS &operator=(const ESDS &);
-};
-
-} // namespace android
-#endif // ESDS_H_
diff --git a/include/media/stagefright/FileSource.h b/include/media/stagefright/FileSource.h
index ccbe0ef..d7b42c3 100644
--- a/include/media/stagefright/FileSource.h
+++ b/include/media/stagefright/FileSource.h
@@ -29,11 +29,13 @@ namespace android {
class FileSource : public DataSource {
public:
FileSource(const char *filename);
- virtual ~FileSource();
- status_t InitCheck() const;
+ virtual status_t initCheck() const;
+
+ virtual ssize_t readAt(off_t offset, void *data, size_t size);
- virtual ssize_t read_at(off_t offset, void *data, size_t size);
+protected:
+ virtual ~FileSource();
private:
FILE *mFile;
diff --git a/include/media/stagefright/HTTPDataSource.h b/include/media/stagefright/HTTPDataSource.h
index 0587c7c..d5dc9e6 100644
--- a/include/media/stagefright/HTTPDataSource.h
+++ b/include/media/stagefright/HTTPDataSource.h
@@ -19,28 +19,29 @@
#define HTTP_DATASOURCE_H_
#include <media/stagefright/DataSource.h>
-#include <media/stagefright/HTTPStream.h>
namespace android {
+class HTTPStream;
+
class HTTPDataSource : public DataSource {
public:
HTTPDataSource(const char *host, int port, const char *path);
HTTPDataSource(const char *uri);
- virtual ~HTTPDataSource();
+ virtual status_t initCheck() const;
- // XXXandih
- status_t InitCheck() const { return OK; }
+ virtual ssize_t readAt(off_t offset, void *data, size_t size);
- virtual ssize_t read_at(off_t offset, void *data, size_t size);
+protected:
+ virtual ~HTTPDataSource();
private:
enum {
kBufferSize = 64 * 1024
};
- HTTPStream mHttp;
+ HTTPStream *mHttp;
char *mHost;
int mPort;
char *mPath;
@@ -49,6 +50,8 @@ private:
size_t mBufferLength;
off_t mBufferOffset;
+ status_t mInitCheck;
+
HTTPDataSource(const HTTPDataSource &);
HTTPDataSource &operator=(const HTTPDataSource &);
};
diff --git a/include/media/stagefright/HTTPStream.h b/include/media/stagefright/HTTPStream.h
deleted file mode 100644
index 72e796c..0000000
--- a/include/media/stagefright/HTTPStream.h
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * Copyright (C) 2009 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 HTTP_STREAM_H_
-
-#define HTTP_STREAM_H_
-
-#include <sys/types.h>
-
-#include <media/stagefright/MediaErrors.h>
-#include <media/stagefright/stagefright_string.h>
-#include <utils/KeyedVector.h>
-
-namespace android {
-
-class HTTPStream {
-public:
- HTTPStream();
- ~HTTPStream();
-
- status_t connect(const char *server, int port = 80);
- status_t disconnect();
-
- status_t send(const char *data, size_t size);
-
- // Assumes data is a '\0' terminated string.
- status_t send(const char *data);
-
- // Receive up to "size" bytes of data.
- ssize_t receive(void *data, size_t size);
-
- status_t receive_header(int *http_status);
-
- // The header key used to retrieve the status line.
- static const char *kStatusKey;
-
- bool find_header_value(
- const string &key, string *value) const;
-
-private:
- enum State {
- READY,
- CONNECTED
- };
-
- State mState;
- int mSocket;
-
- KeyedVector<string, string> mHeaders;
-
- // Receive a line of data terminated by CRLF, line will be '\0' terminated
- // _excluding_ the termianting CRLF.
- status_t receive_line(char *line, size_t size);
-
- HTTPStream(const HTTPStream &);
- HTTPStream &operator=(const HTTPStream &);
-};
-
-} // namespace android
-
-#endif // HTTP_STREAM_H_
diff --git a/include/media/stagefright/MP3Extractor.h b/include/media/stagefright/MP3Extractor.h
deleted file mode 100644
index 11ba01d..0000000
--- a/include/media/stagefright/MP3Extractor.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Copyright (C) 2009 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 MP3_EXTRACTOR_H_
-
-#define MP3_EXTRACTOR_H_
-
-#include <media/stagefright/MediaExtractor.h>
-
-namespace android {
-
-class DataSource;
-class String8;
-
-class MP3Extractor : public MediaExtractor {
-public:
- // Extractor assumes ownership of "source".
- MP3Extractor(const sp<DataSource> &source);
-
- virtual size_t countTracks();
- virtual sp<MediaSource> getTrack(size_t index);
- virtual sp<MetaData> getTrackMetaData(size_t index);
-
-protected:
- virtual ~MP3Extractor();
-
-private:
- sp<DataSource> mDataSource;
- off_t mFirstFramePos;
- sp<MetaData> mMeta;
- uint32_t mFixedHeader;
-
- MP3Extractor(const MP3Extractor &);
- MP3Extractor &operator=(const MP3Extractor &);
-};
-
-bool SniffMP3(
- const sp<DataSource> &source, String8 *mimeType, float *confidence);
-
-} // namespace android
-
-#endif // MP3_EXTRACTOR_H_
diff --git a/include/media/stagefright/MPEG4Extractor.h b/include/media/stagefright/MPEG4Extractor.h
deleted file mode 100644
index 932e30f..0000000
--- a/include/media/stagefright/MPEG4Extractor.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * Copyright (C) 2009 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 MPEG4_EXTRACTOR_H_
-
-#define MPEG4_EXTRACTOR_H_
-
-#include <media/stagefright/MediaExtractor.h>
-
-namespace android {
-
-class DataSource;
-class SampleTable;
-class String8;
-
-class MPEG4Extractor : public MediaExtractor {
-public:
- // Extractor assumes ownership of "source".
- MPEG4Extractor(const sp<DataSource> &source);
-
- size_t countTracks();
- sp<MediaSource> getTrack(size_t index);
- sp<MetaData> getTrackMetaData(size_t index);
-
-protected:
- virtual ~MPEG4Extractor();
-
-private:
- struct Track {
- Track *next;
- sp<MetaData> meta;
- uint32_t timescale;
- sp<SampleTable> sampleTable;
- };
-
- sp<DataSource> mDataSource;
- bool mHaveMetadata;
-
- Track *mFirstTrack, *mLastTrack;
-
- uint32_t mHandlerType;
-
- status_t readMetaData();
- status_t parseChunk(off_t *offset, int depth);
-
- MPEG4Extractor(const MPEG4Extractor &);
- MPEG4Extractor &operator=(const MPEG4Extractor &);
-};
-
-bool SniffMPEG4(
- const sp<DataSource> &source, String8 *mimeType, float *confidence);
-
-} // namespace android
-
-#endif // MPEG4_EXTRACTOR_H_
diff --git a/include/media/stagefright/MediaDefs.h b/include/media/stagefright/MediaDefs.h
index feb66e3..1efeb92 100644
--- a/include/media/stagefright/MediaDefs.h
+++ b/include/media/stagefright/MediaDefs.h
@@ -34,6 +34,7 @@ extern const char *MEDIA_MIMETYPE_AUDIO_AAC;
extern const char *MEDIA_MIMETYPE_AUDIO_RAW;
extern const char *MEDIA_MIMETYPE_CONTAINER_MPEG4;
+extern const char *MEDIA_MIMETYPE_CONTAINER_WAV;
} // namespace android
diff --git a/include/media/stagefright/MediaErrors.h b/include/media/stagefright/MediaErrors.h
index 2bb0ed6..73d0f77 100644
--- a/include/media/stagefright/MediaErrors.h
+++ b/include/media/stagefright/MediaErrors.h
@@ -36,6 +36,9 @@ enum {
ERROR_BUFFER_TOO_SMALL = MEDIA_ERROR_BASE - 9,
ERROR_UNSUPPORTED = MEDIA_ERROR_BASE - 10,
ERROR_END_OF_STREAM = MEDIA_ERROR_BASE - 11,
+
+ // Not technically an error.
+ INFO_FORMAT_CHANGED = MEDIA_ERROR_BASE - 12,
};
} // namespace android
diff --git a/include/media/stagefright/MediaExtractor.h b/include/media/stagefright/MediaExtractor.h
index 67e45bd..d56d4b3 100644
--- a/include/media/stagefright/MediaExtractor.h
+++ b/include/media/stagefright/MediaExtractor.h
@@ -31,9 +31,17 @@ public:
static sp<MediaExtractor> Create(
const sp<DataSource> &source, const char *mime = NULL);
+ static sp<MediaExtractor> CreateFromURI(
+ const char *uri, const char *mime = NULL);
+
virtual size_t countTracks() = 0;
virtual sp<MediaSource> getTrack(size_t index) = 0;
- virtual sp<MetaData> getTrackMetaData(size_t index) = 0;
+
+ enum GetTrackMetaDataFlags {
+ kIncludeExtensiveMetaData = 1
+ };
+ virtual sp<MetaData> getTrackMetaData(
+ size_t index, uint32_t flags = 0) = 0;
protected:
MediaExtractor() {}
diff --git a/include/media/stagefright/MediaSource.h b/include/media/stagefright/MediaSource.h
index d1fa114..96d57e7 100644
--- a/include/media/stagefright/MediaSource.h
+++ b/include/media/stagefright/MediaSource.h
@@ -51,6 +51,9 @@ struct MediaSource : public RefBase {
// buffer is available, an error is encountered of the end of the stream
// is reached.
// End of stream is signalled by a result of ERROR_END_OF_STREAM.
+ // A result of INFO_FORMAT_CHANGED indicates that the format of this
+ // MediaSource has changed mid-stream, the client can continue reading
+ // but should be prepared for buffers of the new configuration.
virtual status_t read(
MediaBuffer **buffer, const ReadOptions *options = NULL) = 0;
diff --git a/include/media/stagefright/MetaData.h b/include/media/stagefright/MetaData.h
index abb45a9..c2d8f98 100644
--- a/include/media/stagefright/MetaData.h
+++ b/include/media/stagefright/MetaData.h
@@ -27,25 +27,26 @@
namespace android {
+// The following keys map to int32_t data unless indicated otherwise.
enum {
- kKeyMIMEType = 'mime',
+ kKeyMIMEType = 'mime', // cstring
kKeyWidth = 'widt',
kKeyHeight = 'heig',
kKeyChannelCount = '#chn',
kKeySampleRate = 'srte',
kKeyBitRate = 'brte',
- kKeyESDS = 'esds',
- kKeyAVCC = 'avcc',
- kKeyTimeUnits = '#tim',
- kKeyTimeScale = 'scal',
+ kKeyESDS = 'esds', // raw data
+ kKeyAVCC = 'avcc', // raw data
kKeyWantsNALFragments = 'NALf',
kKeyIsSyncFrame = 'sync',
- kKeyDuration = 'dura',
+ kKeyTime = 'time', // int64_t (usecs)
+ kKeyDuration = 'dura', // int64_t (usecs)
kKeyColorFormat = 'colf',
- kKeyPlatformPrivate = 'priv',
- kKeyDecoderComponent = 'decC',
+ kKeyPlatformPrivate = 'priv', // pointer
+ kKeyDecoderComponent = 'decC', // cstring
kKeyBufferID = 'bfID',
kKeyMaxInputSize = 'inpS',
+ kKeyThumbnailTime = 'thbT', // int64_t (usecs)
};
enum {
@@ -62,6 +63,7 @@ public:
TYPE_NONE = 'none',
TYPE_C_STRING = 'cstr',
TYPE_INT32 = 'in32',
+ TYPE_INT64 = 'in64',
TYPE_FLOAT = 'floa',
TYPE_POINTER = 'ptr ',
};
@@ -71,11 +73,13 @@ public:
bool setCString(uint32_t key, const char *value);
bool setInt32(uint32_t key, int32_t value);
+ bool setInt64(uint32_t key, int64_t value);
bool setFloat(uint32_t key, float value);
bool setPointer(uint32_t key, void *value);
bool findCString(uint32_t key, const char **value);
bool findInt32(uint32_t key, int32_t *value);
+ bool findInt64(uint32_t key, int64_t *value);
bool findFloat(uint32_t key, float *value);
bool findPointer(uint32_t key, void **value);
diff --git a/include/media/stagefright/MmapSource.h b/include/media/stagefright/MmapSource.h
index a8bd57f..1b39d53 100644
--- a/include/media/stagefright/MmapSource.h
+++ b/include/media/stagefright/MmapSource.h
@@ -30,13 +30,14 @@ public:
// Assumes ownership of "fd".
MmapSource(int fd, int64_t offset, int64_t length);
- virtual ~MmapSource();
-
- status_t InitCheck() const;
+ virtual status_t initCheck() const;
- virtual ssize_t read_at(off_t offset, void *data, size_t size);
+ virtual ssize_t readAt(off_t offset, void *data, size_t size);
virtual status_t getSize(off_t *size);
+protected:
+ virtual ~MmapSource();
+
private:
int mFd;
void *mBase;
diff --git a/include/media/stagefright/OMXCodec.h b/include/media/stagefright/OMXCodec.h
index 3f3dcf9..7890883 100644
--- a/include/media/stagefright/OMXCodec.h
+++ b/include/media/stagefright/OMXCodec.h
@@ -30,11 +30,15 @@ struct OMXCodecObserver;
struct OMXCodec : public MediaSource,
public MediaBufferObserver {
+ enum CreationFlags {
+ kPreferSoftwareCodecs = 1,
+ };
static sp<OMXCodec> Create(
const sp<IOMX> &omx,
const sp<MetaData> &meta, bool createEncoder,
const sp<MediaSource> &source,
- const char *matchComponentName = NULL);
+ const char *matchComponentName = NULL,
+ uint32_t flags = 0);
static void setComponentRole(
const sp<IOMX> &omx, IOMX::node_id node, bool isEncoder,
@@ -90,7 +94,6 @@ private:
kRequiresFlushCompleteEmulation = 16,
kRequiresAllocateBufferOnOutputPorts = 32,
kRequiresFlushBeforeShutdown = 64,
- kOutputDimensionsAre16Aligned = 128,
};
struct BufferInfo {
@@ -107,7 +110,6 @@ private:
sp<IOMX> mOMX;
IOMX::node_id mNode;
- sp<OMXCodecObserver> mObserver;
uint32_t mQuirks;
bool mIsEncoder;
char *mMIME;
@@ -125,6 +127,7 @@ private:
bool mInitialBufferSubmit;
bool mSignalledEOS;
bool mNoMoreOutputData;
+ bool mOutputPortSettingsHaveChanged;
int64_t mSeekTimeUs;
Mutex mLock;
@@ -155,6 +158,8 @@ private:
void setVideoInputFormat(
const char *mime, OMX_U32 width, OMX_U32 height);
+ status_t setupMPEG4EncoderParameters();
+
void setVideoOutputFormat(
const char *mime, OMX_U32 width, OMX_U32 height);
@@ -208,6 +213,14 @@ private:
void dumpPortStatus(OMX_U32 portIndex);
+ static uint32_t getComponentQuirks(const char *componentName);
+
+ static void findMatchingCodecs(
+ const char *mime,
+ bool createEncoder, const char *matchComponentName,
+ uint32_t flags,
+ Vector<String8> *matchingCodecs);
+
OMXCodec(const OMXCodec &);
OMXCodec &operator=(const OMXCodec &);
};
diff --git a/include/media/stagefright/SampleTable.h b/include/media/stagefright/SampleTable.h
deleted file mode 100644
index 808d142..0000000
--- a/include/media/stagefright/SampleTable.h
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- * Copyright (C) 2009 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 SAMPLE_TABLE_H_
-
-#define SAMPLE_TABLE_H_
-
-#include <sys/types.h>
-#include <stdint.h>
-
-#include <media/stagefright/MediaErrors.h>
-#include <utils/RefBase.h>
-#include <utils/threads.h>
-
-namespace android {
-
-class DataSource;
-
-class SampleTable : public RefBase {
-public:
- SampleTable(const sp<DataSource> &source);
-
- // type can be 'stco' or 'co64'.
- status_t setChunkOffsetParams(
- uint32_t type, off_t data_offset, off_t data_size);
-
- status_t setSampleToChunkParams(off_t data_offset, off_t data_size);
-
- // type can be 'stsz' or 'stz2'.
- status_t setSampleSizeParams(
- uint32_t type, off_t data_offset, off_t data_size);
-
- status_t setTimeToSampleParams(off_t data_offset, off_t data_size);
-
- status_t setSyncSampleParams(off_t data_offset, off_t data_size);
-
- ////////////////////////////////////////////////////////////////////////////
-
- uint32_t countChunkOffsets() const;
- status_t getChunkOffset(uint32_t chunk_index, off_t *offset);
-
- status_t getChunkForSample(
- uint32_t sample_index, uint32_t *chunk_index,
- uint32_t *chunk_relative_sample_index, uint32_t *desc_index);
-
- uint32_t countSamples() const;
- status_t getSampleSize(uint32_t sample_index, size_t *sample_size);
-
- status_t getSampleOffsetAndSize(
- uint32_t sample_index, off_t *offset, size_t *size);
-
- status_t getMaxSampleSize(size_t *size);
-
- status_t getDecodingTime(uint32_t sample_index, uint32_t *time);
-
- enum {
- kSyncSample_Flag = 1
- };
- status_t findClosestSample(
- uint32_t req_time, uint32_t *sample_index, uint32_t flags);
-
- status_t findClosestSyncSample(
- uint32_t start_sample_index, uint32_t *sample_index);
-
-protected:
- ~SampleTable();
-
-private:
- sp<DataSource> mDataSource;
- Mutex mLock;
-
- off_t mChunkOffsetOffset;
- uint32_t mChunkOffsetType;
- uint32_t mNumChunkOffsets;
-
- off_t mSampleToChunkOffset;
- uint32_t mNumSampleToChunkOffsets;
-
- off_t mSampleSizeOffset;
- uint32_t mSampleSizeFieldSize;
- uint32_t mDefaultSampleSize;
- uint32_t mNumSampleSizes;
-
- uint32_t mTimeToSampleCount;
- uint32_t *mTimeToSample;
-
- off_t mSyncSampleOffset;
- uint32_t mNumSyncSamples;
-
- SampleTable(const SampleTable &);
- SampleTable &operator=(const SampleTable &);
-};
-
-} // namespace android
-
-#endif // SAMPLE_TABLE_H_
diff --git a/include/media/stagefright/ShoutcastSource.h b/include/media/stagefright/ShoutcastSource.h
index 352857a..bc67156 100644
--- a/include/media/stagefright/ShoutcastSource.h
+++ b/include/media/stagefright/ShoutcastSource.h
@@ -31,7 +31,6 @@ class ShoutcastSource : public MediaSource {
public:
// Assumes ownership of "http".
ShoutcastSource(HTTPStream *http);
- virtual ~ShoutcastSource();
virtual status_t start(MetaData *params = NULL);
virtual status_t stop();
@@ -41,6 +40,9 @@ public:
virtual status_t read(
MediaBuffer **buffer, const ReadOptions *options = NULL);
+protected:
+ virtual ~ShoutcastSource();
+
private:
HTTPStream *mHttp;
size_t mMetaDataOffset;
diff --git a/include/media/stagefright/SoftwareRenderer.h b/include/media/stagefright/SoftwareRenderer.h
deleted file mode 100644
index 1545493..0000000
--- a/include/media/stagefright/SoftwareRenderer.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Copyright (C) 2009 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 SOFTWARE_RENDERER_H_
-
-#define SOFTWARE_RENDERER_H_
-
-#include <OMX_Video.h>
-#include <media/stagefright/VideoRenderer.h>
-#include <utils/RefBase.h>
-
-namespace android {
-
-class ISurface;
-class MemoryHeapBase;
-
-class SoftwareRenderer : public VideoRenderer {
-public:
- SoftwareRenderer(
- OMX_COLOR_FORMATTYPE colorFormat,
- const sp<ISurface> &surface,
- size_t displayWidth, size_t displayHeight,
- size_t decodedWidth, size_t decodedHeight);
-
- virtual ~SoftwareRenderer();
-
- virtual void render(
- const void *data, size_t size, void *platformPrivate);
-
-private:
- uint8_t *initClip();
-
- void renderCbYCrY(const void *data, size_t size);
- void renderYUV420Planar(const void *data, size_t size);
- void renderQCOMYUV420SemiPlanar(const void *data, size_t size);
-
- OMX_COLOR_FORMATTYPE mColorFormat;
- sp<ISurface> mISurface;
- size_t mDisplayWidth, mDisplayHeight;
- size_t mDecodedWidth, mDecodedHeight;
- size_t mFrameSize;
- sp<MemoryHeapBase> mMemoryHeap;
- int mIndex;
-
- uint8_t *mClip;
-
- SoftwareRenderer(const SoftwareRenderer &);
- SoftwareRenderer &operator=(const SoftwareRenderer &);
-};
-
-} // namespace android
-
-#endif // SOFTWARE_RENDERER_H_
diff --git a/include/media/stagefright/TimedEventQueue.h b/include/media/stagefright/TimedEventQueue.h
deleted file mode 100644
index a264421..0000000
--- a/include/media/stagefright/TimedEventQueue.h
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- * Copyright (C) 2009 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 TIMED_EVENT_QUEUE_H_
-
-#define TIMED_EVENT_QUEUE_H_
-
-#include <pthread.h>
-
-#include <utils/List.h>
-#include <utils/RefBase.h>
-#include <utils/threads.h>
-
-namespace android {
-
-struct TimedEventQueue {
-
- struct Event : public RefBase {
- Event() {}
- virtual ~Event() {}
-
- protected:
- virtual void fire(TimedEventQueue *queue, int64_t now_us) = 0;
-
- private:
- friend class TimedEventQueue;
-
- Event(const Event &);
- Event &operator=(const Event &);
- };
-
- TimedEventQueue();
- ~TimedEventQueue();
-
- // Start executing the event loop.
- void start();
-
- // Stop executing the event loop, if flush is false, any pending
- // events are discarded, otherwise the queue will stop (and this call
- // return) once all pending events have been handled.
- void stop(bool flush = false);
-
- // Posts an event to the front of the queue (after all events that
- // have previously been posted to the front but before timed events).
- void postEvent(const sp<Event> &event);
-
- void postEventToBack(const sp<Event> &event);
-
- // It is an error to post an event with a negative delay.
- void postEventWithDelay(const sp<Event> &event, int64_t delay_us);
-
- // If the event is to be posted at a time that has already passed,
- // it will fire as soon as possible.
- void postTimedEvent(const sp<Event> &event, int64_t realtime_us);
-
- // Returns true iff event is currently in the queue and has been
- // successfully cancelled. In this case the event will have been
- // removed from the queue and won't fire.
- bool cancelEvent(const sp<Event> &event);
-
- static int64_t getRealTimeUs();
-
-private:
- struct QueueItem {
- sp<Event> event;
- int64_t realtime_us;
- };
-
- struct StopEvent : public TimedEventQueue::Event {
- virtual void fire(TimedEventQueue *queue, int64_t now_us) {
- queue->mStopped = true;
- }
- };
-
- pthread_t mThread;
- List<QueueItem> mQueue;
- Mutex mLock;
- Condition mQueueNotEmptyCondition;
- Condition mQueueHeadChangedCondition;
-
- bool mRunning;
- bool mStopped;
-
- static void *ThreadWrapper(void *me);
- void threadEntry();
-
- TimedEventQueue(const TimedEventQueue &);
- TimedEventQueue &operator=(const TimedEventQueue &);
-};
-
-} // namespace android
-
-#endif // TIMED_EVENT_QUEUE_H_
diff --git a/include/media/stagefright/stagefright_string.h b/include/media/stagefright/stagefright_string.h
deleted file mode 100644
index 1ed4c86..0000000
--- a/include/media/stagefright/stagefright_string.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Copyright (C) 2009 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 STAGEFRIGHT_STRING_H_
-
-#define STAGEFRIGHT_STRING_H_
-
-#include <utils/String8.h>
-
-namespace android {
-
-class string {
-public:
- typedef size_t size_type;
- static size_type npos;
-
- string();
- string(const char *s);
- string(const char *s, size_t length);
- string(const string &from, size_type start, size_type length = npos);
-
- const char *c_str() const;
- size_type size() const;
-
- void clear();
- void erase(size_type from, size_type length);
-
- size_type find(char c) const;
-
- bool operator<(const string &other) const;
- bool operator==(const string &other) const;
-
- string &operator+=(char c);
-
-private:
- String8 mString;
-};
-
-} // namespace android
-
-#endif // STAGEFRIGHT_STRING_H_