summaryrefslogtreecommitdiffstats
path: root/media
diff options
context:
space:
mode:
Diffstat (limited to 'media')
-rw-r--r--media/java/android/media/audiofx/AudioEffect.java15
-rw-r--r--media/java/android/media/audiofx/BassBoost.java13
-rw-r--r--media/java/android/media/audiofx/Equalizer.java15
-rw-r--r--media/java/android/media/audiofx/Virtualizer.java16
-rwxr-xr-xmedia/jni/mediaeditor/VideoBrowserMain.c46
-rwxr-xr-xmedia/jni/mediaeditor/VideoBrowserMain.h3
-rwxr-xr-xmedia/jni/mediaeditor/VideoEditorMain.cpp9
-rwxr-xr-xmedia/jni/mediaeditor/VideoEditorThumbnailMain.cpp17
-rwxr-xr-xmedia/jni/mediaeditor/VideoEditorThumbnailMain.h6
9 files changed, 58 insertions, 82 deletions
diff --git a/media/java/android/media/audiofx/AudioEffect.java b/media/java/android/media/audiofx/AudioEffect.java
index 3ac0104..673f9f4 100644
--- a/media/java/android/media/audiofx/AudioEffect.java
+++ b/media/java/android/media/audiofx/AudioEffect.java
@@ -40,13 +40,11 @@ import java.util.UUID;
* <li> {@link android.media.audiofx.PresetReverb}</li>
* <li> {@link android.media.audiofx.EnvironmentalReverb}</li>
* </ul>
- * <p>If the audio effect is to be applied to a specific AudioTrack or MediaPlayer instance,
+ * <p>To apply the audio effect to a specific AudioTrack or MediaPlayer instance,
* the application must specify the audio session ID of that instance when creating the AudioEffect.
* (see {@link android.media.MediaPlayer#getAudioSessionId()} for details on audio sessions).
- * To apply an effect to the global audio output mix, session 0 must be specified when creating the
- * AudioEffect.
- * <p>Creating an effect on the output mix (audio session 0) requires permission
- * {@link android.Manifest.permission#MODIFY_AUDIO_SETTINGS}
+ * <p>NOTE: attaching insert effects (equalizer, bass boost, virtualizer) to the global audio output
+ * mix by use of session 0 is deprecated.
* <p>Creating an AudioEffect object will create the corresponding effect engine in the audio
* framework if no instance of the same effect type exists in the specified audio session.
* If one exists, this instance will be used.
@@ -356,10 +354,9 @@ public class AudioEffect {
* how much the requesting application needs control of effect
* parameters. The normal priority is 0, above normal is a
* positive number, below normal a negative number.
- * @param audioSession system wide unique audio session identifier. If audioSession
- * is not 0, the effect will be attached to the MediaPlayer or
- * AudioTrack in the same audio session. Otherwise, the effect
- * will apply to the output mix.
+ * @param audioSession system wide unique audio session identifier.
+ * The effect will be attached to the MediaPlayer or AudioTrack in
+ * the same audio session.
*
* @throws java.lang.IllegalArgumentException
* @throws java.lang.UnsupportedOperationException
diff --git a/media/java/android/media/audiofx/BassBoost.java b/media/java/android/media/audiofx/BassBoost.java
index ca55f0f..91459ed 100644
--- a/media/java/android/media/audiofx/BassBoost.java
+++ b/media/java/android/media/audiofx/BassBoost.java
@@ -39,9 +39,7 @@ import java.util.StringTokenizer;
* for the SLBassBoostItf interface. Please refer to this specification for more details.
* <p>To attach the BassBoost to a particular AudioTrack or MediaPlayer, specify the audio session
* ID of this AudioTrack or MediaPlayer when constructing the BassBoost.
- * If the audio session ID 0 is specified, the BassBoost applies to the main audio output mix.
- * <p>Creating a BassBoost on the output mix (audio session 0) requires permission
- * {@link android.Manifest.permission#MODIFY_AUDIO_SETTINGS}
+ * <p>NOTE: attaching a BassBoost to the global audio output mix by use of session 0 is deprecated.
* <p>See {@link android.media.MediaPlayer#getAudioSessionId()} for details on audio sessions.
* <p>See {@link android.media.audiofx.AudioEffect} class for more details on
* controlling audio effects.
@@ -89,9 +87,8 @@ public class BassBoost extends AudioEffect {
* engine. As the same engine can be shared by several applications, this parameter indicates
* how much the requesting application needs control of effect parameters. The normal priority
* is 0, above normal is a positive number, below normal a negative number.
- * @param audioSession system wide unique audio session identifier. If audioSession
- * is not 0, the BassBoost will be attached to the MediaPlayer or AudioTrack in the
- * same audio session. Otherwise, the BassBoost will apply to the output mix.
+ * @param audioSession system wide unique audio session identifier. The BassBoost will be
+ * attached to the MediaPlayer or AudioTrack in the same audio session.
*
* @throws java.lang.IllegalStateException
* @throws java.lang.IllegalArgumentException
@@ -103,6 +100,10 @@ public class BassBoost extends AudioEffect {
UnsupportedOperationException, RuntimeException {
super(EFFECT_TYPE_BASS_BOOST, EFFECT_TYPE_NULL, priority, audioSession);
+ if (audioSession == 0) {
+ Log.w(TAG, "WARNING: attaching a BassBoost to global output mix is deprecated!");
+ }
+
int[] value = new int[1];
checkStatus(getParameter(PARAM_STRENGTH_SUPPORTED, value));
mStrengthSupported = (value[0] != 0);
diff --git a/media/java/android/media/audiofx/Equalizer.java b/media/java/android/media/audiofx/Equalizer.java
index b3bafa9..7f38955 100644
--- a/media/java/android/media/audiofx/Equalizer.java
+++ b/media/java/android/media/audiofx/Equalizer.java
@@ -39,10 +39,8 @@ import java.util.StringTokenizer;
* mapping those defined by the OpenSL ES 1.0.1 Specification (http://www.khronos.org/opensles/)
* for the SLEqualizerItf interface. Please refer to this specification for more details.
* <p>To attach the Equalizer to a particular AudioTrack or MediaPlayer, specify the audio session
- * ID of this AudioTrack or MediaPlayer when constructing the Equalizer. If the audio session ID 0
- * is specified, the Equalizer applies to the main audio output mix.
- * <p>Creating an Equalizer on the output mix (audio session 0) requires permission
- * {@link android.Manifest.permission#MODIFY_AUDIO_SETTINGS}
+ * ID of this AudioTrack or MediaPlayer when constructing the Equalizer.
+ * <p>NOTE: attaching an Equalizer to the global audio output mix by use of session 0 is deprecated.
* <p>See {@link android.media.MediaPlayer#getAudioSessionId()} for details on audio sessions.
* <p>See {@link android.media.audiofx.AudioEffect} class for more details on controlling audio
* effects.
@@ -134,9 +132,8 @@ public class Equalizer extends AudioEffect {
* engine. As the same engine can be shared by several applications, this parameter indicates
* how much the requesting application needs control of effect parameters. The normal priority
* is 0, above normal is a positive number, below normal a negative number.
- * @param audioSession system wide unique audio session identifier. If audioSession
- * is not 0, the Equalizer will be attached to the MediaPlayer or AudioTrack in the
- * same audio session. Otherwise, the Equalizer will apply to the output mix.
+ * @param audioSession system wide unique audio session identifier. The Equalizer will be
+ * attached to the MediaPlayer or AudioTrack in the same audio session.
*
* @throws java.lang.IllegalStateException
* @throws java.lang.IllegalArgumentException
@@ -148,6 +145,10 @@ public class Equalizer extends AudioEffect {
UnsupportedOperationException, RuntimeException {
super(EFFECT_TYPE_EQUALIZER, EFFECT_TYPE_NULL, priority, audioSession);
+ if (audioSession == 0) {
+ Log.w(TAG, "WARNING: attaching an Equalizer to global output mix is deprecated!");
+ }
+
getNumberOfBands();
mNumPresets = (int)getNumberOfPresets();
diff --git a/media/java/android/media/audiofx/Virtualizer.java b/media/java/android/media/audiofx/Virtualizer.java
index a682a45..68a7b88 100644
--- a/media/java/android/media/audiofx/Virtualizer.java
+++ b/media/java/android/media/audiofx/Virtualizer.java
@@ -40,10 +40,9 @@ import java.util.StringTokenizer;
* mapping those defined by the OpenSL ES 1.0.1 Specification (http://www.khronos.org/opensles/)
* for the SLVirtualizerItf interface. Please refer to this specification for more details.
* <p>To attach the Virtualizer to a particular AudioTrack or MediaPlayer, specify the audio session
- * ID of this AudioTrack or MediaPlayer when constructing the Virtualizer. If the audio session ID 0
- * is specified, the Virtualizer applies to the main audio output mix.
- * <p>Creating a Virtualizer on the output mix (audio session 0) requires permission
- * {@link android.Manifest.permission#MODIFY_AUDIO_SETTINGS}
+ * ID of this AudioTrack or MediaPlayer when constructing the Virtualizer.
+ * <p>NOTE: attaching a Virtualizer to the global audio output mix by use of session 0 is
+ * deprecated.
* <p>See {@link android.media.MediaPlayer#getAudioSessionId()} for details on audio sessions.
* <p>See {@link android.media.audiofx.AudioEffect} class for more details on controlling
* audio effects.
@@ -90,9 +89,8 @@ public class Virtualizer extends AudioEffect {
* engine. As the same engine can be shared by several applications, this parameter indicates
* how much the requesting application needs control of effect parameters. The normal priority
* is 0, above normal is a positive number, below normal a negative number.
- * @param audioSession system wide unique audio session identifier. If audioSession
- * is not 0, the Virtualizer will be attached to the MediaPlayer or AudioTrack in the
- * same audio session. Otherwise, the Virtualizer will apply to the output mix.
+ * @param audioSession system wide unique audio session identifier. The Virtualizer will
+ * be attached to the MediaPlayer or AudioTrack in the same audio session.
*
* @throws java.lang.IllegalStateException
* @throws java.lang.IllegalArgumentException
@@ -104,6 +102,10 @@ public class Virtualizer extends AudioEffect {
UnsupportedOperationException, RuntimeException {
super(EFFECT_TYPE_VIRTUALIZER, EFFECT_TYPE_NULL, priority, audioSession);
+ if (audioSession == 0) {
+ Log.w(TAG, "WARNING: attaching a Virtualizer to global output mix is deprecated!");
+ }
+
int[] value = new int[1];
checkStatus(getParameter(PARAM_STRENGTH_SUPPORTED, value));
mStrengthSupported = (value[0] != 0);
diff --git a/media/jni/mediaeditor/VideoBrowserMain.c b/media/jni/mediaeditor/VideoBrowserMain.c
index 6ef688d..2de55e3 100755
--- a/media/jni/mediaeditor/VideoBrowserMain.c
+++ b/media/jni/mediaeditor/VideoBrowserMain.c
@@ -258,6 +258,7 @@ M4OSA_ERR videoBrowserCreate(
err = pContext->m_pDecoder->m_pFctCreate(
&pContext->m_pDecoderCtx,
pContext->m_pStreamHandler,
+ pContext->m_3gpReader,
pContext->m_3gpData,
&pContext->m_accessUnit,
pContext->m_pCodecLoaderContext) ;
@@ -284,6 +285,7 @@ M4OSA_ERR videoBrowserCreate(
err = pContext->m_pDecoder->m_pFctCreate(
&pContext->m_pDecoderCtx,
pContext->m_pStreamHandler,
+ pContext->m_3gpReader,
pContext->m_3gpData,
&pContext->m_accessUnit,
pContext->m_pCodecLoaderContext) ;
@@ -435,9 +437,12 @@ videoBrowserCleanUp_cleanUp:
* @param pContext (IN) : Video browser context
* @param pTime (IN/OUT) : Pointer on the time to reach. Updated
* by this function with the reached time
+* @param tolerance (IN) : We may decode an earlier frame within the tolerance.
+* The time difference is specified in milliseconds.
* @return M4NO_ERROR / M4ERR_PARAMETER / M4ERR_STATE / M4ERR_ALLOC
******************************************************************************/
-M4OSA_ERR videoBrowserPrepareFrame(M4OSA_Context pContext, M4OSA_UInt32* pTime)
+M4OSA_ERR videoBrowserPrepareFrame(M4OSA_Context pContext, M4OSA_UInt32* pTime,
+ M4OSA_UInt32 tolerance)
{
VideoBrowserContext* pC = (VideoBrowserContext*)pContext;
M4OSA_ERR err = M4NO_ERROR;
@@ -481,52 +486,15 @@ M4OSA_ERR videoBrowserPrepareFrame(M4OSA_Context pContext, M4OSA_UInt32* pTime)
bJumpNeeded = M4OSA_TRUE;
}
- if (M4OSA_TRUE == bJumpNeeded)
- {
- rapTime = targetTime;
- /*--- Retrieve the previous RAP time ---*/
- err = pC->m_3gpReader->m_pFctGetPrevRapTime(
- pC->m_pReaderCtx, pC->m_pStreamHandler, &rapTime);
-
- CHECK_ERR(videoBrowserPrepareFrame, err);
-
- jumpTime = rapTime;
-
- err = pC->m_3gpReader->m_pFctJump(pC->m_pReaderCtx,
- pC->m_pStreamHandler,
- (M4OSA_Int32*)&jumpTime);
- CHECK_ERR(videoBrowserPrepareFrame, err);
- }
-
timeMS = (M4_MediaTime)targetTime;
err = pC->m_pDecoder->m_pFctDecode(
- pC->m_pDecoderCtx, &timeMS, bJumpNeeded);
+ pC->m_pDecoderCtx, &timeMS, bJumpNeeded, tolerance);
if ((err != M4NO_ERROR) && (err != M4WAR_NO_MORE_AU))
{
return err;
}
- // FIXME:
- // Not sure that I understand why we need a second jump logic here
- if ((timeMS >= pC->m_currentCTS) && (M4OSA_TRUE == isBackward))
- {
- jumpTime = rapTime;
- err = pC->m_3gpReader->m_pFctJump(
- pC->m_pReaderCtx, pC->m_pStreamHandler, (M4OSA_Int32*)&jumpTime);
-
- CHECK_ERR(videoBrowserPrepareFrame, err);
-
- timeMS = (M4_MediaTime)rapTime;
- err = pC->m_pDecoder->m_pFctDecode(
- pC->m_pDecoderCtx, &timeMS, M4OSA_TRUE);
-
- if ((err != M4NO_ERROR) && (err != M4WAR_NO_MORE_AU))
- {
- return err;
- }
- }
-
err = pC->m_pDecoder->m_pFctRender(
pC->m_pDecoderCtx, &timeMS, pC->m_outputPlane, M4OSA_TRUE);
diff --git a/media/jni/mediaeditor/VideoBrowserMain.h b/media/jni/mediaeditor/VideoBrowserMain.h
index 5156ebb..00b5e05 100755
--- a/media/jni/mediaeditor/VideoBrowserMain.h
+++ b/media/jni/mediaeditor/VideoBrowserMain.h
@@ -133,7 +133,8 @@ M4OSA_ERR videoBrowserCleanUp(M4OSA_Context pContext) ;
* this function with the reached time
* @return M4NO_ERROR / M4ERR_PARAMETER / M4ERR_STATE / M4ERR_ALLOC
******************************************************************************/
-M4OSA_ERR videoBrowserPrepareFrame(M4OSA_Context pContext, M4OSA_UInt32* pTime);
+M4OSA_ERR videoBrowserPrepareFrame(M4OSA_Context pContext, M4OSA_UInt32* pTime,
+ M4OSA_UInt32 tolerance);
/******************************************************************************
* @brief This function sets the size and the position of the display.
diff --git a/media/jni/mediaeditor/VideoEditorMain.cpp b/media/jni/mediaeditor/VideoEditorMain.cpp
index c95a0c2..14972a2 100755
--- a/media/jni/mediaeditor/VideoEditorMain.cpp
+++ b/media/jni/mediaeditor/VideoEditorMain.cpp
@@ -763,7 +763,7 @@ static int videoEditor_renderPreviewFrame(JNIEnv* pEnv,
ClipProperties.uiVideoWidth,
pContext->pEditSettings->pClipList[iCurrentClipIndex]->\
ClipProperties.uiVideoHeight,
- &tnTimeMs);
+ &tnTimeMs, 0);
if (result != M4NO_ERROR) {
free(pixelArray);
ThumbnailClose(tnContext);
@@ -991,7 +991,7 @@ static int videoEditor_renderMediaItemPreviewFrame(JNIEnv* pEnv,
result = ThumbnailGetPixels16(tnContext, (M4OSA_Int16 *)pixelArray,
frameWidth,
- frameHeight, &timeMs);
+ frameHeight, &timeMs, 0);
if (result != M4NO_ERROR) {
free(pixelArray);
ThumbnailClose(tnContext);
@@ -2132,7 +2132,7 @@ static int videoEditor_getPixels(
m_dst32 = env->GetIntArrayElements(pixelArray, NULL);
- err = ThumbnailGetPixels32(mContext, (M4OSA_Int32 *)m_dst32, width,height,&timeMS);
+ err = ThumbnailGetPixels32(mContext, (M4OSA_Int32 *)m_dst32, width,height,&timeMS,0);
if (err != M4NO_ERROR ) {
if (env != NULL) {
jniThrowException(env, "java/lang/RuntimeException",\
@@ -2194,9 +2194,10 @@ static int videoEditor_getPixelsList(
m_dst32 = env->GetIntArrayElements(pixelArray, NULL);
+ M4OSA_UInt32 tolerance = deltatimeMS / 2;
do {
err = ThumbnailGetPixels32(mContext, ((M4OSA_Int32 *)m_dst32 + arrayOffset),
- width,height,&timeMS);
+ width,height,&timeMS, tolerance);
if (err != M4NO_ERROR ) {
if (env != NULL) {
jniThrowException(env, "java/lang/RuntimeException",\
diff --git a/media/jni/mediaeditor/VideoEditorThumbnailMain.cpp b/media/jni/mediaeditor/VideoEditorThumbnailMain.cpp
index fe3734f..1508246 100755
--- a/media/jni/mediaeditor/VideoEditorThumbnailMain.cpp
+++ b/media/jni/mediaeditor/VideoEditorThumbnailMain.cpp
@@ -74,7 +74,7 @@ typedef struct
M4OSA_ERR ThumbnailGetPixels(const M4OSA_Context pContext,
M4OSA_Int32* pixelArray,
M4OSA_UInt32 width, M4OSA_UInt32 height,
- M4OSA_UInt32* pTimeMS);
+ M4OSA_UInt32* pTimeMS, M4OSA_UInt32 tolerance);
/**
@@ -219,7 +219,7 @@ ThumbnailOpen_cleanUp:
M4OSA_ERR ThumbnailGetPixels(const M4OSA_Context pContext,
M4OSA_Int32* pixelArray,
M4OSA_UInt32 width, M4OSA_UInt32 height,
- M4OSA_UInt32* pTimeMS)
+ M4OSA_UInt32* pTimeMS, M4OSA_UInt32 tolerance)
{
M4OSA_ERR err;
@@ -249,7 +249,7 @@ M4OSA_ERR ThumbnailGetPixels(const M4OSA_Context pContext,
pC->m_previousTime = *pTimeMS;
}
- err = videoBrowserPrepareFrame(pC->m_pVideoBrowser, pTimeMS);
+ err = videoBrowserPrepareFrame(pC->m_pVideoBrowser, pTimeMS, tolerance);
CHECK_ERR(ThumbnailGetPixels, err);
if (pC->m_bRender != M4OSA_TRUE) {
@@ -264,7 +264,8 @@ ThumbnailGetPixels_cleanUp:
M4OSA_ERR ThumbnailGetPixels32(const M4OSA_Context pContext,
M4OSA_Int32* pixelArray, M4OSA_UInt32 width,
- M4OSA_UInt32 height, M4OSA_UInt32* timeMS)
+ M4OSA_UInt32 height, M4OSA_UInt32* timeMS,
+ M4OSA_UInt32 tolerance)
{
M4OSA_ERR err = M4NO_ERROR;
@@ -277,7 +278,7 @@ M4OSA_ERR ThumbnailGetPixels32(const M4OSA_Context pContext,
pC->m_dst16 = NULL;
pC->m_dst32 = pixelArray;
- err = ThumbnailGetPixels(pContext, pixelArray, width, height, timeMS);
+ err = ThumbnailGetPixels(pContext, pixelArray, width, height, timeMS, tolerance);
ThumbnailGetPixels32_cleanUp:
@@ -286,7 +287,8 @@ ThumbnailGetPixels32_cleanUp:
M4OSA_ERR ThumbnailGetPixels16(const M4OSA_Context pContext,
M4OSA_Int16* pixelArray, M4OSA_UInt32 width,
- M4OSA_UInt32 height, M4OSA_UInt32* timeMS)
+ M4OSA_UInt32 height, M4OSA_UInt32* timeMS,
+ M4OSA_UInt32 tolerance)
{
M4OSA_ERR err = M4NO_ERROR;
@@ -298,7 +300,8 @@ M4OSA_ERR ThumbnailGetPixels16(const M4OSA_Context pContext,
pC->m_dst16 = pixelArray;
pC->m_dst32 = NULL;
- err = ThumbnailGetPixels(pContext, (M4OSA_Int32*)pixelArray, width, height, timeMS);
+ err = ThumbnailGetPixels(pContext, (M4OSA_Int32*)pixelArray, width, height,
+ timeMS, tolerance);
ThumbnailGetPixels16_cleanUp:
diff --git a/media/jni/mediaeditor/VideoEditorThumbnailMain.h b/media/jni/mediaeditor/VideoEditorThumbnailMain.h
index 14c60dd..0b3b0c8 100755
--- a/media/jni/mediaeditor/VideoEditorThumbnailMain.h
+++ b/media/jni/mediaeditor/VideoEditorThumbnailMain.h
@@ -49,7 +49,8 @@ M4OSA_ERR ThumbnailOpen(M4OSA_Context *pPContext,
*/
M4OSA_ERR ThumbnailGetPixels32(const M4OSA_Context pContext,
M4OSA_Int32* pixelArray, M4OSA_UInt32 width,
- M4OSA_UInt32 height, M4OSA_UInt32 *timeMS);
+ M4OSA_UInt32 height, M4OSA_UInt32 *timeMS,
+ M4OSA_UInt32 tolerance);
/**
************************************************************************
@@ -63,7 +64,8 @@ M4OSA_ERR ThumbnailGetPixels32(const M4OSA_Context pContext,
*/
M4OSA_ERR ThumbnailGetPixels16(const M4OSA_Context pContext,
M4OSA_Int16* pixelArray, M4OSA_UInt32 width,
- M4OSA_UInt32 height, M4OSA_UInt32 *timeMS);
+ M4OSA_UInt32 height, M4OSA_UInt32 *timeMS,
+ M4OSA_UInt32 tolerance);
/**
************************************************************************