[propput, helpstring("Sets video aspect ratio.")]\r
HRESULT aspectRatio([in] BSTR aspect);\r
\r
+ [propget, helpstring("Returns crop filter geometry.")]\r
+ HRESULT crop([out, retval] BSTR* geometry);\r
+ [propput, helpstring("Sets crop filter geometry.")]\r
+ HRESULT crop([in] BSTR geometry);\r
+\r
[helpstring("toggle fullscreen/windowed state.")]\r
HRESULT toggleFullscreen();\r
+\r
+ [helpstring("take video snapshot and save into into filePath.")]\r
+ HRESULT takeSnapshot(BSTR filePath);\r
};\r
\r
[\r
-/*** 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>
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 {
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 {
#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
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(
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__ */
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;
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;
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:
"fullscreen",\r
"height",\r
"width",\r
- "aspectRatio"\r
+ "aspectRatio",\r
+ "crop"\r
};\r
\r
enum LibvlcVideoNPObjectPropertyIds\r
ID_video_fullscreen,\r
ID_video_height,\r
ID_video_width,\r
- ID_video_aspectratio\r
+ ID_video_aspectratio,\r
+ ID_video_crop\r
};\r
\r
const int LibvlcVideoNPObject::propertyCount = sizeof(LibvlcVideoNPObject::propertyNames)/sizeof(NPUTF8 *);\r
STRINGZ_TO_NPVARIANT(psz_aspect, result);\r
return INVOKERESULT_NO_ERROR;\r
}\r
+ case ID_video_crop:\r
+ {\r
+ NPUTF8 *psz_geometry = libvlc_video_get_crop_geometry(p_input, &ex);\r
+ libvlc_input_free(p_input);\r
+ if( libvlc_exception_raised(&ex) )\r
+ {\r
+ NPN_SetException(this, libvlc_exception_get_message(&ex));\r
+ libvlc_exception_clear(&ex);\r
+ return INVOKERESULT_GENERIC_ERROR;\r
+ }\r
+ if( !psz_geometry )\r
+ return INVOKERESULT_GENERIC_ERROR;\r
+\r
+ STRINGZ_TO_NPVARIANT(psz_geometry, result);\r
+ return INVOKERESULT_NO_ERROR;\r
+ }\r
}\r
libvlc_input_free(p_input);\r
}\r
int val = NPVARIANT_TO_BOOLEAN(value);\r
libvlc_set_fullscreen(p_input, val, &ex);\r
libvlc_input_free(p_input);\r
+\r
if( libvlc_exception_raised(&ex) )\r
{\r
NPN_SetException(this, libvlc_exception_get_message(&ex));\r
}\r
\r
libvlc_video_set_aspect_ratio(p_input, psz_aspect, &ex);\r
- if( psz_aspect )\r
- free(psz_aspect );\r
+ free(psz_aspect );\r
+ libvlc_input_free(p_input);\r
+\r
+ if( libvlc_exception_raised(&ex) )\r
+ {\r
+ NPN_SetException(this, libvlc_exception_get_message(&ex));\r
+ libvlc_exception_clear(&ex);\r
+ return INVOKERESULT_GENERIC_ERROR;\r
+ }\r
+ return INVOKERESULT_NO_ERROR;\r
+ }\r
+ case ID_video_crop:\r
+ {\r
+ char *psz_geometry = NULL;\r
+\r
+ if( ! NPVARIANT_IS_STRING(value) )\r
+ {\r
+ libvlc_input_free(p_input);\r
+ return INVOKERESULT_INVALID_VALUE;\r
+ }\r
\r
+ psz_geometry = stringValue(NPVARIANT_TO_STRING(value));\r
+ if( !psz_geometry )\r
+ {\r
+ libvlc_input_free(p_input);\r
+ return INVOKERESULT_GENERIC_ERROR;\r
+ }\r
+\r
+ libvlc_video_set_crop_geometry(p_input, psz_geometry, &ex);\r
+ free(psz_geometry );\r
libvlc_input_free(p_input);\r
+\r
if( libvlc_exception_raised(&ex) )\r
{\r
NPN_SetException(this, libvlc_exception_get_message(&ex));\r