[xiph-commits] r17480 - in trunk/oggdsf: . build/NSIS/Release src/lib/core/directshow/dsfOggDemux2 src/lib/core/directshow/libDirectshowAbstracts src/lib/plugin/AxPlayer

cristianadam at svn.xiph.org cristianadam at svn.xiph.org
Sun Oct 3 15:48:49 PDT 2010


Author: cristianadam
Date: 2010-10-03 15:48:49 -0700 (Sun, 03 Oct 2010)
New Revision: 17480

Modified:
   trunk/oggdsf/ChangeLog.txt
   trunk/oggdsf/build/NSIS/Release/macros.nsi
   trunk/oggdsf/src/lib/core/directshow/dsfOggDemux2/OggDemuxInputPin.cpp
   trunk/oggdsf/src/lib/core/directshow/libDirectshowAbstracts/BasicSeekPassThrough.cpp
   trunk/oggdsf/src/lib/plugin/AxPlayer/AxPlayer-2005.vcproj
   trunk/oggdsf/src/lib/plugin/AxPlayer/DShowVideoPlayer.cpp
   trunk/oggdsf/src/lib/plugin/AxPlayer/DShowVideoPlayer.h
   trunk/oggdsf/src/lib/plugin/AxPlayer/FilterGraph.cpp
   trunk/oggdsf/src/lib/plugin/AxPlayer/FilterGraph.h
Log:
Added seeking support for activex player.

Modified: trunk/oggdsf/ChangeLog.txt
===================================================================
--- trunk/oggdsf/ChangeLog.txt	2010-10-03 14:49:42 UTC (rev 17479)
+++ trunk/oggdsf/ChangeLog.txt	2010-10-03 22:48:49 UTC (rev 17480)
@@ -1,3 +1,8 @@
+Version 0.84.xxxxx - xx.xx.2010
+
+    * Updated libvpx to 0.9.2
+    * Updated webmdshow to 0.9.10
+
 Version 0.84.17359 - 04.08.2010
     
     * Released Windows CE decoder package, no WebM/VP8 support for now, only Ogg Vorbis,

Modified: trunk/oggdsf/build/NSIS/Release/macros.nsi
===================================================================
--- trunk/oggdsf/build/NSIS/Release/macros.nsi	2010-10-03 14:49:42 UTC (rev 17479)
+++ trunk/oggdsf/build/NSIS/Release/macros.nsi	2010-10-03 22:48:49 UTC (rev 17480)
@@ -10,12 +10,12 @@
 ;--------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 ; Location of Visual Studio runtime libraries on the compiling system
 !if "$%COMPILER%" == "VS2008"
-    !define VS_RUNTIME_LOCATION_X64 "d:\Program Files\Microsoft Visual Studio 9.0\VC\redist\amd64\Microsoft.VC90.CRT\"
-    !define VS_RUNTIME_LOCATION_WIN32 "d:\Program Files\Microsoft Visual Studio 9.0\VC\redist\x86\Microsoft.VC90.CRT\"
+    !define VS_RUNTIME_LOCATION_X64 "c:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\redist\amd64\Microsoft.VC90.CRT\"
+    !define VS_RUNTIME_LOCATION_WIN32 "c:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\redist\x86\Microsoft.VC90.CRT\"
     !define VS_RUNTIME_SUFFIX 90
 !else if "$%COMPILER%" == "VS2005"
-    !define VS_RUNTIME_LOCATION_X64 "d:\Program Files\Microsoft Visual Studio 8\VC\redist\amd64\Microsoft.VC80.CRT\"
-    !define VS_RUNTIME_LOCATION_WIN32 "d:\Program Files\Microsoft Visual Studio 8\VC\redist\x86\Microsoft.VC80.CRT\"	
+    !define VS_RUNTIME_LOCATION_X64 "c:\Program Files (x86)\Microsoft Visual Studio 8\VC\redist\amd64\Microsoft.VC80.CRT\"
+    !define VS_RUNTIME_LOCATION_WIN32 "c:\Program Files (x86)\Microsoft Visual Studio 8\VC\redist\x86\Microsoft.VC80.CRT\"	
     !define VS_RUNTIME_SUFFIX 80
 !endif
 

