void VlcMediaWidget::updateAudioStreams() { audioStreams.clear(); libvlc_track_description_t *track = libvlc_audio_get_track_description(vlcMediaPlayer); if (track != NULL) { // skip the 'deactivate' audio channel track = track->p_next; } while (track != NULL) { QString audioStream = QString::fromUtf8(track->psz_name); int cutBegin = (audioStream.indexOf(QLatin1Char('[')) + 1); if (cutBegin > 0) { int cutEnd = audioStream.lastIndexOf(QLatin1Char(']')); if (cutEnd >= 0) { // remove unnecessary text audioStream = audioStream.mid(cutBegin, cutEnd - cutBegin); } } if (audioStream.isEmpty()) { audioStream = QString::number(audioStreams.size() + 1); } audioStreams.append(audioStream); track = track->p_next; } // skip the 'deactivate' audio channel currentAudioStream = (libvlc_audio_get_track(vlcMediaPlayer) - 1); }
static void _send_all_track_info(struct _App *app) { int track_count, current; libvlc_track_description_t *desc; current = libvlc_audio_get_track(app->mp); track_count = libvlc_audio_get_track_count(app->mp); desc = libvlc_audio_get_track_description(app->mp); _send_track_info(app, EM_RESULT_AUDIO_TRACK_INFO, current, track_count, desc); current = libvlc_video_get_track(app->mp); track_count = libvlc_video_get_track_count(app->mp); desc = libvlc_video_get_track_description(app->mp); _send_track_info(app, EM_RESULT_VIDEO_TRACK_INFO, current, track_count, desc); current = libvlc_video_get_spu(app->mp); track_count = libvlc_video_get_spu_count(app->mp); desc = libvlc_video_get_spu_description(app->mp); _send_track_info(app, EM_RESULT_SPU_TRACK_INFO, current, track_count, desc); }
jint Java_org_videolan_libvlc_LibVLC_getAudioTrack(JNIEnv *env, jobject thiz) { libvlc_media_player_t *mp = getMediaPlayer(env, thiz); if (mp) return libvlc_audio_get_track(mp); return -1; }
RuntimeNPObject::InvokeResult LibvlcAudioNPObject::getProperty(int index, NPVariant &result) { /* 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: { bool muted = libvlc_audio_get_mute(p_plugin->getVLC(), &ex); RETURN_ON_EXCEPTION(this,ex); BOOLEAN_TO_NPVARIANT(muted, result); return INVOKERESULT_NO_ERROR; } case ID_audio_volume: { int volume = libvlc_audio_get_volume(p_plugin->getVLC(), &ex); RETURN_ON_EXCEPTION(this,ex); INT32_TO_NPVARIANT(volume, result); return INVOKERESULT_NO_ERROR; } case ID_audio_track: { libvlc_media_player_t *p_md = p_plugin->getMD(&ex); RETURN_ON_EXCEPTION(this,ex); int track = libvlc_audio_get_track(p_md, &ex); RETURN_ON_EXCEPTION(this,ex); INT32_TO_NPVARIANT(track, result); return INVOKERESULT_NO_ERROR; } case ID_audio_count: { libvlc_media_player_t *p_md = p_plugin->getMD(&ex); RETURN_ON_EXCEPTION(this,ex); // get the number of audio track available int i_track = libvlc_audio_get_track_count(p_md, &ex); RETURN_ON_EXCEPTION(this,ex); // return it INT32_TO_NPVARIANT(i_track, result); return INVOKERESULT_NO_ERROR; } case ID_audio_channel: { int channel = libvlc_audio_get_channel(p_plugin->getVLC(), &ex); RETURN_ON_EXCEPTION(this,ex); INT32_TO_NPVARIANT(channel, result); return INVOKERESULT_NO_ERROR; } default: ; } } return INVOKERESULT_GENERIC_ERROR; }
int VlcAudio::track() const { int track = -1; if (_vlcMediaPlayer) { track = libvlc_audio_get_track(_vlcMediaPlayer); VlcError::showErrmsg(); } return track; }
jint Java_org_videolan_libvlc_MediaPlayer_nativeGetAudioTrack(JNIEnv *env, jobject thiz) { vlcjni_object *p_obj = VLCJniObject_getInstance(env, thiz); if (!p_obj) return -2; return libvlc_audio_get_track(p_obj->u.p_mp); }
STDMETHODIMP VLCAudio::get_track(long* track) { if( NULL == track ) return E_POINTER; libvlc_media_player_t* p_md; HRESULT hr = getMD(&p_md); if( SUCCEEDED(hr) ) { *track = libvlc_audio_get_track(p_md); } return hr; };
void LiveWidget::setupAudioTrackMenu() { if (!libvlc_media_player_is_playing(this->vlcMediaPlayer)) return; foreach (QAction* action, this->audioTrackMenu->actions()) this->audioTrackMenu->removeAction(action); int currentTrack = libvlc_audio_get_track(this->vlcMediaPlayer); libvlc_track_description_t* trackDescription = libvlc_audio_get_track_description(this->vlcMediaPlayer); while (trackDescription != NULL) { this->audioTrackAction = this->audioTrackMenu->addAction(/*QIcon(":/Graphics/Images/RenameRundown.png"),*/ trackDescription->psz_name); this->audioTrackAction->setCheckable(true); this->audioTrackAction->setData(trackDescription->i_id); if (trackDescription->i_id == currentTrack) this->audioTrackAction->setChecked(true); trackDescription = trackDescription->p_next; } }