A window that can play back a DirectShow video. More...
Inherits Component.
Public Types | |
| enum | VideoRendererType { dshowDefault, dshowVMR7, dshowEVR } |
| DirectShow video renderer type. More... | |
Public Member Functions | |
| DirectShowComponent (VideoRendererType type=dshowDefault) | |
| Creates a DirectShowComponent, initially blank. | |
| ~DirectShowComponent () | |
| Destructor. | |
| bool | loadMovie (const String &fileOrURLPath) |
| Tries to load a DirectShow video from a file or URL into the player. | |
| bool | loadMovie (const File &videoFile) |
| Tries to load a DirectShow video from a file into the player. | |
| bool | loadMovie (const URL &videoURL) |
| Tries to load a DirectShow video from a URL into the player. | |
| void | closeMovie () |
| Closes the video, if one is open. | |
| File | getCurrentMoviePath () const |
| Returns the file path or URL from which the video file was loaded. | |
| bool | isMovieOpen () const |
| Returns true if there's currently a video open. | |
| double | getMovieDuration () const |
| Returns the length of the video, in seconds. | |
| void | getMovieNormalSize (int &width, int &height) const |
| Returns the video's natural size, in pixels. | |
| void | setBoundsWithCorrectAspectRatio (const Rectangle< int > &spaceToFitWithin, const RectanglePlacement &placement) |
| This will position the component within a given area, keeping its aspect ratio correct according to the video's normal size. | |
| void | play () |
| Starts the video playing. | |
| void | stop () |
| Stops the video playing. | |
| bool | isPlaying () const |
| Returns true if the video is currently playing. | |
| void | goToStart () |
| Moves the video's position back to the start. | |
| void | setPosition (double seconds) |
| Sets the video's position to a given time. | |
| double | getPosition () const |
| Returns the current play position of the video. | |
| void | setSpeed (float newSpeed) |
| Changes the video playback rate. | |
| void | setMovieVolume (float newVolume) |
| Changes the video's playback volume. | |
| float | getMovieVolume () const |
| Returns the video's playback volume. | |
| void | setLooping (bool shouldLoop) |
| Tells the video whether it should loop. | |
| bool | isLooping () const |
| Returns true if the video is currently looping. | |
| void | paint (Graphics &g) |
Static Public Member Functions | |
| static bool | isDirectShowAvailable () |
| Returns true if DirectShow is installed and working on this machine. | |
A window that can play back a DirectShow video.
Creates a DirectShowComponent, initially blank.
Use the loadMovie() method to load a video once you've added the component to a window, (or put it on the desktop as a heavyweight window). Loading a video when the component isn't visible can cause problems, as DirectShow needs a window handle to initialise properly.
Destructor.
| static bool DirectShowComponent::isDirectShowAvailable | ( | ) | [static] |
Returns true if DirectShow is installed and working on this machine.
| bool DirectShowComponent::loadMovie | ( | const String & | fileOrURLPath | ) |
Tries to load a DirectShow video from a file or URL into the player.
It's best to call this function once you've added the component to a window, (or put it on the desktop as a heavyweight window). Loading a video when the component isn't visible can cause problems, because DirectShow needs a window handle to do its stuff.
| fileOrURLPath | the file or URL path to open |
| bool DirectShowComponent::loadMovie | ( | const File & | videoFile | ) |
Tries to load a DirectShow video from a file into the player.
It's best to call this function once you've added the component to a window, (or put it on the desktop as a heavyweight window). Loading a video when the component isn't visible can cause problems, because DirectShow needs a window handle to do its stuff.
| videoFile | the video file to open |
| bool DirectShowComponent::loadMovie | ( | const URL & | videoURL | ) |
Tries to load a DirectShow video from a URL into the player.
It's best to call this function once you've added the component to a window, (or put it on the desktop as a heavyweight window). Loading a video when the component isn't visible can cause problems, because DirectShow needs a window handle to do its stuff.
| videoURL | the video URL to open |
| void DirectShowComponent::closeMovie | ( | ) |
Closes the video, if one is open.
| File DirectShowComponent::getCurrentMoviePath | ( | ) | const |
Returns the file path or URL from which the video file was loaded.
If there isn't one, this returns an empty string.
| bool DirectShowComponent::isMovieOpen | ( | ) | const |
Returns true if there's currently a video open.
| double DirectShowComponent::getMovieDuration | ( | ) | const |
Returns the length of the video, in seconds.
| void DirectShowComponent::getMovieNormalSize | ( | int & | width, |
| int & | height | ||
| ) | const |
Returns the video's natural size, in pixels.
You can use this to resize the component to show the video at its preferred scale.
If no video is loaded, the size returned will be 0 x 0.
| void DirectShowComponent::setBoundsWithCorrectAspectRatio | ( | const Rectangle< int > & | spaceToFitWithin, |
| const RectanglePlacement & | placement | ||
| ) |
This will position the component within a given area, keeping its aspect ratio correct according to the video's normal size.
The component will be made as large as it can go within the space, and will be aligned according to the justification value if this means there are gaps at the top or sides.
| void DirectShowComponent::play | ( | ) |
Starts the video playing.
| void DirectShowComponent::stop | ( | ) |
Stops the video playing.
| bool DirectShowComponent::isPlaying | ( | ) | const |
Returns true if the video is currently playing.
| void DirectShowComponent::goToStart | ( | ) |
Moves the video's position back to the start.
| void DirectShowComponent::setPosition | ( | double | seconds | ) |
Sets the video's position to a given time.
| double DirectShowComponent::getPosition | ( | ) | const |
Returns the current play position of the video.
Reimplemented from Component.
| void DirectShowComponent::setSpeed | ( | float | newSpeed | ) |
Changes the video playback rate.
A value of 1 is normal speed, greater values play it proportionately faster, smaller values play it slower.
| void DirectShowComponent::setMovieVolume | ( | float | newVolume | ) |
Changes the video's playback volume.
| newVolume | the volume in the range 0 (silent) to 1.0 (full) |
| float DirectShowComponent::getMovieVolume | ( | ) | const |
Returns the video's playback volume.
| void DirectShowComponent::setLooping | ( | bool | shouldLoop | ) |
Tells the video whether it should loop.
| bool DirectShowComponent::isLooping | ( | ) | const |
Returns true if the video is currently looping.
| void DirectShowComponent::paint | ( | Graphics & | g | ) | [virtual] |
Reimplemented from Component.