Example #1
0
File: tls.c Project: Crazybond/vlc
/**
 * Allocates TLS credentials for a client.
 * Credentials can be cached and reused across multiple TLS sessions.
 *
 * @return TLS credentials object, or NULL on error.
 **/
vlc_tls_creds_t *vlc_tls_ClientCreate (vlc_object_t *obj)
{
    vlc_tls_creds_t *crd = vlc_custom_create (obj, sizeof (*crd),
                                              "tls client");
    if (unlikely(crd == NULL))
        return NULL;

    crd->module = vlc_module_load (crd, "tls client", NULL, false,
                                   tls_client_load, crd);
    if (crd->module == NULL)
    {
        msg_Err (crd, "TLS client plugin not available");
        vlc_object_release (crd);
        return NULL;
    }

    return crd;
}
Example #2
0
/* Destroy a "stream_out" module */
static void sout_StreamDelete( sout_stream_t *p_stream )
{
    sout_instance_t *p_sout = (sout_instance_t *)(p_stream->p_parent);

    msg_Dbg( p_stream, "destroying chain... (name=%s)", p_stream->psz_name );

    p_sout->i_out_pace_nocontrol -= p_stream->pace_nocontrol;

    if( p_stream->p_module != NULL )
        module_unneed( p_stream, p_stream->p_module );

    FREENULL( p_stream->psz_name );

    config_ChainDestroy( p_stream->p_cfg );

    msg_Dbg( p_stream, "destroying chain done" );
    vlc_object_release( p_stream );
}
Example #3
0
void libvlc_video_redraw_rectangle( libvlc_media_player_t *p_mi,
                           const libvlc_rectangle_t *area,
                           libvlc_exception_t *p_e )
{
    if( (NULL != area)
     && ((area->bottom - area->top) > 0)
     && ((area->right - area->left) > 0) )
    {
        vout_thread_t *p_vout = GetVout( p_mi, p_e );
        if( p_vout )
        {
            /* tell running vout to redraw area */
            vout_Control( p_vout , VOUT_REDRAW_RECT,
                               area->top, area->left, area->bottom, area->right );
            vlc_object_release( p_vout );
        }
    }
}
Example #4
0
bool InputManager::hasVisualisation()
{
    if( !p_input )
        return false;

    aout_instance_t *aout = input_GetAout( p_input );
    if( !aout )
        return false;

    char *visual = var_InheritString( aout, "visual" );
    vlc_object_release( aout );

    if( !visual )
        return false;

    free( visual );
    return true;
}
Example #5
0
File: audio.c Project: 0xheart0/vlc
int libvlc_audio_set_volume( libvlc_media_player_t *mp, int volume )
{
    float vol = volume / 100.f;
    if (!isgreaterequal(vol, 0.f))
    {
        libvlc_printerr( "Volume out of range" );
        return -1;
    }

    int ret = -1;
    audio_output_t *aout = GetAOut( mp );
    if( aout != NULL )
    {
        ret = aout_VolumeSet( aout, vol );
        vlc_object_release( aout );
    }
    return ret;
}
Example #6
0
void CmdFullscreen::execute()
{
    vout_thread_t *pVout;

    if( getIntf()->p_sys->p_input == NULL )
    {
        return;
    }

    pVout = (vout_thread_t *)vlc_object_find( getIntf()->p_sys->p_input,
                                              VLC_OBJECT_VOUT, FIND_CHILD );
    if( pVout )
    {
        // Switch to fullscreen
        pVout->i_changes |= VOUT_FULLSCREEN_CHANGE;
        vlc_object_release( pVout );
    }
}
void libvlc_media_player_set_title( libvlc_media_player_t *p_mi,
                                    int i_title )
{
    input_thread_t *p_input_thread;

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

    var_SetInteger( p_input_thread, "title", i_title );
    vlc_object_release( p_input_thread );

    //send event
    libvlc_event_t event;
    event.type = libvlc_MediaPlayerTitleChanged;
    event.u.media_player_title_changed.new_title = i_title;
    libvlc_event_send( p_mi->p_event_manager, &event );
}
Example #8
0
static int vlclua_playlist_current( lua_State *L )
{
    playlist_t *p_playlist = vlclua_get_playlist_internal( L );
    input_thread_t *p_input = playlist_CurrentInput( p_playlist );
    int id = -1;

    if( p_input )
    {
        input_item_t *p_item = input_GetItem( p_input );
        if( p_item )
            id = p_item->i_id;
        vlc_object_release( p_input );
    }

#warning Indexing input items by ID is unsafe,
    lua_pushinteger( L, id );
    return 1;
}
Example #9
0
/**
 * Deinitializes an audio output module and destroys an audio output object.
 */
