STDMETHODIMP VLCAudio::put_channel(long channel) { libvlc_media_player_t *p_md; HRESULT hr = getMD(&p_md); if( SUCCEEDED(hr) ) { libvlc_audio_set_channel(p_md, channel); } return hr; };
void VlcAudio::setChannel(Vlc::AudioChannel channel) { if (_vlcMediaPlayer) { // Don't change if channel is the same if (channel != VlcAudio::channel()) { libvlc_audio_set_channel(_vlcMediaPlayer, channel); VlcError::showErrmsg(); } } }
RuntimeNPObject::InvokeResult LibvlcAudioNPObject::setProperty(int index, const NPVariant &value) { /* is plugin still running */ if( isPluginRunning() ) { VlcPlugin* p_plugin = getPrivate<VlcPlugin>(); libvlc_exception_t ex; libvlc_exception_init(&ex); switch( index ) { case ID_audio_mute: if( NPVARIANT_IS_BOOLEAN(value) ) { libvlc_audio_set_mute(p_plugin->getVLC(), NPVARIANT_TO_BOOLEAN(value), &ex); RETURN_ON_EXCEPTION(this,ex); return INVOKERESULT_NO_ERROR; } return INVOKERESULT_INVALID_VALUE; case ID_audio_volume: if( isNumberValue(value) ) { libvlc_audio_set_volume(p_plugin->getVLC(), numberValue(value), &ex); RETURN_ON_EXCEPTION(this,ex); return INVOKERESULT_NO_ERROR; } return INVOKERESULT_INVALID_VALUE; case ID_audio_track: if( isNumberValue(value) ) { libvlc_media_player_t *p_md = p_plugin->getMD(&ex); RETURN_ON_EXCEPTION(this,ex); libvlc_audio_set_track(p_md, numberValue(value), &ex); RETURN_ON_EXCEPTION(this,ex); return INVOKERESULT_NO_ERROR; } return INVOKERESULT_INVALID_VALUE; case ID_audio_channel: if( isNumberValue(value) ) { libvlc_audio_set_channel(p_plugin->getVLC(), numberValue(value), &ex); RETURN_ON_EXCEPTION(this,ex); return INVOKERESULT_NO_ERROR; } return INVOKERESULT_INVALID_VALUE; default: ; } } return INVOKERESULT_GENERIC_ERROR; }
/* Returns 0 if the channel was set, -1 if it was out of range or error */ jint Java_org_videolan_libvlc_MediaPlayer_setChannel(JNIEnv *env, jobject thiz, jint channel) { vlcjni_object *p_obj = VLCJniObject_getInstance(env, thiz); if (!p_obj) return -1; return (jint) libvlc_audio_set_channel(p_obj->u.p_mp, (int) channel); }