diff options
author | Andreas Huber <andih@google.com> | 2010-12-15 15:17:42 -0800 |
---|---|---|
committer | Andreas Huber <andih@google.com> | 2010-12-15 15:18:26 -0800 |
commit | f933441648ef6a71dee783d733aac17b9508b452 (patch) | |
tree | 240f8068edb362cbea579659a963bbb029a2bac0 /include/media/stagefright/foundation | |
parent | 60c5b57edd3c8f4bdf6b38cf5b8a193ba770bb72 (diff) | |
download | frameworks_av-f933441648ef6a71dee783d733aac17b9508b452.zip frameworks_av-f933441648ef6a71dee783d733aac17b9508b452.tar.gz frameworks_av-f933441648ef6a71dee783d733aac17b9508b452.tar.bz2 |
Initial support for a true streaming player for mpeg2 transport streams.
Change-Id: I153eec439d260a5524b21270e16d36940ec3161a
Diffstat (limited to 'include/media/stagefright/foundation')
-rw-r--r-- | include/media/stagefright/foundation/ADebug.h | 11 | ||||
-rw-r--r-- | include/media/stagefright/foundation/AHierarchicalStateMachine.h | 49 | ||||
-rw-r--r-- | include/media/stagefright/foundation/AMessage.h | 3 |
3 files changed, 58 insertions, 5 deletions
diff --git a/include/media/stagefright/foundation/ADebug.h b/include/media/stagefright/foundation/ADebug.h index 69021d8..eb5e494 100644 --- a/include/media/stagefright/foundation/ADebug.h +++ b/include/media/stagefright/foundation/ADebug.h @@ -32,6 +32,7 @@ namespace android { #define CHECK(condition) \ LOG_ALWAYS_FATAL_IF( \ !(condition), \ + "%s", \ __FILE__ ":" LITERAL_TO_STRING(__LINE__) \ " CHECK(" #condition ") failed.") @@ -58,10 +59,12 @@ MAKE_COMPARATOR(GT,>) do { \ AString ___res = Compare_##suffix(x, y); \ if (!___res.empty()) { \ - LOG_ALWAYS_FATAL( \ - __FILE__ ":" LITERAL_TO_STRING(__LINE__) \ - " CHECK_" #suffix "( " #x "," #y ") failed: %s", \ - ___res.c_str()); \ + AString ___full = \ + __FILE__ ":" LITERAL_TO_STRING(__LINE__) \ + " CHECK_" #suffix "( " #x "," #y ") failed: "; \ + ___full.append(___res); \ + \ + LOG_ALWAYS_FATAL("%s", ___full.c_str()); \ } \ } while (false) diff --git a/include/media/stagefright/foundation/AHierarchicalStateMachine.h b/include/media/stagefright/foundation/AHierarchicalStateMachine.h new file mode 100644 index 0000000..b5786fb --- /dev/null +++ b/include/media/stagefright/foundation/AHierarchicalStateMachine.h @@ -0,0 +1,49 @@ +#ifndef A_HIERARCHICAL_STATE_MACHINE_H_ + +#define A_HIERARCHICAL_STATE_MACHINE_H_ + +#include <media/stagefright/foundation/AHandler.h> + +namespace android { + +struct AState : public RefBase { + AState(const sp<AState> &parentState = NULL); + + sp<AState> parentState(); + +protected: + virtual ~AState(); + + virtual void stateEntered(); + virtual void stateExited(); + + virtual bool onMessageReceived(const sp<AMessage> &msg) = 0; + +private: + friend struct AHierarchicalStateMachine; + + sp<AState> mParentState; + + DISALLOW_EVIL_CONSTRUCTORS(AState); +}; + +struct AHierarchicalStateMachine : public AHandler { + AHierarchicalStateMachine(); + +protected: + virtual ~AHierarchicalStateMachine(); + + virtual void onMessageReceived(const sp<AMessage> &msg); + + // Only to be called in response to a message. + void changeState(const sp<AState> &state); + +private: + sp<AState> mState; + + DISALLOW_EVIL_CONSTRUCTORS(AHierarchicalStateMachine); +}; + +} // namespace android + +#endif // A_HIERARCHICAL_STATE_MACHINE_H_ diff --git a/include/media/stagefright/foundation/AMessage.h b/include/media/stagefright/foundation/AMessage.h index 2fbdddc..941f6b9 100644 --- a/include/media/stagefright/foundation/AMessage.h +++ b/include/media/stagefright/foundation/AMessage.h @@ -40,6 +40,8 @@ struct AMessage : public RefBase { void setTarget(ALooper::handler_id target); ALooper::handler_id target() const; + void clear(); + void setInt32(const char *name, int32_t value); void setInt64(const char *name, int64_t value); void setSize(const char *name, size_t value); @@ -106,7 +108,6 @@ private: Item mItems[kMaxNumItems]; size_t mNumItems; - void clear(); Item *allocateItem(const char *name); void freeItem(Item *item); const Item *findItem(const char *name, Type type) const; |