wxMediaCtrl API changes for 2.5.x/2.6
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@31051 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -172,16 +172,16 @@ wxMediaCtrl figure it out.}
|
||||
\docparam{name}{Window name.}
|
||||
|
||||
|
||||
\membersection{wxMediaCtrl::GetDuration}\label{wxmediactrlgetduration}
|
||||
\membersection{wxMediaCtrl::Length}\label{wxmediactrlgetduration}
|
||||
|
||||
\func{wxLongLong}{GetDuration}{\void}
|
||||
\func{wxFileOffset}{GetDuration}{\void}
|
||||
|
||||
Obtains the length - the total amount of time the movie has in milliseconds.
|
||||
|
||||
|
||||
\membersection{wxMediaCtrl::GetPosition}\label{wxmediactrlgetposition}
|
||||
\membersection{wxMediaCtrl::Tell}\label{wxmediactrlgetposition}
|
||||
|
||||
\func{wxLongLong}{GetPosition}{\void}
|
||||
\func{wxFileOffset}{GetPosition}{\void}
|
||||
|
||||
Obtains the current position in time within the movie in milliseconds.
|
||||
|
||||
@@ -220,9 +220,9 @@ Pauses playback of the movie.
|
||||
Resumes playback of the movie.
|
||||
|
||||
|
||||
\membersection{wxMediaCtrl::SetPosition}\label{wxmediactrlsetposition}
|
||||
\membersection{wxMediaCtrl::Seek}\label{wxmediactrlsetposition}
|
||||
|
||||
\func{bool}{SetPosition}{\param{wxLongLong }{where}}
|
||||
\func{wxFileOffset}{SetPosition}{\param{wxFileOffset }{where}, \param{wxSeekMode }{mode}}
|
||||
|
||||
Seeks to a position within the movie.
|
||||
|
||||
|
@@ -55,11 +55,6 @@ enum wxMediaState
|
||||
wxMEDIASTATE_PLAYING
|
||||
};
|
||||
|
||||
enum wxMediaTimeFormat
|
||||
{
|
||||
wxMEDIATIMEFORMAT_TIME
|
||||
};
|
||||
|
||||
#define wxMEDIABACKEND_DIRECTSHOW wxT("wxAMMediaBackend")
|
||||
#define wxMEDIABACKEND_MCI wxT("wxMCIMediaBackend")
|
||||
#define wxMEDIABACKEND_QUICKTIME wxT("wxQTMediaBackend")
|
||||
@@ -159,7 +154,7 @@ public:
|
||||
long style = 0,
|
||||
const wxString& szBackend = wxT(""),
|
||||
const wxValidator& validator = wxDefaultValidator,
|
||||
const wxString& name = wxT("mediaCtrl"));
|
||||
const wxString& name = wxT("mediaCtrl")); //DirectShow only
|
||||
|
||||
bool DoCreate(wxClassInfo* instance,
|
||||
wxWindow* parent, wxWindowID id,
|
||||
@@ -174,26 +169,19 @@ public:
|
||||
bool Stop();
|
||||
|
||||
bool Load(const wxString& fileName);
|
||||
bool Load(const wxURI& location);
|
||||
bool Load(const wxURI& location); //DirectShow only
|
||||
|
||||
void Loop(bool bLoop = true);
|
||||
bool IsLooped();
|
||||
|
||||
wxMediaState GetState();
|
||||
|
||||
double GetPlaybackRate();
|
||||
bool SetPlaybackRate(double dRate);
|
||||
double GetPlaybackRate(); //All but MCI
|
||||
bool SetPlaybackRate(double dRate); //All but MCI
|
||||
|
||||
bool SetPosition(wxLongLong where);
|
||||
wxLongLong GetPosition();
|
||||
wxLongLong GetDuration();
|
||||
|
||||
//The following two prevent function hiding
|
||||
void GetPosition(int* x, int* y) const
|
||||
{ wxControl::GetPosition(x, y); }
|
||||
|
||||
wxPoint GetPosition() const
|
||||
{ return wxControl::GetPosition(); }
|
||||
wxFileOffset Seek(wxFileOffset where, wxSeekMode mode = wxFromStart);
|
||||
wxFileOffset Tell(); //FIXME: This should be const
|
||||
wxFileOffset Length(); //FIXME: This should be const
|
||||
|
||||
protected:
|
||||
static wxClassInfo* NextBackend();
|
||||
@@ -213,7 +201,7 @@ protected:
|
||||
//
|
||||
// wxMediaBackend
|
||||
//
|
||||
// Currently an internal class - API stability not gauranteed.
|
||||
// Currently an internal class - API stability not guaranteed.
|
||||
//
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
|
@@ -244,6 +244,7 @@ bool MyApp::OnInit()
|
||||
// 4) Connect our events
|
||||
// 5) Start our timer
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
MyFrame::MyFrame(const wxString& title)
|
||||
: wxFrame(NULL, wxID_ANY, title)
|
||||
{
|
||||
@@ -482,11 +483,11 @@ void MyFrame::ResetStatus()
|
||||
_T("Length(Seconds):%u Speed:%1.1fx"),
|
||||
m_mediactrl->GetBestSize().x,
|
||||
m_mediactrl->GetBestSize().y,
|
||||
(unsigned)((m_mediactrl->GetDuration() / 1000).ToLong()),
|
||||
(unsigned)((m_mediactrl->Length() / 1000)),
|
||||
m_mediactrl->GetPlaybackRate()
|
||||
);
|
||||
|
||||
m_slider->SetRange(0, (m_mediactrl->GetDuration() / 1000).ToLong());
|
||||
m_slider->SetRange(0, (m_mediactrl->Length() / 1000));
|
||||
|
||||
m_nLoops = 0;
|
||||
}
|
||||
@@ -599,7 +600,7 @@ void MyFrame::OnStop(wxCommandEvent& WXUNUSED(event))
|
||||
// ----------------------------------------------------------------------------
|
||||
void MyFrame::OnSeek(wxCommandEvent& WXUNUSED(event))
|
||||
{
|
||||
if( !m_mediactrl->SetPosition( m_slider->GetValue() * 1000 ) )
|
||||
if( m_mediactrl->Seek( m_slider->GetValue() * 1000 ) == wxInvalidOffset )
|
||||
wxMessageBox(wxT("Couldn't seek in movie!"));
|
||||
}
|
||||
|
||||
@@ -630,7 +631,7 @@ void MyFrame::OnMediaStop(wxMediaEvent& WXUNUSED(event))
|
||||
// ----------------------------------------------------------------------------
|
||||
void MyTimer::Notify()
|
||||
{
|
||||
long lPosition = (m_frame->m_mediactrl->GetPosition() / 1000).ToLong();
|
||||
long lPosition = (m_frame->m_mediactrl->Tell() / 1000);
|
||||
m_frame->m_slider->SetValue(lPosition);
|
||||
|
||||
#if wxUSE_STATUSBAR
|
||||
|
@@ -70,7 +70,7 @@ DEFINE_EVENT_TYPE(wxEVT_MEDIA_STOP);
|
||||
//
|
||||
// This searches by searching the global RTTI hashtable, class by class,
|
||||
// attempting to call CreateControl on each one found that is a derivative
|
||||
// of wxMediaBackend - if it succeededs Create returns true, otherwise
|
||||
// of wxMediaBackend - if it succeeded Create returns true, otherwise
|
||||
// it keeps iterating through the hashmap.
|
||||
//---------------------------------------------------------------------------
|
||||
bool wxMediaCtrl::Create(wxWindow* parent, wxWindowID id,
|
||||
@@ -301,9 +301,9 @@ bool wxMediaCtrl::Load(const wxURI& location)
|
||||
// wxMediaCtrl::Stop
|
||||
// wxMediaCtrl::GetPlaybackRate
|
||||
// wxMediaCtrl::SetPlaybackRate
|
||||
// wxMediaCtrl::SetPosition
|
||||
// wxMediaCtrl::GetPosition
|
||||
// wxMediaCtrl::GetDuration
|
||||
// wxMediaCtrl::Seek --> SetPosition
|
||||
// wxMediaCtrl::Tell --> GetPosition
|
||||
// wxMediaCtrl::Length --> GetDuration
|
||||
// wxMediaCtrl::GetState
|
||||
// wxMediaCtrl::DoGetBestSize
|
||||
//
|
||||
@@ -346,25 +346,43 @@ bool wxMediaCtrl::SetPlaybackRate(double dRate)
|
||||
return false;
|
||||
}
|
||||
|
||||
bool wxMediaCtrl::SetPosition(wxLongLong where)
|
||||
wxFileOffset wxMediaCtrl::Seek(wxFileOffset where, wxSeekMode mode)
|
||||
{
|
||||
if(m_imp && m_bLoaded)
|
||||
return m_imp->SetPosition(where);
|
||||
return false;
|
||||
wxFileOffset offset;
|
||||
|
||||
switch (mode)
|
||||
{
|
||||
case wxFromStart:
|
||||
offset = where;
|
||||
break;
|
||||
case wxFromEnd:
|
||||
offset = Length() - where;
|
||||
break;
|
||||
// case wxFromCurrent:
|
||||
default:
|
||||
offset = Tell() + where;
|
||||
break;
|
||||
}
|
||||
|
||||
if(m_imp && m_bLoaded && m_imp->SetPosition(offset))
|
||||
return offset;
|
||||
return wxInvalidOffset;
|
||||
}
|
||||
|
||||
wxLongLong wxMediaCtrl::GetPosition()
|
||||
wxFileOffset wxMediaCtrl::Tell()
|
||||
{
|
||||
//FIXME
|
||||
if(m_imp && m_bLoaded)
|
||||
return m_imp->GetPosition();
|
||||
return 0;
|
||||
return (wxFileOffset) m_imp->GetPosition().ToLong();
|
||||
return wxInvalidOffset;
|
||||
}
|
||||
|
||||
wxLongLong wxMediaCtrl::GetDuration()
|
||||
wxFileOffset wxMediaCtrl::Length()
|
||||
{
|
||||
//FIXME
|
||||
if(m_imp && m_bLoaded)
|
||||
return m_imp->GetDuration();
|
||||
return 0;
|
||||
return (wxFileOffset) m_imp->GetDuration().ToLong();
|
||||
return wxInvalidOffset;
|
||||
}
|
||||
|
||||
wxMediaState wxMediaCtrl::GetState()
|
||||
|
Reference in New Issue
Block a user