JUCE
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Defines
Public Types | Public Member Functions | Static Public Member Functions
DirectShowComponent Class Reference

A window that can play back a DirectShow video. More...

Inherits Component.

List of all members.

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.

Detailed Description

A window that can play back a DirectShow video.

Note:
Controller is not implemented

Member Enumeration Documentation

DirectShow video renderer type.

See MSDN for adivce about choosing the right renderer.

Enumerator:
dshowDefault 

VMR7 for Windows XP, EVR for Windows Vista and later.

dshowVMR7 

Video Mixing Renderer 7.

dshowEVR 

Enhanced Video Renderer.


Constructor & Destructor Documentation

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.

See also:
VideoRendererType

Destructor.


Member Function Documentation

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.

Parameters:
fileOrURLPaththe file or URL path to open
Returns:
true if the video opens successfully
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.

Parameters:
videoFilethe video file to open
Returns:
true if the video opens successfully
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.

Parameters:
videoURLthe video URL to open
Returns:
true if the video opens successfully

Closes the video, if one is open.

Returns the file path or URL from which the video file was loaded.

If there isn't one, this returns an empty string.

Returns true if there's currently a video open.

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.

Note:
Not implemented

Starts the video playing.

Stops the video playing.

Returns true if the video is currently playing.

Moves the video's position back to the start.

void DirectShowComponent::setPosition ( double  seconds)

Sets the video's position to a given time.

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.

Parameters:
newVolumethe volume in the range 0 (silent) to 1.0 (full)

Returns the video's playback volume.

Returns:
the volume in the range 0 (silent) to 1.0 (full)
void DirectShowComponent::setLooping ( bool  shouldLoop)

Tells the video whether it should loop.

Returns true if the video is currently looping.

See also:
setLooping
void DirectShowComponent::paint ( Graphics g) [virtual]

Reimplemented from Component.


The documentation for this class was generated from the following file: