Exemplo n.º 1
0
PleoraVideo::PleoraVideo(Params& p): size_bytes(0), lPvSystem(0), lDevice(0), lStream(0), lDeviceParams(0), lStart(0), lStop(0),
    lTemperatureCelcius(0), getTemp(false), lStreamParams(0), validGrabbedBuffers(0)
{
    std::string sn;
    std::string mn;
    int index = 0;
    size_t buffer_count = PleoraVideo::DEFAULT_BUFFER_COUNT;
    Params device_params;

    for(Params::ParamMap::iterator it = p.params.begin(); it != p.params.end(); it++) {
        if(it->first == "model"){
            mn = it->second;
        } else if(it->first == "sn"){
            sn = it->second;
        } else if(it->first == "idx"){
            index = p.Get<int>("idx", 0);
        } else if(it->first == "buffers"){
            buffer_count = p.Get<size_t>("buffers", PleoraVideo::DEFAULT_BUFFER_COUNT);
        } else {
            device_params.Set(it->first, it->second);
        }
    }

    InitDevice(mn.empty() ? 0 : mn.c_str(), sn.empty() ? 0 : sn.c_str(), index);
    SetDeviceParams(device_params);
    InitStream();

    InitPangoStreams();
    InitBuffers(buffer_count);

    Start();
}
Exemplo n.º 2
0
PleoraVideo::PleoraVideo(const Params& p): size_bytes(0), lPvSystem(0), lDevice(0), lStream(0), lDeviceParams(0), lStart(0), lStop(0),
    lTemperatureCelcius(0), getTemp(false), lStreamParams(0), validGrabbedBuffers(0)
{
    std::string sn;
    std::string mn;
    int index = 0;
    size_t buffer_count = PleoraVideo::DEFAULT_BUFFER_COUNT;
    Params device_params;

    for(Params::ParamMap::const_iterator it = p.params.begin(); it != p.params.end(); it++) {
        if(it->first == "model"){
            mn = it->second;
        } else if(it->first == "sn"){
            sn = it->second;
        } else if(it->first == "idx"){
            index = p.Get<int>("idx", 0);
        } else if(it->first == "size") {
            const ImageDim dim = p.Get<ImageDim>("size", ImageDim(0,0) );
            device_params.Set("Width"  , dim.x);
            device_params.Set("Height" , dim.y);
        } else if(it->first == "pos") {
            const ImageDim pos = p.Get<ImageDim>("pos", ImageDim(0,0) );
            device_params.Set("OffsetX"  , pos.x);
            device_params.Set("OffsetY" , pos.y);
        } else if(it->first == "roi") {
            const ImageRoi roi = p.Get<ImageRoi>("roi", ImageRoi(0,0,0,0) );
            device_params.Set("Width"  , roi.w);
            device_params.Set("Height" , roi.h);
            device_params.Set("OffsetX", roi.x);
            device_params.Set("OffsetY", roi.y);
        } else {
            device_params.Set(it->first, it->second);
        }
    }

    InitDevice(mn.empty() ? 0 : mn.c_str(), sn.empty() ? 0 : sn.c_str(), index);
    SetDeviceParams(device_params);
    InitStream();

    InitPangoStreams();
    InitPangoDeviceProperties();
    InitBuffers(buffer_count);
}