summaryrefslogtreecommitdiffstats
path: root/media/libmedia/mediarecorder.cpp
diff options
context:
space:
mode:
authorPannag Sanketi <psanketi@google.com>2011-07-01 17:39:39 -0700
committerPannag Sanketi <psanketi@google.com>2011-07-22 14:17:25 -0700
commitb33f3407bab0970a7f9241680723a1140b177c50 (patch)
tree8c49b51867769176b088f5ee2dbecd69c188464f /media/libmedia/mediarecorder.cpp
parentfe388eedca9f46ed3fee9579258acecd93e88641 (diff)
downloadframeworks_av-b33f3407bab0970a7f9241680723a1140b177c50.zip
frameworks_av-b33f3407bab0970a7f9241680723a1140b177c50.tar.gz
frameworks_av-b33f3407bab0970a7f9241680723a1140b177c50.tar.bz2
Connect MediaRecorder Native to SurfaceMediaSource
Making a connection from MediaRecorder Native layer to the SurfaceMediaSource for the purpose of encoding GL Frames. This will be called from the java side inside the Mobile Filter Framework. The mediarecorder native layer (client), when set the videosource to option VIDEO_SOURCE_FRAMES, asks the StageFrightRecorder on the mediaserver side to create a SurfaceMediaSource object and pass it back as a sp<ISurfaceTexture> object. Using that, the client side will dequeue and queue buffers. Connecting the GL Frames to the obtained sp<ISurfaceTexture> is not part of this CL. Related to bug id: 4529323 Change-Id: I651bec718dd5b935779e7d7a050b841c2d0b0fcd
Diffstat (limited to 'media/libmedia/mediarecorder.cpp')
-rw-r--r--media/libmedia/mediarecorder.cpp33
1 files changed, 30 insertions, 3 deletions
diff --git a/media/libmedia/mediarecorder.cpp b/media/libmedia/mediarecorder.cpp
index 9e4edd0..fab674c 100644
--- a/media/libmedia/mediarecorder.cpp
+++ b/media/libmedia/mediarecorder.cpp
@@ -25,6 +25,7 @@
#include <media/IMediaPlayerService.h>
#include <media/IMediaRecorder.h>
#include <media/mediaplayer.h> // for MEDIA_ERROR_SERVER_DIED
+#include <gui/ISurfaceTexture.h>
namespace android {
@@ -127,7 +128,9 @@ status_t MediaRecorder::setVideoSource(int vs)
return INVALID_OPERATION;
}
+ // following call is made over the Binder Interface
status_t ret = mMediaRecorder->setVideoSource(vs);
+
if (OK != ret) {
LOGV("setVideoSource failed: %d", ret);
mCurrentState = MEDIA_RECORDER_ERROR;
@@ -357,7 +360,7 @@ status_t MediaRecorder::setVideoSize(int width, int height)
return INVALID_OPERATION;
}
if (!mIsVideoSourceSet) {
- LOGE("try to set video size without setting video source first");
+ LOGE("Cannot set video size without setting video source first");
return INVALID_OPERATION;
}
@@ -367,9 +370,27 @@ status_t MediaRecorder::setVideoSize(int width, int height)
mCurrentState = MEDIA_RECORDER_ERROR;
return ret;
}
+
return ret;
}
+// Query a SurfaceMediaSurface through the Mediaserver, over the
+// binder interface. This is used by the Filter Framework (MeidaEncoder)
+// to get an <ISurfaceTexture> object to hook up to ANativeWindow.
+sp<ISurfaceTexture> MediaRecorder::
+ querySurfaceMediaSourceFromMediaServer()
+{
+ Mutex::Autolock _l(mLock);
+ mSurfaceMediaSource =
+ mMediaRecorder->querySurfaceMediaSource();
+ if (mSurfaceMediaSource == NULL) {
+ LOGE("SurfaceMediaSource could not be initialized!");
+ }
+ return mSurfaceMediaSource;
+}
+
+
+
status_t MediaRecorder::setVideoFrameRate(int frames_per_second)
{
LOGV("setVideoFrameRate(%d)", frames_per_second);
@@ -382,7 +403,7 @@ status_t MediaRecorder::setVideoFrameRate(int frames_per_second)
return INVALID_OPERATION;
}
if (!mIsVideoSourceSet) {
- LOGE("try to set video frame rate without setting video source first");
+ LOGE("Cannot set video frame rate without setting video source first");
return INVALID_OPERATION;
}
@@ -621,7 +642,7 @@ status_t MediaRecorder::release()
return INVALID_OPERATION;
}
-MediaRecorder::MediaRecorder()
+MediaRecorder::MediaRecorder() : mSurfaceMediaSource(NULL)
{
LOGV("constructor");
@@ -632,6 +653,8 @@ MediaRecorder::MediaRecorder()
if (mMediaRecorder != NULL) {
mCurrentState = MEDIA_RECORDER_IDLE;
}
+
+
doCleanUp();
}
@@ -646,6 +669,10 @@ MediaRecorder::~MediaRecorder()
if (mMediaRecorder != NULL) {
mMediaRecorder.clear();
}
+
+ if (mSurfaceMediaSource != NULL) {
+ mSurfaceMediaSource.clear();
+ }
}
status_t MediaRecorder::setListener(const sp<MediaRecorderListener>& listener)