diff options
author | Insun Kang <insun@google.com> | 2012-02-16 20:28:27 +0900 |
---|---|---|
committer | Insun Kang <insun@google.com> | 2012-03-15 08:36:52 +0900 |
commit | 41f3f716b07265fb355ef70e89b9d7e1ad5f0a6f (patch) | |
tree | 60a2fb8619721d5a575aef156b5ddbff0582ba98 /include | |
parent | 81fe4fbd6ba87a0be556c57c14de0b23cf51f179 (diff) | |
download | frameworks_base-41f3f716b07265fb355ef70e89b9d7e1ad5f0a6f.zip frameworks_base-41f3f716b07265fb355ef70e89b9d7e1ad5f0a6f.tar.gz frameworks_base-41f3f716b07265fb355ef70e89b9d7e1ad5f0a6f.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.h | 23 | ||||
-rw-r--r-- | include/media/stagefright/MediaDefs.h | 1 | ||||
-rw-r--r-- | include/media/stagefright/timedtext/TimedTextDriver.h | 20 |
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); }; |