Home | History | Annotate | Download | only in camera

Lines Matching refs:camera

18  * Contains emulated camera service implementation.
27 #include "android/camera/camera-capture.h"
28 #include "android/camera/camera-format-converters.h"
29 #include "android/camera/camera-service.h"
33 #define D(...) VERBOSE_PRINT(camera,__VA_ARGS__)
34 #define D_ACTIVE VERBOSE_CHECK(camera)
40 #define T(...) VERBOSE_PRINT(camera,__VA_ARGS__)
45 /* Defines name of the camera service. */
46 #define SERVICE_NAME "camera"
51 /* Camera sevice descriptor. */
54 /* Information about camera devices connected to the host.
58 /* Number of camera devices connected to the host. */
62 /* One and only one camera service. */
71 * query - Query string. Query string in the camera service are formatted as such:
158 /* Represents camera information as a string formatted as follows:
161 * ci - Camera information descriptor to convert into a string.
162 * str - Pointer to the string buffer where to save the converted camera
218 /* Stringified camera properties should end with EOL. */
222 /* Gets camera information matching a display name.
225 * arr - Array of camera informations.
228 * Matching camera information, or NULL if matching camera information for the
244 /* Gets camera information matching a device name.
247 * arr - Array of camera informations.
250 * Matching camera information, or NULL if matching camera information for the
269 /* Initialized webcam emulation record in camera service descriptor.
271 * csd - Camera service descriptor to initialize a record in.
272 * disp_name - Display name of a web camera ('webcam<N>') to use for emulation.
273 * dir - Direction ('back', or 'front') that emulated camera is facing.
287 W("Camera name '%s' is not found in the list of connected cameras.\n"
288 "Use '-webcam-list' emulator option to obtain the list of connected camera names.\n",
293 /* Save to the camera info array that will be used by the service. */
295 /* This camera is taken. */
302 D("Camera %d '%s' connected to '%s' facing %s using %.4s pixel format",
310 /* Initializes camera service descriptor.
318 /* Enumerate camera devices connected to the host. */
326 /* Web camera emulation is disabled. Skip enumeration of webcameras. */
337 /* Set up back camera emulation. */
342 /* Set up front camera emulation. */
348 /* Gets camera information for the given camera device name.
350 * cs - Initialized camera service descriptor.
351 * device_name - Camera's device name to look up the information for.
353 * Camera information pointer on success, or NULL if no camera information has
365 * Helpers for handling camera client queries
384 * Prefixes for replies to camera client queries.
397 * All replies to a query in camera service have a prefix indicating whether the
471 * Camera Factory API
475 * Response to this query is a string that represents each connected camera in
477 * Strings, representing each camera are separated with EOL symbol.
497 /* "Stringify" each camera information into the reply string. */
517 /* Handles a message received from the emulated camera factory client.
521 * opaque - Camera service descriptor.
522 * msg, msglen - Message received from the camera factory client.
523 * client - Camera factory client pipe.
532 * Emulated camera factory client queries.
550 D("%s Camera factory query '%s'", __FUNCTION__, query_name);
557 E("%s: Unknown camera factory query name in '%s'",
563 /* Emulated camera factory client has been disconnected from the service. */
568 * the "root" camera service, that doesn't require anything more, than camera
573 * Camera client API
576 /* Describes an emulated camera client.
582 * On Linux this is the name of the camera device.
586 /* Input channel to use to connect to the camera. */
588 /* Camera information. */
590 /* Emulated camera device descriptor. */
591 CameraDevice* camera;
615 /* Frees emulated camera client descriptor. */
619 /* The only exception to the "read only" rule: we have to mark the camera
624 if (cc->camera != NULL) {
625 camera_device_close(cc->camera);
637 /* Creates descriptor for a connecting emulated camera client.
639 * csd - Camera service descriptor.
642 * identifiying the camera device to create the service for. Also parameters
644 * channel to use when communicating with the camera device.
646 * Emulated camera client descriptor on success, or NULL on failure.
657 * Parse parameter string, containing camera client properties.
681 /* Get camera info for the emulated camera represented with this service.
682 * Array of camera information records has been created when the camera
683 * service was enumerating camera devices during the service initialization.
684 * By the camera service protocol, camera service clients must first obtain
685 * list of enumerated cameras via the 'list' query to the camera service, and
686 * then use device name reported in the list to connect to an emulated camera
687 * service. So, if camera information for the given device name is not found
691 E("%s: Cannot find camera info for device '%s'",
697 /* We can't allow multiple camera services for a single camera device, Lets
698 * make sure that there is no client created for this camera. */
700 E("%s: Camera device '%s' is in use", __FUNCTION__, cc->device_name);
705 /* We're done. Set camera in use, and succeed the connection. */
709 D("%s: Camera service is created for device '%s' using input channel %d",
716 * Camera client queries
719 /* Client has queried conection to the camera.
721 * cc - Queried camera client descriptor.
722 * qc - Qemu client for the emulated camera.
728 if (cc->camera != NULL) {
730 W("%s: Camera '%s' is already connected", __FUNCTION__, cc->device_name);
731 _qemu_client_reply_ok(qc, "Camera is already connected");
735 /* Open camera device. */
736 cc->camera = camera_device_open(cc->device_name, cc->inp_channel);
737 if (cc->camera == NULL) {
738 E("%s: Unable to open camera device '%s'", __FUNCTION__, cc->device_name);
739 _qemu_client_reply_ko(qc, "Unable to open camera device.");
743 D("%s: Camera device '%s' is now connected", __FUNCTION__, cc->device_name);
748 /* Client has queried disconection from the camera.
750 * cc - Queried camera client descriptor.
751 * qc - Qemu client for the emulated camera.
759 if (cc->camera == NULL) {
761 W("%s: Camera '%s' is already disconnected", __FUNCTION__, cc->device_name);
762 _qemu_client_reply_ok(qc, "Camera is not connected");
766 /* Before we can go ahead and disconnect, we must make sure that camera is
769 E("%s: Cannot disconnect camera '%s' while it is not stopped",
771 _qemu_client_reply_ko(qc, "Camera is not stopped");
775 /* Close camera device. */
776 camera_device_close(cc->camera);
777 cc->camera = NULL;
779 D("Camera device '%s' is now disconnected", cc->device_name);
786 * cc - Queried camera client descriptor.
787 * qc - Qemu client for the emulated camera.
803 if (cc->camera == NULL) {
805 E("%s: Camera '%s' is not connected", __FUNCTION__, cc->device_name);
806 _qemu_client_reply_ko(qc, "Camera is not connected");
851 /* After collecting capture parameters lets see if camera has already
858 W("%s: Camera '%s' is already started", __FUNCTION__, cc->device_name);
859 _qemu_client_reply_ok(qc, "Camera is already started");
862 E("%s: Camera '%s' is already started, and parameters don't match:\n"
867 "Camera is already started with different capturing parameters");
873 * Start the camera.
900 /* Make sure that we have a converters between the original camera pixel
911 /* TODO: At the moment camera framework in the emulator requires RGB32 pixel
931 /* Start the camera. */
932 if (camera_device_start_capturing(cc->camera, cc->camera_info->pixel_format,
934 E("%s: Cannot start camera '%s' for %.4s[%dx%d]: %s",
939 _qemu_client_reply_ko(qc, "Cannot start the camera");
943 D("%s: Camera '%s' is now started for %.4s[%dx%d]",
952 * cc - Queried camera client descriptor.
953 * qc - Qemu client for the emulated camera.
961 W("%s: Camera '%s' is not started", __FUNCTION__, cc->device_name);
962 _qemu_client_reply_ok(qc, "Camera is not started");
966 /* Stop the camera. */
967 if (camera_device_stop_capturing(cc->camera)) {
968 E("%s: Cannot stop camera device '%s': %s",
970 _qemu_client_reply_ko(qc, "Cannot stop camera device");
977 D("%s: Camera device '%s' is now stopped.", __FUNCTION__, cc->device_name);
983 * cc - Queried camera client descriptor.
984 * qc - Qemu client for the emulated camera.
1011 E("%s: Camera '%s' is not started", __FUNCTION__, cc->device_name);
1012 _qemu_client_reply_ko(qc, "Camera is not started");
1042 /* Verify that framebuffer sizes match the ones that the started camera
1046 E("%s: Frame sizes don't match for camera '%s':\n"
1072 repeat = camera_device_read_frame(cc->camera, fbs, fbs_num,
1090 repeat = camera_device_read_frame(cc->camera, fbs, fbs_num,
1095 E("%s: Unable to obtain first video frame from the camera '%s' in %d milliseconds: %s.",
1098 _qemu_client_reply_ko(qc, "Unable to obtain video frame from the camera");
1102 E("%s: Unable to obtain video frame from the camera '%s': %s.",
1141 /* Handles a message received from the emulated camera client.
1143 * - 'connect' - Connects to the camera device (opens it).
1144 * - 'disconnect' - Disconnexts from the camera device (closes it).
1145 * - 'start' - Starts capturing video from the connected camera device.
1146 * - 'stop' - Stop capturing video from the connected camera device.
1147 * - 'frame' - Queries video and preview frames captured from the camera.
1149 * opaque - Camera service descriptor.
1150 * msg, msglen - Message received from the camera factory client.
1151 * client - Camera factory client pipe.
1160 * Emulated camera client queries.
1163 /* Connect to the camera. */
1165 /* Disconnect from the camera. */
1179 * Emulated camera queries are formatted as such:
1183 T("%s: Camera client query: '%s'", __FUNCTION__, (char*)msg);
1196 /* Camera connection is queried. */
1199 /* Camera disnection is queried. */
1213 /* Emulated camera client has been disconnected from the service. */
1219 D("%s: Camera client for device '%s' on input channel %d is now closed",
1226 * Camera service API
1229 /* Connects a client to the camera service.
1231 * - Camera factory that is insterested only in listing camera devices attached
1233 * - Camera device emulators that attach to the actual camera devices.
1236 * connects to a camera factory. Otherwise, parameters describe the camera device
1248 D("%s: Connecting camera client '%s'",
1251 /* This is an emulated camera factory client. */
1256 /* This is an emulated camera client. */
1295 /* Enumerate camera devices connected to the host. */
1303 printf(" Camera '%s' is connected to device '%s' on channel %d using pixel format '%.4s'\n",