void aout_Destroy (audio_output_t *aout)
{
    aout_owner_t *owner = aout_owner (aout);

    aout_OutputLock (aout);
    module_unneed (aout, owner->module);
    /* Protect against late call from intf.c */
    aout->volume_set = NULL;
    aout->mute_set = NULL;
    aout->device_select = NULL;
    aout_OutputUnlock (aout);

    var_DelCallback (aout, "audio-filter", FilterCallback, NULL);
    var_DelCallback (aout, "mute", var_Copy, aout->p_parent);
    var_SetFloat (aout, "volume", -1.f);
    var_DelCallback (aout, "volume", var_Copy, aout->p_parent);
    vlc_object_release (aout);
}
Example #10
0
/*****************************************************************************
 * CloseIntf: destroy dummy interface
 *****************************************************************************/
void Close ( vlc_object_t *p_this )
{
    intf_thread_t *p_intf = (intf_thread_t *)p_this;

    // Destroy the callbacks
    if( p_intf->p_sys->p_vout )
    {
        var_DelCallback( p_intf->p_sys->p_vout, "mouse-moved",
                         MouseEvent, p_intf );
        var_DelCallback( p_intf->p_sys->p_vout, "mouse-button-down",
                         MouseEvent, p_intf );
        vlc_object_release( p_intf->p_sys->p_vout );
    }

    /* Destroy structure */
    vlc_mutex_destroy( &p_intf->p_sys->lock );
    free( p_intf->p_sys );
}
Example #11
0
/*****************************************************************************
 * End: terminate opencv_wrapper video thread output method
 *****************************************************************************/