Modified: trunk/oggdsf/src/lib/core/directshow/dsfOggDemux2/OggDemuxInputPin.cpp
===================================================================
--- trunk/oggdsf/src/lib/core/directshow/dsfOggDemux2/OggDemuxInputPin.cpp	2010-10-03 14:49:42 UTC (rev 17479)
+++ trunk/oggdsf/src/lib/core/directshow/dsfOggDemux2/OggDemuxInputPin.cpp	2010-10-03 22:48:49 UTC (rev 17480)
@@ -98,6 +98,7 @@
     CComQIPtr<IAsyncReader> reader = pPin;
     if (!reader)
     {
+        LOG(logERROR) << __FUNCTIONW__ << " No IAsyncReader interface found";
         hr = VFW_E_NO_TRANSPORT;
     }
 
@@ -114,9 +115,16 @@
             magic[2] != 'g' ||
             magic[3] != 'S')
         {
+            LOG(logERROR) << __FUNCTIONW__ << " Magic is different than 'OggS': " << 
+                magic[0] << ", " << magic[1] << ", " << magic[2] << ", " << magic[3];
+
             hr = VFW_E_UNSUPPORTED_STREAM;
         }
     }
+    else
+    {
+        LOG(logERROR) << __FUNCTIONW__ << " SyncRead failed. Error: 0x" << hex << hr;
+    }
 
     return hr;
 }

Modified: trunk/oggdsf/src/lib/core/directshow/libDirectshowAbstracts/BasicSeekPassThrough.cpp
===================================================================
--- trunk/oggdsf/src/lib/core/directshow/libDirectshowAbstracts/BasicSeekPassThrough.cpp	2010-10-03 14:49:42 UTC (rev 17479)
+++ trunk/oggdsf/src/lib/core/directshow/libDirectshowAbstracts/BasicSeekPassThrough.cpp	2010-10-03 22:48:49 UTC (rev 17480)
@@ -49,9 +49,6 @@
 						AM_SEEKING_CanGetStopPos |
 						AM_SEEKING_CanGetDuration;
 
-	//string x = "g:\\logs\\seeker.log";
-	//seekDebug.open(x.c_str(), ios_base::out);
-
 }
 
 BasicSeekPassThrough::BasicSeekPassThrough(void)

Modified: trunk/oggdsf/src/lib/plugin/AxPlayer/AxPlayer-2005.vcproj
===================================================================
--- trunk/oggdsf/src/lib/plugin/AxPlayer/AxPlayer-2005.vcproj	2010-10-03 14:49:42 UTC (rev 17479)
+++ trunk/oggdsf/src/lib/plugin/AxPlayer/AxPlayer-2005.vcproj	2010-10-03 22:48:49 UTC (rev 17480)
@@ -626,11 +626,11 @@
 				>
 			</File>
 			<File
-				RelativePath=".\VideoTagBehavior.rgs"
+				RelativePath=".\Res\VideoTagBehavior.rgs"
 				>
 			</File>
 			<File
-				RelativePath=".\Res\VideoTagBehavior.rgs"
+				RelativePath=".\VideoTagBehavior.rgs"
 				>
 			</File>
 		</Filter>

