When you aren't using the camera, you can stop the image buffers
from streaming. You should also close (disconnect) from the camera.
To use the Camera library, you previously would have called
camera_open(), typically with
read/write permissions, and started the viewfinder (getting image buffers) as shown here:
...
...
camera_open(CAMERA_UNIT_1, CAMERA_MODE_RW | CAMERA_MODE_ROLL, &cameraHandle);
camera_set_vf_mode(cameraHandle, CAMERA_VFMODE_VIDEO);
camera_start_viewfinder(cameraHandle, NULL, NULL,NULL);
...
...
camera_start_viewfinder )camera_stop_viewfinder(cameraHandle);
camera_close(cameraHandle);
...
...
//Deallocate other
To stop streaming image buffers from the camera, you call
camera_stop_viewfinder(), but
before your application is done using the camera, ensure that you that call the
corresponding
camera_stop_*() functions before you call
camera_close(). Here are some examples of the
corresponding
camera_stop_*() calls to make before you call
camera_close():
After you have called the corresponding
camera_stop_* functions,
call
camera_close() last, which disconnects the application
from the camera, releases all the resources
that was allocated to the camera, and frees the handle to the camera.
If you had called
camera_open() with the (
CAMERA_MODE_WRITE mode)
flag, but don't call
camera_close(), other applications
won't be able to access the viewfinder, camera configuration settings,
and the camera roll (
CAMERA_MODE_WRITE mode).
Note: If you are using
Screen,
you must release the resources that were
Screen allocated, which includes
deallocating windows or contexts that you created. This includes the viewfinder window that you created and the parent window if you you no longer require it.
For example, you can call the
screen_destroy_window() and
screen_destroy_context(). For more information, see the
Screen Developer's Guide. For an example, see
Example: Show Viewfinder window.
For example:
...
int err;
...
...
err = camera_stop_viewfinder(handle)
err = camera_close(handle);
...
...
The handle that you pass to the
camera_close() must be the handle
you got from calling
camera_open(), otherwise undefined results may occur.