Logo Search packages:      
Sourcecode: libdc1394-22 version File versions  Download package

dc1394error_t dc1394_format7_get_mode_info ( dc1394camera_t camera,
dc1394video_mode_t  video_mode,
dc1394format7mode_t f7_mode 
)

Gets the properties of a Format_7 mode

Definition at line 675 of file format7.c.

References __dc1394format7mode_t::color_coding, __dc1394format7mode_t::color_codings, __dc1394format7mode_t::color_filter, __dc1394_camera::iidc_version, __dc1394format7mode_t::max_packet_size, __dc1394format7mode_t::max_size_x, __dc1394format7mode_t::max_size_y, __dc1394format7mode_t::packet_size, __dc1394format7mode_t::pixnum, __dc1394format7mode_t::pos_x, __dc1394format7mode_t::pos_y, __dc1394format7mode_t::present, __dc1394format7mode_t::size_x, __dc1394format7mode_t::size_y, __dc1394format7mode_t::total_bytes, __dc1394format7mode_t::unit_packet_size, __dc1394format7mode_t::unit_pos_x, __dc1394format7mode_t::unit_pos_y, __dc1394format7mode_t::unit_size_x, and __dc1394format7mode_t::unit_size_y.

{
    dc1394error_t err=DC1394_SUCCESS;

    if (!dc1394_is_video_mode_scalable(video_mode))
        return DC1394_INVALID_VIDEO_MODE;

    if (f7_mode->present>0) { // check for mode presence before query
        err=dc1394_format7_get_max_image_size(camera,video_mode,&f7_mode->max_size_x,&f7_mode->max_size_y);
        DC1394_ERR_RTN(err,"Got a problem querying format7 max image size");
        err=dc1394_format7_get_unit_size(camera,video_mode,&f7_mode->unit_size_x,&f7_mode->unit_size_y);
        DC1394_ERR_RTN(err,"Got a problem querying format7 unit size");
        err=dc1394_format7_get_unit_position(camera,video_mode,&f7_mode->unit_pos_x,&f7_mode->unit_pos_y);
        if (err!=DC1394_SUCCESS) {
            //DC1394_ERR_RTN(err,"Got a problem querying format7 unit position");
            // unit position might not be supported, hence a softer check is implemented
            f7_mode->unit_pos_x=0;
            f7_mode->unit_pos_y=0;
        }

        err=dc1394_format7_get_image_position(camera,video_mode,&f7_mode->pos_x,&f7_mode->pos_y);
        DC1394_ERR_RTN(err,"Got a problem querying format7 image position");
        err=dc1394_format7_get_image_size(camera,video_mode,&f7_mode->size_x,&f7_mode->size_y);
        DC1394_ERR_RTN(err,"Got a problem querying format7 image size");
        err=dc1394_format7_get_packet_size(camera,video_mode,&f7_mode->packet_size);
        DC1394_ERR_RTN(err,"Got a problem querying format7 packet_size");

        if (f7_mode->packet_size==0) {
            // sometimes a camera will not set the bpp register until a valid image size
            // has been set after boot. If BPP is zero, we therefor
            // try again after setting the image size to the maximum size.
            err=dc1394_format7_set_image_position(camera,video_mode,0,0);
            DC1394_ERR_RTN(err,"Got a problem setting format7 image position");
            err=dc1394_format7_set_image_size(camera,video_mode,f7_mode->max_size_x,f7_mode->max_size_y);
            DC1394_ERR_RTN(err,"Got a problem setting format7 image size");
            // maybe we should also force a color coding here.
            err=dc1394_format7_get_packet_size(camera,video_mode,&f7_mode->packet_size);
            DC1394_ERR_RTN(err,"Got a problem querying format7 packet size");
        }

        err=dc1394_format7_get_packet_parameters(camera,video_mode,&f7_mode->unit_packet_size,&f7_mode->max_packet_size);
        DC1394_ERR_RTN(err,"Got a problem querying format7 packet parameters");
        err=dc1394_format7_get_pixel_number(camera,video_mode,&f7_mode->pixnum);
        DC1394_ERR_RTN(err,"Got a problem querying format7 pixel number");
        err=dc1394_format7_get_total_bytes(camera,video_mode,&f7_mode->total_bytes);
        DC1394_ERR_RTN(err,"Got a problem querying format7 total bytes per frame");
        err=dc1394_format7_get_color_coding(camera,video_mode,&f7_mode->color_coding);
        DC1394_ERR_RTN(err,"Got a problem querying format7 color coding ID");
        err=dc1394_format7_get_color_codings(camera,video_mode,&f7_mode->color_codings);
        DC1394_ERR_RTN(err,"Got a problem querying format7 color coding");

        // WARNING: this requires to set the format7 mode!!
        if (camera->iidc_version >= DC1394_IIDC_VERSION_1_31) {
            err=dc1394_format7_get_color_filter(camera,video_mode,&f7_mode->color_filter);
            DC1394_ERR_RTN(err,"Got a problem querying format7 bayer pattern");
        }
        else {
            f7_mode->color_filter = 0;
        }

    }

    return err;
}


Generated by  Doxygen 1.6.0   Back to index