From 67047481a79534f2d35455d955f7cc01df4ec31e Mon Sep 17 00:00:00 2001 From: Owen Kwon Date: Mon, 11 Oct 2010 11:53:42 +0900 Subject: [PATCH] enable mplayer as the default player if BUILD_WITH_MPLAYER is true --- include/media/MediaPlayerInterface.h | 3 ++- media/java/android/media/MediaFile.java | 6 ++++- media/libmediaplayerservice/Android.mk | 6 +++++ media/libmediaplayerservice/MediaPlayerService.cpp | 26 ++++++++++++++++++++++ 4 files changed, 39 insertions(+), 2 deletions(-) diff --git a/include/media/MediaPlayerInterface.h b/include/media/MediaPlayerInterface.h index 9e606d99f3de..44ba686f1c5f 100644 --- a/include/media/MediaPlayerInterface.h +++ b/include/media/MediaPlayerInterface.h @@ -41,10 +41,11 @@ enum player_type { SONIVOX_PLAYER = 2, VORBIS_PLAYER = 3, STAGEFRIGHT_PLAYER = 4, + MPLAYER_PLAYER = 5, // Test players are available only in the 'test' and 'eng' builds. // The shared library with the test player is passed passed as an // argument to the 'test:' url in the setDataSource call. - TEST_PLAYER = 5, + TEST_PLAYER = 6, }; diff --git a/media/java/android/media/MediaFile.java b/media/java/android/media/MediaFile.java index 9d1d4201cb24..8daddd78614a 100644 --- a/media/java/android/media/MediaFile.java +++ b/media/java/android/media/MediaFile.java @@ -63,8 +63,10 @@ public class MediaFile { public static final int FILE_TYPE_3GPP2 = 24; public static final int FILE_TYPE_WMV = 25; public static final int FILE_TYPE_ASF = 26; + public static final int FILE_TYPE_AVI = 27; + public static final int FILE_TYPE_MKV = 28; private static final int FIRST_VIDEO_FILE_TYPE = FILE_TYPE_MP4; - private static final int LAST_VIDEO_FILE_TYPE = FILE_TYPE_ASF; + private static final int LAST_VIDEO_FILE_TYPE = FILE_TYPE_MKV; // Image file types public static final int FILE_TYPE_JPEG = 31; @@ -145,6 +147,8 @@ public class MediaFile { addFileType("OTA", FILE_TYPE_MID, "audio/midi"); addFileType("MPEG", FILE_TYPE_MP4, "video/mpeg"); + addFileType("AVI", FILE_TYPE_AVI, "video/avi"); + addFileType("MKV", FILE_TYPE_MKV, "video/mkv"); addFileType("MP4", FILE_TYPE_MP4, "video/mp4"); addFileType("M4V", FILE_TYPE_M4V, "video/mp4"); addFileType("3GP", FILE_TYPE_3GPP, "video/3gpp"); diff --git a/media/libmediaplayerservice/Android.mk b/media/libmediaplayerservice/Android.mk index cf97b2344eba..5edfb13af387 100644 --- a/media/libmediaplayerservice/Android.mk +++ b/media/libmediaplayerservice/Android.mk @@ -62,6 +62,12 @@ LOCAL_C_INCLUDES := \ $(TOP)/frameworks/base/media/libstagefright/include \ $(TOP)/external/tremolo/Tremolo +ifeq ($(BUILD_WITH_MPLAYER),true) +LOCAL_CFLAGS += -DBUILD_WITH_MPLAYER=1 +LOCAL_SHARED_LIBRARIES += libandroidmplayer +LOCAL_C_INCLUDES += external/mplayer +endif + LOCAL_MODULE:= libmediaplayerservice include $(BUILD_SHARED_LIBRARY) diff --git a/media/libmediaplayerservice/MediaPlayerService.cpp b/media/libmediaplayerservice/MediaPlayerService.cpp index 3e1f4a57ba66..49a53b619001 100644 --- a/media/libmediaplayerservice/MediaPlayerService.cpp +++ b/media/libmediaplayerservice/MediaPlayerService.cpp @@ -60,6 +60,9 @@ #include #include "TestPlayerStub.h" #include "StagefrightPlayer.h" +#ifdef BUILD_WITH_MPLAYER +#include "MPlayer.h" +#endif #include @@ -199,6 +202,15 @@ extmap FILE_EXTS [] = { {".ota", SONIVOX_PLAYER}, {".ogg", VORBIS_PLAYER}, {".oga", VORBIS_PLAYER}, +#ifdef BUILD_WITH_MPLAYER +#ifndef NO_OPENCORE + {".m4a", PV_PLAYER}, + {".mp3", PV_PLAYER}, +#endif + {".mp4", MPLAYER_PLAYER}, + {".avi", MPLAYER_PLAYER}, + {".mkv", MPLAYER_PLAYER}, +#endif #ifndef NO_OPENCORE {".wma", PV_PLAYER}, {".wmv", PV_PLAYER}, @@ -667,6 +679,9 @@ void MediaPlayerService::Client::disconnect() } static player_type getDefaultPlayerType() { +#ifdef BUILD_WITH_MPLAYER + return MPLAYER_PLAYER; +#endif #if BUILD_WITH_FULL_STAGEFRIGHT char value[PROPERTY_VALUE_MAX]; if (property_get("media.stagefright.enable-player", value, NULL) @@ -719,6 +734,11 @@ player_type getPlayerType(int fd, int64_t offset, int64_t length) } #endif +#ifdef BUILD_WITH_MPLAYER + if (ident == 0x03334449 || ident == 20000000) + return PV_PLAYER; +#endif + // Some kind of MIDI? EAS_DATA_HANDLE easdata; if (EAS_Init(&easdata) == EAS_SUCCESS) { @@ -788,6 +808,12 @@ static sp createPlayer(player_type playerType, void* cookie, { sp p; switch (playerType) { +#ifdef BUILD_WITH_MPLAYER + case MPLAYER_PLAYER: + LOGV(" create MPlayer"); + p = new MPlayer(); + break; +#endif #ifndef NO_OPENCORE case PV_PLAYER: LOGV(" create PVPlayer"); -- 2.11.0