MeVisLab Resolution Independence API
Toggle main menu visibility
Loading...
Searching...
No Matches
FrameGrabber.h
Go to the documentation of this file.
1
/*************************************************************************************
2
**
3
** Copyright 2007, MeVis Medical Solutions AG
4
**
5
** The user may use this file in accordance with the license agreement provided with
6
** the Software or, alternatively, in accordance with the terms contained in a
7
** written agreement between the user and MeVis Medical Solutions AG.
8
**
9
** For further information use the contact form at https://www.mevislab.de/contact
10
**
11
**************************************************************************************/
12
13
#ifndef FRAME_GRABBER_H
14
#define FRAME_GRABBER_H
15
17
18
#include "
SoViewers.h
"
19
21
#define FRAMEGRABBER_MAX_BYTES 1024 * 1024 * 50
22
25
#define FRAMEGRABBER_CROP 0xfffc
26
27
class
SoSFString;
28
29
//=============================================================
31
/*
32
FrameGrabber is a helper class that handles the creation
33
of a movie by storing GL frames from a passed SoQtRenderArea
34
whenever requested. It stores the images in memory and writes
35
them on disk when requested or when too much memory is consumed.
36
It is used by \c SoRenderArea.
37
38
39
*/
40
//=============================================================
41
class
SO_VIEWERS_CLASS_SPEC
FrameGrabber
42
{
43
public
:
44
FrameGrabber
();
45
~FrameGrabber
();
46
48
void
cleanup
(
bool
deleteFiles);
49
52
void
createAviWithBink
(
const
char
* filename,
float
framerate);
53
55
void
startRecording
();
56
58
void
stopRecording
()
59
{
60
_isRecording =
false
;
61
}
62
64
bool
isRecording
()
65
{
66
return
_isRecording;
67
}
68
70
void
grabFrame
(
void
* renderarea,
int
mode = GL_BACK);
71
73
void
writeToFiles
();
74
76
void
setMaximumBytes
(
long
bytes)
77
{
78
_maxBytes = bytes;
79
}
80
82
long
getMaximumBytes
()
83
{
84
return
_maxBytes;
85
}
86
88
int
getDiskFrames
()
89
{
90
return
_diskCount;
91
};
92
94
int
getMemFrames
()
95
{
96
return
static_cast<
int
>
(_frames.size());
97
};
98
100
void
setStatusField
(SoSFString* field, SoNode* owner)
101
{
102
_status = field;
103
_statusNode = owner;
104
};
105
107
void
updateStatus
(
const
char
*
string
);
108
110
void
writeCurrentFrameToDisk
(
const
char
* name,
void
* renderarea,
int
mode);
111
113
MLuint8*
grabGLFrame
(
void
* renderarea,
int
& w,
int
& h,
int
mode = GL_BACK);
114
115
// returns the filename template (without image number & .tif)
116
std::string
getFileNameTemplate
();
117
118
private
:
120
void
writeToFile(
const
char
* name, MLuint8* data,
int
width,
int
height);
121
123
void
createUniqueDirectory();
124
126
std::string intToString(
int
value);
127
129
int
_uniqueDirCount;
130
132
int
_diskCount;
134
int
_bufferCount;
135
137
bool
_dirCreated;
138
140
bool
_isRecording;
141
143
std::string _tmpDir;
144
146
int
_width, _height;
147
149
std::vector<MLuint8*> _frames;
150
152
long
_maxBytes;
154
long
_bytes;
155
157
SoSFString* _status;
159
SoNode* _statusNode;
160
};
161
162
#endif
SoViewers.h
SO_VIEWERS_CLASS_SPEC
#define SO_VIEWERS_CLASS_SPEC
Definition
SoViewers.h:44
FrameGrabber::FrameGrabber
FrameGrabber()
FrameGrabber::getMemFrames
int getMemFrames()
get current mem frame number
Definition
FrameGrabber.h:94
FrameGrabber::grabGLFrame
MLuint8 * grabGLFrame(void *renderarea, int &w, int &h, int mode=GL_BACK)
returns new buffer with content of gl framebuffer
FrameGrabber::getDiskFrames
int getDiskFrames()
get current disk frame number
Definition
FrameGrabber.h:88
FrameGrabber::createAviWithBink
void createAviWithBink(const char *filename, float framerate)
FrameGrabber::cleanup
void cleanup(bool deleteFiles)
cleanup memory, if deleteFiles is set, it also deletes all temporary files
FrameGrabber::setMaximumBytes
void setMaximumBytes(long bytes)
set the maximum number of bytes stored in memory for movie frames
Definition
FrameGrabber.h:76
FrameGrabber::stopRecording
void stopRecording()
stop recording
Definition
FrameGrabber.h:58
FrameGrabber::grabFrame
void grabFrame(void *renderarea, int mode=GL_BACK)
grab a single gl frame, (mode is GL_FRONT or GL_BACK, front contains windows and mouse also)
FrameGrabber::writeCurrentFrameToDisk
void writeCurrentFrameToDisk(const char *name, void *renderarea, int mode)
grabs the current frame and writes to disk
FrameGrabber::startRecording
void startRecording()
start recording at 0
FrameGrabber::getMaximumBytes
long getMaximumBytes()
get the maximum number of bytes stored in memory for movie frames
Definition
FrameGrabber.h:82
FrameGrabber::getFileNameTemplate
std::string getFileNameTemplate()
FrameGrabber::~FrameGrabber
~FrameGrabber()
FrameGrabber::setStatusField
void setStatusField(SoSFString *field, SoNode *owner)
set status field
Definition
FrameGrabber.h:100
FrameGrabber::isRecording
bool isRecording()
flag if currently a record session is running
Definition
FrameGrabber.h:64
FrameGrabber::updateStatus
void updateStatus(const char *string)
update status
FrameGrabber::writeToFiles
void writeToFiles()
write stored images to temp disk
MeVisLab
Standard
Sources
Inventor
SoViewers
FrameGrabber.h
Generated by
1.18.0