summaryrefslogtreecommitdiffstats
path: root/media/libmedia
diff options
context:
space:
mode:
authorSteve Kondik <shade@chemlab.org>2013-02-12 22:30:27 -0800
committerSteve Kondik <shade@chemlab.org>2013-02-12 22:30:27 -0800
commit001a7b82e04646682170d4b946529ebc0b956c16 (patch)
treefb3784437f93380f21b6d69e9c819fc1305104da /media/libmedia
parentd852697190e617c43930723bbb446375394b4194 (diff)
parentf0ff908da019a44115109f1b4d1b6864b35a8a29 (diff)
downloadframeworks_av-001a7b82e04646682170d4b946529ebc0b956c16.zip
frameworks_av-001a7b82e04646682170d4b946529ebc0b956c16.tar.gz
frameworks_av-001a7b82e04646682170d4b946529ebc0b956c16.tar.bz2
Merge tag 'android-4.2.2_r1' of https://android.googlesource.com/platform/frameworks/av into 1.1
Android 4.2.2 release 1
Diffstat (limited to 'media/libmedia')
-rw-r--r--media/libmedia/IRemoteDisplay.cpp31
-rw-r--r--media/libmedia/IStreamSource.cpp3
-rw-r--r--media/libmedia/mediaplayer.cpp36
3 files changed, 58 insertions, 12 deletions
diff --git a/media/libmedia/IRemoteDisplay.cpp b/media/libmedia/IRemoteDisplay.cpp
index da25a15..1e15434 100644
--- a/media/libmedia/IRemoteDisplay.cpp
+++ b/media/libmedia/IRemoteDisplay.cpp
@@ -23,6 +23,8 @@ namespace android {
enum {
DISPOSE = IBinder::FIRST_CALL_TRANSACTION,
+ PAUSE,
+ RESUME,
};
class BpRemoteDisplay: public BpInterface<IRemoteDisplay>
@@ -33,6 +35,20 @@ public:
{
}
+ virtual status_t pause() {
+ Parcel data, reply;
+ data.writeInterfaceToken(IRemoteDisplay::getInterfaceDescriptor());
+ remote()->transact(PAUSE, data, &reply);
+ return reply.readInt32();
+ }
+
+ virtual status_t resume() {
+ Parcel data, reply;
+ data.writeInterfaceToken(IRemoteDisplay::getInterfaceDescriptor());
+ remote()->transact(RESUME, data, &reply);
+ return reply.readInt32();
+ }
+
status_t dispose()
{
Parcel data, reply;
@@ -55,6 +71,21 @@ status_t BnRemoteDisplay::onTransact(
reply->writeInt32(dispose());
return NO_ERROR;
}
+
+ case PAUSE:
+ {
+ CHECK_INTERFACE(IRemoteDisplay, data, reply);
+ reply->writeInt32(pause());
+ return OK;
+ }
+
+ case RESUME:
+ {
+ CHECK_INTERFACE(IRemoteDisplay, data, reply);
+ reply->writeInt32(resume());
+ return OK;
+ }
+
default:
return BBinder::onTransact(code, data, reply, flags);
}
diff --git a/media/libmedia/IStreamSource.cpp b/media/libmedia/IStreamSource.cpp
index 78d810d..68ffca8 100644
--- a/media/libmedia/IStreamSource.cpp
+++ b/media/libmedia/IStreamSource.cpp
@@ -32,6 +32,9 @@ const char *const IStreamListener::kKeyResumeAtPTS = "resume-at-PTS";
// static
const char *const IStreamListener::kKeyDiscontinuityMask = "discontinuity-mask";
+// static
+const char *const IStreamListener::kKeyMediaTimeUs = "media-time-us";
+
enum {
// IStreamSource
SET_LISTENER = IBinder::FIRST_CALL_TRANSACTION,
diff --git a/media/libmedia/mediaplayer.cpp b/media/libmedia/mediaplayer.cpp
index b52a37d..bbbf4b6 100644
--- a/media/libmedia/mediaplayer.cpp
+++ b/media/libmedia/mediaplayer.cpp
@@ -47,7 +47,6 @@ MediaPlayer::MediaPlayer()
ALOGV("constructor");
mListener = NULL;
mCookie = NULL;
- mDuration = -1;
mStreamType = AUDIO_STREAM_MUSIC;
mCurrentPosition = -1;
mSeekPosition = -1;
@@ -90,7 +89,6 @@ void MediaPlayer::disconnect()
// always call with lock held
void MediaPlayer::clear_l()
{
- mDuration = -1;
mCurrentPosition = -1;
mSeekPosition = -1;
mVideoWidth = mVideoHeight = 0;
@@ -395,14 +393,14 @@ status_t MediaPlayer::getCurrentPosition(int *msec)
status_t MediaPlayer::getDuration_l(int *msec)
{
- ALOGV("getDuration");
+ ALOGV("getDuration_l");
bool isValidState = (mCurrentState & (MEDIA_PLAYER_PREPARED | MEDIA_PLAYER_STARTED | MEDIA_PLAYER_PAUSED | MEDIA_PLAYER_STOPPED | MEDIA_PLAYER_PLAYBACK_COMPLETE));
if (mPlayer != 0 && isValidState) {
- status_t ret = NO_ERROR;
- if (mDuration <= 0)
- ret = mPlayer->getDuration(&mDuration);
- if (msec)
- *msec = mDuration;
+ int durationMs;
+ status_t ret = mPlayer->getDuration(&durationMs);
+ if (msec) {
+ *msec = durationMs;
+ }
return ret;
}
ALOGE("Attempt to call getDuration without a valid mediaplayer");
@@ -422,14 +420,28 @@ status_t MediaPlayer::seekTo_l(int msec)
if ( msec < 0 ) {
ALOGW("Attempt to seek to invalid position: %d", msec);
msec = 0;
- } else if ((mDuration > 0) && (msec > mDuration)) {
- ALOGW("Attempt to seek to past end of file: request = %d, EOF = %d", msec, mDuration);
- msec = mDuration;
}
+
+ int durationMs;
+ status_t err = mPlayer->getDuration(&durationMs);
+
+ if (err != OK) {
+ ALOGW("Stream has no duration and is therefore not seekable.");
+ return err;
+ }
+
+ if (msec > durationMs) {
+ ALOGW("Attempt to seek to past end of file: request = %d, "
+ "durationMs = %d",
+ msec,
+ durationMs);
+
+ msec = durationMs;
+ }
+
// cache duration
mCurrentPosition = msec;
if (mSeekPosition < 0) {
- getDuration_l(NULL);
mSeekPosition = msec;
return mPlayer->seekTo(msec);
}