MediaSync: address API review.
Rename *Settings to *Params;
Remove size parameter from MediaSync.queueAudio();
Bug: 20887706
Change-Id: I4c572da92ada51458031a482b96b3f624224e608
diff --git a/media/jni/Android.mk b/media/jni/Android.mk
index dbb53b4..51d0140 100644
--- a/media/jni/Android.mk
+++ b/media/jni/Android.mk
@@ -20,7 +20,7 @@
android_media_MediaScanner.cpp \
android_media_MediaSync.cpp \
android_media_ResampleInputStream.cpp \
- android_media_SyncSettings.cpp \
+ android_media_SyncParams.cpp \
android_media_Utils.cpp \
android_mtp_MtpDatabase.cpp \
android_mtp_MtpDevice.cpp \
diff --git a/media/jni/android_media_MediaPlayer.cpp b/media/jni/android_media_MediaPlayer.cpp
index 5b55a61..d8041f4 100644
--- a/media/jni/android_media_MediaPlayer.cpp
+++ b/media/jni/android_media_MediaPlayer.cpp
@@ -38,8 +38,8 @@
#include "utils/KeyedVector.h"
#include "utils/String8.h"
#include "android_media_MediaDataSource.h"
-#include "android_media_PlaybackSettings.h"
-#include "android_media_SyncSettings.h"
+#include "android_media_PlaybackParams.h"
+#include "android_media_SyncParams.h"
#include "android_media_Utils.h"
#include "android_os_Parcel.h"
@@ -69,8 +69,8 @@
};
static fields_t fields;
-static PlaybackSettings::fields_t gPlaybackSettingsFields;
-static SyncSettings::fields_t gSyncSettingsFields;
+static PlaybackParams::fields_t gPlaybackParamsFields;
+static SyncParams::fields_t gSyncParamsFields;
static Mutex sLock;
@@ -428,7 +428,7 @@
}
static void
-android_media_MediaPlayer_setPlaybackSettings(JNIEnv *env, jobject thiz, jobject settings)
+android_media_MediaPlayer_setPlaybackParams(JNIEnv *env, jobject thiz, jobject params)
{
sp<MediaPlayer> mp = getMediaPlayer(env, thiz);
if (mp == NULL) {
@@ -436,32 +436,32 @@
return;
}
- PlaybackSettings pbs;
- pbs.fillFromJobject(env, gPlaybackSettingsFields, settings);
- ALOGV("setPlaybackSettings: %d:%f %d:%f %d:%u %d:%u",
- pbs.speedSet, pbs.audioRate.mSpeed,
- pbs.pitchSet, pbs.audioRate.mPitch,
- pbs.audioFallbackModeSet, pbs.audioRate.mFallbackMode,
- pbs.audioStretchModeSet, pbs.audioRate.mStretchMode);
+ PlaybackParams pbp;
+ pbp.fillFromJobject(env, gPlaybackParamsFields, params);
+ ALOGV("setPlaybackParams: %d:%f %d:%f %d:%u %d:%u",
+ pbp.speedSet, pbp.audioRate.mSpeed,
+ pbp.pitchSet, pbp.audioRate.mPitch,
+ pbp.audioFallbackModeSet, pbp.audioRate.mFallbackMode,
+ pbp.audioStretchModeSet, pbp.audioRate.mStretchMode);
AudioPlaybackRate rate;
status_t err = mp->getPlaybackSettings(&rate);
if (err == OK) {
bool updatedRate = false;
- if (pbs.speedSet) {
- rate.mSpeed = pbs.audioRate.mSpeed;
+ if (pbp.speedSet) {
+ rate.mSpeed = pbp.audioRate.mSpeed;
updatedRate = true;
}
- if (pbs.pitchSet) {
- rate.mPitch = pbs.audioRate.mPitch;
+ if (pbp.pitchSet) {
+ rate.mPitch = pbp.audioRate.mPitch;
updatedRate = true;
}
- if (pbs.audioFallbackModeSet) {
- rate.mFallbackMode = pbs.audioRate.mFallbackMode;
+ if (pbp.audioFallbackModeSet) {
+ rate.mFallbackMode = pbp.audioRate.mFallbackMode;
updatedRate = true;
}
- if (pbs.audioStretchModeSet) {
- rate.mStretchMode = pbs.audioRate.mStretchMode;
+ if (pbp.audioStretchModeSet) {
+ rate.mStretchMode = pbp.audioRate.mStretchMode;
updatedRate = true;
}
if (updatedRate) {
@@ -474,7 +474,7 @@
}
static jobject
-android_media_MediaPlayer_getPlaybackSettings(JNIEnv *env, jobject thiz)
+android_media_MediaPlayer_getPlaybackParams(JNIEnv *env, jobject thiz)
{
sp<MediaPlayer> mp = getMediaPlayer(env, thiz);
if (mp == NULL) {
@@ -482,24 +482,24 @@
return NULL;
}
- PlaybackSettings pbs;
- AudioPlaybackRate &audioRate = pbs.audioRate;
+ PlaybackParams pbp;
+ AudioPlaybackRate &audioRate = pbp.audioRate;
process_media_player_call(
env, thiz, mp->getPlaybackSettings(&audioRate),
"java/lang/IllegalStateException", "unexpected error");
ALOGV("getPlaybackSettings: %f %f %d %d",
audioRate.mSpeed, audioRate.mPitch, audioRate.mFallbackMode, audioRate.mStretchMode);
- pbs.speedSet = true;
- pbs.pitchSet = true;
- pbs.audioFallbackModeSet = true;
- pbs.audioStretchModeSet = true;
+ pbp.speedSet = true;
+ pbp.pitchSet = true;
+ pbp.audioFallbackModeSet = true;
+ pbp.audioStretchModeSet = true;
- return pbs.asJobject(env, gPlaybackSettingsFields);
+ return pbp.asJobject(env, gPlaybackParamsFields);
}
static void
-android_media_MediaPlayer_setSyncSettings(JNIEnv *env, jobject thiz, jobject settings)
+android_media_MediaPlayer_setSyncParams(JNIEnv *env, jobject thiz, jobject params)
{
sp<MediaPlayer> mp = getMediaPlayer(env, thiz);
if (mp == NULL) {
@@ -507,33 +507,33 @@
return;
}
- SyncSettings scs;
- scs.fillFromJobject(env, gSyncSettingsFields, settings);
- ALOGV("setSyncSettings: %d:%d %d:%d %d:%f %d:%f",
- scs.syncSourceSet, scs.sync.mSource,
- scs.audioAdjustModeSet, scs.sync.mAudioAdjustMode,
- scs.toleranceSet, scs.sync.mTolerance,
- scs.frameRateSet, scs.frameRate);
+ SyncParams scp;
+ scp.fillFromJobject(env, gSyncParamsFields, params);
+ ALOGV("setSyncParams: %d:%d %d:%d %d:%f %d:%f",
+ scp.syncSourceSet, scp.sync.mSource,
+ scp.audioAdjustModeSet, scp.sync.mAudioAdjustMode,
+ scp.toleranceSet, scp.sync.mTolerance,
+ scp.frameRateSet, scp.frameRate);
AVSyncSettings avsync;
float videoFrameRate;
status_t err = mp->getSyncSettings(&avsync, &videoFrameRate);
if (err == OK) {
- bool updatedSync = scs.frameRateSet;
- if (scs.syncSourceSet) {
- avsync.mSource = scs.sync.mSource;
+ bool updatedSync = scp.frameRateSet;
+ if (scp.syncSourceSet) {
+ avsync.mSource = scp.sync.mSource;
updatedSync = true;
}
- if (scs.audioAdjustModeSet) {
- avsync.mAudioAdjustMode = scs.sync.mAudioAdjustMode;
+ if (scp.audioAdjustModeSet) {
+ avsync.mAudioAdjustMode = scp.sync.mAudioAdjustMode;
updatedSync = true;
}
- if (scs.toleranceSet) {
- avsync.mTolerance = scs.sync.mTolerance;
+ if (scp.toleranceSet) {
+ avsync.mTolerance = scp.sync.mTolerance;
updatedSync = true;
}
if (updatedSync) {
- err = mp->setSyncSettings(avsync, scs.frameRateSet ? scs.frameRate : -1.f);
+ err = mp->setSyncSettings(avsync, scp.frameRateSet ? scp.frameRate : -1.f);
}
}
process_media_player_call(
@@ -542,7 +542,7 @@
}
static jobject
-android_media_MediaPlayer_getSyncSettings(JNIEnv *env, jobject thiz)
+android_media_MediaPlayer_getSyncParams(JNIEnv *env, jobject thiz)
{
sp<MediaPlayer> mp = getMediaPlayer(env, thiz);
if (mp == NULL) {
@@ -550,30 +550,30 @@
return NULL;
}
- SyncSettings scs;
- scs.frameRate = -1.f;
+ SyncParams scp;
+ scp.frameRate = -1.f;
process_media_player_call(
- env, thiz, mp->getSyncSettings(&scs.sync, &scs.frameRate),
+ env, thiz, mp->getSyncSettings(&scp.sync, &scp.frameRate),
"java/lang/IllegalStateException", "unexpected error");
ALOGV("getSyncSettings: %d %d %f %f",
- scs.sync.mSource, scs.sync.mAudioAdjustMode, scs.sync.mTolerance, scs.frameRate);
+ scp.sync.mSource, scp.sync.mAudioAdjustMode, scp.sync.mTolerance, scp.frameRate);
- // sanity check settings
- if (scs.sync.mSource >= AVSYNC_SOURCE_MAX
- || scs.sync.mAudioAdjustMode >= AVSYNC_AUDIO_ADJUST_MODE_MAX
- || scs.sync.mTolerance < 0.f
- || scs.sync.mTolerance >= AVSYNC_TOLERANCE_MAX) {
+ // sanity check params
+ if (scp.sync.mSource >= AVSYNC_SOURCE_MAX
+ || scp.sync.mAudioAdjustMode >= AVSYNC_AUDIO_ADJUST_MODE_MAX
+ || scp.sync.mTolerance < 0.f
+ || scp.sync.mTolerance >= AVSYNC_TOLERANCE_MAX) {
jniThrowException(env, "java/lang/IllegalStateException", NULL);
return NULL;
}
- scs.syncSourceSet = true;
- scs.audioAdjustModeSet = true;
- scs.toleranceSet = true;
- scs.frameRateSet = scs.frameRate >= 0.f;
+ scp.syncSourceSet = true;
+ scp.audioAdjustModeSet = true;
+ scp.toleranceSet = true;
+ scp.frameRateSet = scp.frameRate >= 0.f;
- return scs.asJobject(env, gSyncSettingsFields);
+ return scp.asJobject(env, gSyncParamsFields);
}
static void
@@ -860,8 +860,8 @@
env->DeleteLocalRef(clazz);
- gPlaybackSettingsFields.init(env);
- gSyncSettingsFields.init(env);
+ gPlaybackParamsFields.init(env);
+ gSyncParamsFields.init(env);
}
static void
@@ -1050,10 +1050,10 @@
{"_stop", "()V", (void *)android_media_MediaPlayer_stop},
{"getVideoWidth", "()I", (void *)android_media_MediaPlayer_getVideoWidth},
{"getVideoHeight", "()I", (void *)android_media_MediaPlayer_getVideoHeight},
- {"setPlaybackSettings", "(Landroid/media/PlaybackSettings;)V", (void *)android_media_MediaPlayer_setPlaybackSettings},
- {"getPlaybackSettings", "()Landroid/media/PlaybackSettings;", (void *)android_media_MediaPlayer_getPlaybackSettings},
- {"setSyncSettings", "(Landroid/media/SyncSettings;)V", (void *)android_media_MediaPlayer_setSyncSettings},
- {"getSyncSettings", "()Landroid/media/SyncSettings;", (void *)android_media_MediaPlayer_getSyncSettings},
+ {"setPlaybackParams", "(Landroid/media/PlaybackParams;)V", (void *)android_media_MediaPlayer_setPlaybackParams},
+ {"getPlaybackParams", "()Landroid/media/PlaybackParams;", (void *)android_media_MediaPlayer_getPlaybackParams},
+ {"setSyncParams", "(Landroid/media/SyncParams;)V", (void *)android_media_MediaPlayer_setSyncParams},
+ {"getSyncParams", "()Landroid/media/SyncParams;", (void *)android_media_MediaPlayer_getSyncParams},
{"seekTo", "(I)V", (void *)android_media_MediaPlayer_seekTo},
{"_pause", "()V", (void *)android_media_MediaPlayer_pause},
{"isPlaying", "()Z", (void *)android_media_MediaPlayer_isPlaying},
diff --git a/media/jni/android_media_MediaSync.cpp b/media/jni/android_media_MediaSync.cpp
index 5c18901..8e0ed64 100644
--- a/media/jni/android_media_MediaSync.cpp
+++ b/media/jni/android_media_MediaSync.cpp
@@ -21,8 +21,8 @@
#include "android_media_MediaSync.h"
#include "android_media_AudioTrack.h"
-#include "android_media_PlaybackSettings.h"
-#include "android_media_SyncSettings.h"
+#include "android_media_PlaybackParams.h"
+#include "android_media_SyncParams.h"
#include "android_runtime/AndroidRuntime.h"
#include "android_runtime/android_view_Surface.h"
#include "jni.h"
@@ -49,8 +49,8 @@
};
static fields_t gFields;
-static PlaybackSettings::fields_t gPlaybackSettingsFields;
-static SyncSettings::fields_t gSyncSettingsFields;
+static PlaybackParams::fields_t gPlaybackParamsFields;
+static SyncParams::fields_t gSyncParamsFields;
////////////////////////////////////////////////////////////////////////////////
@@ -78,20 +78,20 @@
return mSync->getMediaClock();
}
-status_t JMediaSync::setPlaybackSettings(const AudioPlaybackRate& rate) {
+status_t JMediaSync::setPlaybackParams(const AudioPlaybackRate& rate) {
return mSync->setPlaybackSettings(rate);
}
-void JMediaSync::getPlaybackSettings(AudioPlaybackRate* rate /* nonnull */) {
+void JMediaSync::getPlaybackParams(AudioPlaybackRate* rate /* nonnull */) {
mSync->getPlaybackSettings(rate);
}
-status_t JMediaSync::setSyncSettings(const AVSyncSettings& syncSettings) {
- return mSync->setSyncSettings(syncSettings);
+status_t JMediaSync::setSyncParams(const AVSyncSettings& syncParams) {
+ return mSync->setSyncSettings(syncParams);
}
-void JMediaSync::getSyncSettings(AVSyncSettings* syncSettings /* nonnull */) {
- mSync->getSyncSettings(syncSettings);
+void JMediaSync::getSyncParams(AVSyncSettings* syncParams /* nonnull */) {
+ mSync->getSyncSettings(syncParams);
}
status_t JMediaSync::setVideoFrameRateHint(float rate) {
@@ -308,24 +308,24 @@
return (jlong)playTimeUs;
}
-static jfloat android_media_MediaSync_setPlaybackSettings(
- JNIEnv *env, jobject thiz, jobject settings) {
+static jfloat android_media_MediaSync_setPlaybackParams(
+ JNIEnv *env, jobject thiz, jobject params) {
sp<JMediaSync> sync = getMediaSync(env, thiz);
if (sync == NULL) {
throwExceptionAsNecessary(env, INVALID_OPERATION);
return (jfloat)0.f;
}
- PlaybackSettings pbs;
- pbs.fillFromJobject(env, gPlaybackSettingsFields, settings);
- ALOGV("setPlaybackSettings: %d:%f %d:%f %d:%u %d:%u",
+ PlaybackParams pbs;
+ pbs.fillFromJobject(env, gPlaybackParamsFields, params);
+ ALOGV("setPlaybackParams: %d:%f %d:%f %d:%u %d:%u",
pbs.speedSet, pbs.audioRate.mSpeed,
pbs.pitchSet, pbs.audioRate.mPitch,
pbs.audioFallbackModeSet, pbs.audioRate.mFallbackMode,
pbs.audioStretchModeSet, pbs.audioRate.mStretchMode);
AudioPlaybackRate rate;
- sync->getPlaybackSettings(&rate);
+ sync->getPlaybackParams(&rate);
bool updatedRate = false;
if (pbs.speedSet) {
rate.mSpeed = pbs.audioRate.mSpeed;
@@ -344,7 +344,7 @@
updatedRate = true;
}
if (updatedRate) {
- status_t err = sync->setPlaybackSettings(rate);
+ status_t err = sync->setPlaybackParams(rate);
if (err != OK) {
throwExceptionAsNecessary(env, err);
return (jfloat)0.f;
@@ -359,7 +359,7 @@
return (jfloat)mediaClock->getPlaybackRate();
}
-static jobject android_media_MediaSync_getPlaybackSettings(
+static jobject android_media_MediaSync_getPlaybackParams(
JNIEnv *env, jobject thiz) {
sp<JMediaSync> sync = getMediaSync(env, thiz);
if (sync == NULL) {
@@ -367,10 +367,10 @@
return NULL;
}
- PlaybackSettings pbs;
+ PlaybackParams pbs;
AudioPlaybackRate &audioRate = pbs.audioRate;
- sync->getPlaybackSettings(&audioRate);
- ALOGV("getPlaybackSettings: %f %f %d %d",
+ sync->getPlaybackParams(&audioRate);
+ ALOGV("getPlaybackParams: %f %f %d %d",
audioRate.mSpeed, audioRate.mPitch, audioRate.mFallbackMode, audioRate.mStretchMode);
pbs.speedSet = true;
@@ -378,27 +378,27 @@
pbs.audioFallbackModeSet = true;
pbs.audioStretchModeSet = true;
- return pbs.asJobject(env, gPlaybackSettingsFields);
+ return pbs.asJobject(env, gPlaybackParamsFields);
}
-static jfloat android_media_MediaSync_setSyncSettings(
- JNIEnv *env, jobject thiz, jobject settings) {
+static jfloat android_media_MediaSync_setSyncParams(
+ JNIEnv *env, jobject thiz, jobject params) {
sp<JMediaSync> sync = getMediaSync(env, thiz);
if (sync == NULL) {
throwExceptionAsNecessary(env, INVALID_OPERATION);
return (jfloat)0.f;
}
- SyncSettings scs;
- scs.fillFromJobject(env, gSyncSettingsFields, settings);
- ALOGV("setSyncSettings: %d:%d %d:%d %d:%f %d:%f",
+ SyncParams scs;
+ scs.fillFromJobject(env, gSyncParamsFields, params);
+ ALOGV("setSyncParams: %d:%d %d:%d %d:%f %d:%f",
scs.syncSourceSet, scs.sync.mSource,
scs.audioAdjustModeSet, scs.sync.mAudioAdjustMode,
scs.toleranceSet, scs.sync.mTolerance,
scs.frameRateSet, scs.frameRate);
AVSyncSettings avsync;
- sync->getSyncSettings(&avsync);
+ sync->getSyncParams(&avsync);
bool updatedSync = false;
status_t err = OK;
if (scs.syncSourceSet) {
@@ -414,7 +414,7 @@
updatedSync = true;
}
if (updatedSync) {
- err = sync->setSyncSettings(avsync);
+ err = sync->setSyncParams(avsync);
}
if (scs.frameRateSet && err == OK) {
@@ -433,21 +433,21 @@
return (jfloat)mediaClock->getPlaybackRate();
}
-static jobject android_media_MediaSync_getSyncSettings(JNIEnv *env, jobject thiz) {
+static jobject android_media_MediaSync_getSyncParams(JNIEnv *env, jobject thiz) {
sp<JMediaSync> sync = getMediaSync(env, thiz);
if (sync == NULL) {
throwExceptionAsNecessary(env, INVALID_OPERATION);
return NULL;
}
- SyncSettings scs;
- sync->getSyncSettings(&scs.sync);
+ SyncParams scs;
+ sync->getSyncParams(&scs.sync);
scs.frameRate = sync->getVideoFrameRate();
- ALOGV("getSyncSettings: %d %d %f %f",
+ ALOGV("getSyncParams: %d %d %f %f",
scs.sync.mSource, scs.sync.mAudioAdjustMode, scs.sync.mTolerance, scs.frameRate);
- // sanity check settings
+ // sanity check params
if (scs.sync.mSource >= AVSYNC_SOURCE_MAX
|| scs.sync.mAudioAdjustMode >= AVSYNC_AUDIO_ADJUST_MODE_MAX
|| scs.sync.mTolerance < 0.f
@@ -461,7 +461,7 @@
scs.toleranceSet = true;
scs.frameRateSet = scs.frameRate >= 0.f;
- return scs.asJobject(env, gSyncSettingsFields);
+ return scs.asJobject(env, gSyncParamsFields);
}
static void android_media_MediaSync_native_init(JNIEnv *env) {
@@ -486,8 +486,8 @@
env->GetFieldID(clazz.get(), "clockRate", "F");
CHECK(gFields.mediaTimestampClockRateID != NULL);
- gSyncSettingsFields.init(env);
- gPlaybackSettingsFields.init(env);
+ gSyncParamsFields.init(env);
+ gPlaybackParamsFields.init(env);
}
static void android_media_MediaSync_native_setup(JNIEnv *env, jobject thiz) {
@@ -530,17 +530,17 @@
{ "native_release", "()V", (void *)android_media_MediaSync_release },
- { "native_setPlaybackSettings", "(Landroid/media/PlaybackSettings;)F",
- (void *)android_media_MediaSync_setPlaybackSettings },
+ { "native_setPlaybackParams", "(Landroid/media/PlaybackParams;)F",
+ (void *)android_media_MediaSync_setPlaybackParams },
- { "getPlaybackSettings", "()Landroid/media/PlaybackSettings;",
- (void *)android_media_MediaSync_getPlaybackSettings },
+ { "getPlaybackParams", "()Landroid/media/PlaybackParams;",
+ (void *)android_media_MediaSync_getPlaybackParams },
- { "native_setSyncSettings", "(Landroid/media/SyncSettings;)F",
- (void *)android_media_MediaSync_setSyncSettings },
+ { "native_setSyncParams", "(Landroid/media/SyncParams;)F",
+ (void *)android_media_MediaSync_setSyncParams },
- { "getSyncSettings", "()Landroid/media/SyncSettings;",
- (void *)android_media_MediaSync_getSyncSettings },
+ { "getSyncParams", "()Landroid/media/SyncParams;",
+ (void *)android_media_MediaSync_getSyncParams },
{ "native_finalize", "()V", (void *)android_media_MediaSync_native_finalize },
};
diff --git a/media/jni/android_media_MediaSync.h b/media/jni/android_media_MediaSync.h
index fa5e5e0..b69af9c 100644
--- a/media/jni/android_media_MediaSync.h
+++ b/media/jni/android_media_MediaSync.h
@@ -42,10 +42,10 @@
status_t getPlayTimeForPendingAudioFrames(int64_t *outTimeUs);
- status_t setPlaybackSettings(const AudioPlaybackRate& rate);
- void getPlaybackSettings(AudioPlaybackRate* rate /* nonnull */);
- status_t setSyncSettings(const AVSyncSettings& syncSettings);
- void getSyncSettings(AVSyncSettings* syncSettings /* nonnull */);
+ status_t setPlaybackParams(const AudioPlaybackRate& rate);
+ void getPlaybackParams(AudioPlaybackRate* rate /* nonnull */);
+ status_t setSyncParams(const AVSyncSettings& syncParams);
+ void getSyncParams(AVSyncSettings* syncParams /* nonnull */);
status_t setVideoFrameRateHint(float rate);
float getVideoFrameRate();
diff --git a/media/jni/android_media_PlaybackSettings.h b/media/jni/android_media_PlaybackParams.h
similarity index 75%
rename from media/jni/android_media_PlaybackSettings.h
rename to media/jni/android_media_PlaybackParams.h
index 1f4f256..5bf13e9 100644
--- a/media/jni/android_media_PlaybackSettings.h
+++ b/media/jni/android_media_PlaybackParams.h
@@ -14,15 +14,15 @@
* limitations under the License.
*/
-#ifndef _ANDROID_MEDIA_PLAYBACK_SETTINGS_H_
-#define _ANDROID_MEDIA_PLAYBACK_SETTINGS_H_
+#ifndef _ANDROID_MEDIA_PLAYBACK_PARAMS_H_
+#define _ANDROID_MEDIA_PLAYBACK_PARAMS_H_
#include <media/AudioResamplerPublic.h>
namespace android {
// This entire class is inline as it is used from both core and media
-struct PlaybackSettings {
+struct PlaybackParams {
AudioPlaybackRate audioRate;
bool speedSet;
bool pitchSet;
@@ -44,7 +44,7 @@
jint set_audio_stretch_mode;
void init(JNIEnv *env) {
- jclass lclazz = env->FindClass("android/media/PlaybackSettings");
+ jclass lclazz = env->FindClass("android/media/PlaybackParams");
if (lclazz == NULL) {
return;
}
@@ -80,14 +80,14 @@
}
};
- void fillFromJobject(JNIEnv *env, const fields_t& fields, jobject settings) {
- audioRate.mSpeed = env->GetFloatField(settings, fields.speed);
- audioRate.mPitch = env->GetFloatField(settings, fields.pitch);
+ void fillFromJobject(JNIEnv *env, const fields_t& fields, jobject params) {
+ audioRate.mSpeed = env->GetFloatField(params, fields.speed);
+ audioRate.mPitch = env->GetFloatField(params, fields.pitch);
audioRate.mFallbackMode =
- (AudioTimestretchFallbackMode)env->GetIntField(settings, fields.audio_fallback_mode);
+ (AudioTimestretchFallbackMode)env->GetIntField(params, fields.audio_fallback_mode);
audioRate.mStretchMode =
- (AudioTimestretchStretchMode)env->GetIntField(settings, fields.audio_stretch_mode);
- int set = env->GetIntField(settings, fields.set);
+ (AudioTimestretchStretchMode)env->GetIntField(params, fields.audio_stretch_mode);
+ int set = env->GetIntField(params, fields.set);
speedSet = set & fields.set_speed;
pitchSet = set & fields.set_pitch;
@@ -96,25 +96,25 @@
}
jobject asJobject(JNIEnv *env, const fields_t& fields) {
- jobject settings = env->NewObject(fields.clazz, fields.constructID);
- if (settings == NULL) {
+ jobject params = env->NewObject(fields.clazz, fields.constructID);
+ if (params == NULL) {
return NULL;
}
- env->SetFloatField(settings, fields.speed, (jfloat)audioRate.mSpeed);
- env->SetFloatField(settings, fields.pitch, (jfloat)audioRate.mPitch);
- env->SetIntField(settings, fields.audio_fallback_mode, (jint)audioRate.mFallbackMode);
- env->SetIntField(settings, fields.audio_stretch_mode, (jint)audioRate.mStretchMode);
+ env->SetFloatField(params, fields.speed, (jfloat)audioRate.mSpeed);
+ env->SetFloatField(params, fields.pitch, (jfloat)audioRate.mPitch);
+ env->SetIntField(params, fields.audio_fallback_mode, (jint)audioRate.mFallbackMode);
+ env->SetIntField(params, fields.audio_stretch_mode, (jint)audioRate.mStretchMode);
env->SetIntField(
- settings, fields.set,
+ params, fields.set,
(speedSet ? fields.set_speed : 0)
| (pitchSet ? fields.set_pitch : 0)
| (audioFallbackModeSet ? fields.set_audio_fallback_mode : 0)
| (audioStretchModeSet ? fields.set_audio_stretch_mode : 0));
- return settings;
+ return params;
}
};
} // namespace android
-#endif // _ANDROID_MEDIA_PLAYBACK_SETTINGS_H_
+#endif // _ANDROID_MEDIA_PLAYBACK_PARAMS_H_
diff --git a/media/jni/android_media_SyncSettings.cpp b/media/jni/android_media_SyncParams.cpp
similarity index 67%
rename from media/jni/android_media_SyncSettings.cpp
rename to media/jni/android_media_SyncParams.cpp
index 5da35e7..d9b2f1d 100644
--- a/media/jni/android_media_SyncSettings.cpp
+++ b/media/jni/android_media_SyncParams.cpp
@@ -14,14 +14,14 @@
* limitations under the License.
*/
-#include "android_media_SyncSettings.h"
+#include "android_media_SyncParams.h"
#include "JNIHelp.h"
namespace android {
-void SyncSettings::fields_t::init(JNIEnv *env) {
- jclass lclazz = env->FindClass("android/media/SyncSettings");
+void SyncParams::fields_t::init(JNIEnv *env) {
+ jclass lclazz = env->FindClass("android/media/SyncParams");
if (lclazz == NULL) {
return;
}
@@ -51,17 +51,17 @@
env->DeleteLocalRef(lclazz);
}
-void SyncSettings::fields_t::exit(JNIEnv *env) {
+void SyncParams::fields_t::exit(JNIEnv *env) {
env->DeleteGlobalRef(clazz);
clazz = NULL;
}
-void SyncSettings::fillFromJobject(JNIEnv *env, const fields_t& fields, jobject settings) {
- sync.mSource = (AVSyncSource)env->GetIntField(settings, fields.sync_source);
- sync.mAudioAdjustMode = (AVSyncAudioAdjustMode)env->GetIntField(settings, fields.audio_adjust_mode);
- sync.mTolerance = env->GetFloatField(settings, fields.tolerance);
- frameRate = env->GetFloatField(settings, fields.frame_rate);
- int set = env->GetIntField(settings, fields.set);
+void SyncParams::fillFromJobject(JNIEnv *env, const fields_t& fields, jobject params) {
+ sync.mSource = (AVSyncSource)env->GetIntField(params, fields.sync_source);
+ sync.mAudioAdjustMode = (AVSyncAudioAdjustMode)env->GetIntField(params, fields.audio_adjust_mode);
+ sync.mTolerance = env->GetFloatField(params, fields.tolerance);
+ frameRate = env->GetFloatField(params, fields.frame_rate);
+ int set = env->GetIntField(params, fields.set);
syncSourceSet = set & fields.set_sync_source;
audioAdjustModeSet = set & fields.set_audio_adjust_mode;
@@ -69,23 +69,23 @@
frameRateSet = set & fields.set_frame_rate;
}
-jobject SyncSettings::asJobject(JNIEnv *env, const fields_t& fields) {
- jobject settings = env->NewObject(fields.clazz, fields.constructID);
- if (settings == NULL) {
+jobject SyncParams::asJobject(JNIEnv *env, const fields_t& fields) {
+ jobject params = env->NewObject(fields.clazz, fields.constructID);
+ if (params == NULL) {
return NULL;
}
- env->SetIntField(settings, fields.sync_source, (jint)sync.mSource);
- env->SetIntField(settings, fields.audio_adjust_mode, (jint)sync.mAudioAdjustMode);
- env->SetFloatField(settings, fields.tolerance, (jfloat)sync.mTolerance);
- env->SetFloatField(settings, fields.frame_rate, (jfloat)frameRate);
+ env->SetIntField(params, fields.sync_source, (jint)sync.mSource);
+ env->SetIntField(params, fields.audio_adjust_mode, (jint)sync.mAudioAdjustMode);
+ env->SetFloatField(params, fields.tolerance, (jfloat)sync.mTolerance);
+ env->SetFloatField(params, fields.frame_rate, (jfloat)frameRate);
env->SetIntField(
- settings, fields.set,
+ params, fields.set,
(syncSourceSet ? fields.set_sync_source : 0)
| (audioAdjustModeSet ? fields.set_audio_adjust_mode : 0)
| (toleranceSet ? fields.set_tolerance : 0)
| (frameRateSet ? fields.set_frame_rate : 0));
- return settings;
+ return params;
}
} // namespace android
diff --git a/media/jni/android_media_SyncSettings.h b/media/jni/android_media_SyncParams.h
similarity index 84%
rename from media/jni/android_media_SyncSettings.h
rename to media/jni/android_media_SyncParams.h
index 23530db..543d79a 100644
--- a/media/jni/android_media_SyncSettings.h
+++ b/media/jni/android_media_SyncParams.h
@@ -14,8 +14,8 @@
* limitations under the License.
*/
-#ifndef _ANDROID_MEDIA_SYNC_SETTINGS_H_
-#define _ANDROID_MEDIA_SYNC_SETTINGS_H_
+#ifndef _ANDROID_MEDIA_SYNC_PARAMS_H_
+#define _ANDROID_MEDIA_SYNC_PARAMS_H_
#include "jni.h"
@@ -23,7 +23,7 @@
namespace android {
-struct SyncSettings {
+struct SyncParams {
AVSyncSettings sync;
float frameRate;
@@ -53,13 +53,13 @@
void exit(JNIEnv *env);
};
- // fills this from an android.media.SyncSettings object
- void fillFromJobject(JNIEnv *env, const fields_t& fields, jobject settings);
+ // fills this from an android.media.SyncParams object
+ void fillFromJobject(JNIEnv *env, const fields_t& fields, jobject params);
- // returns this as a android.media.SyncSettings object
+ // returns this as a android.media.SyncParams object
jobject asJobject(JNIEnv *env, const fields_t& fields);
};
} // namespace android
-#endif // _ANDROID_MEDIA_SYNC_SETTINGS_H_
+#endif // _ANDROID_MEDIA_SYNC_PARAMS_H_