2008-03-08 08:52:38 -05:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: mediactrl.h
|
2009-01-10 13:59:37 -05:00
|
|
|
// Purpose: interface of wxMediaEvent, wxMediaCtrl
|
2008-03-08 08:52:38 -05:00
|
|
|
// Author: wxWidgets team
|
2010-07-13 09:29:13 -04:00
|
|
|
// Licence: wxWindows licence
|
2008-03-08 08:52:38 -05:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2013-12-18 11:00:38 -05:00
|
|
|
/**
|
|
|
|
Describes the current state of the media.
|
|
|
|
|
|
|
|
@see wxMediaCtrl::GetState()
|
|
|
|
*/
|
|
|
|
enum wxMediaState
|
|
|
|
{
|
|
|
|
/** No media is being currently played. */
|
|
|
|
wxMEDIASTATE_STOPPED,
|
|
|
|
|
|
|
|
/** Current media is paused. */
|
|
|
|
wxMEDIASTATE_PAUSED,
|
|
|
|
|
|
|
|
/** There is media currently playing. */
|
|
|
|
wxMEDIASTATE_PLAYING
|
|
|
|
};
|
2008-09-25 14:14:44 -04:00
|
|
|
|
|
|
|
enum wxMediaCtrlPlayerControls
|
|
|
|
{
|
|
|
|
/** No controls. return wxMediaCtrl to its default state. */
|
|
|
|
wxMEDIACTRLPLAYERCONTROLS_NONE = 0,
|
|
|
|
|
2011-03-22 10:08:30 -04:00
|
|
|
/** Step controls like fastforward, step one frame etc. */
|
2008-09-25 14:14:44 -04:00
|
|
|
wxMEDIACTRLPLAYERCONTROLS_STEP = 1 << 0,
|
|
|
|
|
|
|
|
/** Volume controls like the speaker icon, volume slider, etc. */
|
|
|
|
wxMEDIACTRLPLAYERCONTROLS_VOLUME = 1 << 1,
|
|
|
|
|
|
|
|
/** Default controls for the toolkit. Currently a combination for
|
|
|
|
@c wxMEDIACTRLPLAYERCONTROLS_STEP and @c wxMEDIACTRLPLAYERCONTROLS_VOLUME. */
|
|
|
|
wxMEDIACTRLPLAYERCONTROLS_DEFAULT =
|
|
|
|
wxMEDIACTRLPLAYERCONTROLS_STEP |
|
|
|
|
wxMEDIACTRLPLAYERCONTROLS_VOLUME
|
|
|
|
};
|
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
/**
|
|
|
|
@class wxMediaEvent
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
Event wxMediaCtrl uses.
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-09-25 14:14:44 -04:00
|
|
|
@beginEventTable{wxMediaEvent}
|
|
|
|
@event{EVT_MEDIA_LOADED(id\, func)}
|
|
|
|
Sent when a media has loaded enough data that it can start playing.
|
2013-12-20 12:50:27 -05:00
|
|
|
Processes a @c wxEVT_MEDIA_LOADED event type.
|
2008-09-25 14:14:44 -04:00
|
|
|
@event{EVT_MEDIA_STOP(id\, func)}
|
|
|
|
Sent when a media has switched to the @c wxMEDIASTATE_STOPPED state.
|
|
|
|
You may be able to Veto this event to prevent it from stopping,
|
|
|
|
causing it to continue playing - even if it has reached that end of
|
|
|
|
the media (note that this may not have the desired effect - if you
|
|
|
|
want to loop the media, for example, catch the @c EVT_MEDIA_FINISHED
|
|
|
|
and play there instead).
|
2013-12-20 12:50:27 -05:00
|
|
|
Processes a @c wxEVT_MEDIA_STOP event type.
|
2008-09-25 14:14:44 -04:00
|
|
|
@event{EVT_MEDIA_FINISHED(id\, func)}
|
|
|
|
Sent when a media has finished playing in a wxMediaCtrl.
|
2013-12-20 12:50:27 -05:00
|
|
|
Processes a @c wxEVT_MEDIA_FINISHED event type.
|
2008-09-25 14:14:44 -04:00
|
|
|
@event{EVT_MEDIA_STATECHANGED(id\, func)}
|
|
|
|
Sent when a media has switched its state (from any media state).
|
2013-12-20 12:50:27 -05:00
|
|
|
Processes a @c wxEVT_MEDIA_STATECHANGED event type.
|
2008-09-25 14:14:44 -04:00
|
|
|
@event{EVT_MEDIA_PLAY(id\, func)}
|
|
|
|
Sent when a media has switched to the @c wxMEDIASTATE_PLAYING state.
|
2013-12-20 12:50:27 -05:00
|
|
|
Processes a @c wxEVT_MEDIA_PLAY event type.
|
2008-09-25 14:14:44 -04:00
|
|
|
@event{EVT_MEDIA_PAUSE(id\, func)}
|
|
|
|
Sent when a media has switched to the @c wxMEDIASTATE_PAUSED state.
|
2013-12-20 12:50:27 -05:00
|
|
|
Processes a @c wxEVT_MEDIA_PAUSE event type.
|
2008-09-25 14:14:44 -04:00
|
|
|
@endEventTable
|
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
@library{wxmedia}
|
2008-09-25 14:14:44 -04:00
|
|
|
@category{events}
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
|
|
|
class wxMediaEvent : public wxNotifyEvent
|
|
|
|
{
|
|
|
|
public:
|
2008-09-25 14:14:44 -04:00
|
|
|
/** Default ctor. */
|
|
|
|
wxMediaEvent(wxEventType commandType = wxEVT_NULL, int winid = 0);
|
2008-03-08 08:52:38 -05:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2008-03-10 11:24:38 -04:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
/**
|
|
|
|
@class wxMediaCtrl
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-10-11 09:10:48 -04:00
|
|
|
wxMediaCtrl is a class for displaying types of media, such as videos, audio
|
|
|
|
files, natively through native codecs.
|
2008-03-08 09:43:31 -05:00
|
|
|
|
2008-03-08 08:52:38 -05:00
|
|
|
wxMediaCtrl uses native backends to render media, for example on Windows
|
2008-03-08 09:43:31 -05:00
|
|
|
there is a ActiveMovie/DirectShow backend, and on Macintosh there is a
|
2008-03-08 08:52:38 -05:00
|
|
|
QuickTime backend.
|
2008-03-08 09:43:31 -05:00
|
|
|
|
|
|
|
|
2008-10-11 09:10:48 -04:00
|
|
|
@section mediactrl_rendering_media Rendering media
|
2008-09-25 14:14:44 -04:00
|
|
|
|
|
|
|
Depending upon the backend, wxMediaCtrl can render and display pretty much any
|
|
|
|
kind of media that the native system can - such as an image, mpeg video, or mp3
|
|
|
|
(without license restrictions - since it relies on native system calls that may
|
|
|
|
not technically have mp3 decoding available, for example, it falls outside
|
|
|
|
the realm of licensing restrictions).
|
|
|
|
|
|
|
|
For general operation, all you need to do is call Load() to load the file you
|
|
|
|
want to render, catch the @c EVT_MEDIA_LOADED event, and then call Play()
|
|
|
|
to show the video/audio of the media in that event.
|
|
|
|
|
2012-02-22 08:41:07 -05:00
|
|
|
More complex operations are generally more heavily dependent on the capabilities
|
2008-09-25 14:14:44 -04:00
|
|
|
of the backend. For example, QuickTime cannot set the playback rate of certain
|
|
|
|
streaming media - while DirectShow is slightly more flexible in that regard.
|
|
|
|
|
2008-10-11 09:10:48 -04:00
|
|
|
@section mediactrl_operation Operation
|
2008-09-25 14:14:44 -04:00
|
|
|
|
|
|
|
When wxMediaCtrl plays a file, it plays until the stop position is reached
|
|
|
|
(currently the end of the file/stream). Right before it hits the end of the stream,
|
|
|
|
it fires off a @c EVT_MEDIA_STOP event to its parent window, at which point the event
|
|
|
|
handler can choose to veto the event, preventing the stream from actually stopping.
|
|
|
|
|
|
|
|
Example:
|
|
|
|
|
|
|
|
@code
|
|
|
|
//connect to the media event
|
|
|
|
this->Connect(wxMY_ID, wxEVT_MEDIA_STOP, (wxObjectEventFunction)
|
|
|
|
(wxEventFunction)(wxMediaEventFunction) &MyFrame::OnMediaStop);
|
|
|
|
|
|
|
|
//...
|
|
|
|
void MyFrame::OnMediaStop(const wxMediaEvent& evt)
|
|
|
|
{
|
|
|
|
if(bUserWantsToSeek)
|
|
|
|
{
|
|
|
|
m_mediactrl->SetPosition(
|
|
|
|
m_mediactrl->GetDuration() << 1
|
|
|
|
);
|
|
|
|
evt.Veto();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@endcode
|
|
|
|
|
2008-10-11 09:10:48 -04:00
|
|
|
When wxMediaCtrl stops, either by the @c EVT_MEDIA_STOP not being vetoed, or
|
|
|
|
by manually calling Stop(), where it actually stops is not at the beginning,
|
|
|
|
rather, but at the beginning of the stream. That is, when it stops and play
|
2011-03-22 10:08:30 -04:00
|
|
|
is called, playback is guaranteed to start at the beginning of the media.
|
2008-10-11 09:10:48 -04:00
|
|
|
This is because some streams are not seekable, and when stop is called on
|
2011-03-22 10:08:30 -04:00
|
|
|
them they return to the beginning, thus wxMediaCtrl tries to keep consistent
|
2008-10-11 09:10:48 -04:00
|
|
|
for all types of media.
|
|
|
|
|
|
|
|
Note that when changing the state of the media through Play() and other methods,
|
|
|
|
the media may not actually be in the @c wxMEDIASTATE_PLAYING, for example.
|
|
|
|
If you are relying on the media being in certain state catch the event relevant
|
|
|
|
to the state. See wxMediaEvent for the kinds of events that you can catch.
|
|
|
|
|
|
|
|
|
|
|
|
@section mediactrl_video_size Video size
|
|
|
|
|
|
|
|
By default, wxMediaCtrl will scale the size of the video to the requested
|
|
|
|
amount passed to either its constructor or Create().
|
2011-03-22 10:08:30 -04:00
|
|
|
After calling wxMediaCtrl::Load or performing an equivalent operation,
|
2008-10-11 09:10:48 -04:00
|
|
|
you can subsequently obtain the "real" size of the video (if there is any)
|
|
|
|
by calling wxMediaCtrl::GetBestSize(). Note that the actual result on the
|
|
|
|
display will be slightly different when wxMediaCtrl::ShowPlayerControls is
|
2011-03-22 10:08:30 -04:00
|
|
|
activated and the actual video size will be less than specified due to the
|
2008-10-11 09:10:48 -04:00
|
|
|
extra controls provided by the native toolkit.
|
|
|
|
In addition, the backend may modify wxMediaCtrl::GetBestSize() to include
|
|
|
|
the size of the extra controls - so if you want the real size of the video
|
|
|
|
just disable wxMediaCtrl::ShowPlayerControls().
|
|
|
|
|
|
|
|
The idea with setting wxMediaCtrl::GetBestSize() to the size of the video is
|
|
|
|
that GetBestSize() is a wxWindow-derived function that is called when sizers
|
|
|
|
on a window recalculate.
|
|
|
|
What this means is that if you use sizers by default the video will show in
|
|
|
|
its original size without any extra assistance needed from the user.
|
|
|
|
|
|
|
|
|
|
|
|
@section mediactrl_player_controls Player controls
|
|
|
|
|
|
|
|
Normally, when you use wxMediaCtrl it is just a window for the video to play in.
|
|
|
|
However, some toolkits have their own media player interface.
|
|
|
|
For example, QuickTime generally has a bar below the video with a slider.
|
|
|
|
A special feature available to wxMediaCtrl, you can use the toolkits interface
|
|
|
|
instead of making your own by using the ShowPlayerControls() function.
|
|
|
|
There are several options for the flags parameter, with the two general flags
|
|
|
|
being @c wxMEDIACTRLPLAYERCONTROLS_NONE which turns off the native interface,
|
|
|
|
and @c wxMEDIACTRLPLAYERCONTROLS_DEFAULT which lets wxMediaCtrl decide what
|
|
|
|
native controls on the interface.
|
|
|
|
Be sure to review the caveats outlined in @ref mediactrl_video_size before doing so.
|
|
|
|
|
|
|
|
|
|
|
|
@section mediactrl_choosing_backend Choosing a backend
|
|
|
|
|
|
|
|
Generally, you should almost certainly leave this part up to wxMediaCtrl -
|
|
|
|
but if you need a certain backend for a particular reason, such as QuickTime
|
|
|
|
for playing .mov files, all you need to do to choose a specific backend is
|
|
|
|
to pass the name of the backend class to wxMediaCtrl::Create().
|
2008-09-25 14:14:44 -04:00
|
|
|
|
|
|
|
The following are valid backend identifiers:
|
|
|
|
|
2008-10-11 09:10:48 -04:00
|
|
|
- @b wxMEDIABACKEND_DIRECTSHOW: Use ActiveMovie/DirectShow.
|
|
|
|
Uses the native ActiveMovie (I.E. DirectShow) control.
|
|
|
|
Default backend on Windows and supported by nearly all Windows versions,
|
|
|
|
even some Windows CE versions.
|
|
|
|
May display a windows media player logo while inactive.
|
|
|
|
- @b wxMEDIABACKEND_QUICKTIME: Use QuickTime. Mac Only.
|
|
|
|
WARNING: May not working correctly embedded in a wxNotebook.
|
|
|
|
- @b wxMEDIABACKEND_GSTREAMER, Use GStreamer. Unix Only.
|
|
|
|
Requires GStreamer 0.8 along with at the very least the xvimagesink, xoverlay,
|
|
|
|
and gst-play modules of gstreamer to function.
|
2011-03-22 10:08:30 -04:00
|
|
|
You need the correct modules to play the relevant files, for example the
|
2008-10-11 09:10:48 -04:00
|
|
|
mad module to play mp3s, etc.
|
|
|
|
- @b wxMEDIABACKEND_WMP10, Uses Windows Media Player 10 (Windows only) -
|
|
|
|
works on mobile machines with Windows Media Player 10 and desktop machines
|
|
|
|
with either Windows Media Player 9 or 10.
|
|
|
|
|
|
|
|
Note that other backends such as wxMEDIABACKEND_MCI can now be found at
|
|
|
|
wxCode (http://wxcode.sourceforge.net/).
|
|
|
|
|
|
|
|
|
|
|
|
@section mediactrl_creating_backend Creating a backend
|
|
|
|
|
|
|
|
Creating a backend for wxMediaCtrl is a rather simple process.
|
|
|
|
Simply derive from wxMediaBackendCommonBase and implement the methods you want.
|
|
|
|
The methods in wxMediaBackend correspond to those in wxMediaCtrl except for
|
|
|
|
wxMediaCtrl::CreateControl which does the actual creation of the control,
|
|
|
|
in cases where a custom control is not needed you may simply call wxControl::Create().
|
2008-09-25 14:14:44 -04:00
|
|
|
|
2008-10-11 09:10:48 -04:00
|
|
|
You need to make sure to use the @c DECLARE_CLASS and @c IMPLEMENT_CLASS macros.
|
2008-09-25 14:14:44 -04:00
|
|
|
|
2008-10-11 09:10:48 -04:00
|
|
|
The only real tricky part is that you need to make sure the file in compiled in,
|
|
|
|
which if there are just backends in there will not happen and you may need to
|
|
|
|
use a force link hack (see http://www.wxwidgets.org/wiki/index.php/RTTI).
|
2008-09-25 14:14:44 -04:00
|
|
|
|
2008-10-11 09:10:48 -04:00
|
|
|
This is a rather simple example of how to create a backend in the
|
|
|
|
wxActiveXContainer documentation.
|
2008-09-25 14:14:44 -04:00
|
|
|
|
|
|
|
|
2008-10-11 09:10:48 -04:00
|
|
|
@library{wxmedia}
|
|
|
|
@category{media}
|
2008-09-25 14:14:44 -04:00
|
|
|
|
2008-10-11 09:10:48 -04:00
|
|
|
@see wxMediaEvent
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
|
|
|
class wxMediaCtrl : public wxControl
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
/**
|
2008-10-11 09:10:48 -04:00
|
|
|
Default constructor - you MUST call Create() before calling any
|
|
|
|
other methods of wxMediaCtrl.
|
2008-09-25 14:14:44 -04:00
|
|
|
*/
|
|
|
|
wxMediaCtrl();
|
|
|
|
|
|
|
|
/**
|
2008-10-11 09:10:48 -04:00
|
|
|
Constructor that calls Create().
|
|
|
|
You may prefer to call Create() directly to check to see if
|
|
|
|
wxMediaCtrl is available on the system.
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-09-25 14:14:44 -04:00
|
|
|
@param parent
|
2008-03-09 08:33:59 -04:00
|
|
|
parent of this control. Must not be @NULL.
|
2008-03-08 09:43:31 -05:00
|
|
|
@param id
|
2008-03-09 08:33:59 -04:00
|
|
|
id to use for events
|
2008-03-08 09:43:31 -05:00
|
|
|
@param fileName
|
2008-03-09 08:33:59 -04:00
|
|
|
If not empty, the path of a file to open.
|
2008-03-08 09:43:31 -05:00
|
|
|
@param pos
|
2008-03-09 08:33:59 -04:00
|
|
|
Position to put control at.
|
2008-03-08 09:43:31 -05:00
|
|
|
@param size
|
2008-03-09 08:33:59 -04:00
|
|
|
Size to put the control at and to stretch movie to.
|
2008-03-08 09:43:31 -05:00
|
|
|
@param style
|
2008-03-09 08:33:59 -04:00
|
|
|
Optional styles.
|
2008-03-08 09:43:31 -05:00
|
|
|
@param szBackend
|
2008-10-11 09:10:48 -04:00
|
|
|
Name of backend you want to use, leave blank to make wxMediaCtrl figure it out.
|
2008-03-08 09:43:31 -05:00
|
|
|
@param validator
|
2008-03-09 08:33:59 -04:00
|
|
|
validator to use.
|
2008-03-08 09:43:31 -05:00
|
|
|
@param name
|
2008-03-09 08:33:59 -04:00
|
|
|
Window name.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-11-10 16:33:25 -05:00
|
|
|
wxMediaCtrl(wxWindow* parent, wxWindowID id, const wxString& fileName = wxEmptyString,
|
2008-09-25 14:14:44 -04:00
|
|
|
const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
|
2008-11-10 16:33:25 -05:00
|
|
|
long style = 0, const wxString& szBackend = wxEmptyString,
|
2008-09-27 07:21:10 -04:00
|
|
|
const wxValidator& validator = wxDefaultValidator,
|
2008-11-10 16:33:25 -05:00
|
|
|
const wxString& name = "mediaCtrl");
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
2008-10-11 09:10:48 -04:00
|
|
|
Creates this control.
|
|
|
|
Returns @false if it can't load the movie located at @a fileName
|
2008-09-25 14:14:44 -04:00
|
|
|
or it cannot load one of its native backends.
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-10-11 09:10:48 -04:00
|
|
|
If you specify a file to open via @a fileName and you don't specify a
|
|
|
|
backend to use, wxMediaCtrl tries each of its backends until one that
|
|
|
|
can render the path referred to by @a fileName can be found.
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-09-25 14:14:44 -04:00
|
|
|
@param parent
|
2008-03-09 08:33:59 -04:00
|
|
|
parent of this control. Must not be @NULL.
|
2008-03-08 09:43:31 -05:00
|
|
|
@param id
|
2008-03-09 08:33:59 -04:00
|
|
|
id to use for events
|
2008-03-08 09:43:31 -05:00
|
|
|
@param fileName
|
2008-03-09 08:33:59 -04:00
|
|
|
If not empty, the path of a file to open.
|
2008-03-08 09:43:31 -05:00
|
|
|
@param pos
|
2008-03-09 08:33:59 -04:00
|
|
|
Position to put control at.
|
2008-03-08 09:43:31 -05:00
|
|
|
@param size
|
2008-03-09 08:33:59 -04:00
|
|
|
Size to put the control at and to stretch movie to.
|
2008-03-08 09:43:31 -05:00
|
|
|
@param style
|
2008-03-09 08:33:59 -04:00
|
|
|
Optional styles.
|
2008-03-08 09:43:31 -05:00
|
|
|
@param szBackend
|
2008-10-11 09:10:48 -04:00
|
|
|
Name of backend you want to use, leave blank to make wxMediaCtrl figure it out.
|
2008-03-08 09:43:31 -05:00
|
|
|
@param validator
|
2008-03-09 08:33:59 -04:00
|
|
|
validator to use.
|
2008-03-08 09:43:31 -05:00
|
|
|
@param name
|
2008-03-09 08:33:59 -04:00
|
|
|
Window name.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-11-10 16:33:25 -05:00
|
|
|
bool Create(wxWindow* parent, wxWindowID id, const wxString& fileName = wxEmptyString,
|
2008-09-25 14:14:44 -04:00
|
|
|
const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
|
2008-11-10 16:33:25 -05:00
|
|
|
long style = 0, const wxString& szBackend = wxEmptyString,
|
2008-09-27 07:21:10 -04:00
|
|
|
const wxValidator& validator = wxDefaultValidator,
|
2008-11-10 16:33:25 -05:00
|
|
|
const wxString& name = "mediaCtrl");
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Obtains the best size relative to the original/natural size of the
|
2008-10-11 09:10:48 -04:00
|
|
|
video, if there is any.
|
|
|
|
See @ref mediactrl_video_size for more information.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-10-13 09:24:43 -04:00
|
|
|
wxSize GetBestSize() const;
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Obtains the playback rate, or speed of the media. @c 1.0 represents normal
|
|
|
|
speed, while @c 2.0 represents twice the normal speed of the media, for
|
|
|
|
example. Not supported on the GStreamer (Unix) backend.
|
2008-09-25 14:14:44 -04:00
|
|
|
|
|
|
|
@return zero on failure.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2012-02-15 10:39:53 -05:00
|
|
|
double GetPlaybackRate();
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
2013-12-18 11:00:38 -05:00
|
|
|
Obtains the state the playback of the media is in.
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-09-25 14:14:44 -04:00
|
|
|
@beginTable
|
|
|
|
@row2col{wxMEDIASTATE_STOPPED, The movie has stopped.}
|
|
|
|
@row2col{wxMEDIASTATE_PAUSED, The movie is paused.}
|
|
|
|
@row2col{wxMEDIASTATE_PLAYING, The movie is currently playing.}
|
|
|
|
@endTable
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-10-28 11:36:26 -04:00
|
|
|
wxMediaState GetState();
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
2008-09-25 14:14:44 -04:00
|
|
|
Gets the volume of the media from a 0.0 to 1.0 range.
|
|
|
|
|
2008-10-11 09:10:48 -04:00
|
|
|
@note Due to rounding and other errors the value returned may not be the
|
|
|
|
exact value sent to SetVolume().
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
|
|
|
double GetVolume();
|
|
|
|
|
|
|
|
/**
|
|
|
|
Obtains the length - the total amount of time the movie has in milliseconds.
|
|
|
|
*/
|
|
|
|
wxFileOffset Length();
|
|
|
|
|
|
|
|
/**
|
2008-09-25 14:14:44 -04:00
|
|
|
Loads the file that fileName refers to. Returns @false if loading fails.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-09-25 14:14:44 -04:00
|
|
|
bool Load(const wxString& fileName);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
2008-10-11 09:10:48 -04:00
|
|
|
Loads the location that uri refers to. Note that this is very
|
2012-02-22 08:41:07 -05:00
|
|
|
implementation-dependent, although HTTP URI/URLs are generally
|
2008-10-11 09:10:48 -04:00
|
|
|
supported, for example. Returns @false if loading fails.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-09-25 14:14:44 -04:00
|
|
|
bool Load(const wxURI& uri);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
2008-09-25 14:14:44 -04:00
|
|
|
Loads the location that @c uri refers to with the proxy @c proxy.
|
|
|
|
Not implemented on most backends so it should be called with caution.
|
|
|
|
Returns @false if loading fails.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-09-25 14:14:44 -04:00
|
|
|
bool Load(const wxURI& uri, const wxURI& proxy);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
2008-09-25 14:14:44 -04:00
|
|
|
Same as Load(const wxURI& uri). Kept for wxPython compatibility.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-10-28 11:36:26 -04:00
|
|
|
bool LoadURI(const wxString& fileName);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
2008-09-25 14:14:44 -04:00
|
|
|
/**
|
2008-10-11 09:10:48 -04:00
|
|
|
Same as Load(const wxURI& uri, const wxURI& proxy).
|
|
|
|
Kept for wxPython compatibility.
|
2008-09-25 14:14:44 -04:00
|
|
|
*/
|
2008-10-28 11:36:26 -04:00
|
|
|
bool LoadURIWithProxy(const wxString& fileName, const wxString& proxy);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
Pauses playback of the movie.
|
|
|
|
*/
|
|
|
|
bool Pause();
|
|
|
|
|
|
|
|
/**
|
|
|
|
Resumes playback of the movie.
|
|
|
|
*/
|
|
|
|
bool Play();
|
|
|
|
|
|
|
|
/**
|
|
|
|
Seeks to a position within the movie.
|
2008-09-25 14:14:44 -04:00
|
|
|
|
|
|
|
@todo Document the wxSeekMode parameter @a mode, and perhaps also the
|
|
|
|
wxFileOffset and wxSeekMode themselves.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
2008-10-28 11:36:26 -04:00
|
|
|
wxFileOffset Seek(wxFileOffset where, wxSeekMode mode = wxFromStart);
|
2008-03-08 08:52:38 -05:00
|
|
|
|
|
|
|
/**
|
2008-09-25 14:14:44 -04:00
|
|
|
Sets the playback rate, or speed of the media, to that referred by @a dRate.
|
2008-03-08 08:52:38 -05:00
|
|
|
@c 1.0 represents normal speed, while @c 2.0 represents twice the normal
|
|
|
|
speed of the media, for example. Not supported on the GStreamer (Unix) backend.
|
|
|
|
Returns @true if successful.
|
|
|
|
*/
|
|
|
|
bool SetPlaybackRate(double dRate);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Sets the volume of the media from a 0.0 to 1.0 range to that referred
|
|
|
|
by @c dVolume. @c 1.0 represents full volume, while @c 0.5
|
2008-09-25 14:14:44 -04:00
|
|
|
represents half (50 percent) volume, for example.
|
|
|
|
|
|
|
|
@note The volume may not be exact due to conversion and rounding errors,
|
|
|
|
although setting the volume to full or none is always exact.
|
|
|
|
Returns @true if successful.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
|
|
|
bool SetVolume(double dVolume);
|
|
|
|
|
|
|
|
/**
|
|
|
|
A special feature to wxMediaCtrl. Applications using native toolkits such as
|
|
|
|
QuickTime usually have a scrollbar, play button, and more provided to
|
|
|
|
them by the toolkit. By default wxMediaCtrl does not do this. However, on
|
|
|
|
the directshow and quicktime backends you can show or hide the native controls
|
2008-09-25 14:14:44 -04:00
|
|
|
provided by the underlying toolkit at will using ShowPlayerControls(). Simply
|
2008-03-08 08:52:38 -05:00
|
|
|
calling the function with default parameters tells wxMediaCtrl to use the
|
|
|
|
default controls provided by the toolkit. The function takes a
|
2008-09-25 14:14:44 -04:00
|
|
|
wxMediaCtrlPlayerControls enumeration, please see available show modes there.
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-12-12 10:41:22 -05:00
|
|
|
For more info see @ref mediactrl_player_controls.
|
2008-03-20 09:45:17 -04:00
|
|
|
|
2008-09-25 14:14:44 -04:00
|
|
|
Currently only implemented on the QuickTime and DirectShow backends.
|
|
|
|
The function returns @true on success.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
|
|
|
bool ShowPlayerControls(wxMediaCtrlPlayerControls flags = wxMEDIACTRLPLAYERCONTROLS_DEFAULT);
|
|
|
|
|
|
|
|
/**
|
|
|
|
Stops the media.
|
2008-09-25 14:14:44 -04:00
|
|
|
|
2008-10-11 09:10:48 -04:00
|
|
|
See @ref mediactrl_operation for an overview of how stopping works.
|
2008-03-08 08:52:38 -05:00
|
|
|
*/
|
|
|
|
bool Stop();
|
|
|
|
|
|
|
|
/**
|
|
|
|
Obtains the current position in time within the movie in milliseconds.
|
|
|
|
*/
|
|
|
|
wxFileOffset Tell();
|
|
|
|
};
|
2008-03-10 11:24:38 -04:00
|
|
|
|
2013-12-20 12:50:27 -05:00
|
|
|
wxEventType wxEVT_MEDIA_LOADED;
|
|
|
|
wxEventType wxEVT_MEDIA_STOP;
|
|
|
|
wxEventType wxEVT_MEDIA_FINISHED;
|
|
|
|
wxEventType wxEVT_MEDIA_STATECHANGED;
|
|
|
|
wxEventType wxEVT_MEDIA_PLAY;
|
|
|
|
wxEventType wxEVT_MEDIA_PAUSE;
|