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

Commit f78933fd authored by Android (Google) Code Review's avatar Android (Google) Code Review
Browse files

Merge change Iea6a38c6 into eclair-mr2

* changes:
  Squashed commit of the following:
parents c77a293c 30ab6629
Loading
Loading
Loading
Loading
+59 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2009 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#ifndef MEDIA_RECORDER_BASE_H_

#define MEDIA_RECORDER_BASE_H_

#include <media/mediarecorder.h>

namespace android {

class ISurface;

struct MediaRecorderBase {
    MediaRecorderBase() {}
    virtual ~MediaRecorderBase() {}

    virtual status_t init() = 0;
    virtual status_t setAudioSource(audio_source as) = 0;
    virtual status_t setVideoSource(video_source vs) = 0;
    virtual status_t setOutputFormat(output_format of) = 0;
    virtual status_t setAudioEncoder(audio_encoder ae) = 0;
    virtual status_t setVideoEncoder(video_encoder ve) = 0;
    virtual status_t setVideoSize(int width, int height) = 0;
    virtual status_t setVideoFrameRate(int frames_per_second) = 0;
    virtual status_t setCamera(const sp<ICamera>& camera) = 0;
    virtual status_t setPreviewSurface(const sp<ISurface>& surface) = 0;
    virtual status_t setOutputFile(const char *path) = 0;
    virtual status_t setOutputFile(int fd, int64_t offset, int64_t length) = 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 start() = 0;
    virtual status_t stop() = 0;
    virtual status_t close() = 0;
    virtual status_t reset() = 0;
    virtual status_t getMaxAmplitude(int *max) = 0;

private:
    MediaRecorderBase(const MediaRecorderBase &);
    MediaRecorderBase &operator=(const MediaRecorderBase &);
};

}  // namespace android

#endif  // MEDIA_RECORDER_BASE_H_
+26 −24
Original line number Diff line number Diff line
@@ -18,8 +18,8 @@
#ifndef ANDROID_PVMEDIARECORDER_H
#define ANDROID_PVMEDIARECORDER_H

#include <media/mediarecorder.h>
#include <media/IMediaPlayerClient.h>
#include <media/MediaRecorderBase.h>

namespace android {

@@ -27,37 +27,39 @@ class ISurface;
class ICamera;
class AuthorDriverWrapper;

class PVMediaRecorder
{
class PVMediaRecorder : public MediaRecorderBase {
public:
    PVMediaRecorder();
    ~PVMediaRecorder();
    virtual ~PVMediaRecorder();

    status_t init();
    status_t setAudioSource(audio_source as);
    status_t setVideoSource(video_source vs);
    status_t setOutputFormat(output_format of);
    status_t setAudioEncoder(audio_encoder ae);
    status_t setVideoEncoder(video_encoder ve);
    status_t setVideoSize(int width, int height);
    status_t setVideoFrameRate(int frames_per_second);
    status_t setCamera(const sp<ICamera>& camera);
    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();
    status_t stop();
    status_t close();
    status_t reset();
    status_t getMaxAmplitude(int *max);
    virtual status_t init();
    virtual status_t setAudioSource(audio_source as);
    virtual status_t setVideoSource(video_source vs);
    virtual status_t setOutputFormat(output_format of);
    virtual status_t setAudioEncoder(audio_encoder ae);
    virtual status_t setVideoEncoder(video_encoder ve);
    virtual status_t setVideoSize(int width, int height);
    virtual status_t setVideoFrameRate(int frames_per_second);
    virtual status_t setCamera(const sp<ICamera>& camera);
    virtual status_t setPreviewSurface(const sp<ISurface>& surface);
    virtual status_t setOutputFile(const char *path);
    virtual status_t setOutputFile(int fd, int64_t offset, int64_t length);
    virtual status_t setParameters(const String8& params);
    virtual status_t setListener(const sp<IMediaPlayerClient>& listener);
    virtual status_t prepare();
    virtual status_t start();
    virtual status_t stop();
    virtual status_t close();
    virtual status_t reset();
    virtual status_t getMaxAmplitude(int *max);

private:
    status_t doStop();

    AuthorDriverWrapper*            mAuthorDriverWrapper;

    PVMediaRecorder(const PVMediaRecorder &);
    PVMediaRecorder &operator=(const PVMediaRecorder &);
};

}; // namespace android
+5 −0
Original line number Diff line number Diff line
@@ -26,6 +26,7 @@

namespace android {

class ICamera;
class IMemory;
class ISurface;
class Camera;
@@ -33,9 +34,12 @@ class Camera;
class CameraSource : public MediaSource {
public:
    static CameraSource *Create();
    static CameraSource *CreateFromICamera(const sp<ICamera> &icamera);

    virtual ~CameraSource();

    void setPreviewSurface(const sp<ISurface> &surface);

    virtual status_t start(MetaData *params = NULL);
    virtual status_t stop();

@@ -48,6 +52,7 @@ private:
    friend class CameraSourceListener;

    sp<Camera> mCamera;
    sp<ISurface> mPreviewSurface;

    Mutex mLock;
    Condition mFrameAvailableCondition;
+2 −0
Original line number Diff line number Diff line
@@ -33,6 +33,7 @@ class MetaData;
class MPEG4Writer : public RefBase {
public:
    MPEG4Writer(const char *filename);
    MPEG4Writer(int fd);

    void addSource(const sp<MediaSource> &source);
    status_t start();
@@ -65,6 +66,7 @@ private:
    List<off_t> mBoxes;

    off_t addSample(MediaBuffer *buffer);
    off_t addLengthPrefixedSample(MediaBuffer *buffer);

    MPEG4Writer(const MPEG4Writer &);
    MPEG4Writer &operator=(const MPEG4Writer &);
+2 −1
Original line number Diff line number Diff line
@@ -38,7 +38,8 @@ enum {
    kKeyESDS              = 'esds',  // raw data
    kKeyAVCC              = 'avcc',  // raw data
    kKeyWantsNALFragments = 'NALf',
    kKeyIsSyncFrame       = 'sync',
    kKeyIsSyncFrame       = 'sync',  // int32_t (bool)
    kKeyIsCodecConfig     = 'conf',  // int32_t (bool)
    kKeyTime              = 'time',  // int64_t (usecs)
    kKeyDuration          = 'dura',  // int64_t (usecs)
    kKeyColorFormat       = 'colf',
Loading