summaryrefslogtreecommitdiffstats
path: root/include/media/stagefright
diff options
context:
space:
mode:
Diffstat (limited to 'include/media/stagefright')
-rw-r--r--include/media/stagefright/ACodec.h9
-rw-r--r--include/media/stagefright/CameraSource.h5
-rw-r--r--include/media/stagefright/DataSource.h2
-rw-r--r--include/media/stagefright/DataURISource.h49
-rw-r--r--include/media/stagefright/MediaCodecSource.h134
-rw-r--r--include/media/stagefright/MediaHTTP.h77
-rw-r--r--include/media/stagefright/MediaSource.h2
-rw-r--r--include/media/stagefright/NuMediaExtractor.h2
-rw-r--r--include/media/stagefright/SkipCutBuffer.h1
-rw-r--r--include/media/stagefright/timedtext/TimedTextDriver.h6
10 files changed, 283 insertions, 4 deletions
diff --git a/include/media/stagefright/ACodec.h b/include/media/stagefright/ACodec.h
index f1636e6..36f2a67 100644
--- a/include/media/stagefright/ACodec.h
+++ b/include/media/stagefright/ACodec.h
@@ -67,6 +67,8 @@ struct ACodec : public AHierarchicalStateMachine {
void signalRequestIDRFrame();
+ bool isConfiguredForAdaptivePlayback() { return mIsConfiguredForAdaptivePlayback; }
+
struct PortDescription : public RefBase {
size_t countBuffers();
IOMX::buffer_id bufferIDAt(size_t index) const;
@@ -187,6 +189,7 @@ private:
bool mIsEncoder;
bool mUseMetadataOnEncoderOutput;
bool mShutdownInProgress;
+ bool mIsConfiguredForAdaptivePlayback;
// If "mKeepComponentAllocated" we only transition back to Loaded state
// and do not release the component instance.
@@ -202,6 +205,12 @@ private:
int32_t mMetaDataBuffersToSubmit;
int64_t mRepeatFrameDelayUs;
+ int64_t mMaxPtsGapUs;
+
+ int64_t mTimePerFrameUs;
+ int64_t mTimePerCaptureUs;
+
+ bool mCreateInputBuffersSuspended;
status_t setCyclicIntraMacroblockRefresh(const sp<AMessage> &msg, int32_t mode);
status_t allocateBuffersOnPort(OMX_U32 portIndex);
diff --git a/include/media/stagefright/CameraSource.h b/include/media/stagefright/CameraSource.h
index a829916..dd0a106 100644
--- a/include/media/stagefright/CameraSource.h
+++ b/include/media/stagefright/CameraSource.h
@@ -172,7 +172,7 @@ protected:
const sp<IGraphicBufferProducer>& surface,
bool storeMetaDataInVideoBuffers);
- virtual void startCameraRecording();
+ virtual status_t startCameraRecording();
virtual void releaseRecordingFrame(const sp<IMemory>& frame);
// Returns true if need to skip the current frame.
@@ -185,6 +185,8 @@ protected:
virtual void dataCallbackTimestamp(int64_t timestampUs, int32_t msgType,
const sp<IMemory> &data);
+ void releaseCamera();
+
private:
friend class CameraSourceListener;
@@ -233,7 +235,6 @@ private:
int32_t frameRate);
void stopCameraRecording();
- void releaseCamera();
status_t reset();
CameraSource(const CameraSource &);
diff --git a/include/media/stagefright/DataSource.h b/include/media/stagefright/DataSource.h
index 157b1aa..f8787dd 100644
--- a/include/media/stagefright/DataSource.h
+++ b/include/media/stagefright/DataSource.h
@@ -31,6 +31,7 @@
namespace android {
struct AMessage;
+struct IMediaHTTPService;
class String8;
class DataSource : public RefBase {
@@ -43,6 +44,7 @@ public:
};
static sp<DataSource> CreateFromURI(
+ const sp<IMediaHTTPService> &httpService,
const char *uri,
const KeyedVector<String8, String8> *headers = NULL);
diff --git a/include/media/stagefright/DataURISource.h b/include/media/stagefright/DataURISource.h
new file mode 100644
index 0000000..693562e
--- /dev/null
+++ b/include/media/stagefright/DataURISource.h
@@ -0,0 +1,49 @@
+/*
+ * Copyright (C) 2014 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 DATA_URI_SOURCE_H_
+
+#define DATA_URI_SOURCE_H_
+
+#include <media/stagefright/DataSource.h>
+#include <media/stagefright/foundation/ABase.h>
+
+namespace android {
+
+struct ABuffer;
+
+struct DataURISource : public DataSource {
+ static sp<DataURISource> Create(const char *uri);
+
+ virtual status_t initCheck() const;
+ virtual ssize_t readAt(off64_t offset, void *data, size_t size);
+ virtual status_t getSize(off64_t *size);
+
+protected:
+ virtual ~DataURISource();
+
+private:
+ sp<ABuffer> mBuffer;
+
+ DataURISource(const sp<ABuffer> &buffer);
+
+ DISALLOW_EVIL_CONSTRUCTORS(DataURISource);
+};
+
+} // namespace android
+
+#endif // DATA_URI_SOURCE_H_
+
diff --git a/include/media/stagefright/MediaCodecSource.h b/include/media/stagefright/MediaCodecSource.h
new file mode 100644
index 0000000..4b18a0b
--- /dev/null
+++ b/include/media/stagefright/MediaCodecSource.h
@@ -0,0 +1,134 @@
+/*
+ * Copyright (C) 2014 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 MediaCodecSource_H_
+#define MediaCodecSource_H_
+
+#include <media/stagefright/foundation/ABase.h>
+#include <media/stagefright/foundation/AHandlerReflector.h>
+#include <media/stagefright/MediaSource.h>
+
+namespace android {
+
+class ALooper;
+class AMessage;
+class IGraphicBufferProducer;
+class MediaCodec;
+class MetaData;
+
+struct MediaCodecSource : public MediaSource,
+ public MediaBufferObserver {
+ enum FlagBits {
+ FLAG_USE_SURFACE_INPUT = 1,
+ FLAG_USE_METADATA_INPUT = 2,
+ };
+
+ static sp<MediaCodecSource> Create(
+ const sp<ALooper> &looper,
+ const sp<AMessage> &format,
+ const sp<MediaSource> &source,
+ uint32_t flags = 0);
+
+ bool isVideo() const { return mIsVideo; }
+ sp<IGraphicBufferProducer> getGraphicBufferProducer();
+
+ // MediaSource
+ virtual status_t start(MetaData *params = NULL);
+ virtual status_t stop();
+ virtual status_t pause();
+ virtual sp<MetaData> getFormat() { return mMeta; }
+ virtual status_t read(
+ MediaBuffer **buffer,
+ const ReadOptions *options = NULL);
+
+ // MediaBufferObserver
+ virtual void signalBufferReturned(MediaBuffer *buffer);
+
+ // for AHandlerReflector
+ void onMessageReceived(const sp<AMessage> &msg);
+
+protected:
+ virtual ~MediaCodecSource();
+
+private:
+ struct Puller;
+
+ enum {
+ kWhatPullerNotify,
+ kWhatEncoderActivity,
+ kWhatStart,
+ kWhatStop,
+ kWhatPause,
+ };
+
+ MediaCodecSource(
+ const sp<ALooper> &looper,
+ const sp<AMessage> &outputFormat,
+ const sp<MediaSource> &source,
+ uint32_t flags = 0);
+
+ status_t onStart(MetaData *params);
+ status_t init();
+ status_t initEncoder();
+ void releaseEncoder();
+ status_t feedEncoderInputBuffers();
+ void scheduleDoMoreWork();
+ status_t doMoreWork();
+ void suspend();
+ void resume(int64_t skipFramesBeforeUs = -1ll);
+ void signalEOS(status_t err = ERROR_END_OF_STREAM);
+ bool reachedEOS();
+ status_t postSynchronouslyAndReturnError(const sp<AMessage> &msg);
+
+ sp<ALooper> mLooper;
+ sp<ALooper> mCodecLooper;
+ sp<AHandlerReflector<MediaCodecSource> > mReflector;
+ sp<AMessage> mOutputFormat;
+ sp<MetaData> mMeta;
+ sp<Puller> mPuller;
+ sp<MediaCodec> mEncoder;
+ uint32_t mFlags;
+ List<uint32_t> mStopReplyIDQueue;
+ bool mIsVideo;
+ bool mStarted;
+ bool mStopping;
+ bool mDoMoreWorkPending;
+ bool mPullerReachedEOS;
+ sp<AMessage> mEncoderActivityNotify;
+ sp<IGraphicBufferProducer> mGraphicBufferProducer;
+ Vector<sp<ABuffer> > mEncoderInputBuffers;
+ Vector<sp<ABuffer> > mEncoderOutputBuffers;
+ List<MediaBuffer *> mInputBufferQueue;
+ List<size_t> mAvailEncoderInputIndices;
+ List<int64_t> mDecodingTimeQueue; // decoding time (us) for video
+
+ // audio drift time
+ int64_t mFirstSampleTimeUs;
+ List<int64_t> mDriftTimeQueue;
+
+ // following variables are protected by mOutputBufferLock
+ Mutex mOutputBufferLock;
+ Condition mOutputBufferCond;
+ List<MediaBuffer*> mOutputBufferQueue;
+ bool mEncodedReachedEOS;
+ status_t mErrorCode;
+
+ DISALLOW_EVIL_CONSTRUCTORS(MediaCodecSource);
+};
+
+} // namespace android
+
+#endif /* MediaCodecSource_H_ */
diff --git a/include/media/stagefright/MediaHTTP.h b/include/media/stagefright/MediaHTTP.h
new file mode 100644
index 0000000..006d8d8
--- /dev/null
+++ b/include/media/stagefright/MediaHTTP.h
@@ -0,0 +1,77 @@
+/*
+ * Copyright (C) 2013 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 MEDIA_HTTP_H_
+
+#define MEDIA_HTTP_H_
+
+#include <media/stagefright/foundation/AString.h>
+
+#include "include/HTTPBase.h"
+
+namespace android {
+
+struct IMediaHTTPConnection;
+
+struct MediaHTTP : public HTTPBase {
+ MediaHTTP(const sp<IMediaHTTPConnection> &conn);
+
+ virtual status_t connect(
+ const char *uri,
+ const KeyedVector<String8, String8> *headers,
+ off64_t offset);
+
+ virtual void disconnect();
+
+ virtual status_t initCheck() const;
+
+ virtual ssize_t readAt(off64_t offset, void *data, size_t size);
+
+ virtual status_t getSize(off64_t *size);
+
+ virtual uint32_t flags();
+
+ virtual status_t reconnectAtOffset(off64_t offset);
+
+protected:
+ virtual ~MediaHTTP();
+
+ virtual sp<DecryptHandle> DrmInitialization(const char* mime);
+ virtual void getDrmInfo(sp<DecryptHandle> &handle, DrmManagerClient **client);
+ virtual String8 getUri();
+ virtual String8 getMIMEType() const;
+
+private:
+ status_t mInitCheck;
+ sp<IMediaHTTPConnection> mHTTPConnection;
+
+ KeyedVector<String8, String8> mLastHeaders;
+ AString mLastURI;
+
+ bool mCachedSizeValid;
+ off64_t mCachedSize;
+
+ sp<DecryptHandle> mDecryptHandle;
+ DrmManagerClient *mDrmManagerClient;
+
+ void clearDRMState_l();
+
+ DISALLOW_EVIL_CONSTRUCTORS(MediaHTTP);
+};
+
+} // namespace android
+
+#endif // MEDIA_HTTP_H_
diff --git a/include/media/stagefright/MediaSource.h b/include/media/stagefright/MediaSource.h
index 3818e63..204d1c6 100644
--- a/include/media/stagefright/MediaSource.h
+++ b/include/media/stagefright/MediaSource.h
@@ -105,7 +105,7 @@ struct MediaSource : public virtual RefBase {
// This will be called after a successful start() and before the
// first read() call.
// Callee assumes ownership of the buffers if no error is returned.
- virtual status_t setBuffers(const Vector<MediaBuffer *> &buffers) {
+ virtual status_t setBuffers(const Vector<MediaBuffer *> & /* buffers */) {
return ERROR_UNSUPPORTED;
}
diff --git a/include/media/stagefright/NuMediaExtractor.h b/include/media/stagefright/NuMediaExtractor.h
index 5ae6f6b..402e7f8 100644
--- a/include/media/stagefright/NuMediaExtractor.h
+++ b/include/media/stagefright/NuMediaExtractor.h
@@ -31,6 +31,7 @@ namespace android {
struct ABuffer;
struct AMessage;
struct DataSource;
+struct IMediaHTTPService;
struct MediaBuffer;
struct MediaExtractor;
struct MediaSource;
@@ -45,6 +46,7 @@ struct NuMediaExtractor : public RefBase {
NuMediaExtractor();
status_t setDataSource(
+ const sp<IMediaHTTPService> &httpService,
const char *path,
const KeyedVector<String8, String8> *headers = NULL);
diff --git a/include/media/stagefright/SkipCutBuffer.h b/include/media/stagefright/SkipCutBuffer.h
index 2653b53..098aa69 100644
--- a/include/media/stagefright/SkipCutBuffer.h
+++ b/include/media/stagefright/SkipCutBuffer.h
@@ -47,6 +47,7 @@ class SkipCutBuffer: public RefBase {
private:
void write(const char *src, size_t num);
size_t read(char *dst, size_t num);
+ int32_t mSkip;
int32_t mFrontPadding;
int32_t mBackPadding;
int32_t mWriteHead;
diff --git a/include/media/stagefright/timedtext/TimedTextDriver.h b/include/media/stagefright/timedtext/TimedTextDriver.h
index f23c337..37ef674 100644
--- a/include/media/stagefright/timedtext/TimedTextDriver.h
+++ b/include/media/stagefright/timedtext/TimedTextDriver.h
@@ -25,6 +25,7 @@
namespace android {
class ALooper;
+struct IMediaHTTPService;
class MediaPlayerBase;
class MediaSource;
class Parcel;
@@ -34,7 +35,9 @@ class DataSource;
class TimedTextDriver {
public:
- TimedTextDriver(const wp<MediaPlayerBase> &listener);
+ TimedTextDriver(
+ const wp<MediaPlayerBase> &listener,
+ const sp<IMediaHTTPService> &httpService);
~TimedTextDriver();
@@ -77,6 +80,7 @@ private:
sp<ALooper> mLooper;
sp<TimedTextPlayer> mPlayer;
wp<MediaPlayerBase> mListener;
+ sp<IMediaHTTPService> mHTTPService;
// Variables to be guarded by mLock.
State mState;