⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pda.c

📁 video linux conference
💻 C
📖 第 1 页 / 共 2 页
字号:
    /* END OF PLAYLIST GTK_TREE_VIEW */    /* Hide the Preference TAB for now. */    GtkWidget *p_preference_tab = NULL;    p_preference_tab = gtk_notebook_get_nth_page(p_intf->p_sys->p_notebook,5);    if (p_preference_tab != NULL)      gtk_widget_hide(p_preference_tab);    /* Show the control window */    gtk_widget_show( p_intf->p_sys->p_window );#ifdef NEED_GTK2_MAIN    msg_Dbg( p_intf, "Manage GTK keyboard events using threads" );    while( !p_intf->b_die )    {        Manage( p_intf );        /* Sleep to avoid using all CPU - since some interfaces need to         * access keyboard events, a 100ms delay is a good compromise */        gdk_threads_leave();        if (p_intf->p_libvlc->i_cpu & CPU_CAPABILITY_FPU)            msleep( INTF_IDLE_SLEEP );        else            msleep( 1000 );        gdk_threads_enter();    }#else    msg_Dbg( p_intf, "Manage GTK keyboard events using timeouts" );    /* Sleep to avoid using all CPU - since some interfaces needs to access     * keyboard events, a 1000ms delay is a good compromise */    if (p_intf->p_libvlc->i_cpu & CPU_CAPABILITY_FPU)        i_dummy = gtk_timeout_add( INTF_IDLE_SLEEP / 1000, (GtkFunction)Manage, p_intf );    else        i_dummy = gtk_timeout_add( 1000, (GtkFunction)Manage, p_intf );    /* Enter Gtk mode */    gtk_main();    /* Remove the timeout */    gtk_timeout_remove( i_dummy );#endif    gtk_object_destroy( GTK_OBJECT(p_intf->p_sys->p_window) );#ifdef NEED_GTK2_MAIN    gdk_threads_leave();#endif}/***************************************************************************** * GtkAutoplayFile: Autoplay file depending on configuration settings *****************************************************************************/void GtkAutoPlayFile( vlc_object_t *p_this ){    GtkWidget *cbautoplay;    intf_thread_t *p_intf;    int i_index;    vlc_list_t *p_list = vlc_list_find( p_this, VLC_OBJECT_INTF,                                        FIND_ANYWHERE );    for( i_index = 0; i_index < p_list->i_count; i_index++ )    {        p_intf = (intf_thread_t *)p_list->p_values[i_index].p_object ;        if( strcmp( MODULE_STRING, p_intf->p_module->psz_object_name ) )        {            continue;        }        cbautoplay = GTK_WIDGET( gtk_object_get_data(                            GTK_OBJECT( p_intf->p_sys->p_window ),                            "cbautoplay" ) );        if( !config_GetInt( p_this, "pda-autoplayfile" ) )        {            p_intf->p_sys->b_autoplayfile = VLC_FALSE;        }        else        {            p_intf->p_sys->b_autoplayfile = VLC_TRUE;        }        gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( cbautoplay ),                                      p_intf->p_sys->b_autoplayfile );    }    vlc_list_release( p_list );}/* following functions are local *//***************************************************************************** * Manage: manage main thread messages ***************************************************************************** * In this function, called approx. 10 times a second, we check what the * main program wanted to tell us. *****************************************************************************/static int Manage( intf_thread_t *p_intf ){    GtkListStore *p_liststore;    vlc_mutex_lock( &p_intf->change_lock );    /* Update the input */    if( p_intf->p_sys->p_input == NULL )    {        p_intf->p_sys->p_input = vlc_object_find( p_intf, VLC_OBJECT_INPUT,                                                          FIND_ANYWHERE );    }    else if( p_intf->p_sys->p_input->b_dead )    {        vlc_object_release( p_intf->p_sys->p_input );        p_intf->p_sys->p_input = NULL;    }    if( p_intf->p_sys->p_input )    {        input_thread_t *p_input = p_intf->p_sys->p_input;        vlc_mutex_lock( &p_input->object_lock );        if( !p_input->b_die )        {            {                playlist_t *p_playlist;                E_(GtkModeManage)( p_intf );                p_intf->p_sys->b_playing = 1;                /* update playlist interface */                p_playlist = (playlist_t *) vlc_object_find(                        p_intf, VLC_OBJECT_PLAYLIST, FIND_ANYWHERE );                if (p_playlist != NULL)                {                    p_liststore = gtk_list_store_new (3,                                               G_TYPE_STRING,                                               G_TYPE_STRING,                                               G_TYPE_UINT);  /* Hidden index */                    PlaylistRebuildListStore(p_liststore, p_playlist);                    gtk_tree_view_set_model(p_intf->p_sys->p_tvplaylist, (GtkTreeModel*) p_liststore);                    g_object_unref(p_liststore);                    vlc_object_release( p_playlist );                }            }            /* Manage the slider */#if 0#define p_area p_input->p_selected_area            if (p_intf->p_libvlc->i_cpu & CPU_CAPABILITY_FPU)            {                /* Manage the slider for CPU_CAPABILITY_FPU hardware */                if( p_intf->p_sys->b_playing )                {                    float newvalue = p_intf->p_sys->p_adj->value;                    /* If the user hasn't touched the slider since the last time,                     * then the input can safely change it */                    if( newvalue == p_intf->p_sys->f_adj_oldvalue )                    {                        /* Update the value */                        p_intf->p_sys->p_adj->value =                        p_intf->p_sys->f_adj_oldvalue =                            ( 100. * p_area->i_tell ) / p_area->i_size;                        g_signal_emit_by_name( GTK_OBJECT( p_intf->p_sys->p_adj ),                                                 "value_changed" );                    }                    /* Otherwise, send message to the input if the user has                     * finished dragging the slider */                    else if( p_intf->p_sys->b_slider_free )                    {                        double f_pos = (double)newvalue / 100.0;                        /* release the lock to be able to seek */                        vlc_mutex_unlock( &p_input->object_lock );                        var_SetFloat( p_input, "position", f_pos );                        vlc_mutex_lock( &p_input->object_lock );                        /* Update the old value */                        p_intf->p_sys->f_adj_oldvalue = newvalue;                    }                }            }            else            {                /* Manage the slider without CPU_CAPABILITY_FPU hardware */                if( p_intf->p_sys->b_playing )                {                    off_t newvalue = p_intf->p_sys->p_adj->value;                    /* If the user hasn't touched the slider since the last time,                     * then the input can safely change it */                    if( newvalue == p_intf->p_sys->i_adj_oldvalue )                    {                        /* Update the value */                        p_intf->p_sys->p_adj->value =                        p_intf->p_sys->i_adj_oldvalue =                            ( 100 * p_area->i_tell ) / p_area->i_size;                        g_signal_emit_by_name( GTK_OBJECT( p_intf->p_sys->p_adj ),                                                 "value_changed" );                    }                    /* Otherwise, send message to the input if the user has                     * finished dragging the slider */                    else if( p_intf->p_sys->b_slider_free )                    {                        double f_pos = (double)newvalue / 100.0;                        /* release the lock to be able to seek */                        vlc_mutex_unlock( &p_input->object_lock );                        var_SetFloat( p_input, "position", f_pos );                        vlc_mutex_lock( &p_input->object_lock );                        /* Update the old value */                        p_intf->p_sys->i_adj_oldvalue = newvalue;                    }                }            }#undef p_area#endif        }        vlc_mutex_unlock( &p_input->object_lock );    }    else if( p_intf->p_sys->b_playing && !p_intf->b_die )    {        E_(GtkModeManage)( p_intf );        p_intf->p_sys->b_playing = 0;    }#ifndef NEED_GTK2_MAIN    if( p_intf->b_die )    {        vlc_mutex_unlock( &p_intf->change_lock );        /* Prepare to die, young Skywalker */        gtk_main_quit();        return FALSE;    }#endif    vlc_mutex_unlock( &p_intf->change_lock );    return TRUE;}/***************************************************************************** * GtkDisplayDate: display stream date ***************************************************************************** * This function displays the current date related to the position in * the stream. It is called whenever the slider changes its value. * The lock has to be taken before you call the function. *****************************************************************************/void E_(GtkDisplayDate)( GtkAdjustment *p_adj, gpointer userdata ){    intf_thread_t *p_intf;    p_intf = (intf_thread_t*) userdata;    if (p_intf == NULL)        return;    if( p_intf->p_sys->p_input )    {        char psz_time[ MSTRTIME_MAX_SIZE ];        int64_t i_seconds;        i_seconds = var_GetTime( p_intf->p_sys->p_input, "time" ) / I64C(1000000 );        secstotimestr( psz_time, i_seconds );        gtk_label_set_text( GTK_LABEL( p_intf->p_sys->p_slider_label ),                            psz_time );     }}/***************************************************************************** * GtkModeManage: actualize the aspect of the interface whenever the input *                changes. ***************************************************************************** * The lock has to be taken before you call the function. *****************************************************************************/gint E_(GtkModeManage)( intf_thread_t * p_intf ){    GtkWidget *     p_slider = NULL;    vlc_bool_t      b_control;    if ( p_intf->p_sys->p_window == NULL )        msg_Err( p_intf, "Main widget not found" );    p_slider = lookup_widget( p_intf->p_sys->p_window, "timeSlider");    if (p_slider == NULL)        msg_Err( p_intf, "Slider widget not found" );    /* controls unavailable */    b_control = 0;    /* show the box related to current input mode */    if( p_intf->p_sys->p_input )    {        /* initialize and show slider for seekable streams */        {            gtk_widget_show( GTK_WIDGET( p_slider ) );        }        /* control buttons for free pace streams */        b_control = p_intf->p_sys->p_input->b_can_pace_control;        msg_Dbg( p_intf, "stream has changed, refreshing interface" );    }    /* set control items */    gtk_widget_set_sensitive( lookup_widget( p_intf->p_sys->p_window, "tbRewind"), b_control );    gtk_widget_set_sensitive( lookup_widget( p_intf->p_sys->p_window, "tbPause"), b_control );    gtk_widget_set_sensitive( lookup_widget( p_intf->p_sys->p_window, "tbForward"), b_control );    return TRUE;}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -