7 #ifndef _LIBALVISION_ALVISION_ALVIDEO_H_
8 #define _LIBALVISION_ALVISION_ALVIDEO_H_
30 unsigned int width : 32;
31 unsigned int height: 32;
32 unsigned int colorSpace : 32;
33 unsigned int pixelDepth : 32;
42 unsigned int magicNumber : 32;
43 unsigned int userSpaceSize : 32;
44 unsigned int numberOfFrames : 32;
45 unsigned int numberOfStreams : 32;
52 unsigned int resolution;
53 unsigned int colorSpace;
54 unsigned int nbLayers;
55 unsigned int pixelDepth;
56 unsigned int sizePerImage;
69 bool recordVideo(
const std::string pFilePath,
const unsigned int pUserSpaceSize,
const std::vector<streamHeader>& pStreamHeaderVector);
70 bool readVideo(
const std::string pFilePath);
72 bool goToFrame(
const unsigned int pFrameNumber,
const unsigned int pStreamNumber);
73 bool getFrame(
ALImage & pImage,
const unsigned int pFrameNumber,
const unsigned int pStreamNumber,
const bool pCheckFormat =
true);
74 bool getNextFrame(
ALImage & pImage,
const bool pCheckFormat =
true);
75 bool getPrecedingFrame(
ALImage & pImage,
const bool pCheckFormat =
true);
76 bool write(
char* ptrImageData,
const int pSizeData,
const long long pTimeStamp = 0,
const char pCameraId = 0,
77 const float pLeftAngle = 0,
const float pTopAngle = 0,
const float pRightAngle = 0,
const float pBottomAngle = 0);
78 bool write(
int height,
int width,
char *imageData,
const long long pTimeStamp,
const char pCameraId,
79 const float pLeftAngle,
const float pTopAngle,
const float pRightAngle,
const float pBottomAngle);
81 bool write(IplImage* pImage,
const long long pTimeStamp = 0,
const char pCameraId = 0,
82 const float pLeftAngle = 0,
const float pTopAngle = 0,
const float pRightAngle = 0,
const float pBottomAngle = 0);
84 inline const unsigned char* getMagicNumber()
const {
return (
unsigned char*)&fMagicNumber; };
85 inline const unsigned int getNumberOfFrames()
const {
return fNumberOfFrames; };
86 inline const unsigned int getNumberOfStreams()
const {
return fNumberOfStreams; };
87 inline const unsigned int getCurrentFrameNumber()
const {
return fCurrentFrameNumber; };
88 inline const unsigned int getCurrentStreamNumber()
const {
return fCurrentStreamNumber; };
89 inline const bool isOpenForReading()
const {
return fIsOpenForReading; };
90 inline const bool isOpenForWriting()
const {
return fIsOpenForWriting; };
92 inline const int getStreamWidth(
const unsigned int pStreamNumber)
const {
return (pStreamNumber<fNumberOfStreams) ? fStreamPropertiesVector[pStreamNumber].width : -1; };
93 inline const int getStreamHeight(
const unsigned int pStreamNumber)
const {
return (pStreamNumber<fNumberOfStreams) ? fStreamPropertiesVector[pStreamNumber].height : -1; };
94 inline const int getStreamResolution(
const unsigned int pStreamNumber)
const {
return (pStreamNumber<fNumberOfStreams) ? fStreamPropertiesVector[pStreamNumber].resolution : -1; };
95 inline const int getStreamColorSpace(
const unsigned int pStreamNumber)
const {
return (pStreamNumber<fNumberOfStreams) ? fStreamPropertiesVector[pStreamNumber].colorSpace : -1; };
96 inline const int getStreamNbLayers(
const unsigned int pStreamNumber)
const {
return (pStreamNumber<fNumberOfStreams) ? fStreamPropertiesVector[pStreamNumber].nbLayers : -1; };
97 inline const int getStreamPixelDepth(
const unsigned int pStreamNumber)
const {
return (pStreamNumber<fNumberOfStreams) ? fStreamPropertiesVector[pStreamNumber].pixelDepth : -1; };
98 inline const int getStreamSizePerImage(
const unsigned int pStreamNumber)
const {
return (pStreamNumber<fNumberOfStreams) ? fStreamPropertiesVector[pStreamNumber].sizePerImage : -1; };
104 volatile bool fIsOpenForReading;
105 volatile bool fIsOpenForWriting;
107 std::ifstream fVideoStreamIn;
108 std::ofstream fVideoStreamOut;
109 std::string fFilePath;
111 unsigned int fMagicNumber;
112 unsigned int fUserSpaceSize;
113 unsigned int fNumberOfFrames;
114 unsigned int fNumberOfStreams;
115 unsigned int fSizeOfHeader;
116 unsigned int fSizePerMultiplexedFrame;
117 std::vector<struct streamProperties> fStreamPropertiesVector;
119 unsigned int fCurrentStreamNumber;
120 unsigned int fCurrentFrameNumber;
124 #endif // _LIBALVISION_ALVISION_ALVIDEO_H_