diff options
author | The Android Open Source Project <initial-contribution@android.com> | 2009-03-11 12:11:56 -0700 |
---|---|---|
committer | The Android Open Source Project <initial-contribution@android.com> | 2009-03-11 12:11:56 -0700 |
commit | 65e731f393f704eedab6fbe0af7f8a580c8d4617 (patch) | |
tree | 4130ea5fa8057abe670e7eded32794615b53b49f | |
parent | 8365529381f6284f2d59dcc38e26f73adeec9c67 (diff) | |
download | frameworks_av-65e731f393f704eedab6fbe0af7f8a580c8d4617.zip frameworks_av-65e731f393f704eedab6fbe0af7f8a580c8d4617.tar.gz frameworks_av-65e731f393f704eedab6fbe0af7f8a580c8d4617.tar.bz2 |
auto import from //branches/cupcake/...@137873
-rw-r--r-- | include/media/PVPlayer.h | 4 | ||||
-rw-r--r-- | include/media/mediaplayer.h | 68 | ||||
-rw-r--r-- | media/libmedia/mediaplayer.cpp | 13 | ||||
-rw-r--r-- | media/libmedia/mediarecorder.cpp | 5 |
4 files changed, 83 insertions, 7 deletions
diff --git a/include/media/PVPlayer.h b/include/media/PVPlayer.h index 6d98852..8122df6 100644 --- a/include/media/PVPlayer.h +++ b/include/media/PVPlayer.h @@ -53,8 +53,8 @@ public: virtual status_t setLooping(int loop); virtual player_type playerType() { return PV_PLAYER; } - // make available to PlayerDriver - void sendEvent(int msg, int ext1=0, int ext2=0) { MediaPlayerBase::sendEvent(msg, ext1, ext2); } + // make available to PlayerDriver + void sendEvent(int msg, int ext1=0, int ext2=0) { MediaPlayerBase::sendEvent(msg, ext1, ext2); } private: static void do_nothing(status_t s, void *cookie, bool cancelled) { } diff --git a/include/media/mediaplayer.h b/include/media/mediaplayer.h index 7288445..58906d1 100644 --- a/include/media/mediaplayer.h +++ b/include/media/mediaplayer.h @@ -34,11 +34,72 @@ enum media_event_type { MEDIA_SEEK_COMPLETE = 4, MEDIA_SET_VIDEO_SIZE = 5, MEDIA_ERROR = 100, + MEDIA_INFO = 200, }; -typedef int media_error_type; -const media_error_type MEDIA_ERROR_UNKNOWN = 1; -const media_error_type MEDIA_ERROR_SERVER_DIED = 100; +// Generic error codes for the media player framework. Errors are fatal, the +// playback must abort. +// +// Errors are communicated back to the client using the +// MediaPlayerListener::notify method defined below. +// In this situation, 'notify' is invoked with the following: +// 'msg' is set to MEDIA_ERROR. +// 'ext1' should be a value from the enum media_error_type. +// 'ext2' contains an implementation dependant error code to provide +// more details. Should default to 0 when not used. +// +// The codes are distributed as follow: +// 0xx: Reserved +// 1xx: Android Player errors. Something went wrong inside the MediaPlayer. +// 2xx: Media errors (e.g Codec not supported). There is a problem with the +// media itself. +// 3xx: Runtime errors. Some extraordinary condition arose making the playback +// impossible. +// +enum media_error_type { + // 0xx + MEDIA_ERROR_UNKNOWN = 1, + // 1xx + MEDIA_ERROR_SERVER_DIED = 100, + // 2xx + MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK = 200, + // 3xx +}; + + +// Info and warning codes for the media player framework. These are non fatal, +// the playback is going on but there might be some user visible issues. +// +// Info and warning messages are communicated back to the client using the +// MediaPlayerListener::notify method defined below. In this situation, +// 'notify' is invoked with the following: +// 'msg' is set to MEDIA_INFO. +// 'ext1' should be a value from the enum media_info_type. +// 'ext2' contains an implementation dependant error code to provide +// more details. Should default to 0 when not used. +// +// The codes are distributed as follow: +// 0xx: Reserved +// 7xx: Android Player info/warning (e.g player lagging behind.) +// 8xx: Media info/warning (e.g media badly interleaved.) +// +enum media_info_type { + // 0xx + MEDIA_INFO_UNKNOWN = 1, + // 7xx + // The video is too complex for the decoder: it can't decode frames fast + // enough. Possibly only the audio plays fine at this stage. + MEDIA_INFO_VIDEO_TRACK_LAGGING = 700, + // 8xx + // Bad interleaving means that a media has been improperly interleaved or not + // interleaved at all, e.g has all the video samples first then all the audio + // ones. Video is playing but a lot of disk seek may be happening. + MEDIA_INFO_BAD_INTERLEAVING = 800, + // The media is not seekable (e.g live stream). + MEDIA_INFO_NOT_SEEKABLE = 801, +}; + + enum media_player_states { MEDIA_PLAYER_STATE_ERROR = 0, @@ -141,4 +202,3 @@ private: }; // namespace android #endif // ANDROID_MEDIAPLAYER_H - diff --git a/media/libmedia/mediaplayer.cpp b/media/libmedia/mediaplayer.cpp index bd8579c..6b40412 100644 --- a/media/libmedia/mediaplayer.cpp +++ b/media/libmedia/mediaplayer.cpp @@ -215,6 +215,10 @@ status_t MediaPlayer::prepareAsync_l() return INVALID_OPERATION; } +// TODO: In case of error, prepareAsync provides the caller with 2 error codes, +// one defined in the Android framework and one provided by the implementation +// that generated the error. The sync version of prepare returns only 1 error +// code. status_t MediaPlayer::prepare() { LOGV("prepare"); @@ -512,7 +516,9 @@ void MediaPlayer::notify(int msg, int ext1, int ext2) } break; case MEDIA_ERROR: - // Always log errors + // Always log errors. + // ext1: Media framework error code. + // ext2: Implementation dependant error code. LOGE("error (%d, %d)", ext1, ext2); mCurrentState = MEDIA_PLAYER_STATE_ERROR; if (mPrepareSync) @@ -524,6 +530,11 @@ void MediaPlayer::notify(int msg, int ext1, int ext2) send = false; } break; + case MEDIA_INFO: + // ext1: Media framework error code. + // ext2: Implementation dependant error code. + LOGW("info/warning (%d, %d)", ext1, ext2); + break; case MEDIA_SEEK_COMPLETE: LOGV("Received seek complete"); if (mSeekPosition != mCurrentPosition) { diff --git a/media/libmedia/mediarecorder.cpp b/media/libmedia/mediarecorder.cpp index 5eba0ef..572b1e7 100644 --- a/media/libmedia/mediarecorder.cpp +++ b/media/libmedia/mediarecorder.cpp @@ -456,6 +456,11 @@ status_t MediaRecorder::stop() mCurrentState = MEDIA_RECORDER_ERROR; return ret; } + + // FIXME: + // stop and reset are semantically different. + // We treat them the same for now, and will change this in the future. + doCleanUp(); mCurrentState = MEDIA_RECORDER_IDLE; return ret; } |