static void End( vout_thread_t *p_vout )
{
    vout_sys_t *p_sys = p_vout->p_sys;

    vout_filter_DelChild( p_vout, p_sys->p_vout, NULL );
    vout_CloseAndRelease( p_sys->p_vout );

    vout_filter_ReleaseDirectBuffers( p_vout );

    if( p_sys->p_opencv )
    {
        //release the internal opencv filter
        if( p_sys->p_opencv->p_module )
            module_unneed( p_sys->p_opencv, p_sys->p_opencv->p_module );
        vlc_object_release( p_sys->p_opencv );
        p_sys->p_opencv = NULL;
    }
}
Example #12
0
static int
MarshalCanSeek( intf_thread_t *p_intf, DBusMessageIter *container )
{
    dbus_bool_t b_can_seek = FALSE;
    input_thread_t *p_input = pl_CurrentInput( p_intf );

    if( p_input )
    {
        b_can_seek = var_GetBool( p_input, "can-seek" );
        vlc_object_release( p_input );
    }

    if( !dbus_message_iter_append_basic( container, DBUS_TYPE_BOOLEAN,
                                         &b_can_seek ) )
        return VLC_ENOMEM;

    return VLC_SUCCESS;
}
Example #13
0
//---------------------------------------------------------------------------
// DemuxOpen: initialize demux
//---------------------------------------------------------------------------
static int DemuxOpen( vlc_object_t *p_this )
{
    demux_t *p_demux = (demux_t*)p_this;
    intf_thread_t *p_intf;
    char *ext;

    // Needed callbacks
    p_demux->pf_demux   = Demux;
    p_demux->pf_control = DemuxControl;

    // Test that we have a valid .vlt or .wsz file, based on the extension
    if( ( ext = strrchr( p_demux->psz_path, '.' ) ) == NULL ||
        ( strcasecmp( ext, ".vlt" ) && strcasecmp( ext, ".wsz" ) ) )
    {
        return VLC_EGENERIC;
    }

    vlc_mutex_lock( &skin_load.mutex );
    p_intf = skin_load.intf;
    if( p_intf )
        vlc_object_hold( p_intf );
    vlc_mutex_unlock( &skin_load.mutex );

    if( p_intf != NULL )
    {
        playlist_t *p_playlist = pl_Get( p_this );

        PL_LOCK;
        // Make sure the item is deleted afterwards
        /// \bug does not always work
        playlist_CurrentPlayingItem( p_playlist )->i_flags |= PLAYLIST_REMOVE_FLAG;
        PL_UNLOCK;

        var_SetString( p_intf, "skin-to-load", p_demux->psz_path );
        vlc_object_release( p_intf );
    }
    else
    {
        msg_Warn( p_this,
                  "skin could not be loaded (not using skins2 intf)" );
    }

    return VLC_SUCCESS;
}
Example #14
0
static int PlaylistEvent(vlc_object_t *object, char const *cmd,
                         vlc_value_t oldval, vlc_value_t newval, void *data)
{
    VLC_UNUSED(cmd); VLC_UNUSED(oldval); VLC_UNUSED(object);
    intf_thread_t  *intf = data;
    intf_sys_t     *sys = intf->p_sys;

    input_thread_t *input = newval.p_address;
    assert(sys->input == NULL);
    sys->input = vlc_object_hold(input);
    if (vlc_clone(&sys->thread, sys->is_master ? Master : Slave, intf,
                  VLC_THREAD_PRIORITY_INPUT)) {
        vlc_object_release(input);
        sys->input = NULL;
        return VLC_SUCCESS;
    }
    var_AddCallback(input, "intf-event", InputEvent, intf);
    return VLC_SUCCESS;
}
Example #15
0
int playlist_Export( playlist_t * p_playlist, const char *psz_filename,
                     playlist_item_t *p_export_root, const char *psz_type )
{
    if( p_export_root == NULL ) return VLC_EGENERIC;

    playlist_export_t *p_export =
        vlc_custom_create( p_playlist, sizeof( *p_export ), "playlist export" );
    if( !p_export )
        return VLC_ENOMEM;

    msg_Dbg( p_export, "saving %s to file %s",
             p_export_root->p_input->psz_name, psz_filename );

    int ret = VLC_EGENERIC;

    /* Prepare the playlist_export_t structure */
    p_export->p_root = p_export_root;
    p_export->psz_filename = psz_filename;
    p_export->p_file = vlc_fopen( psz_filename, "wt" );
    if( p_export->p_file == NULL )
        msg_Err( p_export, "could not create playlist file %s (%m)",
                 psz_filename );
    else
    {
        module_t *p_module;

        /* And call the module ! All work is done now */
        playlist_Lock( p_playlist );
        p_module = module_need( p_export, "playlist export", psz_type, true );
        playlist_Unlock( p_playlist );

        if( p_module == NULL )
            msg_Err( p_playlist, "could not export playlist" );
        else
        {
            module_unneed( p_export, p_module );
            ret = VLC_SUCCESS;
        }
        fclose( p_export->p_file );
   }
   vlc_object_release( p_export );
   return ret;
}
Example #16
0
static void stop_osdvnc ( filter_t *p_filter )
{
    filter_sys_t *p_sys = p_filter->p_sys;

    /* It will unlock socket reading */
    vlc_object_kill( p_filter );

    /* */
    if( p_sys->p_worker_thread )
    {
        msg_Dbg( p_filter, "joining worker_thread" );
        vlc_object_kill( p_sys->p_worker_thread );
        vlc_thread_join( p_sys->p_worker_thread );
        vlc_object_release( p_sys->p_worker_thread );
        msg_Dbg( p_filter, "released worker_thread" );
    }

    msg_Dbg( p_filter, "osdvnc stopped" );
}
/*****************************************************************************
 * sout_DeleteInstance: delete a previously allocated instance
 *****************************************************************************/
void sout_DeleteInstance( sout_instance_t * p_sout )
{
    /* remove the stream out chain */
    sout_StreamChainDelete( p_sout->p_stream, NULL );

    /* *** free all string *** */
    FREENULL( p_sout->psz_sout );

    /* delete meta */
    if( p_sout->p_meta )
    {
        vlc_meta_Delete( p_sout->p_meta );
    }

    vlc_mutex_destroy( &p_sout->lock );

    /* *** free structure *** */
    vlc_object_release( p_sout );
}
Example #18
0
int dialog_ExtensionUpdate (vlc_object_t *obj, extension_dialog_t *dialog)
{
    assert (obj);
    assert (dialog);

    vlc_object_t *dp = dialog_GetProvider(obj);
    if (!dp)
    {
        msg_Warn (obj, "Dialog provider is not set, can't update dialog '%s'",
                  dialog->psz_title);
        return VLC_EGENERIC;
    }

    // Signaling the dialog provider
    int ret = var_SetAddress (dp, "dialog-extension", dialog);

    vlc_object_release (dp);
    return ret;
}
Example #19
0
/**
 *  UnRegister an existing session
 *
 * \param p_sout a sout instance structure
 * \param p_session the session descriptor
 * \return VLC_SUCCESS or an error
 */
