Automated import from //branches/master/...@141471,141471
This commit is contained in:
committed by
The Android Open Source Project
parent
0f924e65f1
commit
dafe8ac64b
@@ -42,7 +42,8 @@ LOCAL_SRC_FILES:= \
|
||||
LOCAL_SHARED_LIBRARIES:= \
|
||||
libui \
|
||||
libutils \
|
||||
libcutils
|
||||
libcutils \
|
||||
libmedia
|
||||
|
||||
LOCAL_MODULE:= libcameraservice
|
||||
|
||||
|
||||
@@ -28,6 +28,8 @@
|
||||
#include <utils/MemoryHeapBase.h>
|
||||
#include <ui/ICameraService.h>
|
||||
|
||||
#include <media/mediaplayer.h>
|
||||
#include <media/AudioSystem.h>
|
||||
#include "CameraService.h"
|
||||
|
||||
namespace android {
|
||||
@@ -151,6 +153,19 @@ void CameraService::removeClient(const sp<ICameraClient>& cameraClient)
|
||||
}
|
||||
}
|
||||
|
||||
static sp<MediaPlayer> newMediaPlayer(const char *file)
|
||||
{
|
||||
sp<MediaPlayer> mp = new MediaPlayer();
|
||||
if (mp->setDataSource(file) == NO_ERROR) {
|
||||
mp->setAudioStreamType(AudioSystem::ALARM);
|
||||
mp->prepare();
|
||||
} else {
|
||||
mp.clear();
|
||||
LOGE("Failed to load CameraService sounds.");
|
||||
}
|
||||
return mp;
|
||||
}
|
||||
|
||||
CameraService::Client::Client(const sp<CameraService>& cameraService,
|
||||
const sp<ICameraClient>& cameraClient, pid_t clientPid)
|
||||
{
|
||||
@@ -161,6 +176,9 @@ CameraService::Client::Client(const sp<CameraService>& cameraService,
|
||||
mHardware = openCameraHardware();
|
||||
mUseOverlay = mHardware->useOverlay();
|
||||
|
||||
mMediaPlayerClick = newMediaPlayer("/system/media/audio/ui/camera_click.ogg");
|
||||
mMediaPlayerBeep = newMediaPlayer("/system/media/audio/ui/VideoRecord.ogg");
|
||||
|
||||
// Callback is disabled by default
|
||||
mPreviewCallbackFlag = FRAME_CALLBACK_FLAG_NOOP;
|
||||
LOGD("Client X constructor");
|
||||
@@ -265,6 +283,9 @@ CameraService::Client::~Client()
|
||||
#endif
|
||||
}
|
||||
|
||||
mMediaPlayerBeep.clear();
|
||||
mMediaPlayerClick.clear();
|
||||
|
||||
// make sure we tear down the hardware
|
||||
mClientPid = IPCThreadState::self()->getCallingPid();
|
||||
disconnect();
|
||||
@@ -464,6 +485,9 @@ status_t CameraService::Client::startPreview()
|
||||
|
||||
status_t CameraService::Client::startRecording()
|
||||
{
|
||||
if (mMediaPlayerBeep.get() != NULL) {
|
||||
mMediaPlayerBeep->start();
|
||||
}
|
||||
return startCameraMode(CAMERA_RECORDING_MODE);
|
||||
}
|
||||
|
||||
@@ -502,6 +526,9 @@ void CameraService::Client::stopRecording()
|
||||
return;
|
||||
}
|
||||
|
||||
if (mMediaPlayerBeep.get() != NULL) {
|
||||
mMediaPlayerBeep->start();
|
||||
}
|
||||
mHardware->stopRecording();
|
||||
LOGV("stopRecording(), hardware stopped OK");
|
||||
mPreviewBuffer.clear();
|
||||
@@ -684,6 +711,9 @@ status_t CameraService::Client::takePicture()
|
||||
return INVALID_OPERATION;
|
||||
}
|
||||
|
||||
if (mMediaPlayerClick.get() != NULL) {
|
||||
mMediaPlayerClick->start();
|
||||
}
|
||||
return mHardware->takePicture(shutterCallback,
|
||||
yuvPictureCallback,
|
||||
jpegPictureCallback,
|
||||
|
||||
@@ -27,6 +27,8 @@ class android::MemoryHeapBase;
|
||||
|
||||
namespace android {
|
||||
|
||||
class MediaPlayer;
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#define LIKELY( exp ) (__builtin_expect( (exp) != 0, true ))
|
||||
@@ -178,6 +180,9 @@ private:
|
||||
sp<MemoryHeapBase> mPreviewBuffer;
|
||||
int mPreviewCallbackFlag;
|
||||
|
||||
sp<MediaPlayer> mMediaPlayerClick;
|
||||
sp<MediaPlayer> mMediaPlayerBeep;
|
||||
|
||||
// these are immutable once the object is created,
|
||||
// they don't need to be protected by a lock
|
||||
sp<ICameraClient> mCameraClient;
|
||||
|
||||
@@ -45,6 +45,8 @@ PRODUCT_COPY_FILES += \
|
||||
$(local_path)/effects/KeypressSpacebar.ogg:system/media/audio/ui/KeypressSpacebar.ogg \
|
||||
$(local_path)/effects/KeypressDelete.ogg:system/media/audio/ui/KeypressDelete.ogg \
|
||||
$(local_path)/effects/KeypressReturn.ogg:system/media/audio/ui/KeypressReturn.ogg \
|
||||
$(LOCAL_PATH)/effects/VideoRecord.ogg:system/media/audio/ui/VideoRecord.ogg \
|
||||
$(LOCAL_PATH)/effects/camera_click.ogg:system/media/audio/ui/camera_click.ogg \
|
||||
$(local_path)/newwavelabs/Big_Easy.ogg:system/media/audio/ringtones/Big_Easy.ogg \
|
||||
$(local_path)/newwavelabs/Bollywood.ogg:system/media/audio/ringtones/Bollywood.ogg \
|
||||
$(local_path)/newwavelabs/Cairo.ogg:system/media/audio/ringtones/Cairo.ogg \
|
||||
|
||||
@@ -65,5 +65,6 @@ PRODUCT_COPY_FILES += \
|
||||
$(LOCAL_PATH)/effects/KeypressDelete.ogg:system/media/audio/ui/KeypressDelete.ogg \
|
||||
$(LOCAL_PATH)/effects/KeypressReturn.ogg:system/media/audio/ui/KeypressReturn.ogg \
|
||||
$(LOCAL_PATH)/effects/VideoRecord.ogg:system/media/audio/ui/VideoRecord.ogg \
|
||||
$(LOCAL_PATH)/effects/camera_click.ogg:system/media/audio/ui/camera_click.ogg \
|
||||
$(LOCAL_PATH)/newwavelabs/CrazyDream.ogg:system/media/audio/ringtones/CrazyDream.ogg \
|
||||
$(LOCAL_PATH)/newwavelabs/DreamTheme.ogg:system/media/audio/ringtones/DreamTheme.ogg
|
||||
|
||||
BIN
data/sounds/effects/camera_click.ogg
Normal file
BIN
data/sounds/effects/camera_click.ogg
Normal file
Binary file not shown.
Reference in New Issue
Block a user