DeviceRgbMemory.hpp 1.49 KB
#ifndef __DEVICE_RGB_MEMORY_H__
#define __DEVICE_RGB_MEMORY_H__

#include<string>

#include "utiltools.hpp"

using namespace std;

class DeviceRgbMemory{

public:
     DeviceRgbMemory(int _channel, int _width, int _height, string _id, string _dev_id, bool _key_frame, bool _isused){
        channel = _channel;
        width = _width;
        height = _height;
        data_size = channel * width * height;
        isused = _isused;
        id = _id;
        device_id = _dev_id;
        key_frame = _key_frame;
        timestamp = UtilTools::get_cur_time_ms();
    }

    virtual ~DeviceRgbMemory(){}
    
    int getSize() {
        return data_size;
    }
    
    bool isIsused() {
        return isused;
    }

    void setIsused(bool _isused) {
        isused = _isused;
        // 更新时间戳
        timestamp = UtilTools::get_cur_time_ms();
    }

    string getId() {
        return id;
    }

    string getDeviceId() {
        return device_id;
    }

    unsigned char* getMem(){
        return pHwRgb;
    }

    long long getTimesstamp(){
        return timestamp;
    }

    int getWidth(){
        return width;
    }

    int getHeight(){
        return height;
    }

    int getChannel(){
        return channel;
    }

    bool isKeyFrame(){
        return key_frame;
    }

public:
    int data_size;
    bool isused;
    string id;
    string device_id;
    unsigned char * pHwRgb{nullptr};
    long long timestamp;
    int width{0};
    int height{0};
    int channel{3};
    bool key_frame;
};

#endif