Example #1
0
void FBVLCVideoAPI::set_subtitle(unsigned int t)
{
    FBVLCPtr plg = getPlugin();
    vlc_player& p = plg->get_player();

    libvlc_video_set_spu(p.get_mp(), t);
}
jint Java_org_videolan_libvlc_LibVLC_setSpuTrack(JNIEnv *env, jobject thiz, jint index)
{
    libvlc_media_player_t *mp = getMediaPlayer(env, thiz);
    if (mp)
        return libvlc_video_set_spu(mp, index);
    return -1;
}
void VlcVideo::setSubtitle(int subtitle)
{
    if (_vlcMediaPlayer && libvlc_media_player_has_vout(_vlcMediaPlayer)) {
        libvlc_video_set_spu(_vlcMediaPlayer, subtitle);
        VlcError::errmsg();
    }
}
Example #4
0
//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();
	}
}
Example #5
0
RuntimeNPObject::InvokeResult
LibvlcSubtitleNPObject::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);

        libvlc_media_player_t *p_md = p_plugin->getMD(&ex);
        RETURN_ON_EXCEPTION(this,ex);

        switch( index )
        {
            case ID_subtitle_track:
            {
                if( isNumberValue(value) )
                {
                    /* set the new subtitle track to show */
                    libvlc_video_set_spu(p_md, numberValue(value), &ex);
                    RETURN_ON_EXCEPTION(this,ex);

                    return INVOKERESULT_NO_ERROR;
                }
                return INVOKERESULT_INVALID_VALUE;
            }
        }
    }
    return INVOKERESULT_GENERIC_ERROR;
}
Example #6
0
        static void callback(const libvlc_event_t *e, void *opaque)
        {
            T * const t = reinterpret_cast<T *>(opaque);
            std::lock_guard<std::mutex> _(t->mutex);

            if (e->type == libvlc_MediaPlayerTimeChanged)
            {
                if (t->info)
                    t->info->time = e->u.media_player_time_changed.new_time;
            }
            else if (e->type == libvlc_MediaPlayerPlaying)
            {
                t->started = true;

                if (t->track_ids.video >= -1)
                {
                    libvlc_video_set_track(t->player, -1);
                    if (t->track_ids.video > 0)
                        libvlc_video_set_track(t->player, t->track_ids.video);
                }

                if (t->track_ids.audio >= -1)
                {
                    libvlc_audio_set_track(t->player, -1);
                    if (t->track_ids.audio >= 0)
                        libvlc_audio_set_track(t->player, t->track_ids.audio);
                }

                if (t->track_ids.text >= -1)
                {
                    libvlc_video_set_spu(t->player, -1);
                    if (t->track_ids.text >= 0)
                        libvlc_video_set_spu(t->player, t->track_ids.text);
                }
            }
            else if (e->type == libvlc_MediaPlayerEndReached)
            {
                t->end_reached = true;
                if (t->info)
                    t->info->end_reached = true;
            }
            else if (e->type == libvlc_MediaPlayerEncounteredError)
                t->encountered_error = true;

            t->condition.notify_one();
        }
Example #7
0
STDMETHODIMP VLCVideo::put_subtitle(long spu)
{
    libvlc_media_player_t *p_md;
    HRESULT hr = getMD(&p_md);
    if( SUCCEEDED(hr) )
    {
        libvlc_video_set_spu(p_md, spu);
    }
    return hr;
};
jboolean
Java_org_videolan_libvlc_MediaPlayer_nativeSetSpuTrack(JNIEnv *env,
                                                       jobject thiz, jint index)
{
    vlcjni_object *p_obj = VLCJniObject_getInstance(env, thiz);

    if (!p_obj)
        return false;

    return libvlc_video_set_spu(p_obj->u.p_mp, index) == 0 ? true : false;
}
Example #9
0
void VlcMediaWidget::setCurrentSubtitle(int currentSubtitle)
{
	int requestedSubtitle = currentSubtitle;
	int availableSpuCount = libvlc_video_get_spu_count(vlcMediaPlayer);

	if (requestedSubtitle >= availableSpuCount) {
		Log("VlcMediaWidget::setCurrentSubtitle: subtitle is out of range") <<
			requestedSubtitle << availableSpuCount;

		// Disable subtitles.
		requestedSubtitle = -1;
	} else if (requestedSubtitle < 0) {
		// Set all negative subtitle requests to -1 as this makes libvlc
		// disable the subtitles.
		requestedSubtitle = -1;
	} else {
		// We got a valid subtitle request - skip the 'deactivate' subtitle.
		requestedSubtitle += 1;
	}

	libvlc_video_set_spu(vlcMediaPlayer, requestedSubtitle);
}
Example #10
0
void QmlVlcVideo::set_subtitle( unsigned int t )
{
    libvlc_video_set_spu( m_player.get_mp(), t );
}
Example #11
0
void VPlayer::setSubTitle(QString _track)
{
	if(mp){
		libvlc_video_set_spu(mp,subtitle[_track]);
	}
}
Example #12
0
RuntimeNPObject::InvokeResult
LibvlcVideoNPObject::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);

        libvlc_media_player_t *p_md = p_plugin->getMD(&ex);
        RETURN_ON_EXCEPTION(this,ex);

        switch( index )
        {
            case ID_video_fullscreen:
            {
                if( ! NPVARIANT_IS_BOOLEAN(value) )
                {
                    return INVOKERESULT_INVALID_VALUE;
                }

                int val = NPVARIANT_TO_BOOLEAN(value);
                p_plugin->set_fullscreen(val, &ex);
                RETURN_ON_EXCEPTION(this,ex);
                return INVOKERESULT_NO_ERROR;
            }
            case ID_video_aspectratio:
            {
                char *psz_aspect = NULL;

                if( ! NPVARIANT_IS_STRING(value) )
                {
                    return INVOKERESULT_INVALID_VALUE;
                }

                psz_aspect = stringValue(NPVARIANT_TO_STRING(value));
                if( !psz_aspect )
                {
                    return INVOKERESULT_GENERIC_ERROR;
                }

                libvlc_video_set_aspect_ratio(p_md, psz_aspect, &ex);
                free(psz_aspect);
                RETURN_ON_EXCEPTION(this,ex);

                return INVOKERESULT_NO_ERROR;
            }
            case ID_video_subtitle:
            {
                if( isNumberValue(value) )
                {
                    libvlc_video_set_spu(p_md, numberValue(value), &ex);
                    RETURN_ON_EXCEPTION(this,ex);

                    return INVOKERESULT_NO_ERROR;
                }
                return INVOKERESULT_INVALID_VALUE;
            }
            case ID_video_crop:
            {
                char *psz_geometry = NULL;

                if( ! NPVARIANT_IS_STRING(value) )
                {
                    return INVOKERESULT_INVALID_VALUE;
                }

                psz_geometry = stringValue(NPVARIANT_TO_STRING(value));
                if( !psz_geometry )
                {
                    return INVOKERESULT_GENERIC_ERROR;
                }

                libvlc_video_set_crop_geometry(p_md, psz_geometry, &ex);
                free(psz_geometry);
                RETURN_ON_EXCEPTION(this,ex);

                return INVOKERESULT_NO_ERROR;
            }
            case ID_video_teletext:
            {
                if( isNumberValue(value) )
                {
                    libvlc_video_set_teletext(p_md, numberValue(value), &ex);
                    RETURN_ON_EXCEPTION(this,ex);

                    return INVOKERESULT_NO_ERROR;
                }
                return INVOKERESULT_INVALID_VALUE;
            }
        }
    }
    return INVOKERESULT_GENERIC_ERROR;
}