* Copyright (C) 2006 the VideoLAN team\r
*\r
* Authors: Damien Fouilleul <Damien.Fouilleul@laposte.net>\r
+ * Jean-Paul Saman <jpsaman _at_ m2x _dot_ nl>\r
*\r
* This program is free software; you can redistribute it and/or modify\r
* it under the terms of the GNU General Public License as published by\r
\r
[helpstring("Mute/unmute audio playback.")]\r
HRESULT toggleMute();\r
+\r
+ [propget, helpstring("Returns/sets audio track used/to use.")]\r
+ HRESULT track([out, retval] long* track);\r
+ [propput, helpstring("Returns/sets audio track used/to use.")]\r
+ HRESULT track([in] long track);\r
+\r
+ [propget, helpstring("Returns audio channel: reverse, stereo, left, right, dolby.")]\r
+ HRESULT channel([out, retval] BSTR* channel);\r
+ [propput, helpstring("Sets audio channel to: reverse, stereo, left, right, dolby.")]\r
+ HRESULT channel([in] BSTR channel);\r
};\r
\r
[\r
* Copyright (C) 2006 the VideoLAN team
*
* Authors: Damien Fouilleul <Damien.Fouilleul@laposte.net>
+ * Jean-Paul Saman <jpsaman _at_ m2x _dot_ nl>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
return hr;
};
+STDMETHODIMP VLCAudio::get_track(long* track)
+{
+ if( NULL == track )
+ 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);
+
+ *track = libvlc_audio_get_track(p_libvlc, &ex);
+ if( libvlc_exception_raised(&ex) )
+ {
+ _p_instance->setErrorInfo(IID_IVLCAudio, libvlc_exception_get_message(&ex));
+ libvlc_exception_clear(&ex);
+ return E_FAIL;
+ }
+ return NOERROR;
+ }
+ return hr;
+};
+
+STDMETHODIMP VLCAudio::put_track(long track)
+{
+ libvlc_instance_t* p_libvlc;
+ HRESULT hr = _p_instance->getVLC(&p_libvlc);
+ if( SUCCEEDED(hr) )
+ {
+ libvlc_exception_t ex;
+ libvlc_exception_init(&ex);
+
+ libvlc_audio_set_track(p_libvlc, track, &ex);
+ if( libvlc_exception_raised(&ex) )
+ {
+ _p_instance->setErrorInfo(IID_IVLCAudio, libvlc_exception_get_message(&ex));
+ libvlc_exception_clear(&ex);
+ return E_FAIL;
+ }
+ return NOERROR;
+ }
+ return hr;
+};
+
+STDMETHODIMP VLCAudio::get_channel(BSTR *channel)
+{
+ if( NULL == channel )
+ return E_POINTER;
+
+ libvlc_instance_t* p_libvlc;
+ HRESULT hr = _p_instance->getVLC(&p_libvlc);
+ if( SUCCEEDED(hr) )
+ {
+ char *psz_channel = NULL;
+ libvlc_exception_t ex;
+ libvlc_exception_init(&ex);
+
+ psz_channel = libvlc_audio_get_channel(p_libvlc, &ex);
+ if( ! libvlc_exception_raised(&ex) )
+ {
+ if( NULL == psz_channel )
+ return E_OUTOFMEMORY;
+
+ *channel = SysAllocStringByteLen(psz_channel, strlen(psz_channel));
+ free( psz_channel );
+ psz_channel = NULL;
+ return NOERROR;
+ }
+ if( psz_channel ) free( psz_channel );
+ _p_instance->setErrorInfo(IID_IVLCAudio,
+ libvlc_exception_get_message(&ex));
+ libvlc_exception_clear(&ex);
+ return E_FAIL;
+ }
+ return hr;
+};
+
+STDMETHODIMP VLCAudio::put_channel(BSTR channel)
+{
+ if( NULL == channel )
+ return E_POINTER;
+
+ if( 0 == SysStringLen(channel) )
+ return E_INVALIDARG;
+
+ libvlc_instance_t* p_libvlc;
+ HRESULT hr = _p_instance->getVLC(&p_libvlc);
+ if( SUCCEEDED(hr) )
+ {
+ char *psz_channel = NULL;
+ libvlc_exception_t ex;
+ libvlc_exception_init(&ex);
+
+ psz_channel = CStrFromBSTR(CP_UTF8, channel);
+ if( NULL == psz_channel )
+ return E_OUTOFMEMORY;
+
+ libvlc_audio_set_channel(p_libvlc, psz_channel, &ex);
+
+ CoTaskMemFree(psz_channel);
+ if( libvlc_exception_raised(&ex) )
+ {
+ _p_instance->setErrorInfo(IID_IVLCAudio,
+ libvlc_exception_get_message(&ex));
+ libvlc_exception_clear(&ex);
+ return E_FAIL;
+ }
+ return NOERROR;
+ }
+ return hr;
+};
+
STDMETHODIMP VLCAudio::toggleMute()
{
libvlc_instance_t* p_libvlc;
return NOERROR;
};
-
+
STDMETHODIMP VLCControl2::put_Visible(VARIANT_BOOL isVisible)
{
_p_instance->setVisible(isVisible != VARIANT_FALSE);
*volume = _p_instance->getVolume();
return NOERROR;
};
-
+
STDMETHODIMP VLCControl2::put_Volume(long volume)
{
_p_instance->setVolume(volume);
* Copyright (C) 2006 the VideoLAN team
*
* Authors: Damien Fouilleul <Damien.Fouilleul@laposte.net>
+ * Jean-Paul Saman <jpsaman _at_ m2x _dot_ nl>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
STDMETHODIMP put_mute(VARIANT_BOOL);
STDMETHODIMP get_volume(long*);
STDMETHODIMP put_volume(long);
+ STDMETHODIMP get_track(long*);
+ STDMETHODIMP put_track(long);
+ STDMETHODIMP get_channel(BSTR*);
+ STDMETHODIMP put_channel(BSTR);
STDMETHODIMP toggleMute();
-
+
protected:
HRESULT loadTypeInfo();
ITypeInfo* _p_typeinfo;
};
-
+
class VLCInput : public IVLCInput
{
public:
ITypeInfo* _p_typeinfo;
};
-
+
class VLCMessage: public IVLCMessage
{
public:
STDMETHODIMP get_name(BSTR *);
STDMETHODIMP get_header(BSTR *);
STDMETHODIMP get_message(BSTR *);
-
+
protected:
HRESULT loadTypeInfo();
struct libvlc_log_message_t _msg;
};
-
+
class VLCLog;
class VLCMessageIterator : public IVLCMessageIterator
VLCLog* _p_vlclog;
libvlc_log_iterator_t* _p_iter;
};
-
+
class VLCMessages : public IVLCMessages
{
public:
STDMETHODIMP clear();
STDMETHODIMP get_count(long*);
STDMETHODIMP iterator(IVLCMessageIterator**);
-
+
protected:
HRESULT loadTypeInfo();
STDMETHODIMP get_messages(IVLCMessages**);
STDMETHODIMP get_verbosity(long *);
STDMETHODIMP put_verbosity(long);
-
+
protected:
HRESULT loadTypeInfo();
VLCMessages* _p_vlcmessages;
};
-
+
class VLCPlaylistItems : public IVLCPlaylistItems
{
public:
STDMETHODIMP get_count(long*);
STDMETHODIMP clear();
STDMETHODIMP remove(long);
-
+
protected:
HRESULT loadTypeInfo();
ITypeInfo* _p_typeinfo;
};
-
+
class VLCPlaylist : public IVLCPlaylist
{
public:
STDMETHODIMP clear();
STDMETHODIMP removeItem(long);
STDMETHODIMP get_items(IVLCPlaylistItems**);
-
+
protected:
HRESULT loadTypeInfo();
VLCPlaylistItems* _p_vlcplaylistitems;
};
-
+
class VLCVideo : public IVLCVideo
{
public:
STDMETHODIMP get_aspectRatio(BSTR*);
STDMETHODIMP put_aspectRatio(BSTR);
STDMETHODIMP toggleFullscreen();
-
+
protected:
HRESULT loadTypeInfo();
ITypeInfo* _p_typeinfo;
};
-
+
class VLCControl2 : public IVLCControl2
{
-
public:
VLCControl2(VLCPlugin *p_instance);
VLCPlaylist* _p_vlcplaylist;
VLCVideo* _p_vlcvideo;
};
-
-#endif
+#endif
* $Id: vlc.h 13701 2005-12-12 17:58:56Z zorglub $
*
* Authors: Clément Stenac <zorglub@videolan.org>
+ * Jean-Paul Saman <jpsaman _at_ m2x _dot_ nl>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* \param p_exception an initialized exception
* \return void
*/
-void libvlc_audio_set_volume( libvlc_instance_t *, int , libvlc_exception_t *);
+void libvlc_audio_set_volume( libvlc_instance_t *, int, libvlc_exception_t *);
+
+/**
+ * Get current audio track
+ * \param p_instance libvlc instance
+ * \param p_exception an initialized exception
+ * \return the audio track (int)
+ */
+int libvlc_audio_get_track( libvlc_instance_t *, libvlc_exception_t * );
+
+/**
+ * Set current audio track
+ * \param p_instance libvlc instance
+ * \param i_track the track (int)
+ * \param p_exception an initialized exception
+ * \return void
+ */
+void libvlc_audio_set_track( libvlc_instance_t *, int, libvlc_exception_t * );
+
+/**
+ * Get current audio channel
+ * \param p_instance libvlc instance
+ * \param p_exception an initialized exception
+ * \return the audio channel (char *)
+ */
+char *libvlc_audio_get_channel( libvlc_instance_t *, libvlc_exception_t * );
+
+/**
+ * Set current audio track
+ * \param p_instance libvlc instance
+ * \param psz_channel the audio channel (char *)
+ * \param p_exception an initialized exception
+ * \return void
+ */
+void libvlc_audio_set_channel( libvlc_instance_t *, char *, libvlc_exception_t * );
/** @} */
{\r
"mute",\r
"volume",\r
+ "track",\r
+ "channel",\r
};\r
\r
const int LibvlcAudioNPObject::propertyCount = sizeof(LibvlcAudioNPObject::propertyNames)/sizeof(NPUTF8 *);\r
{\r
ID_audio_mute,\r
ID_audio_volume,\r
+ ID_audio_track,\r
+ ID_audio_channel,\r
};\r
\r
RuntimeNPObject::InvokeResult LibvlcAudioNPObject::getProperty(int index, NPVariant &result)\r
INT32_TO_NPVARIANT(volume, result);\r
return INVOKERESULT_NO_ERROR;\r
}\r
+ case ID_audio_track:\r
+ {\r
+ int track = libvlc_audio_get_track(p_plugin->getVLC(), &ex);\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
+ INT32_TO_NPVARIANT(track, result);\r
+ return INVOKERESULT_NO_ERROR;\r
+ }\r
+ case ID_audio_channel:\r
+ {\r
+ char *channel = libvlc_audio_get_channel(p_plugin->getVLC(), &ex);\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( channel )\r
+ {\r
+ int len = strlen(channel);\r
+ NPUTF8 *retval = (NPUTF8*)NPN_MemAlloc(len);\r
+ if( retval )\r
+ {\r
+ memcpy(retval, channel, len);\r
+ STRINGN_TO_NPVARIANT(retval, len, result);\r
+ }\r
+ else\r
+ {\r
+ NULL_TO_NPVARIANT(result);\r
+ }\r
+ free( channel );\r
+ channel = NULL;\r
+ return INVOKERESULT_NO_ERROR;\r
+ }\r
+ return INVOKERESULT_NO_SUCH_METHOD;\r
+ }\r
default:\r
;\r
}\r
return INVOKERESULT_NO_ERROR;\r
}\r
return INVOKERESULT_INVALID_VALUE;\r
+ case ID_audio_track:\r
+ if( isNumberValue(value) )\r
+ {\r
+ libvlc_audio_set_track(p_plugin->getVLC(),\r
+ numberValue(value), &ex);\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
+ return INVOKERESULT_INVALID_VALUE;\r
+ case ID_audio_channel:\r
+ {\r
+ char *psz_channel = NULL;\r
+\r
+ if( ! NPVARIANT_IS_STRING(value) )\r
+ {\r
+ return INVOKERESULT_INVALID_VALUE;\r
+ }\r
+\r
+ psz_channel = stringValue(NPVARIANT_TO_STRING(value));\r
+ if( !psz_channel )\r
+ return INVOKERESULT_GENERIC_ERROR;\r
+\r
+ libvlc_audio_set_channel(p_plugin->getVLC(), psz_channel, &ex);\r
+ if( psz_channel )\r
+ free( psz_channel );\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
default:\r
;\r
}\r
* $Id$
*
* Authors: Filippo Carone <filippo@carone.org>
+ * Jean-Paul Saman <jpsaman _at_ m2x _dot_ nl>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
}
}
+/*****************************************************************************
+ * libvlc_audio_get_track : Get the current audio track
+ *****************************************************************************/
+int libvlc_audio_get_track( libvlc_instance_t *p_instance,
+ libvlc_exception_t *p_e )
+{
+ int i_track = 0;
+
+ i_track = var_GetInteger( p_instance->p_libvlc_int, "audio-track" );
+
+ return i_track;
+}
+
+/*****************************************************************************
+ * libvlc_audio_set_track : Set the current audio track
+ *****************************************************************************/
+void libvlc_audio_set_track( libvlc_instance_t *p_instance, int i_track,
+ libvlc_exception_t *p_e )
+{
+ int i_ret = -1;
+
+ i_ret = var_SetInteger( p_instance->p_libvlc_int, "audio-track", i_track );
+
+ if( i_ret < 0 )
+ {
+ libvlc_exception_raise( p_e, "Audio track out of range" );
+ }
+}
+
+/*****************************************************************************
+ * libvlc_audio_get_channel : Get the current audio channel
+ *****************************************************************************/
+char *libvlc_audio_get_channel( libvlc_instance_t *p_instance,
+ libvlc_exception_t *p_e )
+{
+ char *psz_channel = NULL;
+ int i_channel = 0;
+
+ i_channel = var_GetInteger( p_instance->p_libvlc_int, "audio-channel" );
+ switch( i_channel )
+ {
+ case AOUT_VAR_CHAN_RSTEREO:
+ psz_channel = strdup("reverse");
+ break;
+ case AOUT_VAR_CHAN_STEREO:
+ psz_channel = strdup("stereo");
+ break;
+ case AOUT_VAR_CHAN_LEFT:
+ psz_channel = strdup("left");
+ break;
+ case AOUT_VAR_CHAN_RIGHT:
+ psz_channel = strdup("right");
+ break;
+ case AOUT_VAR_CHAN_DOLBYS:
+ psz_channel = strdup("dolby");
+ break;
+ default:
+ psz_channel = strdup("disabled");
+ break;
+ }
+ return psz_channel;
+}
+
+/*****************************************************************************
+ * libvlc_audio_set_channel : Set the current audio channel
+ *****************************************************************************/
+void libvlc_audio_set_channel( libvlc_instance_t *p_instance, char *psz_channel,
+ libvlc_exception_t *p_e )
+{
+ int i_ret = -1;
+ int i_channel = 0;
+
+ if( !psz_channel )
+ {
+ libvlc_exception_raise( p_e, "Audio track out of range" );
+ }
+ else
+ {
+ if( strncmp( psz_channel, "reverse", 7 ) == 0 )
+ i_channel = AOUT_VAR_CHAN_RSTEREO;
+ else if( strncmp( psz_channel, "stereo", 6 ) == 0 )
+ i_channel = AOUT_VAR_CHAN_STEREO;
+ else if( strncmp( psz_channel, "left", 4 ) == 0 )
+ i_channel = AOUT_VAR_CHAN_LEFT;
+ else if( strncmp( psz_channel, "right", 5 ) == 0 )
+ i_channel = AOUT_VAR_CHAN_RIGHT;
+ else if( strncmp( psz_channel, "dolby", 5 ) == 0 )
+ i_channel = AOUT_VAR_CHAN_DOLBYS;
+
+ i_ret = var_SetInteger( p_instance->p_libvlc_int, "audio-channel", i_channel );
+ if( i_ret < 0 )
+ {
+ libvlc_exception_raise( p_e, "Audio track out of range" );
+ }
+ }
+}