int sout_AnnounceUnRegister( sout_instance_t *p_sout,
                             session_descriptor_t *p_session )
{
    int i_ret;
    announce_handler_t *p_announce = (announce_handler_t*)
                              vlc_object_find( p_sout,
                                              VLC_OBJECT_ANNOUNCE,
                                              FIND_ANYWHERE );
    if( !p_announce )
    {
        msg_Dbg( p_sout, "unable to remove announce: no announce handler" );
        return VLC_ENOOBJ;
    }
    i_ret  = announce_UnRegister( p_announce, p_session );

    vlc_object_release( p_announce );

    return i_ret;
}
Example #20
0
void libvlc_media_player_navigate( libvlc_media_player_t* p_mi,
                                   unsigned navigate )
{
    static const vlc_action_t map[] =
    {
        INPUT_NAV_ACTIVATE, INPUT_NAV_UP, INPUT_NAV_DOWN,
        INPUT_NAV_LEFT, INPUT_NAV_RIGHT,
    };

    if( navigate >= sizeof(map) / sizeof(map[0]) )
      return;

    input_thread_t *p_input = libvlc_get_input_thread ( p_mi );
    if ( p_input == NULL )
      return;

    input_Control( p_input, map[navigate], NULL );
    vlc_object_release( p_input );
}
Example #21
0
File: objects.c Project: paa/vlc
/**
 ****************************************************************************
 * attach object to a parent object
 *****************************************************************************
 * This function sets p_this as a child of p_parent, and p_parent as a parent
 * of p_this. This link can be undone using vlc_object_detach.
 *****************************************************************************/
void vlc_object_attach( vlc_object_t *p_this, vlc_object_t *p_parent )
{
    if( !p_this ) return;

    vlc_object_internals_t *pap = vlc_internals (p_parent);
    vlc_object_internals_t *priv = vlc_internals (p_this);
    vlc_object_t *p_old_parent;

    priv->prev = NULL;
    vlc_object_hold (p_parent);
    libvlc_lock (p_this->p_libvlc);
#ifndef NDEBUG
    /* Reparenting an object carries a risk of invalid access to the parent,
     * from another thread. This can happen when inheriting a variable, or
     * through any direct access to vlc_object_t.p_parent. Also, reparenting
     * brings a functional bug, whereby the reparented object uses incorrect
     * old values for inherited variables (as the new parent may have different
     * variable values, especially if it is an input).
     * Note that the old parent may be already destroyed.
     * So its pointer must not be dereferenced.
     */
    if (priv->old_parent)
        msg_Info (p_this, "Reparenting an object is dangerous (%p -> %p)!",
                  priv->old_parent, p_parent);
#endif

    p_old_parent = p_this->p_parent;
    if (p_old_parent)
        vlc_object_detach_unlocked (p_this);

    /* Attach the parent to its child */
    p_this->p_parent = p_parent;

    /* Attach the child to its parent */
    priv->next = pap->first;
    if (priv->next != NULL)
        priv->next->prev = priv;
    pap->first = priv;
    libvlc_unlock (p_this->p_libvlc);

    if (p_old_parent)
        vlc_object_release (p_old_parent);
}
Example #22
0
void DialogsProvider::OnOpenFileSimple( wxCommandEvent& event )
{
    playlist_t *p_playlist =
        (playlist_t *)vlc_object_find( p_intf, VLC_OBJECT_PLAYLIST,
                                       FIND_ANYWHERE );
    if( p_playlist == NULL )
    {
        return;
    }

    if( p_file_dialog == NULL )
        p_file_dialog = new wxFileDialog( NULL, wxU(_("Open File")),
            wxT(""), wxT(""), wxT("*"), wxOPEN | wxMULTIPLE );

	p_file_dialog->SetWildcard(wxU(_("All Files (*.*)|*"
        "|Sound Files (*.mp3, *.ogg, etc.)|" EXTENSIONS_AUDIO 
        "|Video Files (*.avi, *.mpg, etc.)|" EXTENSIONS_VIDEO 
        "|Playlist Files (*.m3u, *.pls, etc.)|" EXTENSIONS_PLAYLIST 
        "|Subtitle Files (*.srt, *.sub, etc.)|" EXTENSIONS_SUBTITLE)));

    if( p_file_dialog && p_file_dialog->ShowModal() == wxID_OK )
    {
        wxArrayString paths;

        p_file_dialog->GetPaths( paths );

        for( size_t i = 0; i < paths.GetCount(); i++ )
        {
            char *psz_utf8 = wxFromLocale( paths[i] );
            if( event.GetInt() )
                playlist_Add( p_playlist, psz_utf8, psz_utf8,
                              PLAYLIST_APPEND | (i ? 0 : PLAYLIST_GO) |
                              (i ? PLAYLIST_PREPARSE : 0 ),
                              PLAYLIST_END );
            else
                playlist_Add( p_playlist, psz_utf8, psz_utf8,
                              PLAYLIST_APPEND | PLAYLIST_PREPARSE , PLAYLIST_END );
            wxLocaleFree( psz_utf8 );
        }
    }

    vlc_object_release( p_playlist );
}
Example #23
0
/**
 * Close the module.
 * @param p_this: the filter object
 */
