diff options
author | Andreas Huber <andih@google.com> | 2010-03-10 10:55:35 -0800 |
---|---|---|
committer | Andreas Huber <andih@google.com> | 2010-03-10 10:55:35 -0800 |
commit | 1ce986767ae5998ece6810c2933d0b274c529744 (patch) | |
tree | 6458609eb8489dbe0f656783e4e65bc84290fff2 | |
parent | f53774bce6f31ac0ae3dd21ab41aa607e548e703 (diff) | |
download | frameworks_base-1ce986767ae5998ece6810c2933d0b274c529744.zip frameworks_base-1ce986767ae5998ece6810c2933d0b274c529744.tar.gz frameworks_base-1ce986767ae5998ece6810c2933d0b274c529744.tar.bz2 |
Instead of instantiating StagefrightMetadataRetriever directly, instantiate a MediaMetadataRetriever which will do-the-right-thing(tm) even for .wma/.wmv/.asf files.
Change-Id: Ibda4b5268514934f14a3d49a564902bc670f4384
related-to-bug: 2074137
-rw-r--r-- | include/media/stagefright/StagefrightMediaScanner.h | 4 | ||||
-rw-r--r-- | media/libstagefright/StagefrightMediaScanner.cpp | 20 |
2 files changed, 14 insertions, 10 deletions
diff --git a/include/media/stagefright/StagefrightMediaScanner.h b/include/media/stagefright/StagefrightMediaScanner.h index af125dc..4437eee 100644 --- a/include/media/stagefright/StagefrightMediaScanner.h +++ b/include/media/stagefright/StagefrightMediaScanner.h @@ -22,7 +22,7 @@ namespace android { -struct StagefrightMetadataRetriever; +struct MediaMetadataRetriever; struct StagefrightMediaScanner : public MediaScanner { StagefrightMediaScanner(); @@ -35,7 +35,7 @@ struct StagefrightMediaScanner : public MediaScanner { virtual char *extractAlbumArt(int fd); private: - sp<StagefrightMetadataRetriever> mRetriever; + sp<MediaMetadataRetriever> mRetriever; StagefrightMediaScanner(const StagefrightMediaScanner &); StagefrightMediaScanner &operator=(const StagefrightMediaScanner &); diff --git a/media/libstagefright/StagefrightMediaScanner.cpp b/media/libstagefright/StagefrightMediaScanner.cpp index b1eca2b..34fb2bc 100644 --- a/media/libstagefright/StagefrightMediaScanner.cpp +++ b/media/libstagefright/StagefrightMediaScanner.cpp @@ -20,7 +20,8 @@ #include <media/stagefright/StagefrightMediaScanner.h> -#include "include/StagefrightMetadataRetriever.h" +#include <media/mediametadataretriever.h> +#include <private/media/VideoFrame.h> // Sonivox includes #include <libsonivox/eas.h> @@ -32,7 +33,7 @@ namespace android { StagefrightMediaScanner::StagefrightMediaScanner() - : mRetriever(new StagefrightMetadataRetriever) { + : mRetriever(new MediaMetadataRetriever) { } StagefrightMediaScanner::~StagefrightMediaScanner() {} @@ -146,6 +147,8 @@ failure: status_t StagefrightMediaScanner::processFile( const char *path, const char *mimeType, MediaScannerClient &client) { + LOGV("processFile '%s'.", path); + client.setLocale(locale()); client.beginFile(); @@ -218,6 +221,8 @@ status_t StagefrightMediaScanner::processFile( } char *StagefrightMediaScanner::extractAlbumArt(int fd) { + LOGV("extractAlbumArt %d", fd); + off_t size = lseek(fd, 0, SEEK_END); if (size < 0) { return NULL; @@ -227,15 +232,14 @@ char *StagefrightMediaScanner::extractAlbumArt(int fd) { if (mRetriever->setDataSource(fd, 0, size) == OK && mRetriever->setMode( METADATA_MODE_FRAME_CAPTURE_ONLY) == OK) { - MediaAlbumArt *art = mRetriever->extractAlbumArt(); + sp<IMemory> mem = mRetriever->extractAlbumArt(); + + if (mem != NULL) { + MediaAlbumArt *art = static_cast<MediaAlbumArt *>(mem->pointer()); - if (art != NULL) { char *data = (char *)malloc(art->mSize + 4); *(int32_t *)data = art->mSize; - memcpy(&data[4], art->mData, art->mSize); - - delete art; - art = NULL; + memcpy(&data[4], &art[1], art->mSize); return data; } |