01-17-2013 05:16 PM - edited 01-17-2013 05:17 PM
ah.. so if you are doing video recording, then you will need to eventually update the camera properties.. you've got that part right. you cannot do this while already recording.. just keep that in mind.
you do not need to alter the camera resolution, but you will need to alter the libscreen window resolution (swap w/h).
the steps would then be:
1. update CAMERA_IMGPROP_ROTATION using camera_set_videovf_rotation() AND camera_set_video_rotation(). these 2 need to be kept in sync when dealing with recordings on a device with CAMERA_FEATURE_PREVIEWISVIDEO.
2. after you've confirmed that the above works, don't bother rotating your screen window.. just update SCREEN_PROPERTY_SIZE on the window to deal with the now rotated buffer being rendered into that window.
That should hopefully give you what you want. You would only bother rotating the screen window if you don't care about rotating the camera buffer. Still, what you posted earlier probably should have worked. (I will double check that tonight)
01-17-2013 05:23 PM
Ok. getting closer.
Now I can record properly but the viewfinder goes back to portrait as soon as I start the recording and doesn't show landscape.
is there such api camera_set_video_rotation() can't find it in the camera_api.h
I do this just before recording and then the view finder switch back to portrait.
if (camera_set_videovf_property(mCameraHandle,
CAMERA_IMGPROP_ROTATION, 90,
CAMERA_IMGPROP_END) != 0)
01-17-2013 05:30 PM
camera_set_video_property() is used to apply the video rotation. it doesn't do much though on this hardware. we just have a check to ensure that you specified the same rotation for the vf and the video.
Show me the rotation code you are applying when the device rotates (camera & screen), and show me the code you are applying when the recording starts. Sounds like you are overdoing it.
01-17-2013 05:51 PM
when rotation changes
if (m_orientation != oldOrientation)
{
angle = (m_orientation -1 )*90;
screen_set_window_property_iv(mViewfinderWindow->w
}
on recording
// 90 just hardcode for testing
if (camera_set_videovf_property(mCameraHandle,
CAMERA_IMGPROP_ROTATION, 90,
CAMERA_IMGPROP_END) != 0)
thanks
01-17-2013 06:30 PM
OK, there's your problem ![]()
Remember: these rotations stack up!
To make things look right, you need to either rotate the window OR rotate the camera buffers. (Or actually, do something such that the sum of the rotations adds up to the desired angle: eg. SCREEN_PROPERTY_ROTATION=180, CAMERA_IMGPROP_ROTATION=270 would give you the same effect as setting either of those to 90).
So when you applied your window rotation, that looked fine.
Then you applied an image rotation. That means that the total rotation will be the sum of the 2, which is why you are back to portrait again.
Since you NEED camera rotation in your case (you are doing video recording), what you should do is just solve the equation: Rscreen + Rcamera = angle.
The other way to deal with this is to always use CAMERA_IMGPROP_ROTATION instead of SCREEN_PROPERTY_ROTATION if you are starting to get confused. The only reason you may not want to do this is that it will cause the window to blank while buffers are re-allocated. That, and it takes time.
And note that any time you rotate things, you likely need to re-size the screen window, unless you are dealing with a square viewfinder ![]()
01-17-2013 08:36 PM
I'm really confused now. Changing the code doesn't work and i'm back to square one.
So from the beginning. Have the following handles
mCameraHandle
mViewfinderWindow->windowHandle()
I have event to handle rotation change. When the device is rotated in any direction which handle should I change?
I have tried
camera_set_videovf_property(mCameraHandle,
CAMERA_IMGPROP_ROTATION, &angle,
CAMERA_IMGPROP_END);
and it does not work.
If you have time can you do an example? thanks
01-17-2013 08:44 PM
I'll see if I can find time on the weekend.
01-21-2013 12:30 PM
hi,
did you find any spare time over the weekend?
I'm getting really stressed over this. thanks
01-21-2013 12:44 PM
zero extra time.
The information is already all here in this thread.
I am under the gun for BB10 deliverables and all of my spare time is currently taken up with preparing content for the conference in 2 weeks.
are you looking for an example using ForeignWindow or libscreen?
01-21-2013 12:57 PM
I'm using ForeignWindowControl in my c++ cascade app.
when i rotate the screen i use this call
screen_set_window_property_iv(mViewfinderWindow->w
everything works except that the recorded landscape video is not in landscape.
so somehow I need to rotate the camera buffer?