Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c048cae0 authored by The Android Open Source Project's avatar The Android Open Source Project
Browse files

auto import from //branches/cupcake_rel/...@138607

parent 65e731f3
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -42,6 +42,7 @@ public:
    virtual	status_t		setOutputFile(int fd, int64_t offset, int64_t length) = 0;
    virtual	status_t		setVideoSize(int width, int height) = 0;
    virtual	status_t		setVideoFrameRate(int frames_per_second) = 0;
    virtual     status_t                setParameters(const String8& params) = 0;
    virtual     status_t                setListener(const sp<IMediaPlayerClient>& listener) = 0;
    virtual	status_t		prepare() = 0;
    virtual	status_t		getMaxAmplitude(int* max) = 0;
+1 −0
Original line number Diff line number Diff line
@@ -45,6 +45,7 @@ public:
    status_t setPreviewSurface(const sp<ISurface>& surface);
    status_t setOutputFile(const char *path);
    status_t setOutputFile(int fd, int64_t offset, int64_t length);
    status_t setParameters(const String8& params);
    status_t setListener(const sp<IMediaPlayerClient>& listener);
    status_t prepare();
    status_t start();
+14 −3
Original line number Diff line number Diff line
@@ -89,14 +89,24 @@ enum media_recorder_states {
};

// The "msg" code passed to the listener in notify.
enum {
    MEDIA_RECORDER_EVENT_ERROR                    = 1
enum media_recorder_event_type {
    MEDIA_RECORDER_EVENT_ERROR                    = 1,
    MEDIA_RECORDER_EVENT_INFO                     = 2
};

enum {
enum media_recorder_error_type {
    MEDIA_RECORDER_ERROR_UNKNOWN                  = 1
};

// The codes are distributed as follow:
//   0xx: Reserved
//   8xx: General info/warning
// 
enum media_recorder_info_type {
    MEDIA_RECORDER_INFO_UNKNOWN                   = 1,
    MEDIA_RECORDER_INFO_MAX_DURATION_REACHED      = 800
};

// ----------------------------------------------------------------------------
// ref-counted object for callbacks
class MediaRecorderListener: virtual public RefBase
@@ -123,6 +133,7 @@ public:
    status_t    setOutputFile(int fd, int64_t offset, int64_t length);
    status_t    setVideoSize(int width, int height);
    status_t    setVideoFrameRate(int frames_per_second);
    status_t    setParameters(const String8& params);
    status_t    setListener(const sp<MediaRecorderListener>& listener);
    status_t    prepare();
    status_t    getMaxAmplitude(int* max);
+17 −0
Original line number Diff line number Diff line
@@ -44,6 +44,7 @@ enum {
    SET_OUTPUT_FILE_FD,
    SET_VIDEO_SIZE,
    SET_VIDEO_FRAMERATE,
    SET_PARAMETERS,
    SET_PREVIEW_SURFACE,
    SET_CAMERA,
    SET_LISTENER
@@ -178,6 +179,16 @@ public:
        return reply.readInt32();
    }

    status_t setParameters(const String8& params)
    {
        LOGV("setParameter(%s)", params.string());
        Parcel data, reply;
        data.writeInterfaceToken(IMediaRecorder::getInterfaceDescriptor());
        data.writeString8(params);
        remote()->transact(SET_PARAMETERS, data, &reply);
        return reply.readInt32();
    }

    status_t setListener(const sp<IMediaPlayerClient>& listener)
    {
        LOGV("setListener(%p)", listener.get());
@@ -385,6 +396,12 @@ status_t BnMediaRecorder::onTransact(
            reply->writeInt32(setVideoFrameRate(frames_per_second));
            return NO_ERROR;
        } break;
        case SET_PARAMETERS: {
            LOGV("SET_PARAMETER");
            CHECK_INTERFACE(IMediaRecorder, data, reply);
            reply->writeInt32(setParameters(data.readString8()));
            return NO_ERROR;
        } break;
        case SET_LISTENER: {
            LOGV("SET_LISTENER");
            CHECK_INTERFACE(IMediaRecorder, data, reply);
+18 −0
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@
#include <ui/Surface.h>
#include <media/mediarecorder.h>
#include <utils/IServiceManager.h>
#include <utils/String8.h>
#include <media/IMediaPlayerService.h>
#include <media/IMediaRecorder.h>

@@ -356,6 +357,23 @@ status_t MediaRecorder::setVideoFrameRate(int frames_per_second)
    return ret;
}

status_t MediaRecorder::setParameters(const String8& params) {
    LOGV("setParameters(%s)", params.string());
    if(mMediaRecorder == NULL) {
        LOGE("media recorder is not initialized yet");
        return INVALID_OPERATION;
    }

    status_t ret = mMediaRecorder->setParameters(params);
    if (OK != ret) {
        LOGE("setParameters(%s) failed: %d", params.string(), ret);
        mCurrentState = MEDIA_RECORDER_ERROR;
        return ret;
    }

    return ret;
}

status_t MediaRecorder::prepare()
{
    LOGV("prepare");
Loading