MediaPlayer2: add getMediaPlayer2State
Test: MediaPlayer2 plays
Bug: 63934228
Change-Id: I1a5290de44e0ba78fa6adc055ffdd18a4f259f15
diff --git a/media/libmediaplayer2/include/mediaplayer2/MediaPlayer2Types.h b/media/libmediaplayer2/include/mediaplayer2/MediaPlayer2Types.h
index 260c7ed..3905b55 100644
--- a/media/libmediaplayer2/include/mediaplayer2/MediaPlayer2Types.h
+++ b/media/libmediaplayer2/include/mediaplayer2/MediaPlayer2Types.h
@@ -148,7 +148,16 @@
MEDIA2_INFO_TIMED_TEXT_ERROR = 900,
};
-enum media_player2_states {
+// Do not change these values without updating their counterparts in MediaPlayer2.java
+enum mediaplayer2_states {
+ MEDIAPLAYER2_STATE_IDLE = 1,
+ MEDIAPLAYER2_STATE_PREPARED = 2,
+ MEDIAPLAYER2_STATE_PLAYING = 3,
+ MEDIAPLAYER2_STATE_PAUSED = 4,
+ MEDIAPLAYER2_STATE_ERROR = 5,
+};
+
+enum media_player2_internal_states {
MEDIA_PLAYER2_STATE_ERROR = 0,
MEDIA_PLAYER2_IDLE = 1 << 0,
MEDIA_PLAYER2_INITIALIZED = 1 << 1,
diff --git a/media/libmediaplayer2/include/mediaplayer2/mediaplayer2.h b/media/libmediaplayer2/include/mediaplayer2/mediaplayer2.h
index 3433cb1..d586192 100644
--- a/media/libmediaplayer2/include/mediaplayer2/mediaplayer2.h
+++ b/media/libmediaplayer2/include/mediaplayer2/mediaplayer2.h
@@ -68,6 +68,7 @@
status_t stop();
status_t pause();
bool isPlaying();
+ mediaplayer2_states getMediaPlayer2State();
status_t setPlaybackSettings(const AudioPlaybackRate& rate);
status_t getPlaybackSettings(AudioPlaybackRate* rate /* nonnull */);
status_t setSyncSettings(const AVSyncSettings& sync, float videoFpsHint);
@@ -145,7 +146,7 @@
mutable Mutex mLock;
Mutex mNotifyLock;
sp<MediaPlayer2Listener> mListener;
- media_player2_states mCurrentState;
+ media_player2_internal_states mCurrentState;
int64_t mCurrentPosition;
MediaPlayer2SeekMode mCurrentSeekMode;
int64_t mSeekPosition;