static void Close(vlc_object_t *p_this)
{
    filter_t *p_filter = (filter_t *)p_this;
    filter_sys_t *p_sys = p_filter->p_sys;

    /* Terminate the thread. */
    vlc_cancel(p_sys->thread);
    vlc_join(p_sys->thread, NULL);

    /* Free the ressources */
    vout_DeleteDisplay(p_sys->p_vd, NULL);
    vlc_object_release(p_sys->p_vout);

    block_FifoRelease(p_sys->fifo);
    free(p_sys->p_prev_s16_buff);

    vlc_sem_destroy(&p_sys->ready);
    free(p_sys);
}
Example #24
0
File: dbus.c Project: RicoP/vlcfork
static void Close   ( vlc_object_t *p_this )
{
    intf_thread_t   *p_intf     = (intf_thread_t*) p_this;
    intf_sys_t      *p_sys      = p_intf->p_sys;
    playlist_t      *p_playlist = p_sys->p_playlist;

    var_DelCallback( p_playlist, "item-current", AllCallback, p_intf );
    var_DelCallback( p_playlist, "intf-change", AllCallback, p_intf );
    var_DelCallback( p_playlist, "volume", AllCallback, p_intf );
    var_DelCallback( p_playlist, "mute", AllCallback, p_intf );
    var_DelCallback( p_playlist, "playlist-item-append", AllCallback, p_intf );
    var_DelCallback( p_playlist, "playlist-item-deleted", AllCallback, p_intf );
    var_DelCallback( p_playlist, "random", AllCallback, p_intf );
    var_DelCallback( p_playlist, "repeat", AllCallback, p_intf );
    var_DelCallback( p_playlist, "loop", AllCallback, p_intf );
    var_DelCallback( p_playlist, "fullscreen", AllCallback, p_intf );

    if( p_sys->p_input )
    {
        var_DelCallback( p_sys->p_input, "intf-event", AllCallback, p_intf );
        var_DelCallback( p_sys->p_input, "can-pause", AllCallback, p_intf );
        var_DelCallback( p_sys->p_input, "can-seek", AllCallback, p_intf );
        vlc_object_release( p_sys->p_input );
    }

    /* The dbus connection is private, so we are responsible
     * for closing it */
    dbus_connection_close( p_sys->p_conn );
    dbus_connection_unref( p_sys->p_conn );

    // Free the events array
    for( int i = 0; i < vlc_array_count( p_sys->p_events ); i++ )
    {
        callback_info_t* info = vlc_array_item_at_index( p_sys->p_events, i );
        free( info );
    }
    vlc_mutex_destroy( &p_sys->lock );
    vlc_array_destroy( p_sys->p_events );
    vlc_array_destroy( p_sys->p_timeouts );
    vlc_array_destroy( p_sys->p_watches );
    free( p_sys );
}
static int filter_chain_DeleteFilterInternal( filter_chain_t *p_chain,
                                              filter_t *p_filter )
{
    chained_filter_t *p_chained = chained( p_filter );

    /* Remove it from the chain */
    if( p_chained->prev != NULL )
        p_chained->prev->next = p_chained->next;
    else
    {
        assert( p_chained == p_chain->first );
        p_chain->first = p_chained->next;
    }

    if( p_chained->next != NULL )
        p_chained->next->prev = p_chained->prev;
    else
    {
        assert( p_chained == p_chain->last );
        p_chain->last = p_chained->prev;
    }
    p_chain->length--;

    msg_Dbg( p_chain->p_this, "Filter %p removed from chain", p_filter );

    FilterDeletePictures( &p_chained->filter, p_chained->pending );

    /* Destroy the filter object */
    if( IsInternalVideoAllocator( p_chained ) )
        AllocatorClean( &internal_video_allocator, p_chained );
    else
        AllocatorClean( &p_chain->allocator, p_chained );

    if( p_filter->p_module )
        module_unneed( p_filter, p_filter->p_module );
    free( p_chained->mouse );
    vlc_object_release( p_filter );


    /* FIXME: check fmt_in/fmt_out consitency */
    return VLC_SUCCESS;
}
Example #26
0
/*****************************************************************************
 * ChapterMenu::AttachedToWindow
 *****************************************************************************/