Modified: trunk/oggdsf/src/lib/plugin/AxPlayer/DShowVideoPlayer.cpp
===================================================================
--- trunk/oggdsf/src/lib/plugin/AxPlayer/DShowVideoPlayer.cpp	2010-10-03 14:49:42 UTC (rev 17479)
+++ trunk/oggdsf/src/lib/plugin/AxPlayer/DShowVideoPlayer.cpp	2010-10-03 22:48:49 UTC (rev 17480)
@@ -39,11 +39,24 @@
 namespace 
 {
     const int CONTROLS_HEIGHT = 28;
+    const int CONTROLS_WIDTH = 28;
 
-    const Gdiplus::Color CONTROLS_BACKGROUND_COLOR = Gdiplus::Color((BYTE)(0.74 * 256), 35, 31, 32);
-    const Gdiplus::Color TEXT_COLOR = Gdiplus::Color((BYTE)(0.75 * 256), 255, 255, 255);
+    using Gdiplus::Color;
 
+    const Color CONTROLS_BACKGROUND_COLOR = Color(192, 35, 31, 32);
+    const Color TEXT_COLOR = Color(192, 255, 255, 255);
+    const Color PLAYED_COLOR = Color(192, 255, 255, 255);
+    const Color OPEN_COLOR = Color(192, 192, 192, 192);
+    const Color TO_BE_PLAYED_COLOR = Color(192, 128, 128, 128);
+
     const int UPDATE_DURATION = 1;
+
+    const CString TEXT_FONT = L"Arial";
+    const int TEXT_SIZE = 9;
+    const int TEXT_WIDTH = 80;
+
+    const int SLIDER_TOP = 9;
+    const int SLIDER_BOTTOM = 10;
 }
 
 DShowVideoPlayer::DShowVideoPlayer() :
@@ -56,10 +69,12 @@
 m_isMouseOver(false),
 m_audioVolume(FilterGraph::MIN_VOLUME),
 m_duration(0),
