|
Packit |
713213 |
/*
|
|
Packit |
713213 |
* 1394-Based Digital Camera Control Library
|
|
Packit |
713213 |
*
|
|
Packit |
713213 |
* Written by Damien Douxchamps <ddouxchamps@users.sf.net>
|
|
Packit |
713213 |
*
|
|
Packit |
713213 |
* This library is free software; you can redistribute it and/or
|
|
Packit |
713213 |
* modify it under the terms of the GNU Lesser General Public
|
|
Packit |
713213 |
* License as published by the Free Software Foundation; either
|
|
Packit |
713213 |
* version 2.1 of the License, or (at your option) any later version.
|
|
Packit |
713213 |
*
|
|
Packit |
713213 |
* This library is distributed in the hope that it will be useful,
|
|
Packit |
713213 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Packit |
713213 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
Packit |
713213 |
* Lesser General Public License for more details.
|
|
Packit |
713213 |
*
|
|
Packit |
713213 |
* You should have received a copy of the GNU Lesser General Public
|
|
Packit |
713213 |
* License along with this library; if not, write to the Free Software
|
|
Packit |
713213 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
Packit |
713213 |
*/
|
|
Packit |
713213 |
|
|
Packit |
713213 |
|
|
Packit |
713213 |
#include <dc1394/log.h>
|
|
Packit |
713213 |
#include <dc1394/video.h>
|
|
Packit |
713213 |
|
|
Packit |
713213 |
#ifndef __DC1394_CAPTURE_H__
|
|
Packit |
713213 |
#define __DC1394_CAPTURE_H__
|
|
Packit |
713213 |
|
|
Packit |
713213 |
/*! \file dc1394/capture.h
|
|
Packit |
713213 |
\brief Capture functions
|
|
Packit |
713213 |
\author Damien Douxchamps: coding
|
|
Packit |
713213 |
\author Peter Antoniac: documentation maintainer
|
|
Packit |
713213 |
|
|
Packit |
713213 |
More details soon
|
|
Packit |
713213 |
*/
|
|
Packit |
713213 |
|
|
Packit |
713213 |
/**
|
|
Packit |
713213 |
* The capture policy.
|
|
Packit |
713213 |
*
|
|
Packit |
713213 |
* Can be blocking (wait for a frame forever) or polling (returns if no frames is in the ring buffer)
|
|
Packit |
713213 |
*/
|
|
Packit |
713213 |
typedef enum {
|
|
Packit |
713213 |
DC1394_CAPTURE_POLICY_WAIT=672,
|
|
Packit |
713213 |
DC1394_CAPTURE_POLICY_POLL
|
|
Packit |
713213 |
} dc1394capture_policy_t;
|
|
Packit |
713213 |
#define DC1394_CAPTURE_POLICY_MIN DC1394_CAPTURE_POLICY_WAIT
|
|
Packit |
713213 |
#define DC1394_CAPTURE_POLICY_MAX DC1394_CAPTURE_POLICY_POLL
|
|
Packit |
713213 |
#define DC1394_CAPTURE_POLICY_NUM (DC1394_CAPTURE_POLICY_MAX - DC1394_CAPTURE_POLICY_MIN + 1)
|
|
Packit |
713213 |
|
|
Packit |
713213 |
/**
|
|
Packit |
713213 |
* typedef for the callback param for dc1394_capture_set_callback
|
|
Packit |
713213 |
*/
|
|
Packit |
713213 |
|
|
Packit |
713213 |
typedef void (*dc1394capture_callback_t)(dc1394camera_t *, void *);
|
|
Packit |
713213 |
|
|
Packit |
713213 |
|
|
Packit |
713213 |
/**
|
|
Packit |
713213 |
* Capture flags. Currently limited to switching automatic functions on/off: channel allocation, bandwidth allocation and automatic
|
|
Packit |
713213 |
* starting of ISO transmission
|
|
Packit |
713213 |
*/
|
|
Packit |
713213 |
#define DC1394_CAPTURE_FLAGS_CHANNEL_ALLOC 0x00000001U
|
|
Packit |
713213 |
#define DC1394_CAPTURE_FLAGS_BANDWIDTH_ALLOC 0x00000002U
|
|
Packit |
713213 |
#define DC1394_CAPTURE_FLAGS_DEFAULT 0x00000004U /* a reasonable default value: do bandwidth and channel allocation */
|
|
Packit |
713213 |
#define DC1394_CAPTURE_FLAGS_AUTO_ISO 0x00000008U /* automatically start iso before capture and stop it after */
|
|
Packit |
713213 |
|
|
Packit |
713213 |
#ifdef __cplusplus
|
|
Packit |
713213 |
extern "C" {
|
|
Packit |
713213 |
#endif
|
|
Packit |
713213 |
|
|
Packit |
713213 |
/***************************************************************************
|
|
Packit |
713213 |
Capture Functions
|
|
Packit |
713213 |
***************************************************************************/
|
|
Packit |
713213 |
|
|
Packit |
713213 |
/**
|
|
Packit |
713213 |
* Setup the capture, using a ring buffer of a certain size (num_dma_buffers) and certain options (flags)
|
|
Packit |
713213 |
*/
|
|
Packit |
713213 |
dc1394error_t dc1394_capture_setup(dc1394camera_t *camera, uint32_t num_dma_buffers, uint32_t flags);
|
|
Packit |
713213 |
|
|
Packit |
713213 |
/**
|
|
Packit |
713213 |
* Stop the capture
|
|
Packit |
713213 |
*/
|
|
Packit |
713213 |
dc1394error_t dc1394_capture_stop(dc1394camera_t *camera);
|
|
Packit |
713213 |
|
|
Packit |
713213 |
/**
|
|
Packit |
713213 |
* Gets a file descriptor to be used for select(). Must be called after dc1394_capture_setup().
|
|
Packit |
713213 |
*/
|
|
Packit |
713213 |
int dc1394_capture_get_fileno (dc1394camera_t * camera);
|
|
Packit |
713213 |
|
|
Packit |
713213 |
/**
|
|
Packit |
713213 |
* Captures a video frame. The returned struct contains the image buffer, among others. This image buffer SHALL NOT be freed, as it represents an area
|
|
Packit |
713213 |
* in the memory that belongs to the system.
|
|
Packit |
713213 |
*/
|
|
Packit |
713213 |
dc1394error_t dc1394_capture_dequeue(dc1394camera_t * camera, dc1394capture_policy_t policy, dc1394video_frame_t **frame);
|
|
Packit |
713213 |
|
|
Packit |
713213 |
/**
|
|
Packit |
713213 |
* Returns a frame to the ring buffer once it has been used.
|
|
Packit |
713213 |
*/
|
|
Packit |
713213 |
dc1394error_t dc1394_capture_enqueue(dc1394camera_t * camera, dc1394video_frame_t * frame);
|
|
Packit |
713213 |
|
|
Packit |
713213 |
/**
|
|
Packit |
713213 |
* Returns DC1394_TRUE if the given frame (previously dequeued) has been
|
|
Packit |
713213 |
* detected to be corrupt (missing data, corrupted data, overrun buffer, etc.).
|
|
Packit |
713213 |
* Note that certain types of corruption may go undetected in which case
|
|
Packit |
713213 |
* DC1394_FALSE will be returned. The ability to detect corruption also
|
|
Packit |
713213 |
* varies between platforms. Note that corrupt frames still need to be
|
|
Packit |
713213 |
* enqueued with dc1394_capture_enqueue() when no longer needed by the user.
|
|
Packit |
713213 |
*/
|
|
Packit |
713213 |
dc1394bool_t dc1394_capture_is_frame_corrupt (dc1394camera_t * camera,
|
|
Packit |
713213 |
dc1394video_frame_t * frame);
|
|
Packit |
713213 |
|
|
Packit |
713213 |
/**
|
|
Packit |
713213 |
* Set a callback if supported by the platform (OS X only for now).
|
|
Packit |
713213 |
*/
|
|
Packit |
713213 |
void dc1394_capture_set_callback (dc1394camera_t * camera,
|
|
Packit |
713213 |
dc1394capture_callback_t callback, void * user_data);
|
|
Packit |
713213 |
|
|
Packit |
713213 |
#ifdef __cplusplus
|
|
Packit |
713213 |
}
|
|
Packit |
713213 |
#endif
|
|
Packit |
713213 |
|
|
Packit |
713213 |
#endif
|