void ChapterMenu::AttachedToWindow()
{
    BMenuItem * item;
    while( ( item = RemoveItem( 0L ) ) )
    {
        delete item;
    }

    input_thread_t * p_input;
    p_input = (input_thread_t *)
        vlc_object_find( p_intf, VLC_OBJECT_INPUT, FIND_ANYWHERE );
    if( !p_input )
    {
        return;
    }

    vlc_value_t val;
    BMessage * message;
    if( !var_Get( p_input, "chapter", &val ) )
    {
        vlc_value_t val_list, text_list;
        var_Change( p_input, "chapter", VLC_VAR_GETCHOICES,
                    &val_list, &text_list );

        for( int i = 0; i < val_list.p_list->i_count; i++ )
        {
            message = new BMessage( TOGGLE_CHAPTER );
            message->AddInt32( "index", val_list.p_list->p_values[i].i_int );
            item = new BMenuItem( text_list.p_list->p_values[i].psz_string,
                                  message );
            if( val_list.p_list->p_values[i].i_int == val.i_int )
            {
                item->SetMarked( true );
            }
            AddItem( item );
        }

        var_FreeList( &val_list, &text_list );
    }
    vlc_object_release( p_input );
    BMenu::AttachedToWindow();
}
Example #27
0
/*****************************************************************************
 * LanguageMenu::AttachedToWindow
 *****************************************************************************/
void LanguageMenu::AttachedToWindow()
{
    BMenuItem * item;

    // remove all items
    while( ( item = RemoveItem( 0L ) ) )
    {
        delete item;
    }

    SetRadioMode( true );

    input_thread_t * p_input = (input_thread_t *)
            vlc_object_find( p_intf, VLC_OBJECT_INPUT, FIND_ANYWHERE );
    if( !p_input )
    {
        return;
    }

    vlc_value_t val_list, text_list;
    BMessage * message;
    int i_current;

    i_current = var_GetInteger( p_input, psz_variable );
    var_Change( p_input, psz_variable, VLC_VAR_GETLIST, &val_list, &text_list );
    for( int i = 0; i < val_list.p_list->i_count; i++ )
    {
        message = new BMessage( SELECT_CHANNEL );
        message->AddInt32( psz_variable, val_list.p_list->p_values[i].i_int );
        item = new BMenuItem( text_list.p_list->p_values[i].psz_string, message );
        if( val_list.p_list->p_values[i].i_int == i_current )
        {
            item->SetMarked( true );
        }
        AddItem( item );
    }
    var_FreeList( &val_list, &text_list );

    vlc_object_release( p_input );

    BMenu::AttachedToWindow();
}
Example #28
0
void __osd_MenuShow( vlc_object_t *p_this )
{
    osd_menu_t *p_osd = NULL;
    osd_button_t *p_button = NULL;
    vlc_value_t lockval;

    p_osd = vlc_object_find( p_this, VLC_OBJECT_OSDMENU, FIND_ANYWHERE );
    if( p_osd == NULL )
    {
        msg_Err( p_this, "osd_MenuNext failed" );
        return;
    }

    var_Get( p_this->p_libvlc, "osd_mutex", &lockval );
    vlc_mutex_lock( lockval.p_address );

#if defined(OSD_MENU_DEBUG)
    msg_Dbg( p_osd, "menu on" );
#endif
    p_button = p_osd->p_state->p_visible;
    if( p_button )
    {
        if( !p_button->b_range )
            p_button->p_current_state = osd_StateChange( p_button, OSD_BUTTON_UNSELECT );
        p_osd->p_state->p_visible = p_osd->p_button;

        if( !p_osd->p_state->p_visible->b_range )
            p_osd->p_state->p_visible->p_current_state =
                osd_StateChange( p_osd->p_state->p_visible, OSD_BUTTON_SELECT );

        osd_UpdateState( p_osd->p_state,
                p_osd->p_state->p_visible->i_x, p_osd->p_state->p_visible->i_y,
                p_osd->p_state->p_visible->p_current_state->i_width,
                p_osd->p_state->p_visible->p_current_state->i_height,
                p_osd->p_state->p_visible->p_current_state->p_pic );
        osd_SetMenuUpdate( p_osd, true );
    }
    osd_SetMenuVisible( p_osd, true );

    vlc_object_release( (vlc_object_t*) p_osd );
    vlc_mutex_unlock( lockval.p_address );
}
Example #29
0
/**
 * Display current audio volume bitmap
 *
 * The OSD Menu audio volume bar is updated to reflect the new audio volume. Call this function
 * when the audio volume is updated outside the OSD menu command "menu up", "menu down" or "menu select".
 */
void __osd_Volume( vlc_object_t *p_this )
{
    osd_menu_t *p_osd = NULL;
    osd_button_t *p_button = NULL;
    vlc_value_t lockval;
    int i_volume = 0;
    int i_steps = 0;

    p_osd = vlc_object_find( p_this, VLC_OBJECT_OSDMENU, FIND_ANYWHERE );
    if( p_osd == NULL )
    {
        msg_Err( p_this, "OSD menu volume update failed" );
        return;
    }

    if( p_osd->p_state && p_osd->p_state->p_volume )
    {
        var_Get( p_this->p_libvlc, "osd_mutex", &lockval );
        vlc_mutex_lock( lockval.p_address );

        p_button = p_osd->p_state->p_volume;
        if( p_osd->p_state->p_volume )
            p_osd->p_state->p_visible = p_osd->p_state->p_volume;
        if( p_button && p_button->b_range )
        {
            /* Update the volume state images to match the current volume */
            i_volume = config_GetInt( p_this, "volume" );
            i_steps = osd_VolumeStep( p_this, i_volume, p_button->i_ranges );
            p_button->p_current_state = osd_VolumeStateChange( p_button->p_states, i_steps );

            osd_UpdateState( p_osd->p_state,
                    p_button->i_x, p_button->i_y,
                    p_button->p_current_state->i_width,
                    p_button->p_current_state->i_height,
                    p_button->p_current_state->p_pic );
            osd_SetMenuUpdate( p_osd, true );
            osd_SetMenuVisible( p_osd, true );
        }
        vlc_mutex_unlock( lockval.p_address );
    }
    vlc_object_release( p_osd );
}
Example #30
0
/*****************************************************************************
 * Displays an OSD icon.
 * Types are: OSD_PLAY_ICON, OSD_PAUSE_ICON, OSD_SPEAKER_ICON, OSD_MUTE_ICON
 *****************************************************************************/
void vout_OSDIcon( vlc_object_t *p_caller, int i_channel, short i_type )
{
    vout_thread_t *p_vout = vlc_object_find( p_caller, VLC_OBJECT_VOUT,
                                             FIND_ANYWHERE );

    if( !p_vout ) return;

    if( config_GetInt( p_caller, "osd" ) )
    {
        osd_Icon( p_caller,
                  p_vout->p_spu,
                  p_vout->render.i_width,
                  p_vout->render.i_height,
                  p_vout->fmt_in.i_width - p_vout->fmt_in.i_visible_width
                                         - p_vout->fmt_in.i_x_offset,
                  p_vout->fmt_in.i_y_offset,
                  i_channel, i_type );
    }
    vlc_object_release( p_vout );
}