예제 #1
0
void CMUCamera::getCameraImageFormats(C1394Camera* pCamera, CameraInfo* pCamInfo)
{
    //Iterate over formats (up to 3 formats are supported)
    for (int format = 0; format <= 2; format++) {
        BOOL hasFormat = false;
        hasFormat = pCamera->HasVideoFormat(format);
        if(!hasFormat){
            continue;
        }
        //Iterate over modes (up to 8 modes are supported)
        for (int mode = 0; mode <= 7; mode++) {
            BOOL hasMode = false;
            hasMode = pCamera->HasVideoMode(format, mode);
            if (!hasMode) {
                continue;
            }
            //Ignore not libavg supported formats
            if (mode == 0 && format == 0) {
                continue;
            }

            IntPoint size;
            PixelFormat pixelFormat;
            FrameratesVector framerates;

            getImageSizeAndPF(format, mode, size, pixelFormat);
            getCameraFramerates(pCamera, format, mode, framerates);
                    
            CameraImageFormat imageFormat = CameraImageFormat(size, pixelFormat, framerates);
            pCamInfo->addImageFormat(imageFormat);
        }
    }
}
예제 #2
0
파일: FWCamera.cpp 프로젝트: lynxis/libavg
void FWCamera::getCameraImageFormats(dc1394camera_t* pCamera, CameraInfo* camInfo)
{
    dc1394video_modes_t videoModes;
    dc1394framerates_t framerates;
    dc1394error_t err = dc1394_video_get_supported_modes(pCamera, &videoModes);
    if (err != DC1394_SUCCESS) {
        AVG_ASSERT(false);
        return;
    }
    for (unsigned i = 0; i < videoModes.num; i++) {
        //Covers only libavg supported formats, other capabilities are ignored
        if (videoModes.modes[i] >= DC1394_VIDEO_MODE_320x240_YUV422
                && videoModes.modes[i] <= DC1394_VIDEO_MODE_1600x1200_MONO16){
            PixelFormat pixFormat = getPFFromVideoMode(videoModes.modes[i]);
            IntPoint size = getFrameSizeFromVideoMode(videoModes.modes[i]);
            FrameratesVector framerateList;
            err = dc1394_video_get_supported_framerates(pCamera, videoModes.modes[i],
                    &framerates);
            if (err != DC1394_SUCCESS) {
                AVG_LOG_WARNING("Camera: No framerates. Error was: " << err);
            } else {
                for (unsigned j = 0; j < framerates.num; j++)
                {
                    float rate = framerateToFloat(framerates.framerates[j]);
                    framerateList.push_back(rate);
                }
            }
            CameraImageFormat format = CameraImageFormat(size,pixFormat,framerateList);
            camInfo->addImageFormat(format);
        }
    }
}