Deal better with situations where OpenCORE is disabled.
diff --git a/media/jni/Android.mk b/media/jni/Android.mk
index 0a8d1f3..50c2bcd 100644
--- a/media/jni/Android.mk
+++ b/media/jni/Android.mk
@@ -1,7 +1,8 @@
-ifneq ($(BUILD_WITHOUT_PV),true)
 LOCAL_PATH:= $(call my-dir)
 include $(CLEAR_VARS)
 
+ifneq ($(BUILD_WITHOUT_PV),true)
+
 LOCAL_SRC_FILES:= \
 	android_media_MediaPlayer.cpp \
 	android_media_MediaRecorder.cpp \
@@ -38,6 +39,7 @@
 
 include $(BUILD_SHARED_LIBRARY)
 
+endif
+
 # build libsoundpool.so
 include $(LOCAL_PATH)/soundpool/Android.mk
-endif
diff --git a/media/libmediaplayerservice/Android.mk b/media/libmediaplayerservice/Android.mk
index 922df43..c45eb3d 100644
--- a/media/libmediaplayerservice/Android.mk
+++ b/media/libmediaplayerservice/Android.mk
@@ -7,12 +7,16 @@
 include $(CLEAR_VARS)
 
 LOCAL_SRC_FILES:=               \
-	MediaRecorderClient.cpp \
 	MediaPlayerService.cpp \
 	MetadataRetrieverClient.cpp \
 	VorbisPlayer.cpp \
 	MidiFile.cpp
 
+ifneq ($(BUILD_WITHOUT_PV),true)
+LOCAL_SRC_FILES+=               \
+	MediaRecorderClient.cpp
+endif
+
 ifeq ($(TARGET_OS)-$(TARGET_SIMULATOR),linux-true)
 LOCAL_LDLIBS += -ldl -lpthread
 endif
@@ -22,14 +26,22 @@
 	libutils \
 	libvorbisidec \
 	libsonivox \
-	libopencore_player \
-	libopencore_author \
 	libmedia \
 	libandroid_runtime
 
+ifneq ($(BUILD_WITHOUT_PV),true)
+LOCAL_SHARED_LIBRARIES += \
+	libopencore_player \
+	libopencore_author
+endif
+
 LOCAL_C_INCLUDES := external/tremor/Tremor \
 	$(call include-path-for, graphics corecg)
 
+ifeq ($(BUILD_WITHOUT_PV),true)
+LOCAL_CFLAGS := -DNO_OPENCORE
+endif
+
 LOCAL_MODULE:= libmediaplayerservice
 
 include $(BUILD_SHARED_LIBRARY)
diff --git a/media/libmediaplayerservice/MediaPlayerService.cpp b/media/libmediaplayerservice/MediaPlayerService.cpp
index 40705c6..95001c6 100644
--- a/media/libmediaplayerservice/MediaPlayerService.cpp
+++ b/media/libmediaplayerservice/MediaPlayerService.cpp
@@ -105,7 +105,11 @@
 
 sp<IMediaRecorder> MediaPlayerService::createMediaRecorder(pid_t pid)
 {
+#ifndef NO_OPENCORE
     sp<MediaRecorderClient> recorder = new MediaRecorderClient(pid);
+#else
+    sp<MediaRecorderClient> recorder = NULL;
+#endif
     LOGV("Create new media recorder client from pid %d", pid);
     return recorder;
 }
@@ -531,10 +535,12 @@
 {
     sp<MediaPlayerBase> p;
     switch (playerType) {
+#ifndef NO_OPENCORE
         case PV_PLAYER:
             LOGV(" create PVPlayer");
             p = new PVPlayer();
             break;
+#endif
         case SONIVOX_PLAYER:
             LOGV(" create MidiFile");
             p = new MidiFile();
diff --git a/media/libmediaplayerservice/MetadataRetrieverClient.cpp b/media/libmediaplayerservice/MetadataRetrieverClient.cpp
index a320bd5..6cb4a34 100644
--- a/media/libmediaplayerservice/MetadataRetrieverClient.cpp
+++ b/media/libmediaplayerservice/MetadataRetrieverClient.cpp
@@ -49,7 +49,11 @@
     mThumbnail = NULL;
     mAlbumArt = NULL;
 
+#ifndef NO_OPENCORE
     mRetriever = new PVMetadataRetriever();
+#else
+    mRetriever = NULL;
+#endif
     if (mRetriever == NULL) {
         LOGE("failed to initialize the retriever");
     }
diff --git a/preloaded-classes b/preloaded-classes
index b91f41b..ed476d6 100644
--- a/preloaded-classes
+++ b/preloaded-classes
@@ -177,9 +177,6 @@
 android.graphics.drawable.shapes.RoundRectShape
 android.location.ILocationManager$Stub
 android.media.AudioManager
-android.media.MediaPlayer
-android.media.MediaRecorder
-android.media.MediaScanner
 android.net.LocalSocket
 android.net.LocalSocketAddress
 android.net.LocalSocketAddress$Namespace