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

📄 b4s.c

📁 uclinux 下的vlc播放器源代码
💻 C
📖 第 1 页 / 共 2 页
字号:
                    {                        psz_mrl = strdup( psz_value );                    }                    else                    {                        msg_Warn( p_demux, "unexpected attribure %s in element %s",                                  psz_name, psz_elname );                    }                    free( psz_name );                    free( psz_value );                }                break;            }            case XML_READER_TEXT:            {                char *psz_text = xml_ReaderValue( p_xml_reader );                if( IsWhitespace( psz_text ) )                {                    free( psz_text );                    break;                }                if( !strcmp( psz_elname, "Name" ) )                {                    psz_name = strdup( psz_text );                }                else if( !strcmp( psz_elname, "Genre" ) )                {                    psz_genre = strdup( psz_text );                }                else if( !strcmp( psz_elname, "Nowplaying" ) )                {                    psz_now = strdup( psz_text );                }                else if( !strcmp( psz_elname, "Listeners" ) )                {                    psz_listeners = strdup( psz_text );                }                else if( !strcmp( psz_elname, "Bitrate" ) )                {                    psz_bitrate = strdup( psz_text );                }                else if( !strcmp( psz_elname, "" ) )                {                    ;                }                else                {                    msg_Warn( p_demux, "unexpected text in element '%s'",                              psz_elname );                }                free( psz_text );                break;            }            // End element            case XML_READER_ENDELEM:            {                // Read the element name                free( psz_elname );                psz_elname = xml_ReaderName( p_xml_reader );                if( !psz_elname ) return -1;                if( !strcmp( psz_elname, "entry" ) )                {                    p_item = playlist_ItemNew( p_playlist, psz_mrl, psz_name );                    if( psz_now )                    {                        vlc_input_item_AddInfo( &(p_item->input),                                                _(VLC_META_INFO_CAT),                                                _( VLC_META_NOW_PLAYING ),                                                "%s",                                                psz_now );                    }                    if( psz_genre )                    {                        vlc_input_item_AddInfo( &p_item->input,                                                _(VLC_META_INFO_CAT),                                                _( VLC_META_GENRE ),                                                "%s",                                                psz_genre );                    }                    if( psz_listeners )                    {                        vlc_input_item_AddInfo( &p_item->input,                                                _(VLC_META_INFO_CAT),                                                _( "Listeners" ),                                                "%s",                                                psz_listeners );                    }                    if( psz_bitrate )                    {                        vlc_input_item_AddInfo( &p_item->input,                                                _(VLC_META_INFO_CAT),                                                _( "Bitrate" ),                                                "%s",                                                psz_bitrate );                    }                    playlist_NodeAddItem( p_playlist, p_item,                                          p_current->pp_parents[0]->i_view,                                          p_current, PLAYLIST_APPEND,                                          PLAYLIST_END );                    /* We need to declare the parents of the node as the                     *                  * same of the parent's ones */                    playlist_CopyParents( p_current, p_item );                    vlc_input_item_CopyOptions( &p_current->input,                                                &p_item->input );                    if( b_shoutcast )                    {                        char *psz_genreToken;                        char *psz_otherToken;                        int i = 0;                        psz_genreToken = psz_genre;                        /* split up the combined genre string form                        shoutcast and add the individual genres */                        while ( psz_genreToken &&                          ( psz_otherToken = GetNextToken(psz_genreToken )))                        {                            if( strlen(psz_genreToken)>2 )                            /* We dont want genres below 2 letters,                            this gets rid of alot of junk*/                            {                                /* lowercase everything */                                for( i=0; psz_genreToken[i]!=0; i++ )                                    psz_genreToken[i] =                                        tolower(psz_genreToken[i]);                /* Make first letter uppercase, purely cosmetical */                                psz_genreToken[0] =                                    toupper( psz_genreToken[0] );                                ShoutcastAdd( p_playlist, p_genre,                                              p_bitrate, p_item,                                              psz_genreToken, psz_bitrate );                                psz_genreToken = psz_otherToken;                            }                        }                    }#define FREE(a) if( a ) free( a ); a = NULL;                    FREE( psz_name );                    FREE( psz_mrl );                    FREE( psz_genre );                    FREE( psz_bitrate );                    FREE( psz_listeners );                    FREE( psz_now );#undef FREE                }                free( psz_elname );                psz_elname = strdup("");                break;            }        }    }    if( i_ret != 0 )    {        msg_Warn( p_demux, "error while parsing data" );    }    if( b_shoutcast )    {        vlc_mutex_lock( &p_playlist->object_lock );        playlist_NodeSort( p_playlist, p_bitrate, SORT_TITLE_NUMERIC, ORDER_NORMAL );        vlc_mutex_unlock( &p_playlist->object_lock );    }    /* Go back and play the playlist */    if( b_play && p_playlist->status.p_item &&        p_playlist->status.p_item->i_children > 0 )    {        playlist_Control( p_playlist, PLAYLIST_VIEWPLAY,                          p_playlist->status.i_view,                          p_playlist->status.p_item,                          p_playlist->status.p_item->pp_children[0] );    }        vlc_object_release( p_playlist );    p_sys->p_playlist = NULL;    return VLC_SUCCESS;}static int Control( demux_t *p_demux, int i_query, va_list args ){    return VLC_EGENERIC;}/** * Get a in-string pointer to the start of the next token from a * string terminating the pointer returned by a previous call. * * \param psz_cur_string The string to search for the token from * \return a pointer to withing psz_cur_string, or NULL if no token * was found * \note The returned pointer may contain more than one * token, Run GetNextToken once more to terminate the token properly */static char *GetNextToken(char *psz_cur_string) {    while (*psz_cur_string && !isspace(*psz_cur_string))        psz_cur_string++;    if (!*psz_cur_string)        return NULL;    *psz_cur_string++ = '\0';    while (*psz_cur_string && isspace(*psz_cur_string))        psz_cur_string++;    return psz_cur_string;}static int IsWhitespace( char *psz_string ){    while( *psz_string )    {        if( *psz_string != ' ' && *psz_string != '\t' && *psz_string != '\r' &&            *psz_string != '\n' )        {            return VLC_FALSE;        }        psz_string++;    }    return VLC_TRUE;}static void ShoutcastAdd( playlist_t *p_playlist, playlist_item_t* p_genre,                          playlist_item_t *p_bitrate, playlist_item_t *p_item,                          char *psz_genre, char *psz_bitrate ){    playlist_item_t *p_parent;    if( psz_bitrate )    {        playlist_item_t *p_copy = playlist_ItemCopy(p_playlist,p_item);        p_parent = playlist_ChildSearchName( p_bitrate, psz_bitrate );        if( !p_parent )        {            p_parent = playlist_NodeCreate( p_playlist, p_genre->pp_parents[0]->i_view, psz_bitrate,                                            p_bitrate );            playlist_CopyParents( p_bitrate, p_parent );        }        playlist_NodeAddItem( p_playlist, p_copy, p_parent->pp_parents[0]->i_view, p_parent, PLAYLIST_APPEND, PLAYLIST_END  );        playlist_CopyParents( p_parent, p_copy );    }    if( psz_genre )    {        playlist_item_t *p_copy = playlist_ItemCopy(p_playlist,p_item);        p_parent = playlist_ChildSearchName( p_genre, psz_genre );        if( !p_parent )        {            p_parent = playlist_NodeCreate( p_playlist, p_genre->pp_parents[0]->i_view, psz_genre,                                            p_genre );            playlist_CopyParents( p_genre, p_parent );        }        playlist_NodeAddItem( p_playlist, p_copy, p_parent->pp_parents[0]->i_view, p_parent, PLAYLIST_APPEND, PLAYLIST_END );        playlist_CopyParents( p_parent, p_copy );    }}

⌨️ 快捷键说明

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