-m_position(0)
+m_currentPosition(0),
+m_openProgress(0)
 {
     m_stopPlaybackEvent = ::CreateEvent(0, FALSE, FALSE, 0);
     m_executeFunctionEvent = ::CreateEvent(0 , FALSE, FALSE, 0);
+    m_waitForFunction = ::CreateEvent(0, FALSE, FALSE, 0);
 
     m_d3d.Attach(Direct3DCreate9(D3D_SDK_VERSION));
 
@@ -76,6 +91,7 @@
 {
     ::CloseHandle(m_stopPlaybackEvent);
     ::CloseHandle(m_executeFunctionEvent);
+    ::CloseHandle(m_waitForFunction);
 
     delete m_pngPlay;
     delete m_pngPause;
@@ -485,10 +501,23 @@
 void DShowVideoPlayer::Thread_DurationPosition()
 {
     m_duration = m_filterGraph.GetDuration();
-    m_position = m_filterGraph.GetPosition();
+    m_currentPosition = m_filterGraph.GetPosition();
+    m_openProgress = m_filterGraph.GetOpenProgress();
 }
 
+void DShowVideoPlayer::Thread_SetPosition()
+{
+    m_filterGraph.SetPosition(m_setPosition);
+    long percent = static_cast<unsigned long>((m_setPosition / static_cast<double>(m_duration)) * 100.0);
 
+    LOG(logDEBUG2) << __FUNCTIONW__ << " Percent: " << percent << "%" << " Duration: " << m_duration << " Position: " << m_setPosition;
+
+    m_currentPosition = m_filterGraph.GetPosition();
+
+    ::SetEvent(m_waitForFunction);
+}
+
+
 void DShowVideoPlayer::Thread_ExecuteFunction()
 {
     if (m_executeFunctionOnThread)
@@ -520,11 +549,32 @@
 
 void DShowVideoPlayer::CreateControls(const CSize& videoSize)
 {
-    m_playButtonRect.SetRect(0, videoSize.cy - CONTROLS_HEIGHT, CONTROLS_HEIGHT, videoSize.cy);
-    m_muteButtonRect.SetRect(videoSize.cx - CONTROLS_HEIGHT, videoSize.cy - CONTROLS_HEIGHT,
+    m_playButtonRect.SetRect(0, videoSize.cy - CONTROLS_HEIGHT, CONTROLS_WIDTH, videoSize.cy);
+    m_muteButtonRect.SetRect(videoSize.cx - CONTROLS_WIDTH, videoSize.cy - CONTROLS_HEIGHT,
         videoSize.cx, videoSize.cy);
+
+    m_positionSliderRect.SetRect(CONTROLS_WIDTH, videoSize.cy - CONTROLS_HEIGHT,
+        videoSize.cx - CONTROLS_WIDTH - TEXT_WIDTH, videoSize.cy);
 }
 
+
+Gdiplus::Rect DShowVideoPlayer::GetControlsRect(const CRect& displayRect)
+{
+    return Gdiplus::Rect(0, displayRect.Height() - CONTROLS_HEIGHT, displayRect.Width(), CONTROLS_HEIGHT);
+}
+
+
+Gdiplus::Rect DShowVideoPlayer::GetPlayButtonRect(const CRect& displayRect)
+{
+    return Gdiplus::Rect(0, displayRect.Height() - CONTROLS_HEIGHT, CONTROLS_WIDTH, CONTROLS_HEIGHT);
+}
+
+Gdiplus::Rect DShowVideoPlayer::GetMuteButtonRect(const CRect& displayRect)
+{
+    return Gdiplus::Rect(displayRect.Width() - CONTROLS_WIDTH, displayRect.Height() - CONTROLS_HEIGHT, 
+        CONTROLS_WIDTH, CONTROLS_HEIGHT);
+}
+
 void DShowVideoPlayer::DrawControls(const CRect& rect, HDC dc)
 {
     if (!GetMouseOver())
@@ -538,83 +588,95 @@
 
     // Draw the background
     SolidBrush brush(CONTROLS_BACKGROUND_COLOR);
-    graphics.FillRectangle(&brush, 0, rect.Height() - CONTROLS_HEIGHT, rect.Width(), CONTROLS_HEIGHT);
+    graphics.FillRectangle(&brush, GetControlsRect(rect));
 
     // Draw the play/pause button
     if (GetState() == DShowVideoPlayer::Paused ||
         GetState() == DShowVideoPlayer::Stopped)
     {
-        graphics.DrawImage(m_pngPlay, 0, rect.Height() - CONTROLS_HEIGHT, CONTROLS_HEIGHT, CONTROLS_HEIGHT);
+        graphics.DrawImage(m_pngPlay, GetPlayButtonRect(rect));
     }
     else if (GetState() == DShowVideoPlayer::Playing)
     {
-        graphics.DrawImage(m_pngPause, 0, rect.Height() - CONTROLS_HEIGHT, CONTROLS_HEIGHT, CONTROLS_HEIGHT);
+        graphics.DrawImage(m_pngPause, GetPlayButtonRect(rect));
     }
 
     // Draw the mute/unmute button
     if (GetAudioState() == DShowVideoPlayer::UnMuted)
     {
-        graphics.DrawImage(m_pngMute, rect.Width() - CONTROLS_HEIGHT, rect.Height() - CONTROLS_HEIGHT, 
-            CONTROLS_HEIGHT, CONTROLS_HEIGHT);
+        graphics.DrawImage(m_pngMute, GetMuteButtonRect(rect));
     }
     else
     {
-        graphics.DrawImage(m_pngUnmute, rect.Width() - CONTROLS_HEIGHT, rect.Height() - CONTROLS_HEIGHT, 
-            CONTROLS_HEIGHT, CONTROLS_HEIGHT);
+        graphics.DrawImage(m_pngUnmute, GetMuteButtonRect(rect));
     }
 
     // Draw the duration
     CString durationText;
 
-    if ((m_position / 1000) / 3600 == 0)
+    if ((m_currentPosition / 1000) / 3600 == 0)
     {
         durationText.Format(L"%d:%.2d / %d:%.2d", 
-            (m_position / 1000) / 60, (m_position / 1000) % 60,
+            (m_currentPosition / 1000) / 60, (m_currentPosition / 1000) % 60,
             (m_duration / 1000) / 60, (m_duration / 1000) % 60);
     }
     else
     {
         durationText.Format(L"%d%.2d:%.2d / %d:%.2d:%.2d", 
-            (m_position / 1000) / 3600, ((m_position / 1000) % 3600) / 60, ((m_position / 1000) % 3600) % 60,
+            (m_currentPosition / 1000) / 3600, ((m_currentPosition / 1000) % 3600) / 60, ((m_currentPosition / 1000) % 3600) % 60,
             (m_duration / 1000) / 3600, ((m_duration / 1000) % 3600) / 60, ((m_duration / 1000) % 3600) % 60);
     }
 
-    Font durationFont(L"Arial", 9);
+    Font durationFont(TEXT_FONT, TEXT_SIZE);
     SolidBrush durationBrush(TEXT_COLOR);
 
-    RectF durationRect(rect.Width() - CONTROLS_HEIGHT - 65, rect.Height() - CONTROLS_HEIGHT, 
-        65, CONTROLS_HEIGHT);
+    RectF durationRect(rect.Width() - CONTROLS_HEIGHT - TEXT_WIDTH, rect.Height() - CONTROLS_HEIGHT, 
+        TEXT_WIDTH, CONTROLS_HEIGHT);
 
-    const StringFormat* durationStringFormat = StringFormat::GenericDefault();
-
+    StringFormat* durationStringFormat = StringFormat::GenericDefault()->Clone();
+    durationStringFormat->SetAlignment(StringAlignmentFar);
+ 
     RectF measuredBox;
     graphics.MeasureString(durationText, -1, &durationFont, durationRect, &measuredBox);
 
-    durationRect.X = rect.Width() - CONTROLS_HEIGHT - measuredBox.Width;
+    durationRect.X = rect.Width() - CONTROLS_WIDTH - TEXT_WIDTH;
     durationRect.Y = rect.Height() - CONTROLS_HEIGHT + (CONTROLS_HEIGHT - measuredBox.Height) / 2;
-    durationRect.Width  = measuredBox.Width;
+    durationRect.Width  = TEXT_WIDTH;
     durationRect.Height = measuredBox.Height;
 
     graphics.DrawString(durationText, -1, &durationFont, durationRect, durationStringFormat, &durationBrush);
+    delete durationStringFormat;
 
     // Draw the position
     long positionSliderWidth = rect.Width() - CONTROLS_HEIGHT - CONTROLS_HEIGHT - durationRect.Width - 
-                                m_pngPositionThumb->GetWidth() - 10;
+                                m_pngPositionThumb->GetWidth();
 
     long positionThumb = CONTROLS_HEIGHT;
     if (m_duration)
     {
-        positionThumb += (long)(((float)m_position / m_duration) * positionSliderWidth);
+        positionThumb += (long)(((float)m_currentPosition / m_duration) * positionSliderWidth);
     }
 
-    SolidBrush colorPlayed(Color(192, 255, 255, 255));
-    graphics.FillRectangle(&colorPlayed, CONTROLS_HEIGHT, rect.Height() - CONTROLS_HEIGHT + 9, 
-        positionThumb - CONTROLS_HEIGHT, 10);
+    // Draw the rectangle until the position thumb
+    SolidBrush playedBrush(PLAYED_COLOR);
+    Gdiplus::GraphicsPath path;
 
-    SolidBrush colorToBePlayed(Color(128, 255, 255, 255));
-    graphics.FillRectangle(&colorToBePlayed, positionThumb, rect.Height() - CONTROLS_HEIGHT + 9, 
-        positionSliderWidth - positionThumb + CONTROLS_HEIGHT + m_pngPositionThumb->GetWidth() , 10);
+    graphics.FillRectangle(&playedBrush, CONTROLS_HEIGHT, rect.Height() - CONTROLS_HEIGHT + SLIDER_TOP, 
+        positionThumb - CONTROLS_HEIGHT, SLIDER_BOTTOM);
 
+    // Draw the rectangle until the end of movie
+    SolidBrush toBePlayedBrush(TO_BE_PLAYED_COLOR);
+
+    graphics.FillRectangle(&toBePlayedBrush, positionThumb, rect.Height() - CONTROLS_HEIGHT + SLIDER_TOP, 
+        positionSliderWidth - positionThumb + CONTROLS_HEIGHT + m_pngPositionThumb->GetWidth(), SLIDER_BOTTOM);
+
+    // Draw the rectangle until the end of loaded movie
+    SolidBrush loadedBrush(OPEN_COLOR);
+    long openPosition = positionSliderWidth * m_openProgress / 100;
+
+    graphics.FillRectangle(&loadedBrush, positionThumb, rect.Height() - CONTROLS_HEIGHT + SLIDER_TOP, 
+         openPosition - positionThumb + CONTROLS_HEIGHT + m_pngPositionThumb->GetWidth(), SLIDER_BOTTOM);
+
     graphics.DrawImage(m_pngPositionThumb, positionThumb, 
         rect.Height() - CONTROLS_HEIGHT + (CONTROLS_HEIGHT - m_pngPositionThumb->GetHeight()) / 2,
         m_pngPositionThumb->GetWidth(), m_pngPositionThumb->GetHeight());
@@ -622,7 +684,19 @@
 
 void DShowVideoPlayer::OnMouseButtonDown(long x, long y)
 {
+    if (m_positionSliderRect.PtInRect(CPoint(x, y)))
+    {
+        m_setPosition = static_cast<unsigned long>(((x - m_positionSliderRect.left) / static_cast<double>(m_positionSliderRect.Width())) * m_duration);
 
+        m_executeFunctionOnThread = &DShowVideoPlayer::Thread_SetPosition;
+        ::SetEvent(m_executeFunctionEvent);
+
+        AtlWaitWithMessageLoop(m_waitForFunction);
+        if (m_playerCallback)
+        {
+            m_playerCallback->Refresh();
+        }
+    }
 }
 
 void DShowVideoPlayer::OnMouseButtonUp(long x, long y)
@@ -715,6 +789,11 @@
     {
         m_executeFunctionOnThread = &DShowVideoPlayer::Thread_DurationPosition;
         ::SetEvent(m_executeFunctionEvent);
+
+        if (m_state == Paused && m_openProgress != 100 && m_playerCallback)
+        {
+            m_playerCallback->Refresh();
+        }
     }
 
     return 0;

Modified: trunk/oggdsf/src/lib/plugin/AxPlayer/DShowVideoPlayer.h
===================================================================
--- trunk/oggdsf/src/lib/plugin/AxPlayer/DShowVideoPlayer.h	2010-10-03 14:49:42 UTC (rev 17479)
+++ trunk/oggdsf/src/lib/plugin/AxPlayer/DShowVideoPlayer.h	2010-10-03 22:48:49 UTC (rev 17480)
@@ -118,6 +118,7 @@
     void Thread_Stop();
     void Thread_Mute();
     void Thread_DurationPosition();
+    void Thread_SetPosition();
 
     void Thread_ExecuteFunction();
     
@@ -133,6 +134,10 @@
 
     Gdiplus::Image* LoadImage(UINT resourceId);
 
+    Gdiplus::Rect GetControlsRect(const CRect& displayRect);
+    Gdiplus::Rect GetPlayButtonRect(const CRect& displayRect);
+    Gdiplus::Rect GetMuteButtonRect(const CRect& displayRect);
+
 private:
     FilterGraph m_filterGraph;
 
@@ -151,6 +156,7 @@
     HANDLE m_playbackThreadHandle;
     HANDLE m_stopPlaybackEvent;
     HANDLE m_executeFunctionEvent;
+    HANDLE m_waitForFunction;
 
     Gdiplus::GdiplusStartupInput m_gdiplusStartupInput;
     ULONG_PTR m_gdiplusToken;
@@ -173,11 +179,14 @@
     bool m_isMouseOver;
     CRect m_playButtonRect;
     CRect m_muteButtonRect;
+    CRect m_positionSliderRect;
 
     long m_audioVolume;
 
     unsigned long m_duration;
-    unsigned long m_position;
+    unsigned long m_currentPosition;
+    unsigned long m_openProgress;
+    unsigned long m_setPosition;
 
     D3DTEXTUREFILTERTYPE m_textureFilterType;
 };

Modified: trunk/oggdsf/src/lib/plugin/AxPlayer/FilterGraph.cpp
===================================================================
--- trunk/oggdsf/src/lib/plugin/AxPlayer/FilterGraph.cpp	2010-10-03 14:49:42 UTC (rev 17479)
+++ trunk/oggdsf/src/lib/plugin/AxPlayer/FilterGraph.cpp	2010-10-03 22:48:49 UTC (rev 17480)
@@ -123,6 +123,8 @@
     // Add the source filter
     m_sourceFilter = DShowUtil::AddFilterFromCLSID(m_graphBuilder, sourceCLSID, L"Source Filter");
 
+    CHECK_HR(m_sourceFilter.QueryInterface(&m_openProgress));
+
     CComQIPtr<IFileSourceFilter> fileSource = m_sourceFilter;
     CHECK_HR(fileSource->Load(m_videoUrl, 0));
 
@@ -480,5 +482,50 @@
         LOG(logERROR) << __FUNCTIONW__ << " Error code: " << std::hex << except.m_hr;
     }
 
+    LOG(logDEBUG2) << __FUNCTIONW__ << " result: " << position;
+
     return position;
 }
+
+
+void FilterGraph::SetPosition(unsigned long position)
+{
+    try
+    {
+        REFERENCE_TIME rtPosition = position;
+        rtPosition *= 10000;
+
+        CHECK_HR(m_mediaSeeking->SetPositions(&rtPosition, AM_SEEKING_AbsolutePositioning, 0, AM_SEEKING_NoPositioning));
+    }
+    catch (const CAtlException& except)
+    {
+        LOG(logERROR) << __FUNCTIONW__ << " Error code: " << std::hex << except.m_hr;
+    }
+}
+
+unsigned long FilterGraph::GetOpenProgress() const
+{
+    unsigned long percentage = 0;
+    try
+    {
+        REFERENCE_TIME total = 0;
+        REFERENCE_TIME current = 0;
+        CHECK_HR(m_openProgress->QueryProgress(&total, &current));
+
+        // This should not happen
+        ATLASSERT(total != 0);
+        if (total == 0)
+        {
+            total = 1;
+        }
+        percentage = static_cast<long>((current / static_cast<double>(total)) * 100);
+    }
+    catch (const CAtlException& except)
+    {
+        LOG(logERROR) << __FUNCTIONW__ << " Error code: " << std::hex << except.m_hr;
+    }
+
+    LOG(logDEBUG2) << __FUNCTIONW__ << " result: " << percentage << "%";
+
+    return percentage;
+}

Modified: trunk/oggdsf/src/lib/plugin/AxPlayer/FilterGraph.h
===================================================================
--- trunk/oggdsf/src/lib/plugin/AxPlayer/FilterGraph.h	2010-10-03 14:49:42 UTC (rev 17479)
+++ trunk/oggdsf/src/lib/plugin/AxPlayer/FilterGraph.h	2010-10-03 22:48:49 UTC (rev 17480)
@@ -73,7 +73,10 @@
 
     unsigned long GetDuration() const;
     unsigned long GetPosition() const;
+    void SetPosition(unsigned long position);
 
+    unsigned long GetOpenProgress() const;
+
     static const long MIN_VOLUME = -10000;
 
 private:
@@ -97,6 +100,7 @@
     CComPtr<IBaseFilter> m_audioRenderer;
     CComPtr<IBaseFilter> m_videoRenderer;
     CComPtr<IBasicAudio> m_basicAudio;
+    CComPtr<IAMOpenProgress> m_openProgress;
 
     CComPtr<IVMRSurfaceAllocatorNotify9> m_surfaceNotify;
     CComObject<CustomVMR9Allocator>* m_customVmrAllocator;



More information about the commits mailing list