@@ -1583,7 +1583,7 @@ void SyncControls::update()
 {
     b_userAction = false;
 
-    int64_t i_delay;
+    putime_t i_delay;
     if( THEMIM->getInput() )
     {
         i_delay = var_GetTime( THEMIM->getInput(), "audio-delay" );
@@ -1600,7 +1600,7 @@ void SyncControls::advanceAudio( double 
 {
     if( THEMIM->getInput() && b_userAction )
     {
-        int64_t i_delay = f_advance * 1000000;
+        putime_t i_delay = f_advance * 1000000;
         var_SetTime( THEMIM->getInput(), "audio-delay", i_delay );
     }
 }
@@ -1609,7 +1609,7 @@ void SyncControls::advanceSubs( double f
 {
     if( THEMIM->getInput() && b_userAction )
     {
-        int64_t i_delay = f_advance * 1000000;
+        putime_t i_delay = f_advance * 1000000;
         var_SetTime( THEMIM->getInput(), "spu-delay", i_delay );
     }
 }
Exemple #2
0
Fichier : var.c Projet : Kafay/vlc
static int TimeCallback( vlc_object_t *p_this, char const *psz_cmd,
                         vlc_value_t oldval, vlc_value_t newval, void *p_data )
{
    input_thread_t *p_input = (input_thread_t*)p_this;
    VLC_UNUSED(oldval); VLC_UNUSED(p_data);

    if( !strcmp( psz_cmd, "time-offset" ) )
    {
        mtime_t i_time = var_GetTime( p_input, "time" ) + newval.i_time;
        if( i_time < 0 )
            i_time = 0;
        var_SetTime( p_this, "time", i_time );
    }
    else
    {
        /* Update "position" for better intf behavour */
        const mtime_t i_length = var_GetTime( p_input, "length" );
        if( i_length > 0 && newval.i_time >= 0 && newval.i_time <= i_length )
        {
            vlc_value_t val;

            val.f_float = (double)newval.i_time/(double)i_length;
            var_Change( p_input, "position", VLC_VAR_SETVALUE, &val, NULL );
        }

        /* */
        input_ControlPush( p_input, INPUT_CONTROL_SET_TIME, &newval );
    }
    return VLC_SUCCESS;
}
Exemple #3
0
void InputManager::jumpBwd()
{
    int i_interval = var_InheritInteger( p_input, "short-jump-size" );
    if( i_interval > 0 && hasInput() )
    {
        mtime_t val = -CLOCK_FREQ * i_interval;
        var_SetTime( p_input, "time-offset", val );
    }
}
Exemple #4
0
void InputManager::jumpBwd()
{
    int i_interval = var_InheritInteger( p_input, "short-jump-size" );
    if( i_interval > 0 )
    {
        mtime_t val = -1 *(mtime_t)(i_interval) * 1000000L;
        var_SetTime( p_input, "time-offset", val );
    }
}
Exemple #5
0
void GotoTimeDialog::close()
{
    if ( THEMIM->getIM()->hasInput() )
    {
        int64_t i_time = (int64_t)
            ( QTime( 0, 0, 0 ).msecsTo( timeEdit->time() ) ) * 1000;
        var_SetTime( THEMIM->getInput(), "time", i_time );
    }
    toggleVisible();
}
Exemple #6
0
void libvlc_media_player_set_time( libvlc_media_player_t *p_mi,
                                   libvlc_time_t i_time )
{
    input_thread_t *p_input_thread;

    p_input_thread = libvlc_get_input_thread ( p_mi );
    if( !p_input_thread )
        return;

    var_SetTime( p_input_thread, "time", to_mtime(i_time) );
    vlc_object_release( p_input_thread );
}
Exemple #7
0
void InputManager::setAtoB()
{
    if( !timeA )
    {
        timeA = var_GetTime( THEMIM->getInput(), "time"  );
    }
    else if( !timeB )
    {
        timeB = var_GetTime( THEMIM->getInput(), "time"  );
        var_SetTime( THEMIM->getInput(), "time" , timeA );
        CONNECT( this, positionUpdated( float, int64_t, int ),
                 this, AtoBLoop( float, int64_t, int ) );
    }
Exemple #8
0
/*****************************************************************************
 * libvlc_audio_set_delay : Set the current audio delay
 *****************************************************************************/
int libvlc_audio_set_delay( libvlc_media_player_t *p_mi, int64_t i_delay )
{
    input_thread_t *p_input_thread = libvlc_get_input_thread ( p_mi );
    int ret = 0;
    if( p_input_thread != NULL )
    {
      var_SetTime( p_input_thread, "audio-delay", i_delay );
      vlc_object_release( p_input_thread );
    }
    else
    {
      ret = -1;
    }
    return ret;
}
Exemple #9
0
static void test_times( libvlc_int_t *p_libvlc )
{
    int i;
    for( i = 0; i < i_var_count; i++ )
         var_Create( p_libvlc, psz_var_name[i], VLC_VAR_TIME );

    for( i = 0; i < i_var_count; i++ )
    {
        var_value[i].i_time = rand();
        var_SetTime( p_libvlc, psz_var_name[i], var_value[i].i_time );
    }

    for( i = 0; i < i_var_count; i++ )
        assert( var_GetTime( p_libvlc, psz_var_name[i] ) == var_value[i].i_time );

    for( i = 0; i < i_var_count; i++ )
        var_Destroy( p_libvlc, psz_var_name[i] );
}
Exemple #10
0
	/* Set play time, play, hide this, show concludePreviewButton */
	void FilterWin::preview( Mod * p_mod )
	{
		// require input thread and playlist
		if (p_input == NULL || p_playlist == NULL)
			return;
		// require p_mod
		if (p_mod == NULL)
			p_mod = Moviesoap::p_editingMod;
		if (p_mod == NULL)
			return;
		// dump filter frame to Filter
		filterFrame->dump();
		// calculate start of preview
		mtime_t t_offset = 1000000;
		mtime_t start = p_mod->startTime();
		start = (start > t_offset) ? start - t_offset : 0;
		// change the time and control
		vlc_mutex_lock(&Moviesoap::lock); // todo del?
		var_SetTime( p_input, "time", start );
		vlc_mutex_unlock(&Moviesoap::lock); // todo del?
		playlist_Control( Moviesoap::p_playlist, PLAYLIST_PLAY, false );
		hide();
		concludePreviewButton->show();
	}
Exemple #11
0
static void ProcessGesture( intf_thread_t *p_intf )
{
    intf_sys_t *p_sys = p_intf->p_sys;
    playlist_t *p_playlist = pl_Get( p_intf );

    /* Do something */
    /* If you modify this, please try to follow this convention:
       Start with LEFT, RIGHT for playback related commands
       and UP, DOWN, for other commands */
    switch( p_sys->i_pattern )
    {
        case LEFT:
        {
            msg_Dbg( p_intf, "Go backward in the movie!" );

            input_thread_t *p_input = playlist_CurrentInput( p_playlist );
            if( p_input == NULL )
                break;

            int it = var_InheritInteger( p_intf , "short-jump-size" );
            if( it > 0 )
                var_SetTime( p_input, "time-offset", -CLOCK_FREQ * it );
            vlc_object_release( p_input );
            break;
        }

        case RIGHT:
        {
            msg_Dbg( p_intf, "Go forward in the movie!" );

            input_thread_t *p_input = playlist_CurrentInput( p_playlist );
            if( p_input == NULL )
                break;

            int it = var_InheritInteger( p_intf , "short-jump-size" );
            if( it > 0 )
                var_SetTime( p_input, "time-offset", CLOCK_FREQ * it );
            vlc_object_release( p_input );
            break;
        }

        case GESTURE(LEFT,UP,NONE,NONE):
            msg_Dbg( p_intf, "Going slower." );
            var_TriggerCallback( p_playlist, "rate-slower" );
            break;

        case GESTURE(RIGHT,UP,NONE,NONE):
            msg_Dbg( p_intf, "Going faster." );
            var_TriggerCallback( p_playlist, "rate-faster" );
            break;

        case GESTURE(LEFT,RIGHT,NONE,NONE):
        case GESTURE(RIGHT,LEFT,NONE,NONE):
        {
            msg_Dbg( p_intf, "Play/Pause" );

            input_thread_t *p_input = playlist_CurrentInput( p_playlist );
            if( p_input == NULL )
                break;

            int i_state = var_GetInteger( p_input, "state" );
            i_state = (i_state == PLAYING_S) ? PAUSE_S : PLAYING_S;
            var_SetInteger( p_input, "state", i_state );
            vlc_object_release( p_input );
            break;
        }

        case GESTURE(LEFT,DOWN,NONE,NONE):
            playlist_Prev( p_playlist );
            break;

        case GESTURE(RIGHT,DOWN,NONE,NONE):
            playlist_Next( p_playlist );
            break;

        case UP:
            msg_Dbg(p_intf, "Louder");
            playlist_VolumeUp( p_playlist, 1, NULL );
            break;

        case DOWN:
            msg_Dbg(p_intf, "Quieter");
            playlist_VolumeDown( p_playlist, 1, NULL );
            break;

        case GESTURE(UP,DOWN,NONE,NONE):
        case GESTURE(DOWN,UP,NONE,NONE):
            msg_Dbg( p_intf, "Mute sound" );
            playlist_MuteToggle( p_playlist );
            break;

        case GESTURE(UP,RIGHT,NONE,NONE):
        {
            input_thread_t *p_input = playlist_CurrentInput( p_playlist );
            if( p_input == NULL )
                break;

            vlc_value_t list, list2;
            var_Change( p_input, "audio-es", VLC_VAR_GETCHOICES,
                        &list, &list2 );

            if( list.p_list->i_count > 1 )
            {
                int i_audio_es = var_GetInteger( p_input, "audio-es" );
                int i;

                for( i = 0; i < list.p_list->i_count; i++ )
                     if( i_audio_es == list.p_list->p_values[i].i_int )
                         break;
                /* value of audio-es was not in choices list */
                if( i == list.p_list->i_count )
                {
                    msg_Warn( p_input,
                              "invalid current audio track, selecting 0" );
                    i = 0;
                }
                else if( i == list.p_list->i_count - 1 )
                    i = 1;
                else
                    i++;
                var_SetInteger( p_input, "audio-es",
                                list.p_list->p_values[i].i_int );
            }
            var_FreeList( &list, &list2 );
            vlc_object_release( p_input );
            break;
        }

        case GESTURE(DOWN,RIGHT,NONE,NONE):
        {
            input_thread_t *p_input = playlist_CurrentInput( p_playlist );
            if( p_input == NULL )
                break;

            vlc_value_t list, list2;
            var_Change( p_input, "spu-es", VLC_VAR_GETCHOICES,
                        &list, &list2 );

            if( list.p_list->i_count > 1 )
            {
                int i_audio_es = var_GetInteger( p_input, "spu-es" );
                int i;

                for( i = 0; i < list.p_list->i_count; i++ )
                     if( i_audio_es == list.p_list->p_values[i].i_int )
                         break;
                /* value of audio-es was not in choices list */
                if( i == list.p_list->i_count )
                {
                    msg_Warn( p_input,
                              "invalid current subtitle track, selecting 0" );
                    i = 0;
                }
                else if( i == list.p_list->i_count - 1 )
                    i = 1;
                else
                    i++;
                var_SetInteger( p_input, "audio-es",
                                list.p_list->p_values[i].i_int );
            }
            var_FreeList( &list, &list2 );
            vlc_object_release( p_input );
            break;
        }

        case GESTURE(UP,LEFT,NONE,NONE):
        {
            bool val = var_ToggleBool( pl_Get( p_intf ), "fullscreen" );
            if( p_sys->p_vout )
                var_SetBool( p_sys->p_vout, "fullscreen", val );
            break;
        }

        case GESTURE(DOWN,LEFT,NONE,NONE):
            /* FIXME: Should close the vout!"*/
            libvlc_Quit( p_intf->p_libvlc );
            break;

        case GESTURE(DOWN,LEFT,UP,RIGHT):
        case GESTURE(UP,RIGHT,DOWN,LEFT):
            msg_Dbg( p_intf, "a square was drawn!" );
            break;
    }

    p_sys->i_num_gestures = 0;
    p_sys->i_pattern = 0;
}
Exemple #12
0
static LRESULT HandleCadMessage(intf_thread_t* p_intf, HWND hwnd, WPARAM wParam, LPARAM lParam)
{
	intf_sys_t* const p_sys = p_intf->p_sys;

	switch (lParam)
	{
	case IPC_PLAY:
		{
			playlist_Play(pl_Get(p_intf->p_libvlc));
			return 1;
		}

	case IPC_PLAYPAUSE:
		{
			playlist_t* p_playlist = pl_Get(p_intf->p_libvlc);
			const bool playing = playlist_Status(p_playlist) == PLAYLIST_RUNNING;
			playlist_Control(p_playlist, playing ? PLAYLIST_PAUSE : PLAYLIST_PLAY, pl_Unlocked);
			return 1;
		}

	case IPC_PAUSE:
		{
			playlist_Pause(pl_Get(p_intf->p_libvlc));
			return 1;
		}

	case IPC_STOP:
		{
			playlist_Stop(pl_Get(p_intf->p_libvlc));
			return 1;
		}
			
	case IPC_NEXT:
		{
			playlist_Next(pl_Get(p_intf->p_libvlc));
			return 1;
		}

	case IPC_PREVIOUS:
		{
			playlist_Prev(pl_Get(p_intf->p_libvlc));
			return 1;
		}

	case IPC_SET_VOLUME:
		{
			playlist_VolumeSet(pl_Get(p_intf->p_libvlc), (int)wParam / 100.0f);
			return 1;
		}

	case IPC_GET_VOLUME:
		{
			// VLC can return a volume larger than 100% so we need to cap it to 100 here.
			const float volume = playlist_VolumeGet(pl_Get(p_intf->p_libvlc)) * 100.0f;
			return (LRESULT)min(volume, 100.0f);
		}

	case IPC_GET_DURATION:
		{
			unsigned int duration = 0;
			if (p_sys->p_input)
			{
				input_item_t* const p_item = input_GetItem(p_sys->p_input);
				duration = (unsigned int)(input_item_GetDuration(p_item) / 1000000);
			}
			return duration;
		}

	case IPC_GET_POSITION:
		{
			int pos = 0;
			if (p_sys->p_input)
			{
				pos = (int)(var_GetTime(p_sys->p_input, "time") / CLOCK_FREQ);
			}
			return pos;
		}

	case IPC_SET_POSITION:
		{
			if (p_sys->p_input)
			{
				var_SetTime(p_sys->p_input, "time", (int64_t)wParam * CLOCK_FREQ);
			}
			return 0;
		}

	case IPC_GET_SHUFFLE:
		{
			return (int)var_GetBool(pl_Get(p_intf->p_libvlc), "random");
		}

	case IPC_SET_SHUFFLE:
		{
			return (int)var_SetBool(pl_Get(p_intf->p_libvlc), "random", (bool)wParam);
		}

	case IPC_GET_REPEAT:
		{
			return (int)var_GetBool(pl_Get(p_intf->p_libvlc), "repeat");
		}

	case IPC_SET_REPEAT:
		{
			return (int)var_SetBool(pl_Get(p_intf->p_libvlc), "repeat", (bool)wParam);
		}

	case IPC_SET_RATING:
		{
			// VLC does not support ratings so send back 0.
			PostMessage(p_sys->cad_window, WM_USER, 0, IPC_RATING_CHANGED_NOTIFICATION);
			return 0;
		}

	case IPC_SET_CALLBACK_HWND:
		{
			p_sys->cad_window = (HWND)wParam;
			return 1;
		}

	case IPC_SHOW_WINDOW:
		{
			// TODO.
			return 0;
		}

	case IPC_GET_STATE:
		{
			const int status = playlist_Status(pl_Get(p_intf->p_libvlc));
			return
				status == PLAYLIST_RUNNING ? 1 :
				status == PLAYLIST_PAUSED ? 2 :
				0;
		}

	case IPC_SHUTDOWN_NOTIFICATION:
		{
			p_sys->cad_window = NULL;
			return 1;
		}

	case IPC_CLOSE:
		{
			libvlc_Quit(p_intf->p_libvlc);
			return 1;
		}

	case IPC_GET_CURRENT_TRACK:
		{
			if (!p_sys->p_input) return 0;
			input_item_t* p_item = input_GetItem(p_sys->p_input);

			char buffer[DATA_MAX_LENGTH];
			int buffer_len = 0;

			// If the i sstarts with file://, we assume that it is a local file and detailed
			// metadata is available. Otherwise, we assume it to be a network stream (i.e. radio)
			// with limited info (only a title).
			char* const file = decode_URI(input_item_GetURI(p_item));
			if (strncmp(file, "file://", 7) == 0)
			{
				char* const title = input_item_GetTitleFbName(p_item);
				char* const artist = input_item_GetArtist(p_item);
				char* const album = input_item_GetAlbum(p_item);
				char* const cover = decode_URI(input_item_GetArtworkURL(p_item));
				const unsigned int duration = input_item_GetDuration(p_item) / 1000000U;

				buffer_len = _snprintf(
					buffer, ARRAYSIZE(buffer), "%s\t%s\t%s\t\t\t\t\t%u\t%s\t\t%s\t\t\t\t\t\t\t",
					title ? title : "",
					artist ? artist : "",
					album ? album : "",
					duration,
					file ? &file[8] : "",
					cover ? &cover[8] : "");  // Skip the "file://" part.

				free(title);
				free(artist);
				free(album);
				free(cover);
			}
			else if (char* now_playing = input_item_GetNowPlaying(p_item))
			{
				char* artist = NULL;
				char* title = now_playing;
				char* pos = strstr(now_playing, " - ");
				if (pos)
				{
					pos[0] = '\0';
					artist = title;
					title = pos + 3;	// Skip the " - "
				}

				buffer_len = _snprintf(
					buffer, ARRAYSIZE(buffer), "%s\t%s\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t",
					title ? title : "",
					artist ? artist : "");

				free(now_playing);
			}

			free(file);

			if (buffer_len)
			{
				wchar_t buffer_w[DATA_MAX_LENGTH];
				const int buffer_w_len = MultiByteToWideChar(
					CP_UTF8, 0, buffer, buffer_len + 1, buffer_w, ARRAYSIZE(buffer_w));

				COPYDATASTRUCT cds;
				cds.dwData = IPC_CURRENT_TRACK_NOTIFICATION;
				cds.lpData = &buffer_w;
				cds.cbData = buffer_w_len * sizeof(buffer_w[0]);
				SendMessage(
					p_sys->cad_window, WM_COPYDATA, IPC_CURRENT_TRACK_NOTIFICATION, (LPARAM)&cds);
			}

			return 1;
		}
	}

	return 0;
}
Exemple #13
0
/*****************************************************************************
 * RunIntf: main loop
 *****************************************************************************/
static void RunIntf( intf_thread_t *p_intf )
{
    intf_sys_t *p_sys = p_intf->p_sys;
    int canc = vlc_savecancel();
    input_thread_t *p_input;

    /* Main loop */
    while( vlc_object_alive( p_intf ) )
    {
        vlc_mutex_lock( &p_sys->lock );

        /*
         * mouse cursor
         */
        if( p_sys->b_got_gesture )
        {
            int i_interval = 0;
            /* Do something */
            /* If you modify this, please try to follow this convention:
               Start with LEFT, RIGHT for playback related commands
               and UP, DOWN, for other commands */
            playlist_t * p_playlist = pl_Get( p_intf );
            switch( p_sys->i_pattern )
            {
            case LEFT:
                msg_Dbg( p_intf, "Go backward in the movie!" );
                p_input = playlist_CurrentInput( p_playlist );
                if( p_input )
                {
                    i_interval = var_InheritInteger( p_intf , "short-jump-size" );
                    if ( i_interval > 0 )
                    {
                        mtime_t i_time = ( (mtime_t)( -i_interval ) * 1000000L);
                        var_SetTime( p_input, "time-offset", i_time );
                    }
                    vlc_object_release( p_input );
                }
                break;

            case RIGHT:
                msg_Dbg( p_intf, "Go forward in the movie!" );
                p_input = playlist_CurrentInput( p_playlist );
                if( p_input )
                {
                    i_interval = var_InheritInteger( p_intf , "short-jump-size" );
                    if ( i_interval > 0 )
                    {
                        mtime_t i_time = ( (mtime_t)( i_interval ) * 1000000L);
                        var_SetTime( p_input, "time-offset", i_time );
                    }
                    vlc_object_release( p_input );
                }
                break;

            case GESTURE(LEFT,UP,NONE,NONE):
                msg_Dbg( p_intf, "Going slower." );
                p_input = playlist_CurrentInput( p_playlist );
                if( p_input )
                {
                    var_TriggerCallback( p_input, "rate-slower" );
                    vlc_object_release( p_input );
                }
                break;

            case GESTURE(RIGHT,UP,NONE,NONE):
                msg_Dbg( p_intf, "Going faster." );
                p_input = playlist_CurrentInput( p_playlist );
                if( p_input )
                {
                    var_TriggerCallback( p_input, "rate-faster" );
                    vlc_object_release( p_input );
                }
                break;

            case GESTURE(LEFT,RIGHT,NONE,NONE):
            case GESTURE(RIGHT,LEFT,NONE,NONE):
                msg_Dbg( p_intf, "Play/Pause" );
                p_input = playlist_CurrentInput( p_playlist );
 
                if( p_input )
                {
                    int i_state = var_GetInteger( p_input, "state" );
                    var_SetInteger( p_input, "state", ( i_state != PLAYING_S )
                                                      ? PLAYING_S : PAUSE_S );
                    vlc_object_release( p_input );
                }
                break;

            case GESTURE(LEFT,DOWN,NONE,NONE):
                playlist_Prev( p_playlist );
                break;

            case GESTURE(RIGHT,DOWN,NONE,NONE):
                playlist_Next( p_playlist );
                break;

            case UP:
                msg_Dbg(p_intf, "Louder");
                aout_VolumeUp( p_playlist, 1, NULL );
                break;

            case DOWN:
                msg_Dbg(p_intf, "Quieter");
                aout_VolumeDown( p_playlist, 1, NULL );
                break;

            case GESTURE(UP,DOWN,NONE,NONE):
            case GESTURE(DOWN,UP,NONE,NONE):
                msg_Dbg( p_intf, "Mute sound" );
                aout_ToggleMute( p_playlist, NULL );
                break;

            case GESTURE(UP,RIGHT,NONE,NONE):
                {
                    vlc_value_t list, list2;
                    int i_count, i, i_audio_es;

                    p_input = playlist_CurrentInput( p_playlist );
                    if( !p_input )
                        break;

                    i_audio_es = var_GetInteger( p_input, "audio-es" );
                    var_Change( p_input, "audio-es", VLC_VAR_GETCHOICES,
                                &list, &list2 );
                    i_count = list.p_list->i_count;
                    if( i_count <= 1 )
                    {
                        var_FreeList( &list, &list2 );
                        vlc_object_release( p_input );
                        break;
                    }
                    for( i = 0; i < i_count; i++ )
                    {
                        if( i_audio_es == list.p_list->p_values[i].i_int )
                            break;
                    }
                    /* value of audio-es was not in choices list */
                    if( i == i_count )
                    {
                        msg_Warn( p_input,
                                  "invalid current audio track, selecting 0" );
                        i = 0;
                    }
                    else if( i == i_count - 1 )
                        i = 1;
                    else
                        i++;
                    var_SetInteger( p_input, "audio-es", list.p_list->p_values[i].i_int );
                    var_FreeList( &list, &list2 );
                    vlc_object_release( p_input );
                }
                break;
            case GESTURE(DOWN,RIGHT,NONE,NONE):
                {
                    vlc_value_t list, list2;
                    int i_count, i, i_spu_es;

                    p_input = playlist_CurrentInput( p_playlist );
                    if( !p_input )
                        break;

                    i_spu_es = var_GetInteger( p_input, "spu-es" );

                    var_Change( p_input, "spu-es", VLC_VAR_GETCHOICES,
                            &list, &list2 );
                    i_count = list.p_list->i_count;
                    if( i_count <= 1 )
                    {
                        vlc_object_release( p_input );
                        var_FreeList( &list, &list2 );
                        break;
                    }
                    for( i = 0; i < i_count; i++ )
                    {
                        if( i_spu_es == list.p_list->p_values[i].i_int )
                        {
                            break;
                        }
                    }
                    /* value of spu-es was not in choices list */
                    if( i == i_count )
                    {
                        msg_Warn( p_input,
                                "invalid current subtitle track, selecting 0" );
                        i = 0;
                    }
                    else if( i == i_count - 1 )
                        i = 0;
                    else
                        i++;
                    var_SetInteger( p_input, "spu-es", list.p_list->p_values[i].i_int);
                    var_FreeList( &list, &list2 );
                    vlc_object_release( p_input );
                }
                break;

            case GESTURE(UP,LEFT,NONE,NONE):
            {
                bool val = var_ToggleBool( pl_Get( p_intf ), "fullscreen" );
                if( p_sys->p_vout )
                    var_SetBool( p_sys->p_vout, "fullscreen", val );
                break;
           }

            case GESTURE(DOWN,LEFT,NONE,NONE):
                /* FIXME: Should close the vout!"*/
                libvlc_Quit( p_intf->p_libvlc );
                break;
            case GESTURE(DOWN,LEFT,UP,RIGHT):
            case GESTURE(UP,RIGHT,DOWN,LEFT):
                msg_Dbg( p_intf, "a square was drawn!" );
                break;
            default:
                break;
            }
            p_sys->i_num_gestures = 0;
            p_sys->i_pattern = 0;
            p_sys->b_got_gesture = false;
        }

        /*
         * video output
         */
        if( p_sys->p_vout && !vlc_object_alive( p_sys->p_vout ) )
        {
            var_DelCallback( p_sys->p_vout, "mouse-moved",
                             MouseEvent, p_intf );
            var_DelCallback( p_sys->p_vout, "mouse-button-down",
                             MouseEvent, p_intf );
            vlc_object_release( p_sys->p_vout );
            p_sys->p_vout = NULL;
        }

        if( p_sys->p_vout == NULL )
        {
            p_input = playlist_CurrentInput( pl_Get( p_intf ) );
            if( p_input )
            {
                p_sys->p_vout = input_GetVout( p_input );
                vlc_object_release( p_input );
            }
            if( p_sys->p_vout )
            {
                var_AddCallback( p_sys->p_vout, "mouse-moved",
                                 MouseEvent, p_intf );
                var_AddCallback( p_sys->p_vout, "mouse-button-down",
                                 MouseEvent, p_intf );
            }
        }

        vlc_mutex_unlock( &p_sys->lock );

        /* Wait a bit */
        msleep( INTF_IDLE_SLEEP );
    }

    vlc_restorecancel( canc );
}