Loading include/media/IMediaPlayer.h +2 −0 Original line number Diff line number Diff line Loading @@ -51,6 +51,8 @@ public: virtual status_t setVolume(float leftVolume, float rightVolume) = 0; virtual status_t setAuxEffectSendLevel(float level) = 0; virtual status_t attachAuxEffect(int effectId) = 0; virtual status_t setParameter(int key, const Parcel& request) = 0; virtual status_t getParameter(int key, Parcel* reply) = 0; // Invoke a generic method on the player by using opaque parcels // for the request and reply. Loading include/media/MediaPlayerInterface.h +2 −0 Original line number Diff line number Diff line Loading @@ -132,6 +132,8 @@ public: virtual status_t reset() = 0; virtual status_t setLooping(int loop) = 0; virtual player_type playerType() = 0; virtual status_t setParameter(int key, const Parcel &request) = 0; virtual status_t getParameter(int key, Parcel *reply) = 0; // Invoke a generic method on the player by using opaque parcels // for the request and reply. Loading include/media/mediaplayer.h +3 −0 Original line number Diff line number Diff line Loading @@ -177,6 +177,9 @@ public: int getAudioSessionId(); status_t setAuxEffectSendLevel(float level); status_t attachAuxEffect(int effectId); status_t setParameter(int key, const Parcel& request); status_t getParameter(int key, Parcel* reply); private: void clear_l(); status_t seekTo_l(int msec); Loading media/java/android/media/MediaPlayer.java +78 −0 Original line number Diff line number Diff line Loading @@ -1227,6 +1227,84 @@ public class MediaPlayer */ public native void attachAuxEffect(int effectId); /** * Sets the parameter indicated by key. * @param key key indicates the parameter to be set. * @param value value of the parameter to be set. * @return true if the parameter is set successfully, false otherwise * {@hide} */ public native boolean setParameter(int key, Parcel value); /** * Sets the parameter indicated by key. * @param key key indicates the parameter to be set. * @param value value of the parameter to be set. * @return true if the parameter is set successfully, false otherwise * {@hide} */ public boolean setParameter(int key, String value) { Parcel p = Parcel.obtain(); p.writeString(value); return setParameter(key, p); } /** * Sets the parameter indicated by key. * @param key key indicates the parameter to be set. * @param value value of the parameter to be set. * @return true if the parameter is set successfully, false otherwise * {@hide} */ public boolean setParameter(int key, int value) { Parcel p = Parcel.obtain(); p.writeInt(value); return setParameter(key, p); } /** * Gets the value of the parameter indicated by key. * @param key key indicates the parameter to get. * @param reply value of the parameter to get. */ private native void getParameter(int key, Parcel reply); /** * Gets the value of the parameter indicated by key. * @param key key indicates the parameter to get. * @return value of the parameter. * {@hide} */ public Parcel getParcelParameter(int key) { Parcel p = Parcel.obtain(); getParameter(key, p); return p; } /** * Gets the value of the parameter indicated by key. * @param key key indicates the parameter to get. * @return value of the parameter. * {@hide} */ public String getStringParameter(int key) { Parcel p = Parcel.obtain(); getParameter(key, p); return p.readString(); } /** * Gets the value of the parameter indicated by key. * @param key key indicates the parameter to get. * @return value of the parameter. * {@hide} */ public int getIntParameter(int key) { Parcel p = Parcel.obtain(); getParameter(key, p); return p.readInt(); } /** * Sets the send level of the player to the attached auxiliary effect * {@see #attachAuxEffect(int)}. The level value range is 0 to 1.0. Loading media/jni/android_media_MediaPlayer.cpp +35 −0 Original line number Diff line number Diff line Loading @@ -814,6 +814,39 @@ android_media_MediaPlayer_pullBatteryData(JNIEnv *env, jobject thiz, jobject jav return service->pullBatteryData(reply); } static jboolean android_media_MediaPlayer_setParameter(JNIEnv *env, jobject thiz, jint key, jobject java_request) { LOGV("setParameter: key %d", key); sp<MediaPlayer> mp = getMediaPlayer(env, thiz); if (mp == NULL ) { jniThrowException(env, "java/lang/IllegalStateException", NULL); return false; } Parcel *request = parcelForJavaObject(env, java_request); status_t err = mp->setParameter(key, *request); if (err == OK) { return true; } else { return false; } } static void android_media_MediaPlayer_getParameter(JNIEnv *env, jobject thiz, jint key, jobject java_reply) { LOGV("getParameter: key %d", key); sp<MediaPlayer> mp = getMediaPlayer(env, thiz); if (mp == NULL ) { jniThrowException(env, "java/lang/IllegalStateException", NULL); return; } Parcel *reply = parcelForJavaObject(env, java_reply); process_media_player_call(env, thiz, mp->getParameter(key, reply), NULL, NULL ); } // ---------------------------------------------------------------------------- static JNINativeMethod gMethods[] = { Loading Loading @@ -850,6 +883,8 @@ static JNINativeMethod gMethods[] = { {"setAuxEffectSendLevel", "(F)V", (void *)android_media_MediaPlayer_setAuxEffectSendLevel}, {"attachAuxEffect", "(I)V", (void *)android_media_MediaPlayer_attachAuxEffect}, {"native_pullBatteryData", "(Landroid/os/Parcel;)I", (void *)android_media_MediaPlayer_pullBatteryData}, {"setParameter", "(ILandroid/os/Parcel;)Z", (void *)android_media_MediaPlayer_setParameter}, {"getParameter", "(ILandroid/os/Parcel;)V", (void *)android_media_MediaPlayer_getParameter}, }; static const char* const kClassPathName = "android/media/MediaPlayer"; Loading Loading
include/media/IMediaPlayer.h +2 −0 Original line number Diff line number Diff line Loading @@ -51,6 +51,8 @@ public: virtual status_t setVolume(float leftVolume, float rightVolume) = 0; virtual status_t setAuxEffectSendLevel(float level) = 0; virtual status_t attachAuxEffect(int effectId) = 0; virtual status_t setParameter(int key, const Parcel& request) = 0; virtual status_t getParameter(int key, Parcel* reply) = 0; // Invoke a generic method on the player by using opaque parcels // for the request and reply. Loading
include/media/MediaPlayerInterface.h +2 −0 Original line number Diff line number Diff line Loading @@ -132,6 +132,8 @@ public: virtual status_t reset() = 0; virtual status_t setLooping(int loop) = 0; virtual player_type playerType() = 0; virtual status_t setParameter(int key, const Parcel &request) = 0; virtual status_t getParameter(int key, Parcel *reply) = 0; // Invoke a generic method on the player by using opaque parcels // for the request and reply. Loading
include/media/mediaplayer.h +3 −0 Original line number Diff line number Diff line Loading @@ -177,6 +177,9 @@ public: int getAudioSessionId(); status_t setAuxEffectSendLevel(float level); status_t attachAuxEffect(int effectId); status_t setParameter(int key, const Parcel& request); status_t getParameter(int key, Parcel* reply); private: void clear_l(); status_t seekTo_l(int msec); Loading
media/java/android/media/MediaPlayer.java +78 −0 Original line number Diff line number Diff line Loading @@ -1227,6 +1227,84 @@ public class MediaPlayer */ public native void attachAuxEffect(int effectId); /** * Sets the parameter indicated by key. * @param key key indicates the parameter to be set. * @param value value of the parameter to be set. * @return true if the parameter is set successfully, false otherwise * {@hide} */ public native boolean setParameter(int key, Parcel value); /** * Sets the parameter indicated by key. * @param key key indicates the parameter to be set. * @param value value of the parameter to be set. * @return true if the parameter is set successfully, false otherwise * {@hide} */ public boolean setParameter(int key, String value) { Parcel p = Parcel.obtain(); p.writeString(value); return setParameter(key, p); } /** * Sets the parameter indicated by key. * @param key key indicates the parameter to be set. * @param value value of the parameter to be set. * @return true if the parameter is set successfully, false otherwise * {@hide} */ public boolean setParameter(int key, int value) { Parcel p = Parcel.obtain(); p.writeInt(value); return setParameter(key, p); } /** * Gets the value of the parameter indicated by key. * @param key key indicates the parameter to get. * @param reply value of the parameter to get. */ private native void getParameter(int key, Parcel reply); /** * Gets the value of the parameter indicated by key. * @param key key indicates the parameter to get. * @return value of the parameter. * {@hide} */ public Parcel getParcelParameter(int key) { Parcel p = Parcel.obtain(); getParameter(key, p); return p; } /** * Gets the value of the parameter indicated by key. * @param key key indicates the parameter to get. * @return value of the parameter. * {@hide} */ public String getStringParameter(int key) { Parcel p = Parcel.obtain(); getParameter(key, p); return p.readString(); } /** * Gets the value of the parameter indicated by key. * @param key key indicates the parameter to get. * @return value of the parameter. * {@hide} */ public int getIntParameter(int key) { Parcel p = Parcel.obtain(); getParameter(key, p); return p.readInt(); } /** * Sets the send level of the player to the attached auxiliary effect * {@see #attachAuxEffect(int)}. The level value range is 0 to 1.0. Loading
media/jni/android_media_MediaPlayer.cpp +35 −0 Original line number Diff line number Diff line Loading @@ -814,6 +814,39 @@ android_media_MediaPlayer_pullBatteryData(JNIEnv *env, jobject thiz, jobject jav return service->pullBatteryData(reply); } static jboolean android_media_MediaPlayer_setParameter(JNIEnv *env, jobject thiz, jint key, jobject java_request) { LOGV("setParameter: key %d", key); sp<MediaPlayer> mp = getMediaPlayer(env, thiz); if (mp == NULL ) { jniThrowException(env, "java/lang/IllegalStateException", NULL); return false; } Parcel *request = parcelForJavaObject(env, java_request); status_t err = mp->setParameter(key, *request); if (err == OK) { return true; } else { return false; } } static void android_media_MediaPlayer_getParameter(JNIEnv *env, jobject thiz, jint key, jobject java_reply) { LOGV("getParameter: key %d", key); sp<MediaPlayer> mp = getMediaPlayer(env, thiz); if (mp == NULL ) { jniThrowException(env, "java/lang/IllegalStateException", NULL); return; } Parcel *reply = parcelForJavaObject(env, java_reply); process_media_player_call(env, thiz, mp->getParameter(key, reply), NULL, NULL ); } // ---------------------------------------------------------------------------- static JNINativeMethod gMethods[] = { Loading Loading @@ -850,6 +883,8 @@ static JNINativeMethod gMethods[] = { {"setAuxEffectSendLevel", "(F)V", (void *)android_media_MediaPlayer_setAuxEffectSendLevel}, {"attachAuxEffect", "(I)V", (void *)android_media_MediaPlayer_attachAuxEffect}, {"native_pullBatteryData", "(Landroid/os/Parcel;)I", (void *)android_media_MediaPlayer_pullBatteryData}, {"setParameter", "(ILandroid/os/Parcel;)Z", (void *)android_media_MediaPlayer_setParameter}, {"getParameter", "(ILandroid/os/Parcel;)V", (void *)android_media_MediaPlayer_getParameter}, }; static const char* const kClassPathName = "android/media/MediaPlayer"; Loading