frameworks/base
修訂 | 67047481a79534f2d35455d955f7cc01df4ec31e (tree) |
---|---|
時間 | 2010-11-19 19:03:28 |
作者 | Owen Kwon <pinebud@gmai...> |
Commiter | Chih-Wei Huang |
enable mplayer as the default player if BUILD_WITH_MPLAYER is true
@@ -41,10 +41,11 @@ enum player_type { | ||
41 | 41 | SONIVOX_PLAYER = 2, |
42 | 42 | VORBIS_PLAYER = 3, |
43 | 43 | STAGEFRIGHT_PLAYER = 4, |
44 | + MPLAYER_PLAYER = 5, | |
44 | 45 | // Test players are available only in the 'test' and 'eng' builds. |
45 | 46 | // The shared library with the test player is passed passed as an |
46 | 47 | // argument to the 'test:' url in the setDataSource call. |
47 | - TEST_PLAYER = 5, | |
48 | + TEST_PLAYER = 6, | |
48 | 49 | }; |
49 | 50 | |
50 | 51 |
@@ -63,8 +63,10 @@ public class MediaFile { | ||
63 | 63 | public static final int FILE_TYPE_3GPP2 = 24; |
64 | 64 | public static final int FILE_TYPE_WMV = 25; |
65 | 65 | public static final int FILE_TYPE_ASF = 26; |
66 | + public static final int FILE_TYPE_AVI = 27; | |
67 | + public static final int FILE_TYPE_MKV = 28; | |
66 | 68 | private static final int FIRST_VIDEO_FILE_TYPE = FILE_TYPE_MP4; |
67 | - private static final int LAST_VIDEO_FILE_TYPE = FILE_TYPE_ASF; | |
69 | + private static final int LAST_VIDEO_FILE_TYPE = FILE_TYPE_MKV; | |
68 | 70 | |
69 | 71 | // Image file types |
70 | 72 | public static final int FILE_TYPE_JPEG = 31; |
@@ -145,6 +147,8 @@ public class MediaFile { | ||
145 | 147 | addFileType("OTA", FILE_TYPE_MID, "audio/midi"); |
146 | 148 | |
147 | 149 | addFileType("MPEG", FILE_TYPE_MP4, "video/mpeg"); |
150 | + addFileType("AVI", FILE_TYPE_AVI, "video/avi"); | |
151 | + addFileType("MKV", FILE_TYPE_MKV, "video/mkv"); | |
148 | 152 | addFileType("MP4", FILE_TYPE_MP4, "video/mp4"); |
149 | 153 | addFileType("M4V", FILE_TYPE_M4V, "video/mp4"); |
150 | 154 | addFileType("3GP", FILE_TYPE_3GPP, "video/3gpp"); |
@@ -62,6 +62,12 @@ LOCAL_C_INCLUDES := \ | ||
62 | 62 | $(TOP)/frameworks/base/media/libstagefright/include \ |
63 | 63 | $(TOP)/external/tremolo/Tremolo |
64 | 64 | |
65 | +ifeq ($(BUILD_WITH_MPLAYER),true) | |
66 | +LOCAL_CFLAGS += -DBUILD_WITH_MPLAYER=1 | |
67 | +LOCAL_SHARED_LIBRARIES += libandroidmplayer | |
68 | +LOCAL_C_INCLUDES += external/mplayer | |
69 | +endif | |
70 | + | |
65 | 71 | LOCAL_MODULE:= libmediaplayerservice |
66 | 72 | |
67 | 73 | include $(BUILD_SHARED_LIBRARY) |
@@ -60,6 +60,9 @@ | ||
60 | 60 | #include <media/PVPlayer.h> |
61 | 61 | #include "TestPlayerStub.h" |
62 | 62 | #include "StagefrightPlayer.h" |
63 | +#ifdef BUILD_WITH_MPLAYER | |
64 | +#include "MPlayer.h" | |
65 | +#endif | |
63 | 66 | |
64 | 67 | #include <OMX.h> |
65 | 68 |
@@ -199,6 +202,15 @@ extmap FILE_EXTS [] = { | ||
199 | 202 | {".ota", SONIVOX_PLAYER}, |
200 | 203 | {".ogg", VORBIS_PLAYER}, |
201 | 204 | {".oga", VORBIS_PLAYER}, |
205 | +#ifdef BUILD_WITH_MPLAYER | |
206 | +#ifndef NO_OPENCORE | |
207 | + {".m4a", PV_PLAYER}, | |
208 | + {".mp3", PV_PLAYER}, | |
209 | +#endif | |
210 | + {".mp4", MPLAYER_PLAYER}, | |
211 | + {".avi", MPLAYER_PLAYER}, | |
212 | + {".mkv", MPLAYER_PLAYER}, | |
213 | +#endif | |
202 | 214 | #ifndef NO_OPENCORE |
203 | 215 | {".wma", PV_PLAYER}, |
204 | 216 | {".wmv", PV_PLAYER}, |
@@ -667,6 +679,9 @@ void MediaPlayerService::Client::disconnect() | ||
667 | 679 | } |
668 | 680 | |
669 | 681 | static player_type getDefaultPlayerType() { |
682 | +#ifdef BUILD_WITH_MPLAYER | |
683 | + return MPLAYER_PLAYER; | |
684 | +#endif | |
670 | 685 | #if BUILD_WITH_FULL_STAGEFRIGHT |
671 | 686 | char value[PROPERTY_VALUE_MAX]; |
672 | 687 | if (property_get("media.stagefright.enable-player", value, NULL) |
@@ -719,6 +734,11 @@ player_type getPlayerType(int fd, int64_t offset, int64_t length) | ||
719 | 734 | } |
720 | 735 | #endif |
721 | 736 | |
737 | +#ifdef BUILD_WITH_MPLAYER | |
738 | + if (ident == 0x03334449 || ident == 20000000) | |
739 | + return PV_PLAYER; | |
740 | +#endif | |
741 | + | |
722 | 742 | // Some kind of MIDI? |
723 | 743 | EAS_DATA_HANDLE easdata; |
724 | 744 | if (EAS_Init(&easdata) == EAS_SUCCESS) { |
@@ -788,6 +808,12 @@ static sp<MediaPlayerBase> createPlayer(player_type playerType, void* cookie, | ||
788 | 808 | { |
789 | 809 | sp<MediaPlayerBase> p; |
790 | 810 | switch (playerType) { |
811 | +#ifdef BUILD_WITH_MPLAYER | |
812 | + case MPLAYER_PLAYER: | |
813 | + LOGV(" create MPlayer"); | |
814 | + p = new MPlayer(); | |
815 | + break; | |
816 | +#endif | |
791 | 817 | #ifndef NO_OPENCORE |
792 | 818 | case PV_PLAYER: |
793 | 819 | LOGV(" create PVPlayer"); |