#include <Movie.hpp>
Public Member Functions | |
bool | openFromFile (const std::string &filename) |
Attemps to open a media file (movie or audio) | |
const Streams & | getStreams (MediaType type) const |
Return a description of all the streams of the given type contained in the opened media. | |
bool | selectStream (const StreamDescriptor &streamDescriptor) |
Request activation of the given stream. | |
void | play () |
Start or resume playing the media playback. | |
void | pause () |
Pauses the media playback. | |
void | stop () |
Stops the media playback. The playing offset is reset to the beginning. | |
void | update () |
Update the media status and eventually decode frames. | |
void | setVolume (float volume) |
Sets the sound's volume (default is 100) | |
float | getVolume () const |
Returns the current sound's volume. | |
sf::Time | getDuration () const |
Returns the duration of the movie. | |
sf::Vector2f | getSize () const |
Returns the size (width, height) of the currently active video stream. | |
void | fit (float x, float y, float width, float height, bool preserveRatio=true) |
void | fit (sf::FloatRect frame, bool preserveRatio=true) |
Scales the movie to fit the requested frame. | |
float | getFramerate () const |
Returns the average amount of video frames per second. | |
unsigned int | getSampleRate () const |
Returns the amount of audio samples per second. | |
unsigned int | getChannelCount () const |
Returns the count of audio channels. | |
Status | getStatus () const |
Returns the current status of the movie. | |
sf::Time | getPlayingOffset () const |
Returns the current playing position in the movie. | |
bool | setPlayingOffset (const sf::Time &targetSeekTime) |
const sf::Texture & | getCurrentImage () const |
Returns the latest movie image. |
Main class of the sfeMovie API. It is used to open media files, provide playback and basic controls
void sfe::Movie::fit | ( | float | x, |
float | y, | ||
float | width, | ||
float | height, | ||
bool | preserveRatio = true |
||
) |
void sfe::Movie::fit | ( | sf::FloatRect | frame, |
bool | preserveRatio = true |
||
) |
Scales the movie to fit the requested frame.
If the ratio is preserved, the movie may be centered in the given frame, thus the movie position may be different from the one you specified.
frame | the target frame in which you want to display the movie |
preserveRatio | true to keep the original movie ratio, false otherwise |
unsigned int sfe::Movie::getChannelCount | ( | ) | const |
Returns the count of audio channels.
const sf::Texture& sfe::Movie::getCurrentImage | ( | ) | const |
Returns the latest movie image.
The returned image is a texture in VRAM. If the movie has no video stream, this returns an empty texture.
sf::Time sfe::Movie::getDuration | ( | ) | const |
Returns the duration of the movie.
float sfe::Movie::getFramerate | ( | ) | const |
Returns the average amount of video frames per second.
In case of media that use Variable Frame Rate, this value is approximative
sf::Time sfe::Movie::getPlayingOffset | ( | ) | const |
Returns the current playing position in the movie.
unsigned int sfe::Movie::getSampleRate | ( | ) | const |
Returns the amount of audio samples per second.
sf::Vector2f sfe::Movie::getSize | ( | ) | const |
Returns the size (width, height) of the currently active video stream.
Status sfe::Movie::getStatus | ( | ) | const |
Returns the current status of the movie.
const Streams& sfe::Movie::getStreams | ( | MediaType | type | ) | const |
Return a description of all the streams of the given type contained in the opened media.
type | the stream type (audio, video...) to return |
float sfe::Movie::getVolume | ( | ) | const |
Returns the current sound's volume.
bool sfe::Movie::openFromFile | ( | const std::string & | filename | ) |
Attemps to open a media file (movie or audio)
Opening can fails either because of a wrong filename, or because you tried to open a media file that has no supported video or audio stream.
filename | the path to the media file |
void sfe::Movie::pause | ( | ) |
Pauses the media playback.
If the media playback is already paused, this does nothing, otherwise the playback is paused.
void sfe::Movie::play | ( | ) |
Start or resume playing the media playback.
This function starts the stream if it was stopped, resumes it if it was paused, and restarts it from beginning if it was already playing. This function is non blocking and lets the audio playback happen in the background. The video playback must be updated with the update() method.
bool sfe::Movie::selectStream | ( | const StreamDescriptor & | streamDescriptor | ) |
Request activation of the given stream.
In case another stream of the same kind is already active, it is deactivated.
streamDescriptor | the descriptor of the stream to activate |
bool sfe::Movie::setPlayingOffset | ( | const sf::Time & | targetSeekTime | ) |
Seek up to targetSeekTime
targetSeekTime | the new expected playing offset |
void sfe::Movie::setVolume | ( | float | volume | ) |
Sets the sound's volume (default is 100)
volume | the volume in range [0, 100] |
void sfe::Movie::stop | ( | ) |
Stops the media playback. The playing offset is reset to the beginning.
This function stops the stream if it was playing or paused, and does nothing if it was already stopped. It also resets the playing position (unlike pause()).