[vlc-commits] ActiveX: switch VLCInput to vlc_player

Sergey Radionov git at videolan.org
Wed Jun 6 22:37:21 CEST 2012


npapi-vlc | branch: master | Sergey Radionov <RSATom at gmail.com> | Mon Mar 19 10:18:22 2012 +0700| [10ed5bf64d25b99ccc5415fcbd207033f6f9e73a] | committer: Jean-Baptiste Kempf

ActiveX: switch VLCInput to vlc_player

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

> http://git.videolan.org/gitweb.cgi/npapi-vlc.git/?a=commit;h=10ed5bf64d25b99ccc5415fcbd207033f6f9e73a
---

 activex/vlccontrol2.cpp |  103 ++++++++++++++---------------------------------
 1 file changed, 30 insertions(+), 73 deletions(-)

diff --git a/activex/vlccontrol2.cpp b/activex/vlccontrol2.cpp
index a7d5db6..2cede90 100644
--- a/activex/vlccontrol2.cpp
+++ b/activex/vlccontrol2.cpp
@@ -253,15 +253,10 @@ STDMETHODIMP VLCInput::get_length(double* length)
 {
     if( NULL == length )
         return E_POINTER;
-    *length = 0;
 
-    libvlc_media_player_t *p_md;
-    HRESULT hr = getMD(&p_md);
-    if( SUCCEEDED(hr) )
-    {
-        *length = (double)libvlc_media_player_get_length(p_md);
-    }
-    return hr;
+    *length = static_cast<double>(Instance()->get_player().get_length());
+
+    return S_OK;
 };
 
 STDMETHODIMP VLCInput::get_position(double* position)
@@ -269,25 +264,16 @@ STDMETHODIMP VLCInput::get_position(double* position)
     if( NULL == position )
         return E_POINTER;
 
-    *position = 0.0f;
-    libvlc_media_player_t *p_md;
-    HRESULT hr = getMD(&p_md);
-    if( SUCCEEDED(hr) )
-    {
-        *position = libvlc_media_player_get_position(p_md);
-    }
-    return hr;
+    *position = Instance()->get_player().get_position();
+
+    return S_OK;
 };
 
 STDMETHODIMP VLCInput::put_position(double position)
 {
-    libvlc_media_player_t *p_md;
-    HRESULT hr = getMD(&p_md);
-    if( SUCCEEDED(hr) )
-    {
-        libvlc_media_player_set_position(p_md, position);
-    }
-    return hr;
+    Instance()->get_player().set_position( static_cast<float>(position) );
+
+    return S_OK;
 };
 
 STDMETHODIMP VLCInput::get_time(double* time)
@@ -295,24 +281,16 @@ STDMETHODIMP VLCInput::get_time(double* time)
     if( NULL == time )
         return E_POINTER;
 
-    libvlc_media_player_t *p_md;
-    HRESULT hr = getMD(&p_md);
-    if( SUCCEEDED(hr) )
-    {
-        *time = (double)libvlc_media_player_get_time(p_md);
-    }
-    return hr;
+    *time = static_cast<double>(Instance()->get_player().get_time());
+
+    return S_OK;
 };
 
 STDMETHODIMP VLCInput::put_time(double time)
 {
-    libvlc_media_player_t *p_md;
-    HRESULT hr = getMD(&p_md);
-    if( SUCCEEDED(hr) )
-    {
-        libvlc_media_player_set_time(p_md, (int64_t)time);
-    }
-    return hr;
+    Instance()->get_player().set_time(static_cast<libvlc_time_t>(time));
+
+    return S_OK;
 };
 
 STDMETHODIMP VLCInput::get_state(long* state)
@@ -320,13 +298,9 @@ STDMETHODIMP VLCInput::get_state(long* state)
     if( NULL == state )
         return E_POINTER;
 
-    libvlc_media_player_t *p_md;
-    HRESULT hr = getMD(&p_md);
-    if( SUCCEEDED(hr) )
-    {
-        *state = libvlc_media_player_get_state(p_md);
-    }
-    return hr;
+    *state = Instance()->get_player().get_state();
+
+    return S_OK;
 };
 
 STDMETHODIMP VLCInput::get_rate(double* rate)
@@ -334,24 +308,16 @@ STDMETHODIMP VLCInput::get_rate(double* rate)
     if( NULL == rate )
         return E_POINTER;
 
-    libvlc_media_player_t *p_md;
-    HRESULT hr = getMD(&p_md);
-    if( SUCCEEDED(hr) )
-    {
-        *rate = libvlc_media_player_get_rate(p_md);
-    }
-    return hr;
+    *rate = Instance()->get_player().get_rate();
+
+    return S_OK;
 };
 
 STDMETHODIMP VLCInput::put_rate(double rate)
 {
-    libvlc_media_player_t *p_md;
-    HRESULT hr = getMD(&p_md);
-    if( SUCCEEDED(hr) )
-    {
-        libvlc_media_player_set_rate(p_md, rate);
-    }
-    return hr;
+    Instance()->get_player().set_rate(static_cast<float>(rate));
+
+    return S_OK;
 };
 
 STDMETHODIMP VLCInput::get_fps(double* fps)
@@ -359,14 +325,9 @@ STDMETHODIMP VLCInput::get_fps(double* fps)
     if( NULL == fps )
         return E_POINTER;
 
-    *fps = 0.0;
-    libvlc_media_player_t *p_md;
-    HRESULT hr = getMD(&p_md);
-    if( SUCCEEDED(hr) )
-    {
-        *fps = libvlc_media_player_get_fps(p_md);
-    }
-    return hr;
+    *fps = static_cast<double>(Instance()->get_player().get_fps());
+
+    return S_OK;
 };
 
 STDMETHODIMP VLCInput::get_hasVout(VARIANT_BOOL* hasVout)
@@ -374,13 +335,9 @@ STDMETHODIMP VLCInput::get_hasVout(VARIANT_BOOL* hasVout)
     if( NULL == hasVout )
         return E_POINTER;
 
-    libvlc_media_player_t *p_md;
-    HRESULT hr = getMD(&p_md);
-    if( SUCCEEDED(hr) )
-    {
-        *hasVout = varbool( libvlc_media_player_has_vout(p_md) );
-    }
-    return hr;
+    *hasVout = varbool( Instance()->get_player().has_vout() );
+
+    return S_OK;
 };
 
 /****************************************************************************/



More information about the vlc-commits mailing list