git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@31051
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
\docparam{name}{Window name.}
\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.
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.
Obtains the current position in time within the movie in milliseconds.
Resumes 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.
Seeks to a position within the movie.
-enum wxMediaTimeFormat
-{
- wxMEDIATIMEFORMAT_TIME
-};
-
#define wxMEDIABACKEND_DIRECTSHOW wxT("wxAMMediaBackend")
#define wxMEDIABACKEND_MCI wxT("wxMCIMediaBackend")
#define wxMEDIABACKEND_QUICKTIME wxT("wxQTMediaBackend")
#define wxMEDIABACKEND_DIRECTSHOW wxT("wxAMMediaBackend")
#define wxMEDIABACKEND_MCI wxT("wxMCIMediaBackend")
#define wxMEDIABACKEND_QUICKTIME wxT("wxQTMediaBackend")
long style = 0,
const wxString& szBackend = wxT(""),
const wxValidator& validator = wxDefaultValidator,
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,
bool DoCreate(wxClassInfo* instance,
wxWindow* parent, wxWindowID id,
bool Stop();
bool Load(const wxString& fileName);
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();
void Loop(bool bLoop = true);
bool IsLooped();
wxMediaState GetState();
- double GetPlaybackRate();
- bool SetPlaybackRate(double dRate);
-
- 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); }
+ double GetPlaybackRate(); //All but MCI
+ bool SetPlaybackRate(double dRate); //All but MCI
- 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();
protected:
static wxClassInfo* NextBackend();
-// Currently an internal class - API stability not gauranteed.
+// Currently an internal class - API stability not guaranteed.
//
// ----------------------------------------------------------------------------
//
// ----------------------------------------------------------------------------
// 4) Connect our events
// 5) Start our timer
// ----------------------------------------------------------------------------
// 4) Connect our events
// 5) Start our timer
// ----------------------------------------------------------------------------
MyFrame::MyFrame(const wxString& title)
: wxFrame(NULL, wxID_ANY, title)
{
MyFrame::MyFrame(const wxString& title)
: wxFrame(NULL, wxID_ANY, title)
{
_T("Length(Seconds):%u Speed:%1.1fx"),
m_mediactrl->GetBestSize().x,
m_mediactrl->GetBestSize().y,
_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_mediactrl->GetPlaybackRate()
);
- m_slider->SetRange(0, (m_mediactrl->GetDuration() / 1000).ToLong());
+ m_slider->SetRange(0, (m_mediactrl->Length() / 1000));
// ----------------------------------------------------------------------------
void MyFrame::OnSeek(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!"));
}
wxMessageBox(wxT("Couldn't seek in movie!"));
}
// ----------------------------------------------------------------------------
void MyTimer::Notify()
{
// ----------------------------------------------------------------------------
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
m_frame->m_slider->SetValue(lPosition);
#if wxUSE_STATUSBAR
//
// This searches by searching the global RTTI hashtable, class by class,
// attempting to call CreateControl on each one found that is a derivative
//
// 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,
// it keeps iterating through the hashmap.
//---------------------------------------------------------------------------
bool wxMediaCtrl::Create(wxWindow* parent, wxWindowID id,
// wxMediaCtrl::Stop
// wxMediaCtrl::GetPlaybackRate
// wxMediaCtrl::SetPlaybackRate
// 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
//
// wxMediaCtrl::GetState
// wxMediaCtrl::DoGetBestSize
//
-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()
- return m_imp->GetPosition();
- return 0;
+ return (wxFileOffset) m_imp->GetPosition().ToLong();
+ return wxInvalidOffset;
-wxLongLong wxMediaCtrl::GetDuration()
+wxFileOffset wxMediaCtrl::Length()
- return m_imp->GetDuration();
- return 0;
+ return (wxFileOffset) m_imp->GetDuration().ToLong();
+ return wxInvalidOffset;
}
wxMediaState wxMediaCtrl::GetState()
}
wxMediaState wxMediaCtrl::GetState()