summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorInsun Kang <insun@google.com>2012-02-16 20:28:27 +0900
committerInsun Kang <insun@google.com>2012-03-15 08:36:52 +0900
commitf9d660a5e0196240add5daf0199f128d471e592c (patch)
treef67d9d6c7d7e22e8cedefaae1bf0e7a4872deda5 /include
parentdfaf549e3e310bc22444f4404b19f4907b24c286 (diff)
downloadframeworks_av-f9d660a5e0196240add5daf0199f128d471e592c.zip
frameworks_av-f9d660a5e0196240add5daf0199f128d471e592c.tar.gz
frameworks_av-f9d660a5e0196240add5daf0199f128d471e592c.tar.bz2
Defines MediaPlayer APIs to support multiple audio/video/timedtext
tracks. o Newly introduced APIs are (MediaPlayer): getTrackInfo() / addExternalSource() / enableTrack() / disableTrack(). o Timed text tracks are supported only, for now. o TODOs: - Define the audio/video behavior for enableTrack and disableTrack. - Refactoring AwesomePlayer / TimedTextDriver so that all types of track index can be managed in the correct order and be ready for supporting audio/video tracks. (MediaExtractor and MediaSource for text file might be necessary.) Change-Id: Idb85e1b3f2ed49a64f377d05472dd6663ce94e07
Diffstat (limited to 'include')
-rw-r--r--include/media/mediaplayer.h23
-rw-r--r--include/media/stagefright/MediaDefs.h1
-rw-r--r--include/media/stagefright/timedtext/TimedTextDriver.h20
3 files changed, 31 insertions, 13 deletions
diff --git a/include/media/mediaplayer.h b/include/media/mediaplayer.h
index 662dd13..a68ab4e 100644
--- a/include/media/mediaplayer.h
+++ b/include/media/mediaplayer.h
@@ -120,6 +120,9 @@ enum media_info_type {
MEDIA_INFO_NOT_SEEKABLE = 801,
// New media metadata is available.
MEDIA_INFO_METADATA_UPDATE = 802,
+
+ //9xx
+ MEDIA_INFO_TIMED_TEXT_ERROR = 900,
};
@@ -140,9 +143,6 @@ enum media_player_states {
// The same enum space is used for both set and get, in case there are future keys that
// can be both set and get. But as of now, all parameters are either set only or get only.
enum media_parameter_keys {
- KEY_PARAMETER_TIMED_TEXT_TRACK_INDEX = 1000, // set only
- KEY_PARAMETER_TIMED_TEXT_ADD_OUT_OF_BAND_SOURCE = 1001, // set only
-
// Streaming/buffering parameters
KEY_PARAMETER_CACHE_STAT_COLLECT_FREQ_MS = 1100, // set only
@@ -155,6 +155,23 @@ enum media_parameter_keys {
KEY_PARAMETER_PLAYBACK_RATE_PERMILLE = 1300, // set only
};
+// Keep INVOKE_ID_* in sync with MediaPlayer.java.
+enum media_player_invoke_ids {
+ INVOKE_ID_GET_TRACK_INFO = 1,
+ INVOKE_ID_ADD_EXTERNAL_SOURCE = 2,
+ INVOKE_ID_ADD_EXTERNAL_SOURCE_FD = 3,
+ INVOKE_ID_SELECT_TRACK = 4,
+ INVOKE_ID_UNSELECT_TRACK = 5,
+};
+
+// Keep MEDIA_TRACK_TYPE_* in sync with MediaPlayer.java.
+enum media_track_type {
+ MEDIA_TRACK_TYPE_UNKNOWN = 0,
+ MEDIA_TRACK_TYPE_VIDEO = 1,
+ MEDIA_TRACK_TYPE_AUDIO = 2,
+ MEDIA_TRACK_TYPE_TIMEDTEXT = 3,
+};
+
// ----------------------------------------------------------------------------
// ref-counted object for callbacks
class MediaPlayerListener: virtual public RefBase
diff --git a/include/media/stagefright/MediaDefs.h b/include/media/stagefright/MediaDefs.h
index 2eb259e..457d5d7 100644
--- a/include/media/stagefright/MediaDefs.h
+++ b/include/media/stagefright/MediaDefs.h
@@ -54,6 +54,7 @@ extern const char *MEDIA_MIMETYPE_CONTAINER_MPEG2PS;
extern const char *MEDIA_MIMETYPE_CONTAINER_WVM;
extern const char *MEDIA_MIMETYPE_TEXT_3GPP;
+extern const char *MEDIA_MIMETYPE_TEXT_SUBRIP;
} // namespace android
diff --git a/include/media/stagefright/timedtext/TimedTextDriver.h b/include/media/stagefright/timedtext/TimedTextDriver.h
index efedb6e..b9752df 100644
--- a/include/media/stagefright/timedtext/TimedTextDriver.h
+++ b/include/media/stagefright/timedtext/TimedTextDriver.h
@@ -37,26 +37,26 @@ public:
~TimedTextDriver();
- // TODO: pause-resume pair seems equivalent to stop-start pair.
- // Check if it is replaceable with stop-start.
status_t start();
- status_t stop();
status_t pause();
- status_t resume();
+ status_t selectTrack(int32_t index);
+ status_t unselectTrack(int32_t index);
status_t seekToAsync(int64_t timeUs);
status_t addInBandTextSource(const sp<MediaSource>& source);
- status_t addOutOfBandTextSource(const Parcel &request);
+ status_t addOutOfBandTextSource(const char *uri, const char *mimeType);
+ // Caller owns the file desriptor and caller is responsible for closing it.
+ status_t addOutOfBandTextSource(
+ int fd, off64_t offset, size_t length, const char *mimeType);
- status_t setTimedTextTrackIndex(int32_t index);
+ void getTrackInfo(Parcel *parcel);
private:
Mutex mLock;
enum State {
UNINITIALIZED,
- STOPPED,
PLAYING,
PAUSED,
};
@@ -67,11 +67,11 @@ private:
// Variables to be guarded by mLock.
State mState;
- Vector<sp<TimedTextSource> > mTextInBandVector;
- Vector<sp<TimedTextSource> > mTextOutOfBandVector;
+ int32_t mCurrentTrackIndex;
+ Vector<sp<TimedTextSource> > mTextSourceVector;
// -- End of variables to be guarded by mLock
- status_t setTimedTextTrackIndex_l(int32_t index);
+ status_t selectTrack_l(int32_t index);
DISALLOW_EVIL_CONSTRUCTORS(TimedTextDriver);
};