Dear PV engineer:
I have try several days for this. We want to add video conference
function in PV opencore, so we need to create video capture node in
native mode, I try the following code to capture video, My code is
like this:
sp<SurfaceComposerClient> videoClient = new SurfaceComposerClient;
SurfaceComposerClient* videoClient2 = videoClient.get();
int x = atoi(argv[2]);
int y = atoi(argv[3]);
// printf("press any key to do after new SurfaceComposerClient
\n");
// getchar();
sp<SurfaceControl> vsurCtrl(videoClient->createSurface(pid, 0, x,
y, PIXEL_FORMAT_OPAQUE, ISurfaceComposer::eFXSurfaceNormal|
ISurfaceComposer::ePushBuffers));
SurfaceControl* vsurCtrl2 = vsurCtrl.get();
videoClient->openTransaction();
nState = vsurCtrl->setSize(x, y);
nState = vsurCtrl->setPosition(10, 10);
nState = vsurCtrl->setLayer(INT_MAX);
nState = vsurCtrl->show();
videoClient->closeTransaction();
mRecorder = new PVMediaRecorder();
mRecorder->init();
mRecorder->setAudioSource(AUDIO_SOURCE_CAMCORDER);
mRecorder->setVideoSource(VIDEO_SOURCE_CAMERA);
//sleep(1);
mRecorder->setOutputFormat(OUTPUT_FORMAT_THREE_GPP);
/////////////////////////////////////////
mRecorder->setAudioEncoder(AUDIO_ENCODER_AMR_NB);
mRecorder->setVideoEncoder(VIDEO_ENCODER_H263);
mRecorder->setVideoSize(x, y);
mRecorder->setVideoFrameRate(10);
mRecorder->setOutputFile(argv[1]);
mRecorder->setPreviewSurface(vsurCtrl->getSurface()-
>getISurface2());
status_t retCode = mRecorder->prepare();
if(retCode < 0)
{
printf("prepare failed: %d\n", retCode);
IPCThreadState::self()->stopProcess();
return -1;
};
printf("press any key to start\n");
getchar();
mRecorder->start();
sleep(10);
mRecorder->stop();
mRecorder->reset();
//videoClient->destroySurface(vsurCtrl->getSurface()->ID());
videoClient->dispose();
Could anyone give me some guide on this?
Regards!
the result is
1, when run after prepare(), the screen could see preview movie,
everything seems well.
2, but when run start(), the surface created freeze.
3, after stop, I check the recorded file, there is only audio, no
video.
4, from the logcat, the following function is not called, here I past
some normal output of Camera recording.
========================================
I/CameraInput( 508): postDataTimestamp called!
I/CameraInput( 508): postWriteAsync
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en