diff options
Diffstat (limited to 'media')
11 files changed, 113 insertions, 154 deletions
diff --git a/media/java/android/media/MediaMetadataRetriever.java b/media/java/android/media/MediaMetadataRetriever.java index b99f7ed..77e939e 100644 --- a/media/java/android/media/MediaMetadataRetriever.java +++ b/media/java/android/media/MediaMetadataRetriever.java @@ -29,7 +29,6 @@ import java.io.IOException; /** * MediaMetadataRetriever class provides a unified interface for retrieving * frame and meta data from an input media file. - * {@hide} */ public class MediaMetadataRetriever { @@ -49,30 +48,6 @@ public class MediaMetadataRetriever } /** - * Call this method before setDataSource() so that the mode becomes - * effective for subsequent operations. This method can be called only once - * at the beginning if the intended mode of operation for a - * MediaMetadataRetriever object remains the same for its whole lifetime, - * and thus it is unnecessary to call this method each time setDataSource() - * is called. If this is not never called (which is allowed), by default the - * intended mode of operation is to both capture frame and retrieve meta - * data (i.e., MODE_GET_METADATA_ONLY | MODE_CAPTURE_FRAME_ONLY). - * Often, this may not be what one wants, since doing this has negative - * performance impact on execution time of a call to setDataSource(), since - * both types of operations may be time consuming. - * - * @param mode The intended mode of operation. Can be any combination of - * MODE_GET_METADATA_ONLY and MODE_CAPTURE_FRAME_ONLY: - * 1. MODE_GET_METADATA_ONLY & MODE_CAPTURE_FRAME_ONLY: - * For neither frame capture nor meta data retrieval - * 2. MODE_GET_METADATA_ONLY: For meta data retrieval only - * 3. MODE_CAPTURE_FRAME_ONLY: For frame capture only - * 4. MODE_GET_METADATA_ONLY | MODE_CAPTURE_FRAME_ONLY: - * For both frame capture and meta data retrieval - */ - public native void setMode(int mode); - - /** * Sets the data source (file pathname) to use. Call this * method before the rest of the methods in this class. This method may be * time-consuming. @@ -199,15 +174,15 @@ public class MediaMetadataRetriever * that the implementation considers as representative may be returned. * * @param option a hint on how the frame is found. Use - * {@link OPTION_PREVIOUS_SYNC} if one wants to retrieve a sync frame + * {@link #OPTION_PREVIOUS_SYNC} if one wants to retrieve a sync frame * that has a timestamp earlier than or the same as timeUs. Use - * {@link OPTION_NEXT_SYNC} if one wants to retrieve a sync frame + * {@link #OPTION_NEXT_SYNC} if one wants to retrieve a sync frame * that has a timestamp later than or the same as timeUs. Use - * {@link OPTION_CLOSEST_SYNC} if one wants to retrieve a sync frame + * {@link #OPTION_CLOSEST_SYNC} if one wants to retrieve a sync frame * that has a timestamp closest to or the same as timeUs. Use - * {@link OPTION_CLOSEST} if one wants to retrieve a frame that may + * {@link #OPTION_CLOSEST} if one wants to retrieve a frame that may * or may not be a sync frame but is closest to or the same as timeUs. - * {@link OPTION_CLOSEST} often has larger performance overhead compared + * {@link #OPTION_CLOSEST} often has larger performance overhead compared * to the other options if there is no sync frame located at timeUs. * * @return A Bitmap containing a representative video frame, which @@ -228,7 +203,7 @@ public class MediaMetadataRetriever * and returns it as a bitmap. This is useful for generating a thumbnail * for an input data source. Call this method if one does not care * how the frame is found as long as it is close to the given time; - * otherwise, please call {@link getFrameAtTime(long, int)}. + * otherwise, please call {@link #getFrameAtTime(long, int)}. * * @param timeUs The time position where the frame will be retrieved. * When retrieving the frame at the given time position, there is no @@ -252,7 +227,7 @@ public class MediaMetadataRetriever * and returns it as a bitmap. This is useful for generating a thumbnail * for an input data source. Call this method if one does not * care about where the frame is located; otherwise, please call - * {@link getFrameAtTime(long)} or {@link getFrameAtTime(long, int)} + * {@link #getFrameAtTime(long)} or {@link #getFrameAtTime(long, int)} * * @return A Bitmap containing a representative video frame, which * can be null, if such a frame cannot be retrieved. @@ -269,8 +244,8 @@ public class MediaMetadataRetriever /** * Call this method after setDataSource(). This method finds the optional - * graphic or album art associated (embedded or external url linked) the - * related data source. + * graphic or album art associated associated with the data source. If + * there are more than one pictures, (any) one of them is returned. * * @return null if no such graphic is found. */ @@ -299,52 +274,129 @@ public class MediaMetadataRetriever } } - public static final int MODE_GET_METADATA_ONLY = 0x01; - public static final int MODE_CAPTURE_FRAME_ONLY = 0x02; - /** - * Option used in method {@link getFrameAtTime(long, int)} to get a + * Option used in method {@link #getFrameAtTime(long, int)} to get a * frame at a specified location. * * @see #getFrameAtTime(long, int) */ - /* Do not change these values without updating their counterparts + /* Do not change these option values without updating their counterparts * in include/media/stagefright/MediaSource.h! */ + /** + * This option is used with {@link #getFrameAtTime(long, int)} to retrieve + * a sync (or key) frame associated with a data source that is located + * right before or at the given time. + * + * @see #getFrameAtTime(long, int) + */ public static final int OPTION_PREVIOUS_SYNC = 0x00; + /** + * This option is used with {@link #getFrameAtTime(long, int)} to retrieve + * a sync (or key) frame associated with a data source that is located + * right after or at the given time. + * + * @see #getFrameAtTime(long, int) + */ public static final int OPTION_NEXT_SYNC = 0x01; + /** + * This option is used with {@link #getFrameAtTime(long, int)} to retrieve + * a sync (or key) frame associated with a data source that is located + * closest to (in time) or at the given time. + * + * @see #getFrameAtTime(long, int) + */ public static final int OPTION_CLOSEST_SYNC = 0x02; + /** + * This option is used with {@link #getFrameAtTime(long, int)} to retrieve + * a frame (not necessarily a key frame) associated with a data source that + * is located closest to or at the given time. + * + * @see #getFrameAtTime(long, int) + */ public static final int OPTION_CLOSEST = 0x03; /* - * Do not change these values without updating their counterparts - * in include/media/mediametadataretriever.h! + * Do not change these metadata key values without updating their + * counterparts in include/media/mediametadataretriever.h! + */ + /** + * The metadata key to retrieve the numberic string describing the + * order of the audio data source on its original recording. */ public static final int METADATA_KEY_CD_TRACK_NUMBER = 0; + /** + * The metadata key to retrieve the information about the album title + * of the data source. + */ public static final int METADATA_KEY_ALBUM = 1; + /** + * The metadata key to retrieve the information about the artist of + * the data source. + */ public static final int METADATA_KEY_ARTIST = 2; + /** + * The metadata key to retrieve the information about the author of + * the data source. + */ public static final int METADATA_KEY_AUTHOR = 3; + /** + * The metadata key to retrieve the information about the composer of + * the data source. + */ public static final int METADATA_KEY_COMPOSER = 4; + /** + * The metadata key to retrieve the date when the data source was created + * or modified. + */ public static final int METADATA_KEY_DATE = 5; + /** + * The metadata key to retrieve the content type or genre of the data + * source. + */ public static final int METADATA_KEY_GENRE = 6; + /** + * The metadata key to retrieve the data source title. + */ public static final int METADATA_KEY_TITLE = 7; + /** + * The metadata key to retrieve the year when the data source was created + * or modified. + */ public static final int METADATA_KEY_YEAR = 8; + /** + * The metadata key to retrieve the playback duration of the data source. + */ public static final int METADATA_KEY_DURATION = 9; + /** + * The metadata key to retrieve the number of tracks, such as audio, video, + * text, in the data source, such as a mp4 or 3gpp file. + */ public static final int METADATA_KEY_NUM_TRACKS = 10; - public static final int METADATA_KEY_IS_DRM_CRIPPLED = 11; - public static final int METADATA_KEY_CODEC = 12; - public static final int METADATA_KEY_RATING = 13; - public static final int METADATA_KEY_COMMENT = 14; - public static final int METADATA_KEY_COPYRIGHT = 15; - public static final int METADATA_KEY_BIT_RATE = 16; - public static final int METADATA_KEY_FRAME_RATE = 17; - public static final int METADATA_KEY_VIDEO_FORMAT = 18; - public static final int METADATA_KEY_VIDEO_HEIGHT = 19; - public static final int METADATA_KEY_VIDEO_WIDTH = 20; - public static final int METADATA_KEY_WRITER = 21; - public static final int METADATA_KEY_MIMETYPE = 22; - public static final int METADATA_KEY_DISCNUMBER = 23; - public static final int METADATA_KEY_ALBUMARTIST = 24; - public static final int METADATA_KEY_COMPILATION = 25; + /** + * The metadata key to retrieve the information of the writer (such as + * lyricist) of the data source. + */ + public static final int METADATA_KEY_WRITER = 11; + /** + * The metadata key to retrieve the mime type of the data source. Some + * example mime types include: "video/mp4", "audio/mp4", "audio/amr-wb", + * etc. + */ + public static final int METADATA_KEY_MIMETYPE = 12; + /** + * The metadata key to retrieve the information about the performers or + * artist associated with the data source. + */ + public static final int METADATA_KEY_ALBUMARTIST = 13; + /** + * The metadata key to retrieve the numberic string that describes which + * part of a set the audio data source comes from. + */ + public static final int METADATA_KEY_DISC_NUMBER = 14; + /** + * The metadata key to retrieve the music album compilation status. + */ + public static final int METADATA_KEY_COMPILATION = 15; // Add more here... } diff --git a/media/java/android/media/ThumbnailUtils.java b/media/java/android/media/ThumbnailUtils.java index b5a82e3..7fdf448 100644 --- a/media/java/android/media/ThumbnailUtils.java +++ b/media/java/android/media/ThumbnailUtils.java @@ -146,7 +146,6 @@ public class ThumbnailUtils { Bitmap bitmap = null; MediaMetadataRetriever retriever = new MediaMetadataRetriever(); try { - retriever.setMode(MediaMetadataRetriever.MODE_CAPTURE_FRAME_ONLY); retriever.setDataSource(filePath); bitmap = retriever.getFrameAtTime(-1); } catch (IllegalArgumentException ex) { diff --git a/media/jni/android_media_MediaMetadataRetriever.cpp b/media/jni/android_media_MediaMetadataRetriever.cpp index 05623ec..b625c08 100644 --- a/media/jni/android_media_MediaMetadataRetriever.cpp +++ b/media/jni/android_media_MediaMetadataRetriever.cpp @@ -152,17 +152,6 @@ static void android_media_MediaMetadataRetriever_setDataSourceFD(JNIEnv *env, jo process_media_retriever_call(env, retriever->setDataSource(fd, offset, length), "java/lang/RuntimeException", "setDataSource failed"); } -static void android_media_MediaMetadataRetriever_setMode(JNIEnv *env, jobject thiz, jint mode) -{ - LOGV("setMode"); - MediaMetadataRetriever* retriever = getRetriever(env, thiz); - if (retriever == 0) { - jniThrowException(env, "java/lang/IllegalStateException", "No retriever available"); - return; - } - process_media_retriever_call(env, retriever->setMode(mode), "java/lang/RuntimeException", "setMode failed"); -} - static jobject android_media_MediaMetadataRetriever_getFrameAtTime(JNIEnv *env, jobject thiz, jlong timeUs, jint option) { LOGV("getFrameAtTime: %lld us option: %d", timeUs, option); @@ -447,7 +436,6 @@ static void android_media_MediaMetadataRetriever_native_setup(JNIEnv *env, jobje static JNINativeMethod nativeMethods[] = { {"setDataSource", "(Ljava/lang/String;)V", (void *)android_media_MediaMetadataRetriever_setDataSource}, {"setDataSource", "(Ljava/io/FileDescriptor;JJ)V", (void *)android_media_MediaMetadataRetriever_setDataSourceFD}, - {"setMode", "(I)V", (void *)android_media_MediaMetadataRetriever_setMode}, {"_getFrameAtTime", "(JI)Landroid/graphics/Bitmap;", (void *)android_media_MediaMetadataRetriever_getFrameAtTime}, {"extractMetadata", "(I)Ljava/lang/String;", (void *)android_media_MediaMetadataRetriever_extractMetadata}, {"getEmbeddedPicture", "(I)[B", (void *)android_media_MediaMetadataRetriever_getEmbeddedPicture}, diff --git a/media/libmedia/IMediaMetadataRetriever.cpp b/media/libmedia/IMediaMetadataRetriever.cpp index 0193e25..d5298c9 100644 --- a/media/libmedia/IMediaMetadataRetriever.cpp +++ b/media/libmedia/IMediaMetadataRetriever.cpp @@ -81,7 +81,6 @@ enum { DISCONNECT = IBinder::FIRST_CALL_TRANSACTION, SET_DATA_SOURCE_URL, SET_DATA_SOURCE_FD, - SET_MODE, GET_FRAME_AT_TIME, EXTRACT_ALBUM_ART, EXTRACT_METADATA, @@ -123,15 +122,6 @@ public: return reply.readInt32(); } - status_t setMode(int mode) - { - Parcel data, reply; - data.writeInterfaceToken(IMediaMetadataRetriever::getInterfaceDescriptor()); - data.writeInt32(mode); - remote()->transact(SET_MODE, data, &reply); - return reply.readInt32(); - } - sp<IMemory> getFrameAtTime(int64_t timeUs, int option) { LOGV("getTimeAtTime: time(%lld us) and option(%d)", timeUs, option); @@ -209,12 +199,6 @@ status_t BnMediaMetadataRetriever::onTransact( reply->writeInt32(setDataSource(fd, offset, length)); return NO_ERROR; } break; - case SET_MODE: { - CHECK_INTERFACE(IMediaMetadataRetriever, data, reply); - int mode = data.readInt32(); - reply->writeInt32(setMode(mode)); - return NO_ERROR; - } break; case GET_FRAME_AT_TIME: { CHECK_INTERFACE(IMediaMetadataRetriever, data, reply); int64_t timeUs = data.readInt64(); diff --git a/media/libmedia/mediametadataretriever.cpp b/media/libmedia/mediametadataretriever.cpp index 39b5bc3..8dfcb3b 100644 --- a/media/libmedia/mediametadataretriever.cpp +++ b/media/libmedia/mediametadataretriever.cpp @@ -123,17 +123,6 @@ status_t MediaMetadataRetriever::setDataSource(int fd, int64_t offset, int64_t l return mRetriever->setDataSource(fd, offset, length); } -status_t MediaMetadataRetriever::setMode(int mode) -{ - LOGV("setMode(%d)", mode); - Mutex::Autolock _l(mLock); - if (mRetriever == 0) { - LOGE("retriever is not initialized"); - return INVALID_OPERATION; - } - return mRetriever->setMode(mode); -} - sp<IMemory> MediaMetadataRetriever::getFrameAtTime(int64_t timeUs, int option) { LOGV("getFrameAtTime: time(%lld us) option(%d)", timeUs, option); diff --git a/media/libmediaplayerservice/MetadataRetrieverClient.cpp b/media/libmediaplayerservice/MetadataRetrieverClient.cpp index abaec02..5fcf2a7 100644 --- a/media/libmediaplayerservice/MetadataRetrieverClient.cpp +++ b/media/libmediaplayerservice/MetadataRetrieverClient.cpp @@ -64,7 +64,6 @@ MetadataRetrieverClient::MetadataRetrieverClient(pid_t pid) mThumbnail = NULL; mAlbumArt = NULL; mRetriever = NULL; - mMode = METADATA_MODE_FRAME_CAPTURE_AND_METADATA_RETRIEVAL; } MetadataRetrieverClient::~MetadataRetrieverClient() @@ -79,7 +78,7 @@ status_t MetadataRetrieverClient::dump(int fd, const Vector<String16>& args) con char buffer[SIZE]; String8 result; result.append(" MetadataRetrieverClient\n"); - snprintf(buffer, 255, " pid(%d) mode(%d)\n", mPid, mMode); + snprintf(buffer, 255, " pid(%d)\n", mPid); result.append(buffer); write(fd, result.string(), result.size()); write(fd, "\n", 1); @@ -93,7 +92,6 @@ void MetadataRetrieverClient::disconnect() mRetriever.clear(); mThumbnail.clear(); mAlbumArt.clear(); - mMode = METADATA_MODE_FRAME_CAPTURE_AND_METADATA_RETRIEVAL; IPCThreadState::self()->flushCommands(); } @@ -133,10 +131,7 @@ status_t MetadataRetrieverClient::setDataSource(const char *url) LOGV("player type = %d", playerType); sp<MediaMetadataRetrieverBase> p = createRetriever(playerType); if (p == NULL) return NO_INIT; - status_t ret = p->setMode(mMode); - if (ret == NO_ERROR) { - ret = p->setDataSource(url); - } + status_t ret = p->setDataSource(url); if (ret == NO_ERROR) mRetriever = p; return ret; } @@ -174,28 +169,12 @@ status_t MetadataRetrieverClient::setDataSource(int fd, int64_t offset, int64_t ::close(fd); return NO_INIT; } - status_t status = p->setMode(mMode); - if (status == NO_ERROR) { - p->setDataSource(fd, offset, length); - } + status_t status = p->setDataSource(fd, offset, length); if (status == NO_ERROR) mRetriever = p; ::close(fd); return status; } -status_t MetadataRetrieverClient::setMode(int mode) -{ - LOGV("setMode"); - Mutex::Autolock lock(mLock); - if (mode < METADATA_MODE_NOOP || - mode > METADATA_MODE_FRAME_CAPTURE_AND_METADATA_RETRIEVAL) { - LOGE("invalid mode %d", mode); - return BAD_VALUE; - } - mMode = mode; - return NO_ERROR; -} - sp<IMemory> MetadataRetrieverClient::getFrameAtTime(int64_t timeUs, int option) { LOGV("getFrameAtTime: time(%lld us) option(%d)", timeUs, option); diff --git a/media/libmediaplayerservice/MetadataRetrieverClient.h b/media/libmediaplayerservice/MetadataRetrieverClient.h index 8b4c0c7..b834715 100644 --- a/media/libmediaplayerservice/MetadataRetrieverClient.h +++ b/media/libmediaplayerservice/MetadataRetrieverClient.h @@ -43,7 +43,6 @@ public: virtual void disconnect(); virtual status_t setDataSource(const char *url); virtual status_t setDataSource(int fd, int64_t offset, int64_t length); - virtual status_t setMode(int mode); virtual sp<IMemory> getFrameAtTime(int64_t timeUs, int option); virtual sp<IMemory> extractAlbumArt(); virtual const char* extractMetadata(int keyCode); @@ -59,7 +58,6 @@ private: mutable Mutex mLock; sp<MediaMetadataRetrieverBase> mRetriever; pid_t mPid; - int mMode; // Keep the shared memory copy of album art and capture frame (for thumbnail) sp<IMemory> mAlbumArt; diff --git a/media/libstagefright/StagefrightMediaScanner.cpp b/media/libstagefright/StagefrightMediaScanner.cpp index 5d15246..39b0021 100644 --- a/media/libstagefright/StagefrightMediaScanner.cpp +++ b/media/libstagefright/StagefrightMediaScanner.cpp @@ -131,9 +131,7 @@ status_t StagefrightMediaScanner::processFile( if (status != OK) { return status; } - } else if (mRetriever->setDataSource(path) == OK - && mRetriever->setMode( - METADATA_MODE_METADATA_RETRIEVAL_ONLY) == OK) { + } else if (mRetriever->setDataSource(path) == OK) { const char *value; if ((value = mRetriever->extractMetadata( METADATA_KEY_MIMETYPE)) != NULL) { @@ -182,9 +180,7 @@ char *StagefrightMediaScanner::extractAlbumArt(int fd) { } lseek64(fd, 0, SEEK_SET); - if (mRetriever->setDataSource(fd, 0, size) == OK - && mRetriever->setMode( - METADATA_MODE_FRAME_CAPTURE_ONLY) == OK) { + if (mRetriever->setDataSource(fd, 0, size) == OK) { sp<IMemory> mem = mRetriever->extractAlbumArt(); if (mem != NULL) { diff --git a/media/libstagefright/StagefrightMetadataRetriever.cpp b/media/libstagefright/StagefrightMetadataRetriever.cpp index 4f483ac..600de7c 100644 --- a/media/libstagefright/StagefrightMetadataRetriever.cpp +++ b/media/libstagefright/StagefrightMetadataRetriever.cpp @@ -266,11 +266,6 @@ VideoFrame *StagefrightMetadataRetriever::getFrameAtTime( int64_t timeUs, int option) { LOGV("getFrameAtTime: %lld us option: %d", timeUs, option); - if (0 == (mMode & METADATA_MODE_FRAME_CAPTURE_ONLY)) { - LOGV("getFrameAtTime disabled by mode (0x%08x)", mMode); - - return NULL; - } if (mExtractor.get() == NULL) { LOGV("no extractor."); @@ -324,12 +319,6 @@ VideoFrame *StagefrightMetadataRetriever::getFrameAtTime( MediaAlbumArt *StagefrightMetadataRetriever::extractAlbumArt() { LOGV("extractAlbumArt (extractor: %s)", mExtractor.get() != NULL ? "YES" : "NO"); - if (0 == (mMode & METADATA_MODE_METADATA_RETRIEVAL_ONLY)) { - LOGV("extractAlbumArt/metadata retrieval disabled by mode"); - - return NULL; - } - if (mExtractor == NULL) { return NULL; } @@ -348,12 +337,6 @@ MediaAlbumArt *StagefrightMetadataRetriever::extractAlbumArt() { } const char *StagefrightMetadataRetriever::extractMetadata(int keyCode) { - if (0 == (mMode & METADATA_MODE_METADATA_RETRIEVAL_ONLY)) { - LOGV("extractAlbumArt/metadata retrieval disabled by mode"); - - return NULL; - } - if (mExtractor == NULL) { return NULL; } diff --git a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/MediaMetadataTest.java b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/MediaMetadataTest.java index 95dbb97..6ded74d 100644 --- a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/MediaMetadataTest.java +++ b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/MediaMetadataTest.java @@ -202,7 +202,6 @@ public class MediaMetadataTest extends AndroidTestCase { } String value = null; MediaMetadataRetriever retriever = new MediaMetadataRetriever(); - retriever.setMode(MediaMetadataRetriever.MODE_GET_METADATA_ONLY); try { retriever.setDataSource(meta_data_file[fileIndex][0]); } catch(Exception e) { diff --git a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/unit/MediaMetadataRetrieverTest.java b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/unit/MediaMetadataRetrieverTest.java index 0870522..a66db05 100644 --- a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/unit/MediaMetadataRetrieverTest.java +++ b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/unit/MediaMetadataRetrieverTest.java @@ -37,7 +37,6 @@ public class MediaMetadataRetrieverTest extends AndroidTestCase { boolean supportWMA = MediaProfileReader.getWMAEnable(); boolean hasFailed = false; boolean supportWMV = MediaProfileReader.getWMVEnable(); - retriever.setMode(MediaMetadataRetriever.MODE_GET_METADATA_ONLY); for (int i = 0, n = MediaNames.ALBUMART_TEST_FILES.length; i < n; ++i) { try { Log.v(TAG, "File " + i + ": " + MediaNames.ALBUMART_TEST_FILES[i]); @@ -116,7 +115,6 @@ public class MediaMetadataRetrieverTest extends AndroidTestCase { boolean supportWMV = MediaProfileReader.getWMVEnable(); boolean hasFailed = false; MediaMetadataRetriever retriever = new MediaMetadataRetriever(); - retriever.setMode(MediaMetadataRetriever.MODE_GET_METADATA_ONLY); for(int i = 0, n = MediaNames.METADATA_RETRIEVAL_TEST_FILES.length; i < n; ++i) { try { Log.v(TAG, "File " + i + ": " + MediaNames.METADATA_RETRIEVAL_TEST_FILES[i]); @@ -170,7 +168,6 @@ public class MediaMetadataRetrieverTest extends AndroidTestCase { public static void testBasicAbnormalMethodCallSequence() { boolean hasFailed = false; MediaMetadataRetriever retriever = new MediaMetadataRetriever(); - retriever.setMode(MediaMetadataRetriever.MODE_GET_METADATA_ONLY); if (retriever.extractMetadata(MediaMetadataRetriever.METADATA_KEY_ALBUM) != null) { Log.e(TAG, "No album metadata expected, but is available"); hasFailed = true; @@ -186,7 +183,6 @@ public class MediaMetadataRetrieverTest extends AndroidTestCase { @MediumTest public static void testSetDataSource() { MediaMetadataRetriever retriever = new MediaMetadataRetriever(); - retriever.setMode(MediaMetadataRetriever.MODE_GET_METADATA_ONLY); boolean hasFailed = false; // Null pointer argument @@ -253,7 +249,6 @@ public class MediaMetadataRetrieverTest extends AndroidTestCase { assertTrue(retriever.extractMetadata(MediaMetadataRetriever.METADATA_KEY_NUM_TRACKS) != null); // Do not capture frame or retrieve metadata - retriever.setMode(MediaMetadataRetriever.MODE_CAPTURE_FRAME_ONLY & MediaMetadataRetriever.MODE_GET_METADATA_ONLY); retriever.setDataSource(MediaNames.TEST_PATH_1); if (retriever.getFrameAtTime(-1) != null) { Log.e(TAG, "No frame expected, but is available"); @@ -265,12 +260,10 @@ public class MediaMetadataRetrieverTest extends AndroidTestCase { } // Capture frame only - retriever.setMode(MediaMetadataRetriever.MODE_CAPTURE_FRAME_ONLY); retriever.setDataSource(MediaNames.TEST_PATH_1); assertTrue(retriever.extractMetadata(MediaMetadataRetriever.METADATA_KEY_NUM_TRACKS) == null); // Retriever metadata only - retriever.setMode(MediaMetadataRetriever.MODE_GET_METADATA_ONLY); retriever.setDataSource(MediaNames.TEST_PATH_1); if (retriever.getFrameAtTime(-1) != null) { Log.e(TAG, "No frame expected, but is available"); @@ -278,7 +271,6 @@ public class MediaMetadataRetrieverTest extends AndroidTestCase { } // Capture frame and retrieve metadata - retriever.setMode(MediaMetadataRetriever.MODE_CAPTURE_FRAME_ONLY | MediaMetadataRetriever.MODE_GET_METADATA_ONLY); retriever.setDataSource(MediaNames.TEST_PATH_1); assertTrue(retriever.getFrameAtTime(-1) != null); assertTrue(retriever.extractMetadata(MediaMetadataRetriever.METADATA_KEY_NUM_TRACKS) != null); |