reference

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

ofDirectShowPlayer.h
Go to the documentation of this file.
1//DirectShowVideo and ofDirectShowPlayer written by Theodore Watson, Jan 2014
2//See the cpp file for the DirectShow implementation
3//To allow for QuickTime video playback install the K-Lite Mega Codec Pack 10.2
4
5#pragma once
6#include "ofConstants.h"
7#include "ofVideoBaseTypes.h"
8
9template<typename T>
10class ofPixels_;
11
13
14class DirectShowVideo;
15
17 public:
23
24 bool load(std::string path);
25 void update();
26
27 void close();
28
29 void play();
30 void stop();
31
32 bool isFrameNew() const;
33
34 const ofPixels & getPixels() const;
36
37 float getWidth() const;
38 float getHeight() const;
39
40 bool isPaused() const;
41 bool isLoaded() const;
42 bool isPlaying() const;
43
46
47 float getPosition() const;
48 float getSpeed() const;
49 float getDuration() const;
50 bool getIsMovieDone() const;
51
52 void setPaused(bool bPause);
53 void setPosition(float pct);
54 void setVolume(float volume); // 0..1
55 void setLoopState(ofLoopType state);
56 void setSpeed(float speed);
57 void setFrame(int frame); // frame 0 = first frame...
58
59 int getCurrentFrame() const;
60 int getTotalNumFrames() const;
62
63 void firstFrame();
64 void nextFrame();
65 void previousFrame();
66
67 protected:
68 std::shared_ptr<DirectShowVideo> player;
70};
Definition ofDirectShowPlayer.cpp:299
A base class representing a video player.
Definition ofVideoBaseTypes.h:178
Definition ofDirectShowPlayer.h:16
ofDirectShowPlayer & operator=(const ofDirectShowPlayer &)=delete
ofPixelFormat getPixelFormat() const
Definition ofDirectShowPlayer.cpp:1239
void close()
Close the video source.
Definition ofDirectShowPlayer.cpp:1166
bool setPixelFormat(ofPixelFormat pixelFormat)
Set the requested ofPixelFormat.
Definition ofDirectShowPlayer.cpp:1226
bool isPlaying() const
Returns true if the loaded video is playing.
Definition ofDirectShowPlayer.cpp:1222
void previousFrame()
Advance the playhead backward one frame.
Definition ofDirectShowPlayer.cpp:1348
float getWidth() const
Get the width in pixels of the loaded video.
Definition ofDirectShowPlayer.cpp:1200
void firstFrame()
Set the playhead position to the first frame.
Definition ofDirectShowPlayer.cpp:1338
bool isFrameNew() const
Definition ofDirectShowPlayer.cpp:1188
void setFrame(int frame)
Set the current frame by frame number.
Definition ofDirectShowPlayer.cpp:1331
std::shared_ptr< DirectShowVideo > player
Definition ofDirectShowPlayer.h:68
float getHeight() const
Get the height in pixels of the loaded video.
Definition ofDirectShowPlayer.cpp:1207
void setPaused(bool bPause)
Set the paused state of the video.
Definition ofDirectShowPlayer.cpp:1270
void update()
Update the object's state.
Definition ofDirectShowPlayer.cpp:1170
void nextFrame()
Advance the playhead forward one frame.
Definition ofDirectShowPlayer.cpp:1342
void setSpeed(float speed)
Set the video playback speed.
Definition ofDirectShowPlayer.cpp:1301
int getCurrentFrame() const
Get the current playhead position as a frame number.
Definition ofDirectShowPlayer.cpp:1307
ofDirectShowPlayer(const ofDirectShowPlayer &)=delete
bool getIsMovieDone() const
Returns true if the loaded video has finished playing.
Definition ofDirectShowPlayer.cpp:1266
void setVolume(float volume)
Set the volume of the video player.
Definition ofDirectShowPlayer.cpp:1282
bool load(std::string path)
Load a video resource by name.
Definition ofDirectShowPlayer.cpp:1154
const ofPixels & getPixels() const
Get a const reference to the underlying ofPixels.
Definition ofDirectShowPlayer.cpp:1192
int getTotalNumFrames() const
Get the total number of frames in the currently loaded video.
Definition ofDirectShowPlayer.cpp:1314
ofPixelFormat pixelFormat
Definition ofDirectShowPlayer.h:69
float getDuration() const
Get the duration of the loaded video in seconds.
Definition ofDirectShowPlayer.cpp:1258
void play()
Play the video from the current playhead position.
Definition ofDirectShowPlayer.cpp:1176
void setPosition(float pct)
Set the position of the playhead.
Definition ofDirectShowPlayer.cpp:1276
bool isPaused() const
Returns true if the video is paused.
Definition ofDirectShowPlayer.cpp:1214
float getSpeed() const
Get the playback speed of the video player.
Definition ofDirectShowPlayer.cpp:1251
ofDirectShowPlayer()
Definition ofDirectShowPlayer.cpp:1132
ofLoopType getLoopState() const
Get the current loop state of the video.
Definition ofDirectShowPlayer.cpp:1321
bool isLoaded() const
Returns true if a video is loaded.
Definition ofDirectShowPlayer.cpp:1218
float getPosition() const
Get the current playhead position of the loaded video.
Definition ofDirectShowPlayer.cpp:1244
void stop()
Pause and reset the playhead position to the first frame.
Definition ofDirectShowPlayer.cpp:1182
void setLoopState(ofLoopType state)
Set the video loop state.
Definition ofDirectShowPlayer.cpp:1288
A class representing a collection of pixels.
Definition ofPixels.h:170
ofPixels_< unsigned char > ofPixels
Definition ofDirectShowPlayer.h:12
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