summaryrefslogtreecommitdiffstats
path: root/media/libstagefright/include
diff options
context:
space:
mode:
authorAndreas Huber <andih@google.com>2010-10-12 11:34:37 -0700
committerAndreas Huber <andih@google.com>2010-10-12 14:32:10 -0700
commitbff07d0b22a5ee2d9f044f6cb5e4be1532017ab0 (patch)
tree3377ef036c87095609a0969dbf0b5c93450b8903 /media/libstagefright/include
parent2bc940b4f961e588459c83862b2c6bea314a4027 (diff)
downloadframeworks_av-bff07d0b22a5ee2d9f044f6cb5e4be1532017ab0.zip
frameworks_av-bff07d0b22a5ee2d9f044f6cb5e4be1532017ab0.tar.gz
frameworks_av-bff07d0b22a5ee2d9f044f6cb5e4be1532017ab0.tar.bz2
HTTP Live content that are tagged as complete are now seekable.
Change-Id: I9d0d2f009f883e5baf3e9de8c5c0aa05760e4bde related-to-bug: 2368598
Diffstat (limited to 'media/libstagefright/include')
-rw-r--r--media/libstagefright/include/LiveSource.h7
-rw-r--r--media/libstagefright/include/M3UParser.h2
-rw-r--r--media/libstagefright/include/MPEG2TSExtractor.h12
-rw-r--r--media/libstagefright/include/NuCachedSource2.h6
4 files changed, 23 insertions, 4 deletions
diff --git a/media/libstagefright/include/LiveSource.h b/media/libstagefright/include/LiveSource.h
index 5e89581..55dd45e 100644
--- a/media/libstagefright/include/LiveSource.h
+++ b/media/libstagefright/include/LiveSource.h
@@ -40,6 +40,11 @@ struct LiveSource : public DataSource {
return kWantsPrefetching;
}
+ bool getDuration(int64_t *durationUs) const;
+
+ bool isSeekable() const;
+ bool seekTo(int64_t seekTimeUs);
+
protected:
virtual ~LiveSource();
@@ -53,6 +58,7 @@ private:
AString mMasterURL;
AString mURL;
status_t mInitCheck;
+ int64_t mDurationUs;
sp<M3UParser> mPlaylist;
int32_t mFirstItemSequenceNumber;
@@ -72,6 +78,7 @@ private:
bool switchToNext();
bool loadPlaylist(bool fetchMaster);
+ void determineSeekability();
DISALLOW_EVIL_CONSTRUCTORS(LiveSource);
};
diff --git a/media/libstagefright/include/M3UParser.h b/media/libstagefright/include/M3UParser.h
index 69199ab..bd9eebe 100644
--- a/media/libstagefright/include/M3UParser.h
+++ b/media/libstagefright/include/M3UParser.h
@@ -32,6 +32,7 @@ struct M3UParser : public RefBase {
bool isExtM3U() const;
bool isVariantPlaylist() const;
+ bool isComplete() const;
sp<AMessage> meta();
@@ -52,6 +53,7 @@ private:
AString mBaseURI;
bool mIsExtM3U;
bool mIsVariantPlaylist;
+ bool mIsComplete;
sp<AMessage> mMeta;
Vector<Item> mItems;
diff --git a/media/libstagefright/include/MPEG2TSExtractor.h b/media/libstagefright/include/MPEG2TSExtractor.h
index 1bf4cd1..d83b538 100644
--- a/media/libstagefright/include/MPEG2TSExtractor.h
+++ b/media/libstagefright/include/MPEG2TSExtractor.h
@@ -15,6 +15,7 @@ struct ATSParser;
struct DataSource;
struct MPEG2TSSource;
struct String8;
+struct LiveSource;
struct MPEG2TSExtractor : public MediaExtractor {
MPEG2TSExtractor(const sp<DataSource> &source);
@@ -25,16 +26,19 @@ struct MPEG2TSExtractor : public MediaExtractor {
virtual sp<MetaData> getMetaData();
- virtual uint32_t flags() const {
- return CAN_PAUSE;
- }
+ virtual uint32_t flags() const;
+
+ void setLiveSource(const sp<LiveSource> &liveSource);
+ void seekTo(int64_t seekTimeUs);
private:
friend struct MPEG2TSSource;
- Mutex mLock;
+ mutable Mutex mLock;
sp<DataSource> mDataSource;
+ sp<LiveSource> mLiveSource;
+
sp<ATSParser> mParser;
Vector<sp<AnotherPacketSource> > mSourceImpls;
diff --git a/media/libstagefright/include/NuCachedSource2.h b/media/libstagefright/include/NuCachedSource2.h
index 3a20c16..1fb2088 100644
--- a/media/libstagefright/include/NuCachedSource2.h
+++ b/media/libstagefright/include/NuCachedSource2.h
@@ -42,6 +42,9 @@ struct NuCachedSource2 : public DataSource {
size_t cachedSize();
size_t approxDataRemaining(bool *eos);
+ void suspend();
+ void clearCacheAndResume();
+
protected:
virtual ~NuCachedSource2();
@@ -61,6 +64,7 @@ private:
enum {
kWhatFetchMore = 'fetc',
kWhatRead = 'read',
+ kWhatSuspend = 'susp',
};
sp<DataSource> mSource;
@@ -78,10 +82,12 @@ private:
sp<AMessage> mAsyncResult;
bool mFetching;
int64_t mLastFetchTimeUs;
+ bool mSuspended;
void onMessageReceived(const sp<AMessage> &msg);
void onFetch();
void onRead(const sp<AMessage> &msg);
+ void onSuspend();
void fetchInternal();
ssize_t readInternal(off_t offset, void *data, size_t size);