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

Commit 65cdc2b7 authored by Pannag Sanketi's avatar Pannag Sanketi Committed by Android (Google) Code Review
Browse files

Merge "Connect MediaRecorder Native to SurfaceMediaSource"

parents bbb85c8e 897e27bc
Loading
Loading
Loading
Loading
+2 −0
Original line number Original line Diff line number Diff line
@@ -26,6 +26,7 @@ class Surface;
class ICamera;
class ICamera;
class ICameraRecordingProxy;
class ICameraRecordingProxy;
class IMediaRecorderClient;
class IMediaRecorderClient;
class ISurfaceTexture;


class IMediaRecorder: public IInterface
class IMediaRecorder: public IInterface
{
{
@@ -55,6 +56,7 @@ public:
    virtual status_t init() = 0;
    virtual status_t init() = 0;
    virtual status_t close() = 0;
    virtual status_t close() = 0;
    virtual status_t release() = 0;
    virtual status_t release() = 0;
    virtual sp<ISurfaceTexture> querySurfaceMediaSource() = 0;
};
};


// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
+2 −0
Original line number Original line Diff line number Diff line
@@ -26,6 +26,7 @@ namespace android {


class ICameraRecordingProxy;
class ICameraRecordingProxy;
class Surface;
class Surface;
class ISurfaceTexture;


struct MediaRecorderBase {
struct MediaRecorderBase {
    MediaRecorderBase() {}
    MediaRecorderBase() {}
@@ -54,6 +55,7 @@ struct MediaRecorderBase {
    virtual status_t reset() = 0;
    virtual status_t reset() = 0;
    virtual status_t getMaxAmplitude(int *max) = 0;
    virtual status_t getMaxAmplitude(int *max) = 0;
    virtual status_t dump(int fd, const Vector<String16>& args) const = 0;
    virtual status_t dump(int fd, const Vector<String16>& args) const = 0;
    virtual sp<ISurfaceTexture> querySurfaceMediaSource() const = 0;


private:
private:
    MediaRecorderBase(const MediaRecorderBase &);
    MediaRecorderBase(const MediaRecorderBase &);
+10 −0
Original line number Original line Diff line number Diff line
@@ -31,12 +31,15 @@ class Surface;
class IMediaRecorder;
class IMediaRecorder;
class ICamera;
class ICamera;
class ICameraRecordingProxy;
class ICameraRecordingProxy;
class ISurfaceTexture;
class SurfaceTextureClient;


typedef void (*media_completion_f)(status_t status, void *cookie);
typedef void (*media_completion_f)(status_t status, void *cookie);


enum video_source {
enum video_source {
    VIDEO_SOURCE_DEFAULT = 0,
    VIDEO_SOURCE_DEFAULT = 0,
    VIDEO_SOURCE_CAMERA = 1,
    VIDEO_SOURCE_CAMERA = 1,
    VIDEO_SOURCE_GRALLOC_BUFFER = 2,


    VIDEO_SOURCE_LIST_END  // must be last - used to validate audio source type
    VIDEO_SOURCE_LIST_END  // must be last - used to validate audio source type
};
};
@@ -226,6 +229,7 @@ public:
    status_t    close();
    status_t    close();
    status_t    release();
    status_t    release();
    void        notify(int msg, int ext1, int ext2);
    void        notify(int msg, int ext1, int ext2);
    sp<ISurfaceTexture>     querySurfaceMediaSourceFromMediaServer();


private:
private:
    void                    doCleanUp();
    void                    doCleanUp();
@@ -233,6 +237,12 @@ private:


    sp<IMediaRecorder>          mMediaRecorder;
    sp<IMediaRecorder>          mMediaRecorder;
    sp<MediaRecorderListener>   mListener;
    sp<MediaRecorderListener>   mListener;

    // Reference toISurfaceTexture
    // for encoding GL Frames. That is useful only when the
    // video source is set to VIDEO_SOURCE_GRALLOC_BUFFER
    sp<ISurfaceTexture>         mSurfaceMediaSource;

    media_recorder_states       mCurrentState;
    media_recorder_states       mCurrentState;
    bool                        mIsAudioSourceSet;
    bool                        mIsAudioSourceSet;
    bool                        mIsVideoSourceSet;
    bool                        mIsVideoSourceSet;
+7 −3
Original line number Original line Diff line number Diff line
@@ -64,8 +64,8 @@ public:
    virtual sp<MetaData> getFormat();
    virtual sp<MetaData> getFormat();


    // Get / Set the frame rate used for encoding. Default fps = 30
    // Get / Set the frame rate used for encoding. Default fps = 30
    void setFrameRate(uint32_t fps) ;
    status_t setFrameRate(int32_t fps) ;
    uint32_t getFrameRate( ) const;
    int32_t getFrameRate( ) const;


    // The call for the StageFrightRecorder to tell us that
    // The call for the StageFrightRecorder to tell us that
    // it is done using the MediaBuffer data so that its state
    // it is done using the MediaBuffer data so that its state
@@ -171,6 +171,10 @@ public:
    void dump(String8& result, const char* prefix, char* buffer,
    void dump(String8& result, const char* prefix, char* buffer,
                                                    size_t SIZE) const;
                                                    size_t SIZE) const;


    // isMetaDataStoredInVideoBuffers tells the encoder whether we will
    // pass metadata through the buffers. Currently, it is force set to true
    bool isMetaDataStoredInVideoBuffers() const;

protected:
protected:


    // freeAllBuffers frees the resources (both GraphicBuffer and EGLImage) for
    // freeAllBuffers frees the resources (both GraphicBuffer and EGLImage) for
+1 −1
Original line number Original line Diff line number Diff line
@@ -127,7 +127,7 @@ static bool process_media_recorder_call(JNIEnv *env, status_t opStatus, const ch
    return false;
    return false;
}
}


static sp<MediaRecorder> getMediaRecorder(JNIEnv* env, jobject thiz)
sp<MediaRecorder> getMediaRecorder(JNIEnv* env, jobject thiz)
{
{
    Mutex::Autolock l(sLock);
    Mutex::Autolock l(sLock);
    MediaRecorder* const p = (MediaRecorder*)env->GetIntField(thiz, fields.context);
    MediaRecorder* const p = (MediaRecorder*)env->GetIntField(thiz, fields.context);
Loading