many improvements/bug fixes to media control: new wxEVT_MEDIA_LOADED event, new methods taking URIs, new DirectShow implementation, significant sample improvements (patch 1233613)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@34974 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -9,6 +9,8 @@ All:
|
|||||||
|
|
||||||
- Fixed wxScopeGuard to work with VC++, documented it.
|
- Fixed wxScopeGuard to work with VC++, documented it.
|
||||||
- Fixed proxy handling in wxURL.
|
- Fixed proxy handling in wxURL.
|
||||||
|
- Added wxEVT_MEDIA_LOADED event for wxMediaCtrl
|
||||||
|
- Added new methods to wxMediaCtrl (wxURI version of Load, ShowPlayerControls)
|
||||||
- Added wxZipFSHandler::Cleanup() (Stas Sergeev)
|
- Added wxZipFSHandler::Cleanup() (Stas Sergeev)
|
||||||
- Added wxImage::RotateHue() and RGB <-> HSV conversions (John Anderson)
|
- Added wxImage::RotateHue() and RGB <-> HSV conversions (John Anderson)
|
||||||
|
|
||||||
|
@@ -39,8 +39,9 @@ realm of licensing restrictions).
|
|||||||
|
|
||||||
For general operation, all you need to do is call
|
For general operation, all you need to do is call
|
||||||
\helpref{wxMediaCtrl::Load}{wxmediactrlload} to load the file
|
\helpref{wxMediaCtrl::Load}{wxmediactrlload} to load the file
|
||||||
you want to render, then call \helpref{wxMediaCtrl::Play}{wxmediactrlplay}
|
you want to render, catch the EVT\_MEDIA\_LOADED event,
|
||||||
to show the video/audio of the media.
|
and then call \helpref{wxMediaCtrl::Play}{wxmediactrlplay}
|
||||||
|
to show the video/audio of the media in that event.
|
||||||
|
|
||||||
More complex operations are generally more heavily dependant on the
|
More complex operations are generally more heavily dependant on the
|
||||||
capabilities of the backend. For example, QuickTime cannot set
|
capabilities of the backend. For example, QuickTime cannot set
|
||||||
@@ -102,7 +103,7 @@ Use ActiveMovie/DirectShow. Requires wxUSE\_DIRECTSHOW to be
|
|||||||
enabled, requires linkage with the static library strmiids.lib,
|
enabled, requires linkage with the static library strmiids.lib,
|
||||||
and is available on Windows Only.}
|
and is available on Windows Only.}
|
||||||
\twocolitem{{\bf wxMEDIABACKEND\_QUICKTIME}}{
|
\twocolitem{{\bf wxMEDIABACKEND\_QUICKTIME}}{
|
||||||
Use QuickTime. Windows and Mac Only. WARNING: On Mac Systems lower than OSX 10.2 this defaults to emulating window positioning and suffers from several bugs, including not working correctly embedded in a wxNotebook. }
|
Use QuickTime. Windows and Mac Only. NOTE: On Mac Systems lower than OSX 10.2 this defaults to emulating window positioning and suffers from several bugs, including not working correctly embedded in a wxNotebook. }
|
||||||
\twocolitem{{\bf wxMEDIABACKEND\_MCI}}{
|
\twocolitem{{\bf wxMEDIABACKEND\_MCI}}{
|
||||||
Use Media Command Interface. Windows Only. }
|
Use Media Command Interface. Windows Only. }
|
||||||
\twocolitem{{\bf wxMEDIABACKEND\_GSTREAMER}}{
|
\twocolitem{{\bf wxMEDIABACKEND\_GSTREAMER}}{
|
||||||
@@ -206,6 +207,13 @@ Obtains the state the playback of the movie is in -
|
|||||||
|
|
||||||
Loads the file that \tt{fileName} refers to. Returns false if loading fails.
|
Loads the file that \tt{fileName} refers to. Returns false if loading fails.
|
||||||
|
|
||||||
|
|
||||||
|
\membersection{wxMediaCtrl::Load}\label{wxmediactrlloaduri}
|
||||||
|
|
||||||
|
\func{bool}{Load}{\param{const wxURI\& }{location}}
|
||||||
|
|
||||||
|
Loads the url that \tt{location} refers to. Returns false if loading fails.
|
||||||
|
|
||||||
\membersection{wxMediaCtrl::Pause}\label{wxmediactrlpause}
|
\membersection{wxMediaCtrl::Pause}\label{wxmediactrlpause}
|
||||||
|
|
||||||
\func{bool}{Pause}{\void}
|
\func{bool}{Pause}{\void}
|
||||||
@@ -222,7 +230,7 @@ Resumes playback of the movie.
|
|||||||
|
|
||||||
\membersection{wxMediaCtrl::Seek}\label{wxmediactrlsetposition}
|
\membersection{wxMediaCtrl::Seek}\label{wxmediactrlsetposition}
|
||||||
|
|
||||||
\func{wxFileOffset}{SetPosition}{\param{wxFileOffset }{where}, \param{wxSeekMode }{mode}}
|
\func{wxFileOffset}{Seek}{\param{wxFileOffset }{where}, \param{wxSeekMode }{mode}}
|
||||||
|
|
||||||
Seeks to a position within the movie.
|
Seeks to a position within the movie.
|
||||||
|
|
||||||
@@ -235,3 +243,45 @@ Stops the media.
|
|||||||
|
|
||||||
See \helpref{Operation}{operationwxmediactrl} for an overview of how stopping works.
|
See \helpref{Operation}{operationwxmediactrl} for an overview of how stopping works.
|
||||||
|
|
||||||
|
|
||||||
|
\membersection{wxMediaCtrl::SetVolume}\label{wxmediactrlsetvolume}
|
||||||
|
|
||||||
|
\func{bool}{SetVolume}{\param{double }{dVolume}}
|
||||||
|
|
||||||
|
Sets the volume of the media from a 0.0 to 1.0 range.
|
||||||
|
|
||||||
|
|
||||||
|
\membersection{wxMediaCtrl::GetVolume}\label{wxmediactrlgetvolume}
|
||||||
|
|
||||||
|
\func{double}{GetVolume}{\void}
|
||||||
|
|
||||||
|
Gets the volume of the media from a 0.0 to 1.0 range.
|
||||||
|
|
||||||
|
|
||||||
|
\membersection{wxMediaCtrl::GetPlaybackRate}\label{wxmediactrlgetplaybackrate}
|
||||||
|
|
||||||
|
\func{double}{GetPlaybackrate}{\void}
|
||||||
|
|
||||||
|
Gets the playback rate of the media; for example 2.0 is double speed.
|
||||||
|
Not implemented on MCI or GStreamer.
|
||||||
|
|
||||||
|
|
||||||
|
\membersection{wxMediaCtrl::SetPlaybackRate}\label{wxmediactrlsetplaybackrate}
|
||||||
|
|
||||||
|
\func{bool}{SetPlaybackrate}{\param{double }{dVolume}}
|
||||||
|
|
||||||
|
Sets the rate that the media plays; for example 0.5 is half speed.
|
||||||
|
|
||||||
|
|
||||||
|
\membersection{wxMediaCtrl::ShowPlayerControls}\label{wxmediactrlshowplayercontrols}
|
||||||
|
|
||||||
|
\func{bool}{ShowPlayerControls}{\param{wxMediaCtrlPlayerControls }{flags}}
|
||||||
|
|
||||||
|
Normally, when you use wxMediaCtrl it is just a window for the video to
|
||||||
|
play in. However, platforms generally have their own media player interface,
|
||||||
|
like quicktime has a bar below the video with a slider etc.. If you want that native
|
||||||
|
interface instead of making your own use this function. There are several options
|
||||||
|
for the flags parameter, however you can look at the mediactrl header for these.
|
||||||
|
The two general flags are wxMEDIACTRLPLAYERCONTROLS\_NONE which turns off the
|
||||||
|
native interface, and wxMEDIACTRLPLAYERCONTROLS\_DEFAULT which lets wxMediaCtrl
|
||||||
|
decide what native controls on the interface.
|
||||||
|
@@ -25,6 +25,7 @@ Event \helpref{wxMediaCtrl}{wxmediactrl} uses.
|
|||||||
|
|
||||||
\twocolwidtha{7cm}
|
\twocolwidtha{7cm}
|
||||||
\begin{twocollist}\itemsep=0pt
|
\begin{twocollist}\itemsep=0pt
|
||||||
|
\twocolitem{{\bf EVT\_MEDIA\_LOADED(func)}}{Sent when a media has loaded enough data that it can start playing.}
|
||||||
\twocolitem{{\bf EVT\_MEDIA\_STOP(func)}}{
|
\twocolitem{{\bf EVT\_MEDIA\_STOP(func)}}{
|
||||||
Triggerred right before the media stops. You can Veto this event to prevent it from stopping, causing it to continue playing - even if it has reached that end of the media. }
|
Triggerred right before the media stops. You can Veto this event to prevent it from stopping, causing it to continue playing - even if it has reached that end of the media. }
|
||||||
\twocolitem{{\bf EVT\_MEDIA\_FINISHED(func)}}{Sent when a media has finished playing in a \helpref{wxMediaCtrl}{wxmediactrl}. Note that if you connect to this event and don't skip it, it will override the looping behaviour of the media control.}
|
\twocolitem{{\bf EVT\_MEDIA\_FINISHED(func)}}{Sent when a media has finished playing in a \helpref{wxMediaCtrl}{wxmediactrl}. Note that if you connect to this event and don't skip it, it will override the looping behaviour of the media control.}
|
||||||
|
@@ -58,11 +58,24 @@ enum wxMediaState
|
|||||||
wxMEDIASTATE_PLAYING
|
wxMEDIASTATE_PLAYING
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum wxMediaCtrlPlayerControls
|
||||||
|
{
|
||||||
|
wxMEDIACTRLPLAYERCONTROLS_NONE = 0,
|
||||||
|
//Step controls like fastfoward, step one frame etc.
|
||||||
|
wxMEDIACTRLPLAYERCONTROLS_STEP = 1 << 0,
|
||||||
|
//Volume controls like the speaker icon, volume slider, etc.
|
||||||
|
wxMEDIACTRLPLAYERCONTROLS_VOLUME = 1 << 1,
|
||||||
|
wxMEDIACTRLPLAYERCONTROLS_DEFAULT =
|
||||||
|
wxMEDIACTRLPLAYERCONTROLS_STEP |
|
||||||
|
wxMEDIACTRLPLAYERCONTROLS_VOLUME
|
||||||
|
};
|
||||||
|
|
||||||
#define wxMEDIABACKEND_DIRECTSHOW wxT("wxAMMediaBackend")
|
#define wxMEDIABACKEND_DIRECTSHOW wxT("wxAMMediaBackend")
|
||||||
#define wxMEDIABACKEND_MCI wxT("wxMCIMediaBackend")
|
#define wxMEDIABACKEND_MCI wxT("wxMCIMediaBackend")
|
||||||
#define wxMEDIABACKEND_QUICKTIME wxT("wxQTMediaBackend")
|
#define wxMEDIABACKEND_QUICKTIME wxT("wxQTMediaBackend")
|
||||||
#define wxMEDIABACKEND_GSTREAMER wxT("wxGStreamerMediaBackend")
|
#define wxMEDIABACKEND_GSTREAMER wxT("wxGStreamerMediaBackend")
|
||||||
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// wxMediaEvent
|
// wxMediaEvent
|
||||||
@@ -158,7 +171,7 @@ public:
|
|||||||
long style = 0,
|
long style = 0,
|
||||||
const wxString& szBackend = wxEmptyString,
|
const wxString& szBackend = wxEmptyString,
|
||||||
const wxValidator& validator = wxDefaultValidator,
|
const wxValidator& validator = wxDefaultValidator,
|
||||||
const wxString& name = wxT("mediaCtrl")); //DirectShow only
|
const wxString& name = wxT("mediaCtrl"));
|
||||||
|
|
||||||
bool DoCreate(wxClassInfo* instance,
|
bool DoCreate(wxClassInfo* instance,
|
||||||
wxWindow* parent, wxWindowID winid,
|
wxWindow* parent, wxWindowID winid,
|
||||||
@@ -174,25 +187,36 @@ public:
|
|||||||
|
|
||||||
bool Load(const wxString& fileName);
|
bool Load(const wxString& fileName);
|
||||||
|
|
||||||
|
|
||||||
wxMediaState GetState();
|
wxMediaState GetState();
|
||||||
|
|
||||||
wxFileOffset Seek(wxFileOffset where, wxSeekMode mode = wxFromStart);
|
wxFileOffset Seek(wxFileOffset where, wxSeekMode mode = wxFromStart);
|
||||||
wxFileOffset Tell(); //FIXME: This should be const
|
wxFileOffset Tell(); //FIXME: This should be const
|
||||||
wxFileOffset Length(); //FIXME: This should be const
|
wxFileOffset Length(); //FIXME: This should be const
|
||||||
|
|
||||||
//
|
#if wxABI_VERSION >= 20601 /* 2.6.1+ only */
|
||||||
// Unofficial parts of API
|
|
||||||
//
|
|
||||||
//DirectShow/GStreamer only. Quicktime too, but somewhat buggy...
|
|
||||||
bool Load(const wxURI& location);
|
|
||||||
|
|
||||||
double GetPlaybackRate(); //All but MCI & GStreamer
|
double GetPlaybackRate(); //All but MCI & GStreamer
|
||||||
bool SetPlaybackRate(double dRate); //All but MCI & GStreamer
|
bool SetPlaybackRate(double dRate); //All but MCI & GStreamer
|
||||||
|
#endif
|
||||||
|
|
||||||
double GetVolume(); //DirectShow only
|
#if wxABI_VERSION >= 20602 /* 2.6.2+ only */
|
||||||
bool SetVolume(double dVolume); //DirectShow only
|
bool Load(const wxURI& location);
|
||||||
|
bool Load(const wxURI& location, const wxURI& proxy);
|
||||||
|
|
||||||
|
wxFileOffset GetDownloadProgress();
|
||||||
|
wxFileOffset GetDownloadTotal();
|
||||||
|
|
||||||
|
double GetVolume();
|
||||||
|
bool SetVolume(double dVolume);
|
||||||
|
|
||||||
|
bool ShowPlayerControls(
|
||||||
|
wxMediaCtrlPlayerControls flags = wxMEDIACTRLPLAYERCONTROLS_DEFAULT);
|
||||||
|
|
||||||
|
//helpers for the wxPython people
|
||||||
|
bool LoadURI(const wxString& fileName)
|
||||||
|
{ return Load(wxURI(fileName)); }
|
||||||
|
bool LoadURIWithProxy(const wxString& fileName, const wxString& proxy)
|
||||||
|
{ return Load(wxURI(fileName), wxURI(proxy)); }
|
||||||
|
#endif
|
||||||
protected:
|
protected:
|
||||||
static wxClassInfo* NextBackend();
|
static wxClassInfo* NextBackend();
|
||||||
|
|
||||||
@@ -202,10 +226,7 @@ protected:
|
|||||||
|
|
||||||
//FIXME: This is nasty... find a better way to work around
|
//FIXME: This is nasty... find a better way to work around
|
||||||
//inheritance issues
|
//inheritance issues
|
||||||
#ifdef __WXMAC__
|
#if defined(__WXMAC__) || defined(__WXCOCOA__)
|
||||||
friend class wxQTMediaBackend;
|
|
||||||
#endif
|
|
||||||
#ifdef __WXCOCOA__
|
|
||||||
friend class wxQTMediaBackend;
|
friend class wxQTMediaBackend;
|
||||||
#endif
|
#endif
|
||||||
class wxMediaBackend* m_imp;
|
class wxMediaBackend* m_imp;
|
||||||
@@ -218,7 +239,13 @@ protected:
|
|||||||
//
|
//
|
||||||
// wxMediaBackend
|
// wxMediaBackend
|
||||||
//
|
//
|
||||||
// Currently an internal class - API stability not guaranteed.
|
// Derive from this and use standard wxWidgets RTTI
|
||||||
|
// (DECLARE_DYNAMIC_CLASS and IMPLEMENT_CLASS) to make a backend
|
||||||
|
// for wxMediaCtrl. Backends are searched alphabetically -
|
||||||
|
// the one with the earliest letter is tried first.
|
||||||
|
//
|
||||||
|
// Note that this is currently not API or ABI compatable -
|
||||||
|
// so statically link or make the client compile on-site.
|
||||||
//
|
//
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
@@ -278,11 +305,21 @@ public:
|
|||||||
virtual bool SetVolume(double WXUNUSED(dVolume))
|
virtual bool SetVolume(double WXUNUSED(dVolume))
|
||||||
{ return false; }
|
{ return false; }
|
||||||
|
|
||||||
virtual void RESERVED3() {}
|
virtual bool Load(const wxURI& WXUNUSED(location),
|
||||||
virtual void RESERVED4() {}
|
const wxURI& WXUNUSED(proxy))
|
||||||
virtual void RESERVED5() {}
|
{ return false; }
|
||||||
virtual void RESERVED6() {}
|
|
||||||
virtual void RESERVED7() {}
|
virtual bool ShowPlayerControls(
|
||||||
|
wxMediaCtrlPlayerControls WXUNUSED(flags))
|
||||||
|
{ return false; }
|
||||||
|
virtual bool IsInterfaceShown()
|
||||||
|
{ return false; }
|
||||||
|
|
||||||
|
virtual wxLongLong GetDownloadProgress()
|
||||||
|
{ return 0; }
|
||||||
|
virtual wxLongLong GetDownloadTotal()
|
||||||
|
{ return 0; }
|
||||||
|
|
||||||
virtual void RESERVED8() {}
|
virtual void RESERVED8() {}
|
||||||
virtual void RESERVED9() {}
|
virtual void RESERVED9() {}
|
||||||
|
|
||||||
@@ -307,6 +344,12 @@ typedef void (wxEvtHandler::*wxMediaEventFunction)(wxMediaEvent&);
|
|||||||
#define EVT_MEDIA_FINISHED(winid, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_MEDIA_FINISHED, winid, wxID_ANY, wxMediaEventHandler(fn), (wxObject *) NULL ),
|
#define EVT_MEDIA_FINISHED(winid, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_MEDIA_FINISHED, winid, wxID_ANY, wxMediaEventHandler(fn), (wxObject *) NULL ),
|
||||||
#define EVT_MEDIA_STOP(winid, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_MEDIA_STOP, winid, wxID_ANY, wxMediaEventHandler(fn), (wxObject *) NULL ),
|
#define EVT_MEDIA_STOP(winid, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_MEDIA_STOP, winid, wxID_ANY, wxMediaEventHandler(fn), (wxObject *) NULL ),
|
||||||
|
|
||||||
|
#if wxABI_VERSION >= 20602 /* 2.6.2+ only */
|
||||||
|
# define wxMEDIA_LOADED_ID 13002
|
||||||
|
DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_MEDIA, wxEVT_MEDIA_LOADED, wxMEDIA_LOADED_ID)
|
||||||
|
# define EVT_MEDIA_LOADED(winid, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_MEDIA_LOADED, winid, wxID_ANY, wxMediaEventHandler(fn), (wxObject *) NULL ),
|
||||||
|
#endif
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// End compilation gaurd
|
// End compilation gaurd
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
File diff suppressed because it is too large
Load Diff
@@ -52,6 +52,7 @@ IMPLEMENT_CLASS(wxMediaCtrl, wxControl);
|
|||||||
IMPLEMENT_CLASS(wxMediaBackend, wxObject);
|
IMPLEMENT_CLASS(wxMediaBackend, wxObject);
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxMediaEvent, wxEvent);
|
IMPLEMENT_DYNAMIC_CLASS(wxMediaEvent, wxEvent);
|
||||||
DEFINE_EVENT_TYPE(wxEVT_MEDIA_FINISHED);
|
DEFINE_EVENT_TYPE(wxEVT_MEDIA_FINISHED);
|
||||||
|
DEFINE_EVENT_TYPE(wxEVT_MEDIA_LOADED);
|
||||||
DEFINE_EVENT_TYPE(wxEVT_MEDIA_STOP);
|
DEFINE_EVENT_TYPE(wxEVT_MEDIA_STOP);
|
||||||
|
|
||||||
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||||
@@ -281,6 +282,8 @@ wxMediaCtrl::~wxMediaCtrl()
|
|||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
// wxMediaCtrl::Load (file version)
|
// wxMediaCtrl::Load (file version)
|
||||||
// wxMediaCtrl::Load (URL version)
|
// wxMediaCtrl::Load (URL version)
|
||||||
|
// wxMediaCtrl::Load (URL & Proxy version)
|
||||||
|
// wxMediaCtrl::Load (wxInputStream version)
|
||||||
//
|
//
|
||||||
// Here we call load of the backend - keeping
|
// Here we call load of the backend - keeping
|
||||||
// track of whether it was successful or not - which
|
// track of whether it was successful or not - which
|
||||||
@@ -300,6 +303,13 @@ bool wxMediaCtrl::Load(const wxURI& location)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool wxMediaCtrl::Load(const wxURI& location, const wxURI& proxy)
|
||||||
|
{
|
||||||
|
if(m_imp)
|
||||||
|
return (m_bLoaded = m_imp->Load(location, proxy));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
// wxMediaCtrl::Play
|
// wxMediaCtrl::Play
|
||||||
// wxMediaCtrl::Pause
|
// wxMediaCtrl::Pause
|
||||||
@@ -313,6 +323,9 @@ bool wxMediaCtrl::Load(const wxURI& location)
|
|||||||
// wxMediaCtrl::DoGetBestSize
|
// wxMediaCtrl::DoGetBestSize
|
||||||
// wxMediaCtrl::SetVolume
|
// wxMediaCtrl::SetVolume
|
||||||
// wxMediaCtrl::GetVolume
|
// wxMediaCtrl::GetVolume
|
||||||
|
// wxMediaCtrl::ShowInterface
|
||||||
|
// wxMediaCtrl::GetDownloadProgress
|
||||||
|
// wxMediaCtrl::GetDownloadTotal
|
||||||
//
|
//
|
||||||
// 1) Check to see whether the backend exists and is loading
|
// 1) Check to see whether the backend exists and is loading
|
||||||
// 2) Call the backend's version of the method, returning success
|
// 2) Call the backend's version of the method, returning success
|
||||||
@@ -418,6 +431,27 @@ bool wxMediaCtrl::SetVolume(double dVolume)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool wxMediaCtrl::ShowPlayerControls(wxMediaCtrlPlayerControls flags)
|
||||||
|
{
|
||||||
|
if(m_imp)
|
||||||
|
return m_imp->ShowPlayerControls(flags);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
wxFileOffset wxMediaCtrl::GetDownloadProgress()
|
||||||
|
{
|
||||||
|
if(m_imp && m_bLoaded)
|
||||||
|
return (wxFileOffset) m_imp->GetDownloadProgress().ToLong();
|
||||||
|
return wxInvalidOffset;
|
||||||
|
}
|
||||||
|
|
||||||
|
wxFileOffset wxMediaCtrl::GetDownloadTotal()
|
||||||
|
{
|
||||||
|
if(m_imp && m_bLoaded)
|
||||||
|
return (wxFileOffset) m_imp->GetDownloadTotal().ToLong();
|
||||||
|
return wxInvalidOffset;
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
// wxMediaCtrl::DoMoveWindow
|
// wxMediaCtrl::DoMoveWindow
|
||||||
//
|
//
|
||||||
|
@@ -118,6 +118,9 @@ public:
|
|||||||
virtual double GetPlaybackRate();
|
virtual double GetPlaybackRate();
|
||||||
virtual bool SetPlaybackRate(double dRate);
|
virtual bool SetPlaybackRate(double dRate);
|
||||||
|
|
||||||
|
virtual double GetVolume();
|
||||||
|
virtual bool SetVolume(double);
|
||||||
|
|
||||||
void Cleanup();
|
void Cleanup();
|
||||||
void FinishLoad();
|
void FinishLoad();
|
||||||
|
|
||||||
@@ -477,6 +480,11 @@ void wxQTMediaBackend::FinishLoad()
|
|||||||
m_ctrl->GetParent()->Layout();
|
m_ctrl->GetParent()->Layout();
|
||||||
m_ctrl->GetParent()->Refresh();
|
m_ctrl->GetParent()->Refresh();
|
||||||
m_ctrl->GetParent()->Update();
|
m_ctrl->GetParent()->Update();
|
||||||
|
|
||||||
|
//send loaded event
|
||||||
|
wxMediaEvent theEvent(wxEVT_MEDIA_LOADED,
|
||||||
|
m_ctrl->GetId());
|
||||||
|
m_ctrl->AddPendingEvent(theEvent);
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
@@ -580,6 +588,53 @@ wxLongLong wxQTMediaBackend::GetPosition()
|
|||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
// wxQTMediaBackend::GetVolume
|
||||||
|
//
|
||||||
|
// Gets the volume through GetMovieVolume - which returns a 16 bit short -
|
||||||
|
//
|
||||||
|
// +--------+--------+
|
||||||
|
// + (1) + (2) +
|
||||||
|
// +--------+--------+
|
||||||
|
//
|
||||||
|
// (1) first 8 bits are value before decimal
|
||||||
|
// (2) second 8 bits are value after decimal
|
||||||
|
//
|
||||||
|
// Volume ranges from -1.0 (gain but no sound), 0 (no sound and no gain) to
|
||||||
|
// 1 (full gain and sound)
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
double wxQTMediaBackend::GetVolume()
|
||||||
|
{
|
||||||
|
short sVolume = GetMovieVolume(m_movie);
|
||||||
|
|
||||||
|
if(sVolume & (128 << 8)) //negative - no sound
|
||||||
|
return 0.0;
|
||||||
|
|
||||||
|
return (sVolume & (127 << 8)) ? 1.0 : ((double)(sVolume & 255)) / 255.0;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
// wxQTMediaBackend::SetVolume
|
||||||
|
//
|
||||||
|
// Sets the volume through SetMovieVolume - which takes a 16 bit short -
|
||||||
|
//
|
||||||
|
// +--------+--------+
|
||||||
|
// + (1) + (2) +
|
||||||
|
// +--------+--------+
|
||||||
|
//
|
||||||
|
// (1) first 8 bits are value before decimal
|
||||||
|
// (2) second 8 bits are value after decimal
|
||||||
|
//
|
||||||
|
// Volume ranges from -1.0 (gain but no sound), 0 (no sound and no gain) to
|
||||||
|
// 1 (full gain and sound)
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
|
bool wxQTMediaBackend::SetVolume(double dVolume)
|
||||||
|
{
|
||||||
|
short sVolume = (short) (dVolume >= .9999 ? 1 << 8 : (dVolume * 255) );
|
||||||
|
SetMovieVolume(m_movie, sVolume);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------
|
||||||
// wxQTMediaBackend::GetDuration
|
// wxQTMediaBackend::GetDuration
|
||||||
//
|
//
|
||||||
// Calls GetMovieDuration
|
// Calls GetMovieDuration
|
||||||
|
File diff suppressed because it is too large
Load Diff
@@ -274,6 +274,8 @@ bool wxGStreamerMediaBackend::TransCapsToVideoSize(wxGStreamerMediaBackend* be,
|
|||||||
gst_structure_get_int (s, "width", &be->m_videoSize.x);
|
gst_structure_get_int (s, "width", &be->m_videoSize.x);
|
||||||
gst_structure_get_int (s, "height", &be->m_videoSize.y);
|
gst_structure_get_int (s, "height", &be->m_videoSize.y);
|
||||||
|
|
||||||
|
wxLogDebug(wxT("Native video size: [%i,%i]"), be->m_videoSize.x, be->m_videoSize.y);
|
||||||
|
|
||||||
const GValue *par;
|
const GValue *par;
|
||||||
par = gst_structure_get_value (s, "pixel-aspect-ratio");
|
par = gst_structure_get_value (s, "pixel-aspect-ratio");
|
||||||
|
|
||||||
@@ -289,6 +291,8 @@ bool wxGStreamerMediaBackend::TransCapsToVideoSize(wxGStreamerMediaBackend* be,
|
|||||||
be->m_videoSize.y = (int) ((float) den * be->m_videoSize.y / num);
|
be->m_videoSize.y = (int) ((float) den * be->m_videoSize.y / num);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
wxLogDebug(wxT("Adjusted video size: [%i,%i]"), be->m_videoSize.x, be->m_videoSize.y);
|
||||||
|
|
||||||
be->PostRecalcSize();
|
be->PostRecalcSize();
|
||||||
return true;
|
return true;
|
||||||
}//end if caps
|
}//end if caps
|
||||||
@@ -308,6 +312,7 @@ void wxGStreamerMediaBackend::PostRecalcSize()
|
|||||||
m_ctrl->GetParent()->Layout();
|
m_ctrl->GetParent()->Layout();
|
||||||
m_ctrl->GetParent()->Refresh();
|
m_ctrl->GetParent()->Refresh();
|
||||||
m_ctrl->GetParent()->Update();
|
m_ctrl->GetParent()->Update();
|
||||||
|
m_ctrl->SetSize(m_ctrl->GetSize());
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
@@ -446,6 +451,7 @@ bool wxGStreamerMediaBackend::Load(const wxURI& location)
|
|||||||
if ( ! GST_IS_X_OVERLAY(overlay) )
|
if ( ! GST_IS_X_OVERLAY(overlay) )
|
||||||
{
|
{
|
||||||
#endif
|
#endif
|
||||||
|
wxLogDebug(wxT("Could not load Gnome preferences, reverting to xvimagesink for video for gstreamer"));
|
||||||
videosink = gst_element_factory_make ("xvimagesink", "videosink");
|
videosink = gst_element_factory_make ("xvimagesink", "videosink");
|
||||||
if ( !GST_IS_OBJECT(videosink) )
|
if ( !GST_IS_OBJECT(videosink) )
|
||||||
videosink = gst_element_factory_make ("ximagesink", "videosink");
|
videosink = gst_element_factory_make ("ximagesink", "videosink");
|
||||||
@@ -502,13 +508,18 @@ bool wxGStreamerMediaBackend::Load(const wxURI& location)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
//8
|
//8
|
||||||
|
int nResult = gst_element_set_state (m_player, GST_STATE_PAUSED);
|
||||||
wxASSERT(gst_element_set_state (m_player,
|
if(nResult != GST_STATE_SUCCESS)
|
||||||
GST_STATE_PAUSED) == GST_STATE_SUCCESS);
|
{
|
||||||
|
wxLogDebug(wxT("Could not set initial state to paused!"));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
const GList *list = NULL;
|
const GList *list = NULL;
|
||||||
g_object_get (G_OBJECT (m_player), "stream-info", &list, NULL);
|
g_object_get (G_OBJECT (m_player), "stream-info", &list, NULL);
|
||||||
|
|
||||||
|
bool bVideoFound = false;
|
||||||
|
|
||||||
for ( ; list != NULL; list = list->next)
|
for ( ; list != NULL; list = list->next)
|
||||||
{
|
{
|
||||||
GObject *info = (GObject *) list->data;
|
GObject *info = (GObject *) list->data;
|
||||||
@@ -546,6 +557,9 @@ bool wxGStreamerMediaBackend::Load(const wxURI& location)
|
|||||||
G_CALLBACK(wxGStreamerMediaBackend::OnVideoCapsReady),
|
G_CALLBACK(wxGStreamerMediaBackend::OnVideoCapsReady),
|
||||||
this);
|
this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bVideoFound = true;
|
||||||
|
break;
|
||||||
}//end if video
|
}//end if video
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -554,7 +568,17 @@ bool wxGStreamerMediaBackend::Load(const wxURI& location)
|
|||||||
}
|
}
|
||||||
}//end searching through info list
|
}//end searching through info list
|
||||||
|
|
||||||
|
if(!bVideoFound)
|
||||||
|
{
|
||||||
|
wxLogDebug(wxT("No video found for gstreamer stream"));
|
||||||
|
}
|
||||||
m_nPausedPos = 0;
|
m_nPausedPos = 0;
|
||||||
|
|
||||||
|
//send loaded event
|
||||||
|
wxMediaEvent theEvent(wxEVT_MEDIA_LOADED,
|
||||||
|
m_ctrl->GetId());
|
||||||
|
m_ctrl->AddPendingEvent(theEvent);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -11,12 +11,15 @@
|
|||||||
@WX_VERSION_TAG@.2 {
|
@WX_VERSION_TAG@.2 {
|
||||||
global:
|
global:
|
||||||
*wxDialog*GetEscapeId*;
|
*wxDialog*GetEscapeId*;
|
||||||
*wxLogBuffer*;
|
*wxEVT_MEDIA_LOADED*;
|
||||||
*wxGenericListCtrl*SetItemFont*wxFont*;
|
*wxGenericListCtrl*SetItemFont*wxFont*;
|
||||||
*wxGenericListCtrl*GetItemFont*;
|
*wxGenericListCtrl*GetItemFont*;
|
||||||
*wxImage*HSVValue*;
|
*wxImage*HSVValue*;
|
||||||
*wxImage*RGBValue*;
|
*wxImage*RGBValue*;
|
||||||
*wxImage*RotateHue*;
|
*wxImage*RotateHue*;
|
||||||
|
*wxLogBuffer*;
|
||||||
|
*wxMediaCtrl*Load*wxURI*wxURI*;
|
||||||
|
*wxMediaCtrl*ShowPlayerControls*wxMediaPlayerControls*;
|
||||||
*wxMessageOutputBest*;
|
*wxMessageOutputBest*;
|
||||||
*wxShadowObject*;
|
*wxShadowObject*;
|
||||||
*wxWizard*FinishLayout*;
|
*wxWizard*FinishLayout*;
|
||||||
|
Reference in New Issue
Block a user