Commit 65bc2af7 authored by Jean-Paul Saman's avatar Jean-Paul Saman

JavaScript API to change the selected teletext page from IE ActiveX,...

JavaScript API to change the selected teletext page from IE ActiveX, Mozilla/Firefox, Safari webbrowser plugins.
parent c8555cc6
......@@ -434,6 +434,11 @@ library AXVLC
[propput, helpstring("Sets crop filter geometry.")]
HRESULT crop([in] BSTR geometry);
[propget, helpstring("Returns teletext page used.")]
HRESULT subtitle([out, retval] long* page);
[propput, helpstring("Sets teletext page to use.")]
HRESULT subtitle([in] long page);
[helpstring("toggle fullscreen/windowed state.")]
HRESULT toggleFullscreen();
......
......@@ -2354,6 +2354,58 @@ STDMETHODIMP VLCVideo::put_crop(BSTR geometry)
return hr;
};
STDMETHODIMP VLCVideo::get_teletext(long* page)
{
if( NULL == page )
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) )
{
*page = libvlc_video_get_teletext(p_input, &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::put_teletext(long page)
{
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);
libvlc_video_set_teletext(p_input, page, &ex);
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(LPPICTUREDISP* picture)
{
if( NULL == picture )
......
......@@ -526,6 +526,8 @@ public:
STDMETHODIMP put_subtitle(long);
STDMETHODIMP get_crop(BSTR*);
STDMETHODIMP put_crop(BSTR);
STDMETHODIMP get_teletext(long*);
STDMETHODIMP put_teletext(long);
STDMETHODIMP takeSnapshot(LPPICTUREDISP*);
STDMETHODIMP toggleFullscreen();
......
......@@ -465,6 +465,22 @@ VLC_PUBLIC_API char *libvlc_video_get_crop_geometry( libvlc_media_instance_t *,
*/
VLC_PUBLIC_API void libvlc_video_set_crop_geometry( libvlc_media_instance_t *, char *, libvlc_exception_t * );
/**
* Get current teletext page requested.
* \param p_input the input
* \param p_exception an initialized exception
* \return the current teletext page requested.
*/
VLC_PUBLIC_API int libvlc_video_get_teletext( libvlc_media_instance_t *, libvlc_exception_t * );
/**
* Set new teletext page to retrieve
* \param p_input the input
* \param i_page teletex page number requested
* \param p_exception an initialized exception
*/
VLC_PUBLIC_API void libvlc_video_set_teletext( libvlc_media_instance_t *, int, libvlc_exception_t * );
/**
* Take a snapshot of the current video window
* \param p_input the input
......
......@@ -1789,7 +1789,8 @@ const NPUTF8 * const LibvlcVideoNPObject::propertyNames[] =
"width",
"aspectRatio",
"subtitle",
"crop"
"crop",
"teletext"
};
enum LibvlcVideoNPObjectPropertyIds
......@@ -1799,7 +1800,8 @@ enum LibvlcVideoNPObjectPropertyIds
ID_video_width,
ID_video_aspectratio,
ID_video_subtitle,
ID_video_crop
ID_video_crop,
ID_video_teletext
};
const int LibvlcVideoNPObject::propertyCount = sizeof(LibvlcVideoNPObject::propertyNames)/sizeof(NPUTF8 *);
......@@ -1907,6 +1909,19 @@ RuntimeNPObject::InvokeResult LibvlcVideoNPObject::getProperty(int index, NPVari
STRINGZ_TO_NPVARIANT(psz_geometry, result);
return INVOKERESULT_NO_ERROR;
}
case ID_video_teletext:
{
int i_page = libvlc_video_get_teletext(p_md, &ex);
libvlc_media_instance_release(p_md);
if( libvlc_exception_raised(&ex) )
{
NPN_SetException(this, libvlc_exception_get_message(&ex));
libvlc_exception_clear(&ex);
return INVOKERESULT_GENERIC_ERROR;
}
INT32_TO_NPVARIANT(i_page, result);
return INVOKERESULT_NO_ERROR;
}
}
libvlc_media_instance_release(p_md);
}
......@@ -2028,6 +2043,24 @@ RuntimeNPObject::InvokeResult LibvlcVideoNPObject::setProperty(int index, const
}
return INVOKERESULT_NO_ERROR;
}
case ID_video_teletext:
{
if( isNumberValue(value) )
{
libvlc_video_set_teletext(p_md,
numberValue(value), &ex);
libvlc_media_instance_release(p_md);
if( libvlc_exception_raised(&ex) )
{
NPN_SetException(this, libvlc_exception_get_message(&ex));
libvlc_exception_clear(&ex);
return INVOKERESULT_GENERIC_ERROR;
}
return INVOKERESULT_NO_ERROR;
}
libvlc_media_instance_release(p_md);
return INVOKERESULT_INVALID_VALUE;
}
}
libvlc_media_instance_release(p_md);
}
......
......@@ -479,6 +479,36 @@ void libvlc_video_set_crop_geometry( libvlc_media_instance_t *p_mi,
vlc_object_release( p_vout );
}
int libvlc_video_get_teletext( libvlc_media_instance_t *p_mi,
libvlc_exception_t *p_e )
{
vout_thread_t *p_vout = GetVout( p_mi, p_e );
int i_ret = -1;
if( !p_vout )
return i_ret;
i_ret = var_GetInteger( p_vout, "vbi-page" );
vlc_object_release( p_vout );
return i_ret;
}
void libvlc_video_set_teletext( libvlc_media_instance_t *p_mi, int i_page,
libvlc_exception_t *p_e )
{
vout_thread_t *p_vout = GetVout( p_mi, p_e );
int i_ret = -1;
if( !p_vout )
return;
i_ret = var_SetInteger( p_vout, "vbi-page", i_page );
if( i_ret )
libvlc_exception_raise( p_e,
"Unexpected error while setting teletext page" );
vlc_object_release( p_vout );
}
int libvlc_video_destroy( libvlc_media_instance_t *p_mi,
libvlc_exception_t *p_e )
{
......
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