Commit 66c2e3e9 authored by Damien Fouilleul's avatar Damien Fouilleul

- added 'vlc.video.crop' property for ActiveX/Mozilla

parent 3ef34845
......@@ -422,8 +422,16 @@ library AXVLC
[propput, helpstring("Sets video aspect ratio.")]
HRESULT aspectRatio([in] BSTR aspect);
[propget, helpstring("Returns crop filter geometry.")]
HRESULT crop([out, retval] BSTR* geometry);
[propput, helpstring("Sets crop filter geometry.")]
HRESULT crop([in] BSTR geometry);
[helpstring("toggle fullscreen/windowed state.")]
HRESULT toggleFullscreen();
[helpstring("take video snapshot and save into into filePath.")]
HRESULT takeSnapshot(BSTR filePath);
};
[
......
No preview for this file type
/*** Autogenerated by WIDL 0.9.28 from axvlc.idl - Do not edit ***/
/*** Autogenerated by WIDL 0.9.27 from axvlc.idl - Do not edit ***/
#include <rpc.h>
#include <rpcndr.h>
......
/*** Autogenerated by WIDL 0.9.28 from axvlc.idl - Do not edit ***/
/*** Autogenerated by WIDL 0.9.27 from axvlc.idl - Do not edit ***/
#include <rpc.h>
#include <rpcndr.h>
......@@ -2253,9 +2253,18 @@ interface IVLCVideo : public IDispatch
virtual HRESULT STDMETHODCALLTYPE put_aspectRatio(
BSTR aspect) = 0;
virtual HRESULT STDMETHODCALLTYPE get_crop(
BSTR* geometry) = 0;
virtual HRESULT STDMETHODCALLTYPE put_crop(
BSTR geometry) = 0;
virtual HRESULT STDMETHODCALLTYPE toggleFullscreen(
) = 0;
virtual HRESULT STDMETHODCALLTYPE takeSnapshot(
BSTR filePath) = 0;
};
#else
typedef struct IVLCVideoVtbl {
......@@ -2328,9 +2337,21 @@ typedef struct IVLCVideoVtbl {
IVLCVideo* This,
BSTR aspect);
HRESULT (STDMETHODCALLTYPE *get_crop)(
IVLCVideo* This,
BSTR* geometry);
HRESULT (STDMETHODCALLTYPE *put_crop)(
IVLCVideo* This,
BSTR geometry);
HRESULT (STDMETHODCALLTYPE *toggleFullscreen)(
IVLCVideo* This);
HRESULT (STDMETHODCALLTYPE *takeSnapshot)(
IVLCVideo* This,
BSTR filePath);
END_INTERFACE
} IVLCVideoVtbl;
interface IVLCVideo {
......@@ -2354,7 +2375,10 @@ interface IVLCVideo {
#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_get_crop(p,a) (p)->lpVtbl->get_crop(p,a)
#define IVLCVideo_put_crop(p,a) (p)->lpVtbl->put_crop(p,a)
#define IVLCVideo_toggleFullscreen(p) (p)->lpVtbl->toggleFullscreen(p)
#define IVLCVideo_takeSnapshot(p,a) (p)->lpVtbl->takeSnapshot(p,a)
#endif
#endif
......@@ -2407,6 +2431,22 @@ void __RPC_STUB IVLCVideo_put_aspectRatio_Stub(
IRpcChannelBuffer* pRpcChannelBuffer,
PRPC_MESSAGE pRpcMessage,
DWORD* pdwStubPhase);
HRESULT CALLBACK IVLCVideo_get_crop_Proxy(
IVLCVideo* This,
BSTR* geometry);
void __RPC_STUB IVLCVideo_get_crop_Stub(
IRpcStubBuffer* This,
IRpcChannelBuffer* pRpcChannelBuffer,
PRPC_MESSAGE pRpcMessage,
DWORD* pdwStubPhase);
HRESULT CALLBACK IVLCVideo_put_crop_Proxy(
IVLCVideo* This,
BSTR geometry);
void __RPC_STUB IVLCVideo_put_crop_Stub(
IRpcStubBuffer* This,
IRpcChannelBuffer* pRpcChannelBuffer,
PRPC_MESSAGE pRpcMessage,
DWORD* pdwStubPhase);
HRESULT CALLBACK IVLCVideo_toggleFullscreen_Proxy(
IVLCVideo* This);
void __RPC_STUB IVLCVideo_toggleFullscreen_Stub(
......@@ -2414,6 +2454,14 @@ void __RPC_STUB IVLCVideo_toggleFullscreen_Stub(
IRpcChannelBuffer* pRpcChannelBuffer,
PRPC_MESSAGE pRpcMessage,
DWORD* pdwStubPhase);
HRESULT CALLBACK IVLCVideo_takeSnapshot_Proxy(
IVLCVideo* This,
BSTR filePath);
void __RPC_STUB IVLCVideo_takeSnapshot_Stub(
IRpcStubBuffer* This,
IRpcChannelBuffer* pRpcChannelBuffer,
PRPC_MESSAGE pRpcMessage,
DWORD* pdwStubPhase);
#endif /* __IVLCVideo_INTERFACE_DEFINED__ */
......
......@@ -2098,14 +2098,13 @@ STDMETHODIMP VLCVideo::put_aspectRatio(BSTR aspect)
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);
char *psz_aspect = CStrFromBSTR(CP_UTF8, aspect);
if( NULL == psz_aspect )
{
return E_OUTOFMEMORY;
......@@ -2128,6 +2127,124 @@ STDMETHODIMP VLCVideo::put_aspectRatio(BSTR aspect)
return hr;
};
STDMETHODIMP VLCVideo::get_crop(BSTR* geometry)
{
if( NULL == geometry )
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_geometry = libvlc_video_get_crop_geometry(p_input, &ex);
libvlc_input_free(p_input);
if( ! libvlc_exception_raised(&ex) )
{
if( NULL == psz_geometry )
return E_OUTOFMEMORY;
*geometry = BSTRFromCStr(CP_UTF8, psz_geometry);
free( psz_geometry );
psz_geometry = NULL;
return (NULL == geometry) ? E_OUTOFMEMORY : NOERROR;
}
if( psz_geometry ) free( psz_geometry );
psz_geometry = NULL;
}
_p_instance->setErrorInfo(IID_IVLCVideo, libvlc_exception_get_message(&ex));
libvlc_exception_clear(&ex);
return E_FAIL;
}
return hr;
};
STDMETHODIMP VLCVideo::put_crop(BSTR geometry)
{
if( NULL == geometry )
return E_POINTER;
if( 0 == SysStringLen(geometry) )
return E_INVALIDARG;
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_geometry = CStrFromBSTR(CP_UTF8, geometry);
if( NULL == psz_geometry )
{
return E_OUTOFMEMORY;
}
libvlc_video_set_crop_geometry(p_input, psz_geometry, &ex);
CoTaskMemFree(psz_geometry);
libvlc_input_free(p_input);
if( libvlc_exception_raised(&ex) )
{
_p_instance->setErrorInfo(IID_IVLCVideo,
libvlc_exception_get_message(&ex));
libvlc_exception_clear(&ex);
return E_FAIL;
}
}
return NOERROR;
}
return hr;
};
STDMETHODIMP VLCVideo::takeSnapshot(BSTR filePath)
{
if( NULL == filePath )
return E_POINTER;
if( 0 == SysStringLen(filePath) )
return E_INVALIDARG;
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_filepath = CStrFromBSTR(CP_UTF8, filePath);
if( NULL == psz_filepath )
{
return E_OUTOFMEMORY;
}
/* TODO: check file security */
libvlc_video_take_snapshot(p_input, psz_filepath, &ex);
libvlc_input_free(p_input);
if( ! libvlc_exception_raised(&ex) )
{
return NOERROR;
}
}
_p_instance->setErrorInfo(IID_IVLCVideo, libvlc_exception_get_message(&ex));
libvlc_exception_clear(&ex);
return E_FAIL;
}
return hr;
};
STDMETHODIMP VLCVideo::toggleFullscreen()
{
libvlc_instance_t* p_libvlc;
......
......@@ -522,6 +522,9 @@ public:
STDMETHODIMP get_height(long*);
STDMETHODIMP get_aspectRatio(BSTR*);
STDMETHODIMP put_aspectRatio(BSTR);
STDMETHODIMP get_crop(BSTR*);
STDMETHODIMP put_crop(BSTR);
STDMETHODIMP takeSnapshot(BSTR);
STDMETHODIMP toggleFullscreen();
protected:
......
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