Commit 9db3ec01 authored by Jean-Paul Saman's avatar Jean-Paul Saman

Aspect ratio property for ActiveX plugin

parent a6651a4a
...@@ -306,6 +306,11 @@ library AXVLC ...@@ -306,6 +306,11 @@ library AXVLC
[propget, helpstring("Returns video original height.")] [propget, helpstring("Returns video original height.")]
HRESULT height([out, retval] int* height); HRESULT height([out, retval] int* height);
[propget, helpstring("Returns video aspect ratio.")]
HRESULT aspectRatio([out, retval] BSTR *aspect);
[propput, helpstring("Sets video aspect ratio.")]
HRESULT aspectRatio([in] BSTR aspect);
[helpstring("toggle fullscreen/windowed state.")] [helpstring("toggle fullscreen/windowed state.")]
HRESULT toggleFullscreen(); HRESULT toggleFullscreen();
}; };
......
No preview for this file type
...@@ -1448,6 +1448,12 @@ interface IVLCVideo : public IDispatch ...@@ -1448,6 +1448,12 @@ interface IVLCVideo : public IDispatch
virtual HRESULT STDMETHODCALLTYPE get_height( virtual HRESULT STDMETHODCALLTYPE get_height(
int* height) = 0; int* height) = 0;
virtual HRESULT STDMETHODCALLTYPE get_aspectRatio(
BSTR* aspect) = 0;
virtual HRESULT STDMETHODCALLTYPE put_aspectRatio(
BSTR aspect) = 0;
virtual HRESULT STDMETHODCALLTYPE toggleFullscreen( virtual HRESULT STDMETHODCALLTYPE toggleFullscreen(
) = 0; ) = 0;
...@@ -1515,6 +1521,14 @@ typedef struct IVLCVideoVtbl { ...@@ -1515,6 +1521,14 @@ typedef struct IVLCVideoVtbl {
IVLCVideo* This, IVLCVideo* This,
int* height); int* height);
HRESULT (STDMETHODCALLTYPE *get_aspectRatio)(
IVLCVideo* This,
BSTR* aspect);
HRESULT (STDMETHODCALLTYPE *put_aspectRatio)(
IVLCVideo* This,
BSTR aspect);
HRESULT (STDMETHODCALLTYPE *toggleFullscreen)( HRESULT (STDMETHODCALLTYPE *toggleFullscreen)(
IVLCVideo* This); IVLCVideo* This);
...@@ -1539,6 +1553,8 @@ interface IVLCVideo { ...@@ -1539,6 +1553,8 @@ interface IVLCVideo {
#define IVLCVideo_put_fullscreen(p,a) (p)->lpVtbl->put_fullscreen(p,a) #define IVLCVideo_put_fullscreen(p,a) (p)->lpVtbl->put_fullscreen(p,a)
#define IVLCVideo_get_width(p,a) (p)->lpVtbl->get_width(p,a) #define IVLCVideo_get_width(p,a) (p)->lpVtbl->get_width(p,a)
#define IVLCVideo_get_height(p,a) (p)->lpVtbl->get_height(p,a) #define IVLCVideo_get_height(p,a) (p)->lpVtbl->get_height(p,a)
#define IVLCVideo_get_aspectRatio(p,a) (p)->lpVtbl->get_aspectRatio(p,a)
#define IVLCVideo_put_aspectRatio(p,a) (p)->lpVtbl->put_aspectRatio(p,a)
#define IVLCVideo_toggleFullscreen(p) (p)->lpVtbl->toggleFullscreen(p) #define IVLCVideo_toggleFullscreen(p) (p)->lpVtbl->toggleFullscreen(p)
#endif #endif
...@@ -1576,6 +1592,22 @@ void __RPC_STUB IVLCVideo_get_height_Stub( ...@@ -1576,6 +1592,22 @@ void __RPC_STUB IVLCVideo_get_height_Stub(
IRpcChannelBuffer* pRpcChannelBuffer, IRpcChannelBuffer* pRpcChannelBuffer,
PRPC_MESSAGE pRpcMessage, PRPC_MESSAGE pRpcMessage,
DWORD* pdwStubPhase); DWORD* pdwStubPhase);
HRESULT CALLBACK IVLCVideo_get_aspectRatio_Proxy(
IVLCVideo* This,
BSTR* aspect);
void __RPC_STUB IVLCVideo_get_aspectRatio_Stub(
IRpcStubBuffer* This,
IRpcChannelBuffer* pRpcChannelBuffer,
PRPC_MESSAGE pRpcMessage,
DWORD* pdwStubPhase);
HRESULT CALLBACK IVLCVideo_put_aspectRatio_Proxy(
IVLCVideo* This,
BSTR aspect);
void __RPC_STUB IVLCVideo_put_aspectRatio_Stub(
IRpcStubBuffer* This,
IRpcChannelBuffer* pRpcChannelBuffer,
PRPC_MESSAGE pRpcMessage,
DWORD* pdwStubPhase);
HRESULT CALLBACK IVLCVideo_toggleFullscreen_Proxy( HRESULT CALLBACK IVLCVideo_toggleFullscreen_Proxy(
IVLCVideo* This); IVLCVideo* This);
void __RPC_STUB IVLCVideo_toggleFullscreen_Stub( void __RPC_STUB IVLCVideo_toggleFullscreen_Stub(
......
...@@ -1135,6 +1135,88 @@ STDMETHODIMP VLCVideo::get_height(int* height) ...@@ -1135,6 +1135,88 @@ STDMETHODIMP VLCVideo::get_height(int* height)
return hr; return hr;
}; };
STDMETHODIMP VLCVideo::get_aspectRatio(BSTR *aspect)
{
if( NULL == *aspect )
return E_POINTER;
libvlc_instance_t* p_libvlc;
HRESULT hr = _p_instance->getVLC(&p_libvlc);
if( SUCCEEDED(hr) )
{
libvlc_exception_t ex;
libvlc_exception_init(&ex);
libvlc_input_t *p_input = libvlc_playlist_get_input(p_libvlc, &ex);
if( ! libvlc_exception_raised(&ex) )
{
char *psz_aspect = libvlc_video_get_aspect_ratio(p_input, &ex);
if( !psz_aspect )
return E_OUTOFMEMORY;
if( ! libvlc_exception_raised(&ex) )
{
*aspect = SysAllocStringByteLen(psz_aspect, strlen(psz_aspect));
free( psz_aspect );
psz_aspect = NULL;
libvlc_input_free(p_input);
if( ! libvlc_exception_raised(&ex) )
{
return NOERROR;
}
}
if( psz_aspect ) free( psz_aspect );
}
_p_instance->setErrorInfo(IID_IVLCVideo, libvlc_exception_get_message(&ex));
libvlc_exception_clear(&ex);
return E_FAIL;
}
return hr;
};
STDMETHODIMP VLCVideo::put_aspectRatio(BSTR aspect)
{
if( NULL == aspect )
return E_POINTER;
if( 0 == SysStringLen(aspect) )
return E_INVALIDARG;
libvlc_instance_t* p_libvlc;
HRESULT hr = _p_instance->getVLC(&p_libvlc);
if( SUCCEEDED(hr) )
{
char *psz_aspect = NULL;
libvlc_exception_t ex;
libvlc_exception_init(&ex);
libvlc_input_t *p_input = libvlc_playlist_get_input(p_libvlc, &ex);
if( ! libvlc_exception_raised(&ex) )
{
psz_aspect = CStrFromBSTR(CP_UTF8, aspect);
if( NULL == psz_aspect )
{
return E_OUTOFMEMORY;
}
libvlc_video_set_aspect_ratio(p_input, psz_aspect, &ex);
CoTaskMemFree(psz_aspect);
libvlc_input_free(p_input);
if( libvlc_exception_raised(&ex) )
{
_p_instance->setErrorInfo(IID_IVLCPlaylist,
libvlc_exception_get_message(&ex));
libvlc_exception_clear(&ex);
return E_FAIL;
}
}
return NOERROR;
}
return hr;
};
STDMETHODIMP VLCVideo::toggleFullscreen() STDMETHODIMP VLCVideo::toggleFullscreen()
{ {
libvlc_instance_t* p_libvlc; libvlc_instance_t* p_libvlc;
......
...@@ -119,7 +119,7 @@ public: ...@@ -119,7 +119,7 @@ public:
STDMETHODIMP put_rate(float); STDMETHODIMP put_rate(float);
STDMETHODIMP get_fps(float*); STDMETHODIMP get_fps(float*);
STDMETHODIMP get_hasVout(VARIANT_BOOL*); STDMETHODIMP get_hasVout(VARIANT_BOOL*);
protected: protected:
HRESULT loadTypeInfo(); HRESULT loadTypeInfo();
...@@ -222,8 +222,10 @@ public: ...@@ -222,8 +222,10 @@ public:
STDMETHODIMP put_fullscreen(VARIANT_BOOL); STDMETHODIMP put_fullscreen(VARIANT_BOOL);
STDMETHODIMP get_width(int*); STDMETHODIMP get_width(int*);
STDMETHODIMP get_height(int*); STDMETHODIMP get_height(int*);
STDMETHODIMP get_aspectRatio(BSTR*);
STDMETHODIMP put_aspectRatio(BSTR);
STDMETHODIMP toggleFullscreen(); STDMETHODIMP toggleFullscreen();
protected: protected:
HRESULT loadTypeInfo(); HRESULT loadTypeInfo();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment