SDLView::SDLView(wxWindow* parent, wxWindowID id,
                 const wxPoint& pos, const wxSize& size, long style,
                 const wxString& name)
    : wxControl(parent, id, pos, size, style, wxDefaultValidator, name),
      surface(0)
{
    initializeSurface();
}
void SDLView::OnSize(wxSizeEvent& event)
{
    event.Skip(); // handle event normally
    initializeSurface(); // adjust size of SDL surface

    // now the control has to redraw it's stuff
    redraw();
}
status_t CameraDeviceClientFlashControl::connectCameraDevice(
        const String8& cameraId) {
    camera_info info;
    status_t res = mCameraModule->getCameraInfo(atoi(cameraId.string()), &info);
    if (res != 0) {
        ALOGE("%s: failed to get camera info for camera %s", __FUNCTION__,
                cameraId.string());
        return res;
    }

    sp<CameraDeviceBase> device =
            CameraDeviceFactory::createDevice(atoi(cameraId.string()));
    if (device == NULL) {
        return NO_MEMORY;
    }

    res = device->initialize(mCameraModule);
    if (res) {
        return res;
    }

    int32_t width, height;
    res = getSmallestSurfaceSize(info, &width, &height);
    if (res) {
        return res;
    }
    res = initializeSurface(device, width, height);
    if (res) {
        return res;
    }

    mCameraId = cameraId;
    mStreaming = (info.device_version <= CAMERA_DEVICE_API_VERSION_3_1);
    mDevice = device;

    return OK;
}