reference

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

ofGstVideoPlayer.h
Go to the documentation of this file.
1#pragma once
2
3#include "ofGstUtils.h"
4
5
7public:
8
11
13 bool setPixelFormat(ofPixelFormat pixelFormat);
15
16 void loadAsync(std::string name);
17 bool load(std::string uri);
18
19 void update();
20
21 int getCurrentFrame() const;
22 int getTotalNumFrames() const;
23
24 void firstFrame();
25 void nextFrame();
26 void previousFrame();
27 void setFrame(int frame); // frame 0 = first frame...
28
29 bool isStream() const;
30
31 void play();
32 void stop();
33 void setPaused(bool bPause);
34 bool isPaused() const;
35 bool isLoaded() const;
36 bool isPlaying() const;
37
38 float getPosition() const;
39 float getSpeed() const;
40 float getDuration() const;
41 bool getIsMovieDone() const;
42
43 void setPosition(float pct);
44 void setVolume(float volume);
45 void setLoopState(ofLoopType state);
47 void setSpeed(float speed);
48 void close();
49
50 bool isFrameNew() const;
51
53 const ofPixels& getPixels() const;
55
56 float getHeight() const;
57 float getWidth() const;
58
59 void setFrameByFrame(bool frameByFrame);
60 void setThreadAppSink(bool threaded);
61 bool isThreadedAppSink() const;
62 bool isFrameByFrame() const;
63
65
66protected:
67 bool allocate();
68 bool createPipeline(std::string uri);
69 void on_stream_prepared();
70
71 // return true to set the message as attended so upstream doesn't try to process it
72 virtual bool on_message(GstMessage* msg){return false;};
73
74private:
75 ofPixelFormat internalPixelFormat;
76 guint64 nFrames;
77 int fps_n, fps_d;
78 bool bIsStream;
79 bool bIsAllocated;
80 bool bAsyncLoad;
81 bool threadAppSink;
82 ofGstVideoUtils videoUtils;
83};
A base class representing a video player.
Definition ofVideoBaseTypes.h:178
Definition ofGstUtils.h:244
Definition ofGstVideoPlayer.h:6
bool isFrameNew() const
Definition ofGstVideoPlayer.cpp:422
void loadAsync(std::string name)
Asynchronously load a video resource by name.
Definition ofGstVideoPlayer.cpp:190
void update()
Update the object's state.
Definition ofGstVideoPlayer.cpp:353
float getHeight() const
Get the height in pixels of the loaded video.
Definition ofGstVideoPlayer.cpp:438
bool load(std::string uri)
Load a video resource by name.
Definition ofGstVideoPlayer.cpp:195
void setFrameByFrame(bool frameByFrame)
Definition ofGstVideoPlayer.cpp:450
void setLoopState(ofLoopType state)
Set the video loop state.
Definition ofGstVideoPlayer.cpp:405
virtual bool on_message(GstMessage *msg)
Definition ofGstVideoPlayer.h:72
float getWidth() const
Get the width in pixels of the loaded video.
Definition ofGstVideoPlayer.cpp:442
float getPosition() const
Get the current playhead position of the loaded video.
Definition ofGstVideoPlayer.cpp:381
void setFrame(int frame)
Set the current frame by frame number.
Definition ofGstVideoPlayer.cpp:344
void setPosition(float pct)
Set the position of the playhead.
Definition ofGstVideoPlayer.cpp:397
void close()
Close the video source.
Definition ofGstVideoPlayer.cpp:417
void nextFrame()
Advance the playhead forward one frame.
Definition ofGstVideoPlayer.cpp:334
bool getIsMovieDone() const
Returns true if the loaded video has finished playing.
Definition ofGstVideoPlayer.cpp:393
void play()
Play the video from the current playhead position.
Definition ofGstVideoPlayer.cpp:357
bool isFrameByFrame() const
Definition ofGstVideoPlayer.cpp:458
bool isStream() const
Definition ofGstVideoPlayer.cpp:349
ofGstVideoPlayer()
Definition ofGstVideoPlayer.cpp:15
ofLoopType getLoopState() const
Get the current loop state of the video.
Definition ofGstVideoPlayer.cpp:409
bool allocate()
Definition ofGstVideoPlayer.cpp:240
void setThreadAppSink(bool threaded)
Definition ofGstVideoPlayer.cpp:235
bool isThreadedAppSink() const
Definition ofGstVideoPlayer.cpp:454
float getSpeed() const
Get the playback speed of the video player.
Definition ofGstVideoPlayer.cpp:385
ofPixels & getPixels()
Get a reference to the underlying ofPixels.
Definition ofGstVideoPlayer.cpp:426
float getDuration() const
Get the duration of the loaded video in seconds.
Definition ofGstVideoPlayer.cpp:389
int getTotalNumFrames() const
Get the total number of frames in the currently loaded video.
Definition ofGstVideoPlayer.cpp:326
void firstFrame()
Set the playhead position to the first frame.
Definition ofGstVideoPlayer.cpp:330
int getCurrentFrame() const
Get the current playhead position as a frame number.
Definition ofGstVideoPlayer.cpp:308
void stop()
Pause and reset the playhead position to the first frame.
Definition ofGstVideoPlayer.cpp:361
void setPaused(bool bPause)
Set the paused state of the video.
Definition ofGstVideoPlayer.cpp:365
bool createPipeline(std::string uri)
Definition ofGstVideoPlayer.cpp:41
bool isLoaded() const
Returns true if a video is loaded.
Definition ofGstVideoPlayer.cpp:373
ofGstVideoUtils * getGstVideoUtils()
Definition ofGstVideoPlayer.cpp:446
void previousFrame()
Advance the playhead backward one frame.
Definition ofGstVideoPlayer.cpp:339
bool isPaused() const
Returns true if the video is paused.
Definition ofGstVideoPlayer.cpp:369
void on_stream_prepared()
Definition ofGstVideoPlayer.cpp:304
bool setPixelFormat(ofPixelFormat pixelFormat)
needs to be called before loadMovie
Definition ofGstVideoPlayer.cpp:31
~ofGstVideoPlayer()
Definition ofGstVideoPlayer.cpp:27
ofPixelFormat getPixelFormat() const
Definition ofGstVideoPlayer.cpp:36
void setVolume(float volume)
Set the volume of the video player.
Definition ofGstVideoPlayer.cpp:401
bool isPlaying() const
Returns true if the loaded video is playing.
Definition ofGstVideoPlayer.cpp:377
ofTexture * getTexturePtr()
Get a pointer to the video texture used internally if it exists.
Definition ofGstVideoPlayer.cpp:434
void setSpeed(float speed)
Set the video playback speed.
Definition ofGstVideoPlayer.cpp:413
Definition ofGstUtils.h:156
A wrapper class for an OpenGL texture.
Definition ofTexture.h:253
struct _GstMessage GstMessage
Definition ofGstUtils.h:27
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