void VLCWrapper::setSubtitle (const QString& location) const { if (location.isEmpty ()) { QAction *senderAction = qobject_cast<QAction*> (sender ()); if (!senderAction) return; libvlc_video_set_subtitle_file (Player_.get (), senderAction->data ().toString ().toUtf8 ().constData ()); } else libvlc_video_set_subtitle_file (Player_.get (), location.toUtf8 ().constData ()); }
void VlcVideo::setSubtitleFile(const QString &subtitle) { if (_vlcMediaPlayer && libvlc_media_player_has_vout(_vlcMediaPlayer)) { libvlc_video_set_subtitle_file(_vlcMediaPlayer, subtitle.toUtf8().data()); VlcError::errmsg(); } }
//Subtitle void VLCMediaController::setCurrentSubtitle( const Phonon::SubtitleDescription & subtitle ) { current_subtitle = subtitle; //int id = current_subtitle.index(); QString type = current_subtitle.property("type").toString(); if( type == "file" ) { QString filename = current_subtitle.property("name").toString(); if( !filename.isEmpty() ) { libvlc_video_set_subtitle_file( p_vlc_media_player, filename.toAscii().data(), p_vlc_exception ); checkException(); //There is no subtitle event inside libvlc //so let's send our own event... available_subtitles << current_subtitle; emit availableSubtitlesChanged(); } } else { libvlc_video_set_spu( p_vlc_media_player, subtitle.index(), p_vlc_exception ); checkException(); } }
void VlcMediaWidget::setExternalSubtitle(const QUrl &subtitleUrl) { if (libvlc_video_set_subtitle_file(vlcMediaPlayer, subtitleUrl.toEncoded().constData()) == 0) { Log("VlcMediaWidget::setExternalSubtitle: cannot set subtitle file") << subtitleUrl.url(); } }
jint Java_org_videolan_libvlc_LibVLC_addSubtitleTrack(JNIEnv *env, jobject thiz, jstring path) { libvlc_media_player_t *mp = getMediaPlayer(env, thiz); if (mp) { jboolean isCopy; const char* psz_path = (*env)->GetStringUTFChars(env, path, &isCopy); jint res = libvlc_video_set_subtitle_file(mp, psz_path); (*env)->ReleaseStringUTFChars(env, path, psz_path); return res; } else { return -1; } }
jboolean Java_org_videolan_libvlc_MediaPlayer_nativeSetSubtitleFile(JNIEnv *env, jobject thiz, jstring jpath) { vlcjni_object *p_obj = VLCJniObject_getInstance(env, thiz); const char* psz_path; if (!jpath || !(psz_path = (*env)->GetStringUTFChars(env, jpath, 0))) { throw_IllegalArgumentException(env, "path invalid"); return false; } if (!p_obj) return false; jboolean ret = libvlc_video_set_subtitle_file(p_obj->u.p_mp, psz_path); (*env)->ReleaseStringUTFChars(env, jpath, psz_path); return ret; }