/** * Forward mouse event with proper conversion. */ static int MouseEvent( vlc_object_t *p_this, char const *psz_var, vlc_value_t oldval, vlc_value_t newval, void *p_data ) { vout_thread_t *p_vout = p_data; VLC_UNUSED(p_this); VLC_UNUSED(oldval); if( !strcmp( psz_var, "mouse-button-down" ) ) return var_SetChecked( p_vout, psz_var, VLC_VAR_INTEGER, newval ); /* Translate the mouse coordinates * FIXME missing lock */ newval.coords.x += p_vout->p_sys->i_x; newval.coords.y += p_vout->p_sys->i_y; return var_SetChecked( p_vout, psz_var, VLC_VAR_COORDS, newval ); }
/** * Forward mouse event with proper conversion. */ static int MouseEvent( vlc_object_t *p_this, char const *psz_var, vlc_value_t oldval, vlc_value_t val, void *p_data ) { vout_thread_t *p_vout = p_data; VLC_UNUSED(p_this); VLC_UNUSED(oldval); /* Translate the mouse coordinates * FIXME missing lock */ if( !strcmp( psz_var, "mouse-button-down" ) ) return var_SetChecked( p_vout, psz_var, VLC_VAR_INTEGER, val ); int x = val.coords.x, y = val.coords.y; switch( p_vout->p_sys->i_mode ) { case TRANSFORM_MODE_90: x = p_vout->p_sys->p_vout->output.i_height - val.coords.y; y = val.coords.x; break; case TRANSFORM_MODE_180: x = p_vout->p_sys->p_vout->output.i_width - val.coords.x; y = p_vout->p_sys->p_vout->output.i_height - val.coords.y; break; case TRANSFORM_MODE_270: x = val.coords.y; y = p_vout->p_sys->p_vout->output.i_width - val.coords.x; break; case TRANSFORM_MODE_HFLIP: x = p_vout->p_sys->p_vout->output.i_width - val.coords.x; break; case TRANSFORM_MODE_VFLIP: y = p_vout->p_sys->p_vout->output.i_height - val.coords.y; break; default: break; } return var_SetCoords( p_vout, psz_var, x, y ); }
/** * Create playlist * * Create a playlist structure. * \param p_parent the vlc object that is to be the parent of this playlist * \return a pointer to the created playlist, or NULL on error */ playlist_t *playlist_Create( vlc_object_t *p_parent ) { playlist_t *p_playlist; playlist_private_t *p; /* Allocate structure */ p = vlc_custom_create( p_parent, sizeof( *p ), "playlist" ); if( !p ) return NULL; assert( offsetof( playlist_private_t, public_data ) == 0 ); p_playlist = &p->public_data; TAB_INIT( pl_priv(p_playlist)->i_sds, pl_priv(p_playlist)->pp_sds ); VariablesInit( p_playlist ); vlc_mutex_init( &p->lock ); vlc_cond_init( &p->signal ); p->killed = false; /* Initialise data structures */ pl_priv(p_playlist)->i_last_playlist_id = 0; pl_priv(p_playlist)->p_input = NULL; ARRAY_INIT( p_playlist->items ); ARRAY_INIT( p_playlist->all_items ); ARRAY_INIT( pl_priv(p_playlist)->items_to_delete ); ARRAY_INIT( p_playlist->current ); p_playlist->i_current_index = 0; pl_priv(p_playlist)->b_reset_currently_playing = true; pl_priv(p_playlist)->b_tree = var_InheritBool( p_parent, "playlist-tree" ); pl_priv(p_playlist)->b_preparse = var_InheritBool( p_parent, "auto-preparse" ); /* Create the root, playing items and meida library nodes */ playlist_item_t *root, *playing, *ml; PL_LOCK; root = playlist_NodeCreate( p_playlist, NULL, NULL, PLAYLIST_END, 0, NULL ); playing = playlist_NodeCreate( p_playlist, _( "Playlist" ), root, PLAYLIST_END, PLAYLIST_RO_FLAG | PLAYLIST_NO_INHERIT_FLAG, NULL ); if( var_InheritBool( p_parent, "media-library") ) ml = playlist_NodeCreate( p_playlist, _( "Media Library" ), root, PLAYLIST_END, PLAYLIST_RO_FLAG | PLAYLIST_NO_INHERIT_FLAG, NULL ); else ml = NULL; PL_UNLOCK; if( unlikely(root == NULL || playing == NULL) ) abort(); p_playlist->p_root = root; p_playlist->p_playing = playing; p_playlist->p_media_library = ml; p_playlist->p_root_category = p_playlist->p_root; p_playlist->p_root_onelevel = p_playlist->p_root; p_playlist->p_local_category = p_playlist->p_playing; p_playlist->p_local_onelevel = p_playlist->p_playing; p_playlist->p_ml_category = p_playlist->p_media_library; p_playlist->p_ml_onelevel = p_playlist->p_media_library;; /* Initial status */ pl_priv(p_playlist)->status.p_item = NULL; pl_priv(p_playlist)->status.p_node = p_playlist->p_playing; pl_priv(p_playlist)->request.b_request = false; if (ml != NULL) playlist_MLLoad( p_playlist ); /* Input resources */ p->p_input_resource = input_resource_New( VLC_OBJECT( p_playlist ) ); if( unlikely(p->p_input_resource == NULL) ) abort(); /* Audio output (needed for volume and device controls). */ audio_output_t *aout = input_resource_GetAout( p->p_input_resource ); if( aout != NULL ) input_resource_PutAout( p->p_input_resource, aout ); /* Initialize the shared HTTP cookie jar */ vlc_value_t cookies; cookies.p_address = vlc_http_cookies_new(); if ( likely(cookies.p_address) ) { var_Create( p_playlist, "http-cookies", VLC_VAR_ADDRESS ); var_SetChecked( p_playlist, "http-cookies", VLC_VAR_ADDRESS, cookies ); } /* Thread */ playlist_Activate (p_playlist); /* Add service discovery modules */ char *mods = var_InheritString( p_playlist, "services-discovery" ); if( mods != NULL ) { char *s = mods, *m; while( (m = strsep( &s, " :," )) != NULL ) playlist_ServicesDiscoveryAdd( p_playlist, m ); free( mods ); } return p_playlist; }
/** * Set a variable's value * * \param p_this The object that hold the variable * \param psz_name The name of the variable * \param val the value to set */ int var_Set( vlc_object_t *p_this, const char *psz_name, vlc_value_t val ) { return var_SetChecked( p_this, psz_name, 0, val ); }