MediaSync: address API review.
Rename *Settings to *Params;
Remove size parameter from MediaSync.queueAudio();
Bug: 20887706
Change-Id: I4c572da92ada51458031a482b96b3f624224e608
diff --git a/api/current.txt b/api/current.txt
index cdc2404..0a9e2ae 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -15067,8 +15067,8 @@
method public int getNotificationMarkerPosition();
method public int getPlayState();
method public int getPlaybackHeadPosition();
+ method public android.media.PlaybackParams getPlaybackParams();
method public int getPlaybackRate();
- method public android.media.PlaybackSettings getPlaybackSettings();
method public int getPositionNotificationPeriod();
method public android.media.AudioDeviceInfo getPreferredOutputDevice();
method public android.media.AudioDeviceInfo getRoutedDevice();
@@ -15085,10 +15085,10 @@
method public int setLoopPoints(int, int, int);
method public int setNotificationMarkerPosition(int);
method public int setPlaybackHeadPosition(int);
+ method public void setPlaybackParams(android.media.PlaybackParams);
method public void setPlaybackPositionUpdateListener(android.media.AudioTrack.OnPlaybackPositionUpdateListener);
method public void setPlaybackPositionUpdateListener(android.media.AudioTrack.OnPlaybackPositionUpdateListener, android.os.Handler);
method public int setPlaybackRate(int);
- method public void setPlaybackSettings(android.media.PlaybackSettings);
method public int setPositionNotificationPeriod(int);
method public boolean setPreferredOutputDevice(android.media.AudioDeviceInfo);
method protected deprecated void setState(int);
@@ -16088,9 +16088,9 @@
method public int getAudioSessionId();
method public int getCurrentPosition();
method public int getDuration();
- method public android.media.PlaybackSettings getPlaybackSettings();
+ method public android.media.PlaybackParams getPlaybackParams();
method public int getSelectedTrack(int) throws java.lang.IllegalStateException;
- method public android.media.SyncSettings getSyncSettings();
+ method public android.media.SyncParams getSyncParams();
method public android.media.MediaTimestamp getTimestamp();
method public android.media.MediaPlayer.TrackInfo[] getTrackInfo() throws java.lang.IllegalStateException;
method public int getVideoHeight();
@@ -16126,11 +16126,11 @@
method public void setOnTimedMetaDataListener(android.media.MediaPlayer.OnTimedMetaDataListener);
method public void setOnTimedTextListener(android.media.MediaPlayer.OnTimedTextListener);
method public void setOnVideoSizeChangedListener(android.media.MediaPlayer.OnVideoSizeChangedListener);
+ method public void setPlaybackParams(android.media.PlaybackParams);
method public void setPlaybackRate(float, int);
- method public void setPlaybackSettings(android.media.PlaybackSettings);
method public void setScreenOnWhilePlaying(boolean);
method public void setSurface(android.view.Surface);
- method public void setSyncSettings(android.media.SyncSettings);
+ method public void setSyncParams(android.media.SyncParams);
method public void setVideoScalingMode(int);
method public void setVolume(float, float);
method public void setWakeMode(android.content.Context, int);
@@ -16449,18 +16449,18 @@
ctor public MediaSync();
method public final android.view.Surface createInputSurface();
method public void flush();
- method public android.media.PlaybackSettings getPlaybackSettings();
- method public android.media.SyncSettings getSyncSettings();
+ method public android.media.PlaybackParams getPlaybackParams();
+ method public android.media.SyncParams getSyncParams();
method public android.media.MediaTimestamp getTimestamp();
- method public void queueAudio(java.nio.ByteBuffer, int, int, long);
+ method public void queueAudio(java.nio.ByteBuffer, int, long);
method public final void release();
method public void setAudioTrack(android.media.AudioTrack);
method public void setCallback(android.media.MediaSync.Callback, android.os.Handler);
method public void setOnErrorListener(android.media.MediaSync.OnErrorListener, android.os.Handler);
+ method public void setPlaybackParams(android.media.PlaybackParams);
method public void setPlaybackRate(float, int);
- method public void setPlaybackSettings(android.media.PlaybackSettings);
method public void setSurface(android.view.Surface);
- method public void setSyncSettings(android.media.SyncSettings);
+ method public void setSyncParams(android.media.SyncParams);
field public static final int MEDIASYNC_ERROR_AUDIOTRACK_FAIL = 1; // 0x1
field public static final int MEDIASYNC_ERROR_SURFACE_FAIL = 2; // 0x2
field public static final int PLAYBACK_RATE_AUDIO_MODE_DEFAULT = 0; // 0x0
@@ -16508,15 +16508,15 @@
method public abstract void onAudioTrackRouting(android.media.AudioTrack);
}
- public final class PlaybackSettings {
- ctor public PlaybackSettings();
- method public android.media.PlaybackSettings allowDefaults();
+ public final class PlaybackParams {
+ ctor public PlaybackParams();
+ method public android.media.PlaybackParams allowDefaults();
method public int getAudioFallbackMode();
method public float getPitch();
method public float getSpeed();
- method public android.media.PlaybackSettings setAudioFallbackMode(int);
- method public android.media.PlaybackSettings setPitch(float);
- method public android.media.PlaybackSettings setSpeed(float);
+ method public android.media.PlaybackParams setAudioFallbackMode(int);
+ method public android.media.PlaybackParams setPitch(float);
+ method public android.media.PlaybackParams setSpeed(float);
field public static final int AUDIO_FALLBACK_MODE_DEFAULT = 0; // 0x0
field public static final int AUDIO_FALLBACK_MODE_FAIL = 2; // 0x2
field public static final int AUDIO_FALLBACK_MODE_MUTE = 1; // 0x1
@@ -16707,17 +16707,17 @@
method public abstract void onLoadComplete(android.media.SoundPool, int, int);
}
- public final class SyncSettings {
- ctor public SyncSettings();
- method public android.media.SyncSettings allowDefaults();
+ public final class SyncParams {
+ ctor public SyncParams();
+ method public android.media.SyncParams allowDefaults();
method public int getAudioAdjustMode();
method public float getFrameRate();
method public int getSyncSource();
method public float getTolerance();
- method public android.media.SyncSettings setAudioAdjustMode(int);
- method public android.media.SyncSettings setFrameRate(float);
- method public android.media.SyncSettings setSyncSource(int);
- method public android.media.SyncSettings setTolerance(float);
+ method public android.media.SyncParams setAudioAdjustMode(int);
+ method public android.media.SyncParams setFrameRate(float);
+ method public android.media.SyncParams setSyncSource(int);
+ method public android.media.SyncParams setTolerance(float);
field public static final int AUDIO_ADJUST_MODE_DEFAULT = 0; // 0x0
field public static final int AUDIO_ADJUST_MODE_RESAMPLE = 2; // 0x2
field public static final int AUDIO_ADJUST_MODE_STRETCH = 1; // 0x1
diff --git a/api/system-current.txt b/api/system-current.txt
index 7012773..d43a55f 100644
--- a/api/system-current.txt
+++ b/api/system-current.txt
@@ -16289,8 +16289,8 @@
method public int getNotificationMarkerPosition();
method public int getPlayState();
method public int getPlaybackHeadPosition();
+ method public android.media.PlaybackParams getPlaybackParams();
method public int getPlaybackRate();
- method public android.media.PlaybackSettings getPlaybackSettings();
method public int getPositionNotificationPeriod();
method public android.media.AudioDeviceInfo getPreferredOutputDevice();
method public android.media.AudioDeviceInfo getRoutedDevice();
@@ -16307,10 +16307,10 @@
method public int setLoopPoints(int, int, int);
method public int setNotificationMarkerPosition(int);
method public int setPlaybackHeadPosition(int);
+ method public void setPlaybackParams(android.media.PlaybackParams);
method public void setPlaybackPositionUpdateListener(android.media.AudioTrack.OnPlaybackPositionUpdateListener);
method public void setPlaybackPositionUpdateListener(android.media.AudioTrack.OnPlaybackPositionUpdateListener, android.os.Handler);
method public int setPlaybackRate(int);
- method public void setPlaybackSettings(android.media.PlaybackSettings);
method public int setPositionNotificationPeriod(int);
method public boolean setPreferredOutputDevice(android.media.AudioDeviceInfo);
method protected deprecated void setState(int);
@@ -17311,9 +17311,9 @@
method public int getAudioSessionId();
method public int getCurrentPosition();
method public int getDuration();
- method public android.media.PlaybackSettings getPlaybackSettings();
+ method public android.media.PlaybackParams getPlaybackParams();
method public int getSelectedTrack(int) throws java.lang.IllegalStateException;
- method public android.media.SyncSettings getSyncSettings();
+ method public android.media.SyncParams getSyncParams();
method public android.media.MediaTimestamp getTimestamp();
method public android.media.MediaPlayer.TrackInfo[] getTrackInfo() throws java.lang.IllegalStateException;
method public int getVideoHeight();
@@ -17349,11 +17349,11 @@
method public void setOnTimedMetaDataListener(android.media.MediaPlayer.OnTimedMetaDataListener);
method public void setOnTimedTextListener(android.media.MediaPlayer.OnTimedTextListener);
method public void setOnVideoSizeChangedListener(android.media.MediaPlayer.OnVideoSizeChangedListener);
+ method public void setPlaybackParams(android.media.PlaybackParams);
method public void setPlaybackRate(float, int);
- method public void setPlaybackSettings(android.media.PlaybackSettings);
method public void setScreenOnWhilePlaying(boolean);
method public void setSurface(android.view.Surface);
- method public void setSyncSettings(android.media.SyncSettings);
+ method public void setSyncParams(android.media.SyncParams);
method public void setVideoScalingMode(int);
method public void setVolume(float, float);
method public void setWakeMode(android.content.Context, int);
@@ -17674,18 +17674,18 @@
ctor public MediaSync();
method public final android.view.Surface createInputSurface();
method public void flush();
- method public android.media.PlaybackSettings getPlaybackSettings();
- method public android.media.SyncSettings getSyncSettings();
+ method public android.media.PlaybackParams getPlaybackParams();
+ method public android.media.SyncParams getSyncParams();
method public android.media.MediaTimestamp getTimestamp();
- method public void queueAudio(java.nio.ByteBuffer, int, int, long);
+ method public void queueAudio(java.nio.ByteBuffer, int, long);
method public final void release();
method public void setAudioTrack(android.media.AudioTrack);
method public void setCallback(android.media.MediaSync.Callback, android.os.Handler);
method public void setOnErrorListener(android.media.MediaSync.OnErrorListener, android.os.Handler);
+ method public void setPlaybackParams(android.media.PlaybackParams);
method public void setPlaybackRate(float, int);
- method public void setPlaybackSettings(android.media.PlaybackSettings);
method public void setSurface(android.view.Surface);
- method public void setSyncSettings(android.media.SyncSettings);
+ method public void setSyncParams(android.media.SyncParams);
field public static final int MEDIASYNC_ERROR_AUDIOTRACK_FAIL = 1; // 0x1
field public static final int MEDIASYNC_ERROR_SURFACE_FAIL = 2; // 0x2
field public static final int PLAYBACK_RATE_AUDIO_MODE_DEFAULT = 0; // 0x0
@@ -17733,15 +17733,15 @@
method public abstract void onAudioTrackRouting(android.media.AudioTrack);
}
- public final class PlaybackSettings {
- ctor public PlaybackSettings();
- method public android.media.PlaybackSettings allowDefaults();
+ public final class PlaybackParams {
+ ctor public PlaybackParams();
+ method public android.media.PlaybackParams allowDefaults();
method public int getAudioFallbackMode();
method public float getPitch();
method public float getSpeed();
- method public android.media.PlaybackSettings setAudioFallbackMode(int);
- method public android.media.PlaybackSettings setPitch(float);
- method public android.media.PlaybackSettings setSpeed(float);
+ method public android.media.PlaybackParams setAudioFallbackMode(int);
+ method public android.media.PlaybackParams setPitch(float);
+ method public android.media.PlaybackParams setSpeed(float);
field public static final int AUDIO_FALLBACK_MODE_DEFAULT = 0; // 0x0
field public static final int AUDIO_FALLBACK_MODE_FAIL = 2; // 0x2
field public static final int AUDIO_FALLBACK_MODE_MUTE = 1; // 0x1
@@ -17932,17 +17932,17 @@
method public abstract void onLoadComplete(android.media.SoundPool, int, int);
}
- public final class SyncSettings {
- ctor public SyncSettings();
- method public android.media.SyncSettings allowDefaults();
+ public final class SyncParams {
+ ctor public SyncParams();
+ method public android.media.SyncParams allowDefaults();
method public int getAudioAdjustMode();
method public float getFrameRate();
method public int getSyncSource();
method public float getTolerance();
- method public android.media.SyncSettings setAudioAdjustMode(int);
- method public android.media.SyncSettings setFrameRate(float);
- method public android.media.SyncSettings setSyncSource(int);
- method public android.media.SyncSettings setTolerance(float);
+ method public android.media.SyncParams setAudioAdjustMode(int);
+ method public android.media.SyncParams setFrameRate(float);
+ method public android.media.SyncParams setSyncSource(int);
+ method public android.media.SyncParams setTolerance(float);
field public static final int AUDIO_ADJUST_MODE_DEFAULT = 0; // 0x0
field public static final int AUDIO_ADJUST_MODE_RESAMPLE = 2; // 0x2
field public static final int AUDIO_ADJUST_MODE_STRETCH = 1; // 0x1
diff --git a/core/jni/android_media_AudioTrack.cpp b/core/jni/android_media_AudioTrack.cpp
index 662ecd3..aeb058b 100644
--- a/core/jni/android_media_AudioTrack.cpp
+++ b/core/jni/android_media_AudioTrack.cpp
@@ -35,7 +35,7 @@
#include "android_media_AudioFormat.h"
#include "android_media_AudioErrors.h"
-#include "android_media_PlaybackSettings.h"
+#include "android_media_PlaybackParams.h"
#include "android_media_DeviceCallback.h"
// ----------------------------------------------------------------------------
@@ -61,7 +61,7 @@
};
static audio_track_fields_t javaAudioTrackFields;
static audio_attributes_fields_t javaAudioAttrFields;
-static PlaybackSettings::fields_t gPlaybackSettingsFields;
+static PlaybackParams::fields_t gPlaybackParamsFields;
struct audiotrack_callback_cookie {
jclass audioTrack_class;
@@ -693,8 +693,8 @@
// ----------------------------------------------------------------------------
-static void android_media_AudioTrack_set_playback_settings(JNIEnv *env, jobject thiz,
- jobject settings) {
+static void android_media_AudioTrack_set_playback_params(JNIEnv *env, jobject thiz,
+ jobject params) {
sp<AudioTrack> lpTrack = getAudioTrack(env, thiz);
if (lpTrack == NULL) {
jniThrowException(env, "java/lang/IllegalStateException",
@@ -702,10 +702,10 @@
return;
}
- PlaybackSettings pbs;
- pbs.fillFromJobject(env, gPlaybackSettingsFields, settings);
+ PlaybackParams pbs;
+ pbs.fillFromJobject(env, gPlaybackParamsFields, params);
- ALOGV("setPlaybackSettings: %d:%f %d:%f %d:%u %d:%u",
+ 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,
@@ -719,8 +719,8 @@
// ----------------------------------------------------------------------------
-static jobject android_media_AudioTrack_get_playback_settings(JNIEnv *env, jobject thiz,
- jobject settings) {
+static jobject android_media_AudioTrack_get_playback_params(JNIEnv *env, jobject thiz,
+ jobject params) {
sp<AudioTrack> lpTrack = getAudioTrack(env, thiz);
if (lpTrack == NULL) {
jniThrowException(env, "java/lang/IllegalStateException",
@@ -728,13 +728,13 @@
return NULL;
}
- PlaybackSettings pbs;
+ PlaybackParams pbs;
pbs.audioRate = lpTrack->getPlaybackRate();
pbs.speedSet = true;
pbs.pitchSet = true;
pbs.audioFallbackModeSet = true;
pbs.audioStretchModeSet = true;
- return pbs.asJobject(env, gPlaybackSettingsFields);
+ return pbs.asJobject(env, gPlaybackParamsFields);
}
@@ -1049,12 +1049,12 @@
"(I)I", (void *)android_media_AudioTrack_set_playback_rate},
{"native_get_playback_rate",
"()I", (void *)android_media_AudioTrack_get_playback_rate},
- {"native_set_playback_settings",
- "(Landroid/media/PlaybackSettings;)V",
- (void *)android_media_AudioTrack_set_playback_settings},
- {"native_get_playback_settings",
- "()Landroid/media/PlaybackSettings;",
- (void *)android_media_AudioTrack_get_playback_settings},
+ {"native_set_playback_params",
+ "(Landroid/media/PlaybackParams;)V",
+ (void *)android_media_AudioTrack_set_playback_params},
+ {"native_get_playback_params",
+ "()Landroid/media/PlaybackParams;",
+ (void *)android_media_AudioTrack_get_playback_params},
{"native_set_marker_pos","(I)I", (void *)android_media_AudioTrack_set_marker_pos},
{"native_get_marker_pos","()I", (void *)android_media_AudioTrack_get_marker_pos},
{"native_set_pos_update_period",
@@ -1144,8 +1144,8 @@
env->DeleteLocalRef(audioAttrClass);
- // initialize PlaybackSettings field info
- gPlaybackSettingsFields.init(env);
+ // initialize PlaybackParams field info
+ gPlaybackParamsFields.init(env);
return RegisterMethodsOrDie(env, kClassPathName, gMethods, NELEM(gMethods));
}
diff --git a/media/java/android/media/AudioTrack.java b/media/java/android/media/AudioTrack.java
index a66a1e5..dc37700 100644
--- a/media/java/android/media/AudioTrack.java
+++ b/media/java/android/media/AudioTrack.java
@@ -908,13 +908,13 @@
}
/**
- * Returns the current playback settings.
- * See {@link #setPlaybackSettings(PlaybackSettings)} to set playback settings
- * @return current {@link PlaybackSettings}.
+ * Returns the current playback params.
+ * See {@link #setPlaybackParams(PlaybackParams)} to set playback params
+ * @return current {@link PlaybackParams}.
* @throws IllegalStateException if track is not initialized.
*/
- public @NonNull PlaybackSettings getPlaybackSettings() {
- return native_get_playback_settings();
+ public @NonNull PlaybackParams getPlaybackParams() {
+ return native_get_playback_params();
}
/**
@@ -1294,7 +1294,7 @@
* playback to last twice as long, but will also result in a pitch shift down by one octave.
* The valid sample rate range is from 1 Hz to twice the value returned by
* {@link #getNativeOutputSampleRate(int)}.
- * Use {@link #setPlaybackSettings(PlaybackSettings)} for speed control.
+ * Use {@link #setPlaybackParams(PlaybackParams)} for speed control.
* @param sampleRateInHz the sample rate expressed in Hz
* @return error code or success, see {@link #SUCCESS}, {@link #ERROR_BAD_VALUE},
* {@link #ERROR_INVALID_OPERATION}
@@ -1311,24 +1311,24 @@
/**
- * Sets the playback settings.
- * This method returns failure if it cannot apply the playback settings.
+ * Sets the playback params.
+ * This method returns failure if it cannot apply the playback params.
* One possible cause is that the parameters for speed or pitch are out of range.
* Another possible cause is that the <code>AudioTrack</code> is streaming
* (see {@link #MODE_STREAM}) and the
* buffer size is too small. For speeds greater than 1.0f, the <code>AudioTrack</code> buffer
* on configuration must be larger than the speed multiplied by the minimum size
* {@link #getMinBufferSize(int, int, int)}) to allow proper playback.
- * @param settings see {@link PlaybackSettings}. In particular,
+ * @param params see {@link PlaybackParams}. In particular,
* speed, pitch, and audio mode should be set.
- * @throws IllegalArgumentException if the settings are invalid or not accepted.
+ * @throws IllegalArgumentException if the params are invalid or not accepted.
* @throws IllegalStateException if track is not initialized.
*/
- public void setPlaybackSettings(@NonNull PlaybackSettings settings) {
- if (settings == null) {
- throw new IllegalArgumentException("settings is null");
+ public void setPlaybackParams(@NonNull PlaybackParams params) {
+ if (params == null) {
+ throw new IllegalArgumentException("params is null");
}
- native_set_playback_settings(settings);
+ native_set_playback_params(params);
}
@@ -2353,8 +2353,8 @@
private native final int native_set_playback_rate(int sampleRateInHz);
private native final int native_get_playback_rate();
- private native final void native_set_playback_settings(@NonNull PlaybackSettings settings);
- private native final @NonNull PlaybackSettings native_get_playback_settings();
+ private native final void native_set_playback_params(@NonNull PlaybackParams params);
+ private native final @NonNull PlaybackParams native_get_playback_params();
private native final int native_set_marker_pos(int marker);
private native final int native_get_marker_pos();
diff --git a/media/java/android/media/MediaPlayer.java b/media/java/android/media/MediaPlayer.java
index 6ec10c7..2f42521 100644
--- a/media/java/android/media/MediaPlayer.java
+++ b/media/java/android/media/MediaPlayer.java
@@ -47,12 +47,12 @@
import android.media.AudioManager;
import android.media.MediaFormat;
import android.media.MediaTimeProvider;
-import android.media.PlaybackSettings;
+import android.media.PlaybackParams;
import android.media.SubtitleController;
import android.media.SubtitleController.Anchor;
import android.media.SubtitleData;
import android.media.SubtitleTrack.RenderingWidget;
-import android.media.SyncSettings;
+import android.media.SyncParams;
import com.android.internal.app.IAppOpsService;
@@ -481,7 +481,7 @@
* <td>{} </p></td>
* <td>This method can be called in any state and calling it does not change
* the object state. </p></td></tr>
- * <tr><td>setPlaybackSettings</p></td>
+ * <tr><td>setPlaybackParams</p></td>
* <td>any </p></td>
* <td>{} </p></td>
* <td>This method can be called in any state and calling it does not change
@@ -1408,68 +1408,68 @@
* @throws IllegalArgumentException if audioMode is not supported.
*/
public void setPlaybackRate(float rate, @PlaybackRateAudioMode int audioMode) {
- PlaybackSettings settings = new PlaybackSettings();
- settings.allowDefaults();
+ PlaybackParams params = new PlaybackParams();
+ params.allowDefaults();
switch (audioMode) {
case PLAYBACK_RATE_AUDIO_MODE_DEFAULT:
- settings.setSpeed(rate).setPitch(1.0f);
+ params.setSpeed(rate).setPitch(1.0f);
break;
case PLAYBACK_RATE_AUDIO_MODE_STRETCH:
- settings.setSpeed(rate).setPitch(1.0f)
- .setAudioFallbackMode(settings.AUDIO_FALLBACK_MODE_FAIL);
+ params.setSpeed(rate).setPitch(1.0f)
+ .setAudioFallbackMode(params.AUDIO_FALLBACK_MODE_FAIL);
break;
case PLAYBACK_RATE_AUDIO_MODE_RESAMPLE:
- settings.setSpeed(rate).setPitch(rate);
+ params.setSpeed(rate).setPitch(rate);
break;
default:
final String msg = "Audio playback mode " + audioMode + " is not supported";
throw new IllegalArgumentException(msg);
}
- setPlaybackSettings(settings);
+ setPlaybackParams(params);
}
/**
- * Sets playback rate using {@link PlaybackSettings}.
+ * Sets playback rate using {@link PlaybackParams}.
*
- * @param settings the playback settings.
+ * @param params the playback params.
*
* @throws IllegalStateException if the internal player engine has not been
* initialized.
- * @throws IllegalArgumentException if settings is not supported.
+ * @throws IllegalArgumentException if params is not supported.
*/
- public native void setPlaybackSettings(@NonNull PlaybackSettings settings);
+ public native void setPlaybackParams(@NonNull PlaybackParams params);
/**
- * Gets the playback settings, containing the current playback rate.
+ * Gets the playback params, containing the current playback rate.
*
- * @return the playback settings.
+ * @return the playback params.
* @throws IllegalStateException if the internal player engine has not been
* initialized.
*/
@NonNull
- public native PlaybackSettings getPlaybackSettings();
+ public native PlaybackParams getPlaybackParams();
/**
* Sets A/V sync mode.
*
- * @param settings the A/V sync settings to apply
+ * @param params the A/V sync params to apply
*
* @throws IllegalStateException if the internal player engine has not been
* initialized.
- * @throws IllegalArgumentException if settings are not supported.
+ * @throws IllegalArgumentException if params are not supported.
*/
- public native void setSyncSettings(@NonNull SyncSettings settings);
+ public native void setSyncParams(@NonNull SyncParams params);
/**
* Gets the A/V sync mode.
*
- * @return the A/V sync settings
+ * @return the A/V sync params
*
* @throws IllegalStateException if the internal player engine has not been
* initialized.
*/
@NonNull
- public native SyncSettings getSyncSettings();
+ public native SyncParams getSyncParams();
/**
* Seeks to specified time position.
@@ -1507,7 +1507,7 @@
return new MediaTimestamp(
getCurrentPosition() * 1000L,
System.nanoTime(),
- isPlaying() ? getPlaybackSettings().getSpeed() : 0.f);
+ isPlaying() ? getPlaybackParams().getSpeed() : 0.f);
} catch (IllegalStateException e) {
return null;
}
diff --git a/media/java/android/media/MediaSync.java b/media/java/android/media/MediaSync.java
index a5b0d39..b7ef95c 100644
--- a/media/java/android/media/MediaSync.java
+++ b/media/java/android/media/MediaSync.java
@@ -20,7 +20,7 @@
import android.annotation.NonNull;
import android.annotation.Nullable;
import android.media.AudioTrack;
-import android.media.PlaybackSettings;
+import android.media.PlaybackParams;
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
@@ -62,7 +62,7 @@
* // videoDecoder.releaseOutputBuffer(videoOutputBufferIx, videoPresentationTimeNs);
* // More details are available as below.
* ...
- * sync.queueAudio(audioByteBuffer, bufferIndex, size, audioPresentationTimeUs); // non-blocking.
+ * sync.queueAudio(audioByteBuffer, bufferIndex, audioPresentationTimeUs); // non-blocking.
* // The audioByteBuffer and bufferIndex will be returned via callback.
* // More details are available as below.
* ...
@@ -112,7 +112,7 @@
* initial underrun.
* <p>
*/
-final public class MediaSync {
+public final class MediaSync {
/**
* MediaSync callback interface. Used to notify the user asynchronously
* of various MediaSync events.
@@ -170,14 +170,12 @@
private static class AudioBuffer {
public ByteBuffer mByteBuffer;
public int mBufferIndex;
- public int mSizeInBytes;
long mPresentationTimeUs;
public AudioBuffer(@NonNull ByteBuffer byteBuffer, int bufferIndex,
- int sizeInBytes, long presentationTimeUs) {
+ long presentationTimeUs) {
mByteBuffer = byteBuffer;
mBufferIndex = bufferIndex;
- mSizeInBytes = sizeInBytes;
mPresentationTimeUs = presentationTimeUs;
}
}
@@ -413,18 +411,18 @@
* @throws IllegalArgumentException if audioMode is not supported.
*/
public void setPlaybackRate(float rate, @PlaybackRateAudioMode int audioMode) {
- PlaybackSettings rateSettings = new PlaybackSettings();
- rateSettings.allowDefaults();
+ PlaybackParams rateParams = new PlaybackParams();
+ rateParams.allowDefaults();
switch (audioMode) {
case PLAYBACK_RATE_AUDIO_MODE_DEFAULT:
- rateSettings.setSpeed(rate).setPitch(1.0f);
+ rateParams.setSpeed(rate).setPitch(1.0f);
break;
case PLAYBACK_RATE_AUDIO_MODE_STRETCH:
- rateSettings.setSpeed(rate).setPitch(1.0f)
- .setAudioFallbackMode(rateSettings.AUDIO_FALLBACK_MODE_FAIL);
+ rateParams.setSpeed(rate).setPitch(1.0f)
+ .setAudioFallbackMode(rateParams.AUDIO_FALLBACK_MODE_FAIL);
break;
case PLAYBACK_RATE_AUDIO_MODE_RESAMPLE:
- rateSettings.setSpeed(rate).setPitch(rate);
+ rateParams.setSpeed(rate).setPitch(rate);
break;
default:
{
@@ -432,19 +430,19 @@
throw new IllegalArgumentException(msg);
}
}
- setPlaybackSettings(rateSettings);
+ setPlaybackParams(rateParams);
}
/**
- * Sets playback rate using {@link PlaybackSettings}.
+ * Sets playback rate using {@link PlaybackParams}.
* <p>
- * When using MediaSync with {@link AudioTrack}, set playback settings using this
+ * When using MediaSync with {@link AudioTrack}, set playback params using this
* call instead of calling it directly on the track, so that the sync is aware of
- * the settings change.
+ * the params change.
* <p>
* This call also works if there is no audio track.
*
- * @param settings the playback settings to use. {@link PlaybackSettings#getSpeed
+ * @param params the playback params to use. {@link PlaybackParams#getSpeed
* Speed} is the ratio between desired playback rate and normal one. 1.0 means
* normal playback speed. 0.0 means pause. Value larger than 1.0 means faster playback,
* while value between 0.0 and 1.0 for slower playback. <b>Note:</b> the normal rate
@@ -453,11 +451,11 @@
*
* @throws IllegalStateException if the internal sync engine or the audio track has not
* been initialized.
- * @throws IllegalArgumentException if the settings are not supported.
+ * @throws IllegalArgumentException if the params are not supported.
*/
- public void setPlaybackSettings(@NonNull PlaybackSettings settings) {
+ public void setPlaybackParams(@NonNull PlaybackParams params) {
synchronized(mAudioLock) {
- mPlaybackRate = native_setPlaybackSettings(settings);;
+ mPlaybackRate = native_setPlaybackParams(params);;
}
if (mPlaybackRate != 0.0 && mAudioThread != null) {
postRenderAudio(0);
@@ -465,7 +463,7 @@
}
/**
- * Gets the playback rate using {@link PlaybackSettings}.
+ * Gets the playback rate using {@link PlaybackParams}.
*
* @return the playback rate being used.
*
@@ -473,40 +471,40 @@
* been initialized.
*/
@NonNull
- public native PlaybackSettings getPlaybackSettings();
+ public native PlaybackParams getPlaybackParams();
- private native float native_setPlaybackSettings(@NonNull PlaybackSettings settings);
+ private native float native_setPlaybackParams(@NonNull PlaybackParams params);
/**
* Sets A/V sync mode.
*
- * @param settings the A/V sync settings to apply
+ * @param params the A/V sync params to apply
*
* @throws IllegalStateException if the internal player engine has not been
* initialized.
- * @throws IllegalArgumentException if settings are not supported.
+ * @throws IllegalArgumentException if params are not supported.
*/
- public void setSyncSettings(@NonNull SyncSettings settings) {
+ public void setSyncParams(@NonNull SyncParams params) {
synchronized(mAudioLock) {
- mPlaybackRate = native_setSyncSettings(settings);;
+ mPlaybackRate = native_setSyncParams(params);;
}
if (mPlaybackRate != 0.0 && mAudioThread != null) {
postRenderAudio(0);
}
}
- private native float native_setSyncSettings(@NonNull SyncSettings settings);
+ private native float native_setSyncParams(@NonNull SyncParams params);
/**
* Gets the A/V sync mode.
*
- * @return the A/V sync settings
+ * @return the A/V sync params
*
* @throws IllegalStateException if the internal player engine has not been
* initialized.
*/
@NonNull
- public native SyncSettings getSyncSettings();
+ public native SyncParams getSyncParams();
/**
* Flushes all buffers from the sync object.
@@ -567,23 +565,20 @@
* to the client via registered callback.
* @param bufferIndex the buffer index used to identify audioData. It will be returned to
* the client along with audioData. This helps applications to keep track of audioData.
- * @param sizeInBytes number of bytes to queue.
* @param presentationTimeUs the presentation timestamp in microseconds for the first frame
* in the buffer.
* @throws IllegalStateException if audio track is not set or internal configureation
* has not been done correctly.
*/
public void queueAudio(
- @NonNull ByteBuffer audioData, int bufferIndex, int sizeInBytes,
- long presentationTimeUs) {
+ @NonNull ByteBuffer audioData, int bufferIndex, long presentationTimeUs) {
if (mAudioTrack == null || mAudioThread == null) {
throw new IllegalStateException(
"AudioTrack is NOT set or audio thread is not created");
}
synchronized(mAudioLock) {
- mAudioBuffers.add(new AudioBuffer(
- audioData, bufferIndex, sizeInBytes, presentationTimeUs));
+ mAudioBuffers.add(new AudioBuffer(audioData, bufferIndex, presentationTimeUs));
}
if (mPlaybackRate != 0.0) {
@@ -605,18 +600,19 @@
}
AudioBuffer audioBuffer = mAudioBuffers.get(0);
+ int size = audioBuffer.mByteBuffer.remaining();
int sizeWritten = mAudioTrack.write(
audioBuffer.mByteBuffer,
- audioBuffer.mSizeInBytes,
+ size,
AudioTrack.WRITE_NON_BLOCKING);
if (sizeWritten > 0) {
if (audioBuffer.mPresentationTimeUs != -1) {
native_updateQueuedAudioData(
- audioBuffer.mSizeInBytes, audioBuffer.mPresentationTimeUs);
+ size, audioBuffer.mPresentationTimeUs);
audioBuffer.mPresentationTimeUs = -1;
}
- if (sizeWritten == audioBuffer.mSizeInBytes) {
+ if (sizeWritten == size) {
postReturnByteBuffer(audioBuffer);
mAudioBuffers.remove(0);
if (!mAudioBuffers.isEmpty()) {
@@ -624,8 +620,6 @@
}
return;
}
-
- audioBuffer.mSizeInBytes -= sizeWritten;
}
long pendingTimeMs = TimeUnit.MICROSECONDS.toMillis(
native_getPlayTimeForPendingAudioFrames());
diff --git a/media/java/android/media/PlaybackSettings.java b/media/java/android/media/PlaybackParams.java
similarity index 81%
rename from media/java/android/media/PlaybackSettings.java
rename to media/java/android/media/PlaybackParams.java
index b2e1033..e41b2b6 100644
--- a/media/java/android/media/PlaybackSettings.java
+++ b/media/java/android/media/PlaybackParams.java
@@ -22,21 +22,21 @@
import android.annotation.IntDef;
/**
- * Structure for common playback settings.
+ * Structure for common playback params.
*
- * Used by {@link AudioTrack} {@link AudioTrack#getPlaybackSettings()} and
- * {@link AudioTrack#setPlaybackSettings(PlaybackSettings)}
+ * Used by {@link AudioTrack} {@link AudioTrack#getPlaybackParams()} and
+ * {@link AudioTrack#setPlaybackParams(PlaybackParams)}
* to control playback behavior.
* <p> <strong>audio fallback mode:</strong>
* select out-of-range parameter handling.
* <ul>
- * <li> {@link PlaybackSettings#AUDIO_FALLBACK_MODE_DEFAULT}:
+ * <li> {@link PlaybackParams#AUDIO_FALLBACK_MODE_DEFAULT}:
* System will determine best handling. </li>
- * <li> {@link PlaybackSettings#AUDIO_FALLBACK_MODE_MUTE}:
- * Play silence for settings normally out of range.</li>
- * <li> {@link PlaybackSettings#AUDIO_FALLBACK_MODE_FAIL}:
+ * <li> {@link PlaybackParams#AUDIO_FALLBACK_MODE_MUTE}:
+ * Play silence for params normally out of range.</li>
+ * <li> {@link PlaybackParams#AUDIO_FALLBACK_MODE_FAIL}:
* Return {@link java.lang.IllegalArgumentException} from
- * <code>AudioTrack.setPlaybackSettings(PlaybackSettings)</code>.</li>
+ * <code>AudioTrack.setPlaybackParams(PlaybackParams)</code>.</li>
* </ul>
* <p> <strong>pitch:</strong> increases or decreases the tonal frequency of the audio content.
* It is expressed as a multiplicative factor, where normal pitch is 1.0f.
@@ -52,7 +52,7 @@
* similar to {@link AudioTrack#setPlaybackRate(int)}.</li>
* </ul>
*/
-public final class PlaybackSettings {
+public final class PlaybackParams {
/** @hide */
@IntDef(
value = {
@@ -81,14 +81,14 @@
/** @hide */
public static final int AUDIO_STRETCH_MODE_VOICE = 1;
- // flags to indicate which settings are actually set
+ // flags to indicate which params are actually set
private static final int SET_SPEED = 1 << 0;
private static final int SET_PITCH = 1 << 1;
private static final int SET_AUDIO_FALLBACK_MODE = 1 << 2;
private static final int SET_AUDIO_STRETCH_MODE = 1 << 3;
private int mSet = 0;
- // settings
+ // params
private int mAudioFallbackMode = AUDIO_FALLBACK_MODE_DEFAULT;
private int mAudioStretchMode = AUDIO_STRETCH_MODE_DEFAULT;
private float mPitch = 1.0f;
@@ -99,9 +99,9 @@
* Otherwise a {@link java.lang.IllegalArgumentException} exception
* is raised when getting those properties
* which have defaults but have never been set.
- * @return this <code>PlaybackSettings</code> instance.
+ * @return this <code>PlaybackParams</code> instance.
*/
- public PlaybackSettings allowDefaults() {
+ public PlaybackParams allowDefaults() {
mSet |= SET_AUDIO_FALLBACK_MODE | SET_AUDIO_STRETCH_MODE | SET_PITCH | SET_SPEED;
return this;
}
@@ -109,9 +109,9 @@
/**
* Sets the audio fallback mode.
* @param audioFallbackMode
- * @return this <code>PlaybackSettings</code> instance.
+ * @return this <code>PlaybackParams</code> instance.
*/
- public PlaybackSettings setAudioFallbackMode(@AudioFallbackMode int audioFallbackMode) {
+ public PlaybackParams setAudioFallbackMode(@AudioFallbackMode int audioFallbackMode) {
mAudioFallbackMode = audioFallbackMode;
mSet |= SET_AUDIO_FALLBACK_MODE;
return this;
@@ -133,9 +133,9 @@
* @hide
* Sets the audio stretch mode.
* @param audioStretchMode
- * @return this <code>PlaybackSettings</code> instance.
+ * @return this <code>PlaybackParams</code> instance.
*/
- public PlaybackSettings setAudioStretchMode(@AudioStretchMode int audioStretchMode) {
+ public PlaybackParams setAudioStretchMode(@AudioStretchMode int audioStretchMode) {
mAudioStretchMode = audioStretchMode;
mSet |= SET_AUDIO_STRETCH_MODE;
return this;
@@ -157,9 +157,9 @@
/**
* Sets the pitch factor.
* @param pitch
- * @return this <code>PlaybackSettings</code> instance.
+ * @return this <code>PlaybackParams</code> instance.
*/
- public PlaybackSettings setPitch(float pitch) {
+ public PlaybackParams setPitch(float pitch) {
mPitch = pitch;
mSet |= SET_PITCH;
return this;
@@ -180,9 +180,9 @@
/**
* Sets the speed factor.
* @param speed
- * @return this <code>PlaybackSettings</code> instance.
+ * @return this <code>PlaybackParams</code> instance.
*/
- public PlaybackSettings setSpeed(float speed) {
+ public PlaybackParams setSpeed(float speed) {
mSpeed = speed;
mSet |= SET_SPEED;
return this;
diff --git a/media/java/android/media/SyncSettings.java b/media/java/android/media/SyncParams.java
similarity index 87%
rename from media/java/android/media/SyncSettings.java
rename to media/java/android/media/SyncParams.java
index 9740147..00a8dc0 100644
--- a/media/java/android/media/SyncSettings.java
+++ b/media/java/android/media/SyncParams.java
@@ -22,31 +22,31 @@
import android.annotation.IntDef;
/**
- * Structure for common A/V sync settings.
+ * Structure for common A/V sync params.
*
- * Used by {@link MediaSync} {link MediaSync#getSyncSettings()} and
- * {link MediaSync#setSyncSettings(SyncSettings)}
+ * Used by {@link MediaSync} {link MediaSync#getSyncParams()} and
+ * {link MediaSync#setSyncParams(SyncParams)}
* to control A/V sync behavior.
* <p> <strong>audio adjust mode:</strong>
* select handling of audio track when changing playback speed due to sync.
* <ul>
- * <li> {@link SyncSettings#AUDIO_ADJUST_MODE_DEFAULT}:
+ * <li> {@link SyncParams#AUDIO_ADJUST_MODE_DEFAULT}:
* System will determine best handling. </li>
- * <li> {@link SyncSettings#AUDIO_ADJUST_MODE_STRETCH}:
+ * <li> {@link SyncParams#AUDIO_ADJUST_MODE_STRETCH}:
* Change the speed of audio playback without altering its pitch.</li>
- * <li> {@link SyncSettings#AUDIO_ADJUST_MODE_RESAMPLE}:
+ * <li> {@link SyncParams#AUDIO_ADJUST_MODE_RESAMPLE}:
* Change the speed of audio playback by resampling the audio.</li>
* </ul>
* <p> <strong>sync source:</strong> select
* clock source for sync.
* <ul>
- * <li> {@link SyncSettings#SYNC_SOURCE_DEFAULT}:
+ * <li> {@link SyncParams#SYNC_SOURCE_DEFAULT}:
* System will determine best selection.</li>
- * <li> {@link SyncSettings#SYNC_SOURCE_SYSTEM_CLOCK}:
+ * <li> {@link SyncParams#SYNC_SOURCE_SYSTEM_CLOCK}:
* Use system clock for sync source.</li>
- * <li> {@link SyncSettings#SYNC_SOURCE_AUDIO}:
+ * <li> {@link SyncParams#SYNC_SOURCE_AUDIO}:
* Use audio track for sync source.</li>
- * <li> {@link SyncSettings#SYNC_SOURCE_VSYNC}:
+ * <li> {@link SyncParams#SYNC_SOURCE_VSYNC}:
* Syncronize media to vsync.</li>
* </ul>
* <p> <strong>tolerance:</strong> specifies the amount of allowed playback rate
@@ -55,7 +55,7 @@
* <p> <strong>frameRate:</strong> initial hint for video frame rate. Used when
* sync source is vsync.
*/
-public final class SyncSettings {
+public final class SyncParams {
/** @hide */
@IntDef(
value = {
@@ -155,14 +155,14 @@
*/
public static final int AUDIO_ADJUST_MODE_RESAMPLE = 2;
- // flags to indicate which settings are actually set
+ // flags to indicate which params are actually set
private static final int SET_SYNC_SOURCE = 1 << 0;
private static final int SET_AUDIO_ADJUST_MODE = 1 << 1;
private static final int SET_TOLERANCE = 1 << 2;
private static final int SET_FRAME_RATE = 1 << 3;
private int mSet = 0;
- // settings
+ // params
private int mAudioAdjustMode = AUDIO_ADJUST_MODE_STRETCH;
private int mSyncSource = SYNC_SOURCE_DEFAULT;
private float mTolerance = 0.f;
@@ -173,9 +173,9 @@
* Otherwise a {@link java.lang.IllegalArgumentException} exception
* is raised when getting those properties
* which have defaults but have never been set.
- * @return this <code>SyncSettings</code> instance.
+ * @return this <code>SyncParams</code> instance.
*/
- public SyncSettings allowDefaults() {
+ public SyncParams allowDefaults() {
mSet |= SET_SYNC_SOURCE | SET_AUDIO_ADJUST_MODE | SET_TOLERANCE;
return this;
}
@@ -183,9 +183,9 @@
/**
* Sets the audio adjust mode.
* @param audioAdjustMode
- * @return this <code>SyncSettings</code> instance.
+ * @return this <code>SyncParams</code> instance.
*/
- public SyncSettings setAudioAdjustMode(@AudioAdjustMode int audioAdjustMode) {
+ public SyncParams setAudioAdjustMode(@AudioAdjustMode int audioAdjustMode) {
mAudioAdjustMode = audioAdjustMode;
mSet |= SET_AUDIO_ADJUST_MODE;
return this;
@@ -206,9 +206,9 @@
/**
* Sets the sync source.
* @param syncSource
- * @return this <code>SyncSettings</code> instance.
+ * @return this <code>SyncParams</code> instance.
*/
- public SyncSettings setSyncSource(@SyncSource int syncSource) {
+ public SyncParams setSyncSource(@SyncSource int syncSource) {
mSyncSource = syncSource;
mSet |= SET_SYNC_SOURCE;
return this;
@@ -231,9 +231,9 @@
* @param tolerance A non-negative number representing
* the maximum deviation of the playback rate from the playback rate
* set. ({@code abs(actual_rate - set_rate) / set_rate})
- * @return this <code>SyncSettings</code> instance.
+ * @return this <code>SyncParams</code> instance.
*/
- public SyncSettings setTolerance(float tolerance) {
+ public SyncParams setTolerance(float tolerance) {
mTolerance = tolerance;
mSet |= SET_TOLERANCE;
return this;
@@ -257,9 +257,9 @@
* Sets the video frame rate hint to be used. By default the frame rate is unspecified.
* @param frameRate A non-negative number used as an initial hint on
* the video frame rate to be used when using vsync as the sync source.
- * @return this <code>SyncSettings</code> instance.
+ * @return this <code>SyncParams</code> instance.
*/
- public SyncSettings setFrameRate(float frameRate) {
+ public SyncParams setFrameRate(float frameRate) {
mFrameRate = frameRate;
mSet |= SET_FRAME_RATE;
return this;
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_