reference

This documentation is automatically generated from the openFrameworks source code using doxygen and refers to the most recent release, version 0.12.0.

ofVideoBaseTypes.h
Go to the documentation of this file.
1#pragma once
3#include "ofGLBaseTypes.h"
4
5enum ofPixelFormat: short;
6
19
20
21
29public:
32
34 int width;
35
37 int height;
38
40 std::vector<float> framerates;
41};
42
47public:
49 int id;
50
52 std::string deviceName;
53
55 std::string hardwareName;
56
58 std::string serialID;
59
62 std::vector<ofVideoFormat> formats;
63
66};
67
69class ofBaseVideo: virtual public ofBaseHasPixels, public ofBaseUpdates{
70public:
72 virtual ~ofBaseVideo(){}
73
75 virtual bool isFrameNew() const =0;
76
78 virtual void close()=0;
79
87 virtual bool isInitialized() const=0;
88
92 virtual bool setPixelFormat(ofPixelFormat pixelFormat) = 0;
93
95 virtual ofPixelFormat getPixelFormat() const = 0;
96};
97
98
101 public ofBaseVideo,
102 public ofBaseDraws,
104public:
107};
108
110class ofBaseVideoGrabber: virtual public ofBaseVideo{
111
112 public :
114 virtual ~ofBaseVideoGrabber();
115
116 //needs implementing
119 virtual std::vector<ofVideoDevice> listDevices() const = 0;
120
131 virtual bool setup(int w, int h) = 0;
132
135 virtual float getHeight() const = 0;
136
139 virtual float getWidth() const = 0;
140
147 virtual ofTexture * getTexturePtr(){ return nullptr; }
148
151 virtual void setVerbose(bool bTalkToMe);
152
160 virtual void setDeviceID(int deviceID);
161
168 virtual void setDesiredFrameRate(int framerate);
169
172 virtual void videoSettings();
173
174};
175
176
178class ofBaseVideoPlayer: virtual public ofBaseVideo{
179
180public:
182 virtual ~ofBaseVideoPlayer();
183
192 virtual bool load(std::string name) = 0;
203 virtual void loadAsync(std::string name);
204
208 virtual void play() = 0;
210 virtual void stop() = 0;
218 virtual ofTexture * getTexturePtr(){return nullptr;};
219
222 virtual float getWidth() const = 0;
225 virtual float getHeight() const = 0;
226
229 virtual bool isPaused() const = 0;
237 virtual bool isLoaded() const = 0;
240 virtual bool isPlaying() const = 0;
248 virtual bool isInitialized() const{ return isLoaded(); }
249
257 virtual float getPosition() const;
267 virtual float getSpeed() const;
270 virtual float getDuration() const;
273 virtual bool getIsMovieDone() const;
274
277 virtual void setPaused(bool bPause);
285 virtual void setPosition(float pct);
293 virtual void setVolume(float volume);
297 virtual void setLoopState(ofLoopType state);
313 virtual void setSpeed(float speed);
321 virtual void setFrame(int frame);
322
325 virtual int getCurrentFrame() const;
328 virtual int getTotalNumFrames() const;
331 virtual ofLoopType getLoopState() const;
332
336 virtual void firstFrame();
341 virtual void nextFrame();
346 virtual void previousFrame();
347};
Definition ofGraphicsBaseTypes.h:139
An abstract class representing an object that ofTexture planes.
Definition ofGLBaseTypes.h:32
An abstract class representing an object that can be updated.
Definition ofGraphicsBaseTypes.h:213
A base class representing a drawable video source.
Definition ofVideoBaseTypes.h:103
virtual ~ofBaseVideoDraws()
Destroy the ofBaseVideoDraws.
Definition ofVideoBaseTypes.h:106
A base class representing a video device such as a camera.
Definition ofVideoBaseTypes.h:110
virtual ofTexture * getTexturePtr()
Get the video grabber's internal ofTexture pointer if available.
Definition ofVideoBaseTypes.h:147
virtual void setDesiredFrameRate(int framerate)
Set the video grabber's desired frame rate.
Definition ofBaseTypes.cpp:23
virtual bool setup(int w, int h)=0
Set up the grabber with the requested width and height.
virtual void setDeviceID(int deviceID)
Set the video grabber's device ID.
Definition ofBaseTypes.cpp:18
virtual void setVerbose(bool bTalkToMe)
Set the video grabber's hardware verbosity level.
Definition ofBaseTypes.cpp:13
virtual void videoSettings()
Request a native GUI for video grabber settings.
Definition ofBaseTypes.cpp:28
virtual float getHeight() const =0
Get the video grabber's height.
virtual float getWidth() const =0
Get the video grabber's width.
virtual std::vector< ofVideoDevice > listDevices() const =0
Get a list of available video grabber devices.
virtual ~ofBaseVideoGrabber()
Destroy the ofBaseVideoGrabber.
Definition ofBaseTypes.cpp:8
A base class representing a video source.
Definition ofVideoBaseTypes.h:69
virtual ofPixelFormat getPixelFormat() const =0
virtual bool setPixelFormat(ofPixelFormat pixelFormat)=0
Set the requested ofPixelFormat.
virtual bool isInitialized() const =0
Determine if the video source is initialized.
virtual void close()=0
Close the video source.
virtual bool isFrameNew() const =0
virtual ~ofBaseVideo()
Destroy the ofBaseVideo.
Definition ofVideoBaseTypes.h:72
A base class representing a video player.
Definition ofVideoBaseTypes.h:178
virtual void setFrame(int frame)
Set the current frame by frame number.
Definition ofBaseTypes.cpp:105
virtual ~ofBaseVideoPlayer()
Destroys the ofBaseVideoPlayer.
Definition ofBaseTypes.cpp:46
virtual void setPaused(bool bPause)
Set the paused state of the video.
Definition ofBaseTypes.cpp:80
virtual float getPosition() const
Get the current playhead position of the loaded video.
Definition ofBaseTypes.cpp:56
virtual void firstFrame()
Set the playhead position to the first frame.
Definition ofBaseTypes.cpp:128
virtual bool getIsMovieDone() const
Returns true if the loaded video has finished playing.
Definition ofBaseTypes.cpp:74
virtual void previousFrame()
Advance the playhead backward one frame.
Definition ofBaseTypes.cpp:138
virtual void loadAsync(std::string name)
Asynchronously load a video resource by name.
Definition ofBaseTypes.cpp:50
virtual void setPosition(float pct)
Set the position of the playhead.
Definition ofBaseTypes.cpp:85
virtual bool load(std::string name)=0
Load a video resource by name.
virtual void stop()=0
Pause and reset the playhead position to the first frame.
virtual float getSpeed() const
Get the playback speed of the video player.
Definition ofBaseTypes.cpp:62
virtual float getWidth() const =0
Get the width in pixels of the loaded video.
virtual void setVolume(float volume)
Set the volume of the video player.
Definition ofBaseTypes.cpp:90
virtual bool isInitialized() const
Returns true if a video is loaded.
Definition ofVideoBaseTypes.h:248
virtual void setLoopState(ofLoopType state)
Set the video loop state.
Definition ofBaseTypes.cpp:95
virtual float getHeight() const =0
Get the height in pixels of the loaded video.
virtual ofLoopType getLoopState() const
Get the current loop state of the video.
Definition ofBaseTypes.cpp:122
virtual void nextFrame()
Advance the playhead forward one frame.
Definition ofBaseTypes.cpp:133
virtual bool isLoaded() const =0
Returns true if a video is loaded.
virtual float getDuration() const
Get the duration of the loaded video in seconds.
Definition ofBaseTypes.cpp:68
virtual bool isPlaying() const =0
Returns true if the loaded video is playing.
virtual int getTotalNumFrames() const
Get the total number of frames in the currently loaded video.
Definition ofBaseTypes.cpp:116
virtual bool isPaused() const =0
Returns true if the video is paused.
virtual void play()=0
Play the video from the current playhead position.
virtual int getCurrentFrame() const
Get the current playhead position as a frame number.
Definition ofBaseTypes.cpp:110
virtual ofTexture * getTexturePtr()
Get a pointer to the video texture used internally if it exists.
Definition ofVideoBaseTypes.h:218
virtual void setSpeed(float speed)
Set the video playback speed.
Definition ofBaseTypes.cpp:100
A wrapper class for an OpenGL texture.
Definition ofTexture.h:253
A structure describing attributes of a video device.
Definition ofVideoBaseTypes.h:46
std::string deviceName
The video device name.
Definition ofVideoBaseTypes.h:52
std::string hardwareName
The video device hardware name.
Definition ofVideoBaseTypes.h:55
bool bAvailable
Is true if this video device is available.
Definition ofVideoBaseTypes.h:65
int id
The video device ID.
Definition ofVideoBaseTypes.h:49
std::vector< ofVideoFormat > formats
A list of video device formats provided by the device.
Definition ofVideoBaseTypes.h:62
std::string serialID
Unique identifier for the device if it has one.
Definition ofVideoBaseTypes.h:58
A structure describing attributes of a video format.
Definition ofVideoBaseTypes.h:28
ofPixelFormat pixelFormat
The pixel format of the video format.
Definition ofVideoBaseTypes.h:31
std::vector< float > framerates
A list of framerates for this video format in frames per second.
Definition ofVideoBaseTypes.h:40
int width
The width of the video format in pixels.
Definition ofVideoBaseTypes.h:34
int height
The height of the video format in pixels.
Definition ofVideoBaseTypes.h:37
ofPixelFormat
Used to represent the available pixel formats.
Definition ofPixels.h:68
ofLoopType
Used to represent the available video looping modes.
Definition ofVideoBaseTypes.h:11
@ OF_LOOP_NORMAL
Repeats the video over and over.
Definition ofVideoBaseTypes.h:17
@ OF_LOOP_PALINDROME
Plays the video forwards then backwards repeatedly.
Definition ofVideoBaseTypes.h:15
@ OF_LOOP_NONE
Plays the video once without looping.
Definition ofVideoBaseTypes.h:13