libdc1394: API version 2: Structures


/* Camera structure */
typedef struct __dc1394_camera
{
  // system/firmware information
  int                  port;
  uint16_t             node;
  uint64_t             euid_64;
  uint32_t             ud_reg_tag_12;
  uint32_t             ud_reg_tag_13;
  uint64_t             command_registers_base;
  uint64_t             unit_directory;
  uint64_t             unit_dependent_directory;
  uint64_t             advanced_features_csr;
  uint64_t             PIO_control_csr;
  uint64_t             SIO_control_csr; // future use
  uint64_t             strobe_control_csr; // future use
  uint64_t             format7_csr[DC1394_VIDEO_MODE_FORMAT7_NUM];
  dc1394iidc_version_t iidc_version;
  char                 vendor[MAX_CHARS + 1];
  char                 model[MAX_CHARS + 1];
  uint32_t             vendor_id;
  uint32_t             model_id;
  dc1394bool_t         bmode_capable;
  dc1394bool_t         one_shot_capable;
  dc1394bool_t         multi_shot_capable;
  dc1394bool_t         can_switch_on_off;

  // some current values
  dc1394video_mode_t   video_mode;
  dc1394framerate_t    framerate;
  dc1394switch_t       is_iso_on;
  int                  iso_channel; // this variable contains the iso channel requests or the current iso channel
  int                  iso_channel_is_set; // >0 if the iso_channel above has been allocated within libraw1394
  uint32_t             iso_bandwidth;
  dc1394speed_t        iso_speed;
  uint32_t             mem_channel_number;

  int                  capture_is_set; // 0 for not set, 1 for RAW1394 and 2 for DMA

  // for broadcast:
  dc1394bool_t         broadcast;
  uint16_t             node_id_backup;

  // 1394 PHY interface data:
  dc1394speed_t        phy_speed;
  dc1394power_class_t  power_class;
  dc1394phy_delay_t    phy_delay;
  
  // for Basler SFF
  dc1394bool_t         sff_has_extended_data_stream;

} dc1394camera_t;


typedef struct __dc1394feature_info_t_struct 
{
  dc1394feature_t    id;
  dc1394bool_t       available;
  dc1394bool_t       one_push_capable;
  dc1394bool_t       absolute_capable;
  dc1394bool_t       readout_capable;
  dc1394bool_t       on_off_capable;
  dc1394bool_t       auto_capable;
  dc1394bool_t       manual_capable;
  dc1394bool_t       polarity_capable;
  dc1394switch_t     one_push_active;
  dc1394switch_t     is_on;
  dc1394bool_t       auto_active;
  dc1394trigger_modes_t    trigger_modes;
  dc1394trigger_mode_t     trigger_mode;
  dc1394trigger_polarity_t trigger_polarity;
  dc1394trigger_sources_t  trigger_sources;
  dc1394trigger_source_t   trigger_source;
  uint32_t           min;
  uint32_t           max;
  uint32_t           value;
  uint32_t           BU_value;
  uint32_t           RV_value;
  uint32_t           B_value;
  uint32_t           R_value;
  uint32_t           G_value;
  uint32_t           target_value;
  
  dc1394switch_t     abs_control;
  float              abs_value;
  float              abs_max;
  float              abs_min;
  
} dc1394feature_info_t;

typedef struct __dc1394featureset_t
{
  dc1394feature_t    feature[DC1394_FEATURE_NUM];
} dc1394featureset_t;

typedef struct
{
  uint_t               num;
  dc1394color_coding_t codings[DC1394_COLOR_CODING_NUM];
} dc1394colorcodings_t;

typedef struct
{
  uint_t             num;
  dc1394video_mode_t modes[DC1394_VIDEO_MODE_NUM];
} dc1394videomodes_t;

typedef struct
{
  uint_t             num;
  dc1394framerate_t  framerates[DC1394_FRAMERATE_NUM];
} dc1394framerates_t;

typedef struct
{
  uint_t                  num;
  dc1394trigger_mode_t    modes[DC1394_TRIGGER_MODE_NUM];
} dc1394trigger_modes_t;

typedef struct
{
  uint_t                    num;
  dc1394trigger_source_t    sources[DC1394_TRIGGER_SOURCE_NUM];
} dc1394trigger_sources_t;


typedef struct __dc1394format7mode_t
{
  dc1394bool_t present;

  uint_t size_x;
  uint_t size_y;
  uint_t max_size_x;
  uint_t max_size_y;

  uint_t pos_x;
  uint_t pos_y;

  uint_t unit_size_x;
  uint_t unit_size_y;
  uint_t unit_pos_x;
  uint_t unit_pos_y;

  dc1394colormodes_t color_codings;
  dc1394color_coding_t color_coding_id;

  uint_t pixnum;

  uint_t bpp; // bpp is byte_per_packet, not bit per pixel.
  uint_t min_bpp;
  uint_t max_bpp;

  unsigned long long int total_bytes;

  dc1394color_filter_t color_filter;

} dc1394format7mode_t;

typedef struct __dc1394format7modeset_t
{
  dc1394format7mode_t mode[DC1394_VIDEO_MODE_FORMAT7_NUM];
} dc1394format7modeset_t;

/* video frame structure */
typedef struct __dc1394_video_frame
{
  unsigned char          * image;                 /* the image. May contain padding data too (vendor specific) */
  uint32_t                 size[2];               /* the image size [width, height] */
  uint32_t                 position[2];           /* the WOI/ROI position [horizontal, vertical] == [0,0] for full frame */
  dc1394color_coding_t     color_coding;          /* the color coding used. This field is valid for all video modes. */
  dc1394color_filter_t     color_filter;          /* the color filter used. This field is valid only for RAW modes and IIDC 1.31 */
  uint32_t                 yuv_byte_order;        /* the order of the fields for 422 formats: YUYV or UYVY */
  uint32_t                 bit_depth;             /* the number of bits per pixel. The number of grayscale levels is 2^(this_number) */
  uint32_t                 stride;                /* the number of bytes per image line */
  dc1394video_mode_t       video_mode;            /* the video mode used for capturing this frame */
  uint64_t                 total_bytes;           /* the total size of the frame buffer in bytes. May include packet-
                                                   * multiple padding and intentional padding (vendor specific) */
  uint32_t                 image_bytes;           /* the number of bytes used for the image (image data only, no padding) */
  uint32_t                 padding_bytes;         /* the number of extra bytes, i.e. total_bytes-image_bytes.  */
  uint32_t                 bytes_per_packet;      /* the number of bytes per packet. (IIDC data) */
  uint32_t                 packets_per_frame;     /* the number of packets per frame. (IIDC data) */
  uint64_t                 timestamp;             /* the unix time [microseconds] at which the frame was captured in
					 	   * the video1394 ringbuffer */
  uint32_t                 frames_behind;         /* the number of frames in the ring buffer that are yet to be accessed by the user */
  dc1394camera_t           *camera;               /* the parent camera of this frame */
  uint32_t                 id;                    /* the frame position in the ring buffer */
  uint64_t                 allocated_image_bytes; /* amount of memory allocated in for the *image field. -1 for output
						   * of libdc1394? (this would avoid confusion between 'no allocated
						   * memory' and 'don't touch this buffer' -> signed int?? */ 
} dc1394video_frame_t;