Loading include/media/IMediaRecorder.h +2 −0 Original line number Diff line number Diff line Loading @@ -26,6 +26,7 @@ class Surface; class ICamera; class ICameraRecordingProxy; class IMediaRecorderClient; class ISurfaceTexture; class IMediaRecorder: public IInterface { Loading Loading @@ -55,6 +56,7 @@ public: virtual status_t init() = 0; virtual status_t close() = 0; virtual status_t release() = 0; virtual sp<ISurfaceTexture> querySurfaceMediaSource() = 0; }; // ---------------------------------------------------------------------------- Loading include/media/MediaRecorderBase.h +2 −0 Original line number Diff line number Diff line Loading @@ -26,6 +26,7 @@ namespace android { class ICameraRecordingProxy; class Surface; class ISurfaceTexture; struct MediaRecorderBase { MediaRecorderBase() {} Loading Loading @@ -54,6 +55,7 @@ struct MediaRecorderBase { virtual status_t reset() = 0; virtual status_t getMaxAmplitude(int *max) = 0; virtual status_t dump(int fd, const Vector<String16>& args) const = 0; virtual sp<ISurfaceTexture> querySurfaceMediaSource() const = 0; private: MediaRecorderBase(const MediaRecorderBase &); Loading include/media/mediarecorder.h +10 −0 Original line number Diff line number Diff line Loading @@ -31,12 +31,15 @@ class Surface; class IMediaRecorder; class ICamera; class ICameraRecordingProxy; class ISurfaceTexture; class SurfaceTextureClient; typedef void (*media_completion_f)(status_t status, void *cookie); enum video_source { VIDEO_SOURCE_DEFAULT = 0, VIDEO_SOURCE_CAMERA = 1, VIDEO_SOURCE_GRALLOC_BUFFER = 2, VIDEO_SOURCE_LIST_END // must be last - used to validate audio source type }; Loading Loading @@ -226,6 +229,7 @@ public: status_t close(); status_t release(); void notify(int msg, int ext1, int ext2); sp<ISurfaceTexture> querySurfaceMediaSourceFromMediaServer(); private: void doCleanUp(); Loading @@ -233,6 +237,12 @@ private: sp<IMediaRecorder> mMediaRecorder; 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; bool mIsAudioSourceSet; bool mIsVideoSourceSet; Loading include/media/stagefright/SurfaceMediaSource.h +7 −3 Original line number Diff line number Diff line Loading @@ -64,8 +64,8 @@ public: virtual sp<MetaData> getFormat(); // Get / Set the frame rate used for encoding. Default fps = 30 void setFrameRate(uint32_t fps) ; uint32_t getFrameRate( ) const; status_t setFrameRate(int32_t fps) ; int32_t getFrameRate( ) const; // The call for the StageFrightRecorder to tell us that // it is done using the MediaBuffer data so that its state Loading Loading @@ -171,6 +171,10 @@ public: void dump(String8& result, const char* prefix, char* buffer, 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: // freeAllBuffers frees the resources (both GraphicBuffer and EGLImage) for Loading media/libmedia/IMediaRecorder.cpp +30 −0 Original line number Diff line number Diff line Loading @@ -23,14 +23,17 @@ #include <camera/ICamera.h> #include <media/IMediaRecorderClient.h> #include <media/IMediaRecorder.h> #include <gui/ISurfaceTexture.h> #include <unistd.h> namespace android { enum { RELEASE = IBinder::FIRST_CALL_TRANSACTION, INIT, CLOSE, QUERY_SURFACE_MEDIASOURCE, RESET, STOP, START, Loading Loading @@ -71,6 +74,19 @@ public: return reply.readInt32(); } sp<ISurfaceTexture> querySurfaceMediaSource() { LOGV("Query SurfaceMediaSource"); Parcel data, reply; data.writeInterfaceToken(IMediaRecorder::getInterfaceDescriptor()); remote()->transact(QUERY_SURFACE_MEDIASOURCE, data, &reply); int returnedNull = reply.readInt32(); if (returnedNull) { return NULL; } return interface_cast<ISurfaceTexture>(reply.readStrongBinder()); } status_t setPreviewSurface(const sp<Surface>& surface) { LOGV("setPreviewSurface(%p)", surface.get()); Loading Loading @@ -440,6 +456,20 @@ status_t BnMediaRecorder::onTransact( reply->writeInt32(setCamera(camera, proxy)); return NO_ERROR; } break; case QUERY_SURFACE_MEDIASOURCE: { LOGV("QUERY_SURFACE_MEDIASOURCE"); CHECK_INTERFACE(IMediaRecorder, data, reply); // call the mediaserver side to create // a surfacemediasource sp<ISurfaceTexture> surfaceMediaSource = querySurfaceMediaSource(); // The mediaserver might have failed to create a source int returnedNull= (surfaceMediaSource == NULL) ? 1 : 0 ; reply->writeInt32(returnedNull); if (!returnedNull) { reply->writeStrongBinder(surfaceMediaSource->asBinder()); } return NO_ERROR; } break; default: return BBinder::onTransact(code, data, reply, flags); } Loading Loading
include/media/IMediaRecorder.h +2 −0 Original line number Diff line number Diff line Loading @@ -26,6 +26,7 @@ class Surface; class ICamera; class ICameraRecordingProxy; class IMediaRecorderClient; class ISurfaceTexture; class IMediaRecorder: public IInterface { Loading Loading @@ -55,6 +56,7 @@ public: virtual status_t init() = 0; virtual status_t close() = 0; virtual status_t release() = 0; virtual sp<ISurfaceTexture> querySurfaceMediaSource() = 0; }; // ---------------------------------------------------------------------------- Loading
include/media/MediaRecorderBase.h +2 −0 Original line number Diff line number Diff line Loading @@ -26,6 +26,7 @@ namespace android { class ICameraRecordingProxy; class Surface; class ISurfaceTexture; struct MediaRecorderBase { MediaRecorderBase() {} Loading Loading @@ -54,6 +55,7 @@ struct MediaRecorderBase { virtual status_t reset() = 0; virtual status_t getMaxAmplitude(int *max) = 0; virtual status_t dump(int fd, const Vector<String16>& args) const = 0; virtual sp<ISurfaceTexture> querySurfaceMediaSource() const = 0; private: MediaRecorderBase(const MediaRecorderBase &); Loading
include/media/mediarecorder.h +10 −0 Original line number Diff line number Diff line Loading @@ -31,12 +31,15 @@ class Surface; class IMediaRecorder; class ICamera; class ICameraRecordingProxy; class ISurfaceTexture; class SurfaceTextureClient; typedef void (*media_completion_f)(status_t status, void *cookie); enum video_source { VIDEO_SOURCE_DEFAULT = 0, VIDEO_SOURCE_CAMERA = 1, VIDEO_SOURCE_GRALLOC_BUFFER = 2, VIDEO_SOURCE_LIST_END // must be last - used to validate audio source type }; Loading Loading @@ -226,6 +229,7 @@ public: status_t close(); status_t release(); void notify(int msg, int ext1, int ext2); sp<ISurfaceTexture> querySurfaceMediaSourceFromMediaServer(); private: void doCleanUp(); Loading @@ -233,6 +237,12 @@ private: sp<IMediaRecorder> mMediaRecorder; 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; bool mIsAudioSourceSet; bool mIsVideoSourceSet; Loading
include/media/stagefright/SurfaceMediaSource.h +7 −3 Original line number Diff line number Diff line Loading @@ -64,8 +64,8 @@ public: virtual sp<MetaData> getFormat(); // Get / Set the frame rate used for encoding. Default fps = 30 void setFrameRate(uint32_t fps) ; uint32_t getFrameRate( ) const; status_t setFrameRate(int32_t fps) ; int32_t getFrameRate( ) const; // The call for the StageFrightRecorder to tell us that // it is done using the MediaBuffer data so that its state Loading Loading @@ -171,6 +171,10 @@ public: void dump(String8& result, const char* prefix, char* buffer, 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: // freeAllBuffers frees the resources (both GraphicBuffer and EGLImage) for Loading
media/libmedia/IMediaRecorder.cpp +30 −0 Original line number Diff line number Diff line Loading @@ -23,14 +23,17 @@ #include <camera/ICamera.h> #include <media/IMediaRecorderClient.h> #include <media/IMediaRecorder.h> #include <gui/ISurfaceTexture.h> #include <unistd.h> namespace android { enum { RELEASE = IBinder::FIRST_CALL_TRANSACTION, INIT, CLOSE, QUERY_SURFACE_MEDIASOURCE, RESET, STOP, START, Loading Loading @@ -71,6 +74,19 @@ public: return reply.readInt32(); } sp<ISurfaceTexture> querySurfaceMediaSource() { LOGV("Query SurfaceMediaSource"); Parcel data, reply; data.writeInterfaceToken(IMediaRecorder::getInterfaceDescriptor()); remote()->transact(QUERY_SURFACE_MEDIASOURCE, data, &reply); int returnedNull = reply.readInt32(); if (returnedNull) { return NULL; } return interface_cast<ISurfaceTexture>(reply.readStrongBinder()); } status_t setPreviewSurface(const sp<Surface>& surface) { LOGV("setPreviewSurface(%p)", surface.get()); Loading Loading @@ -440,6 +456,20 @@ status_t BnMediaRecorder::onTransact( reply->writeInt32(setCamera(camera, proxy)); return NO_ERROR; } break; case QUERY_SURFACE_MEDIASOURCE: { LOGV("QUERY_SURFACE_MEDIASOURCE"); CHECK_INTERFACE(IMediaRecorder, data, reply); // call the mediaserver side to create // a surfacemediasource sp<ISurfaceTexture> surfaceMediaSource = querySurfaceMediaSource(); // The mediaserver might have failed to create a source int returnedNull= (surfaceMediaSource == NULL) ? 1 : 0 ; reply->writeInt32(returnedNull); if (!returnedNull) { reply->writeStrongBinder(surfaceMediaSource->asBinder()); } return NO_ERROR; } break; default: return BBinder::onTransact(code, data, reply, flags); } Loading