diff options
author | Benoit Bolsee <benoit.bolsee@online.be> | 2008-11-06 00:53:22 +0300 |
---|---|---|
committer | Benoit Bolsee <benoit.bolsee@online.be> | 2008-11-06 00:53:22 +0300 |
commit | ce1625ebc0317f6e5f9cd0bdfd9c246e5f8c6fef (patch) | |
tree | 8ee2b3c6fde5777bf703a6663cbf11016e866ba6 /source/gameengine/VideoTexture/VideoFFmpeg.h | |
parent | 0ade815affb7f297e2e85b105e6ddd35be3f5fdb (diff) |
VideoTexture: new VideoTexture.ImageFFmpeg to load and reload images.
The FFmpeg library allows to load image files. Although it is possible
to load images using the VideoFFmpeg class, it is not very efficient.
The new class VideoTexture.ImageFFmpeg is dedicated to image management.
Constructor:
-----------
VideoTexture.ImageFFmpeg('image_file_name')
Opens the file but does not load the texture yet.
The file name can also be a network address. It can also be a video
file name; in that case only the first image is loaded.
Methods:
-------
refresh(True)
Loads the image to texture.
You just need to call it once, the file is automatically closed after
that and calling refresh() again will have no effect.
reload('new_file_name')
Reloads the image (if new_file_name is omitted) or loads a new image.
The file is opened but the texture is not updated yet, you need
to call refresh() once to load the texture.
Attributes:
----------
status
returns the image status:
2 : file opened, texture not loaded
3 : file closed, texture loaded
image
returns the image data as a string of RGBA pixel
size
returns the image size [x,y]
scale
get/set the scale flag.
If the scale flag is False, the image is rescale to texture format
using gluScaleImage() function, slow but good quality.
If the scale flag is True, the image is rescaled using a fast but
less accurate algorithm.
flip
get/set Y-flip flag.
Set to True by default as FFmpeg always provides the image upside down
filter
get/set filter(s) on the image.
Example:
Diffstat (limited to 'source/gameengine/VideoTexture/VideoFFmpeg.h')
-rw-r--r-- | source/gameengine/VideoTexture/VideoFFmpeg.h | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/source/gameengine/VideoTexture/VideoFFmpeg.h b/source/gameengine/VideoTexture/VideoFFmpeg.h index 3903116c82c..db2cb293d8b 100644 --- a/source/gameengine/VideoTexture/VideoFFmpeg.h +++ b/source/gameengine/VideoTexture/VideoFFmpeg.h @@ -65,8 +65,8 @@ public: virtual ~VideoFFmpeg (); /// set initial parameters - void initParams (short width, short height, float rate); - /// open video file + void initParams (short width, short height, float rate, bool image=false); + /// open video/image file virtual void openFile (char * file); /// open video capture device virtual void openCam (char * driver, short camIdx); @@ -88,6 +88,7 @@ public: void setPreseek(int preseek) { if (preseek >= 0) m_preseek = preseek; } bool getDeinterlace(void) { return m_deinterlace; } void setDeinterlace(bool deinterlace) { m_deinterlace = deinterlace; } + char *getImageName(void) { return (m_isImage) ? m_imageName.Ptr() : NULL; } protected: @@ -131,6 +132,12 @@ protected: /// frame rate of capture in frames per seconds float m_captRate; + /// is file an image? + bool m_isImage; + + /// keep last image name + STR_String m_imageName; + /// image calculation virtual void calcImage (unsigned int texId); |