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

📄 asx.c

📁 VLC Player Source Code
💻 C
📖 第 1 页 / 共 2 页
字号:
                    psz_parse += 9;                else continue;            }            else if( !strncasecmp( psz_parse, "<PREVIEWDURATION", 16 ) ||                     !strncasecmp( psz_parse, "<LOGURL", 7 ) ||                     !strncasecmp( psz_parse, "<Skin", 5 ) )            {                /* We skip this element */                if( ( psz_parse = strcasestr( psz_parse, "/>" ) ) )                    psz_parse += 2;                else continue;            }            else if( !strncasecmp( psz_parse, "<BASE ", 6 ) )            {                psz_parse = SkipBlanks(psz_parse+6, (unsigned)-1);                if( !strncasecmp( psz_parse, "HREF", 4 ) )                {                    if( ( psz_parse = strcasestr( psz_parse, "\"" ) ) )                    {                        psz_backup = ++psz_parse;                        if( ( psz_parse = strcasestr( psz_parse, "\"" ) ) )                        {                            StoreString( p_demux, (b_entry ? &psz_base_entry : &psz_base_asx), psz_backup, psz_parse );                        }                        else continue;                    }                    else continue;                }                if( ( psz_parse = strcasestr( psz_parse, "/>" ) ) )                    psz_parse += 2;                else continue;            }            else if( !strncasecmp( psz_parse, "<TITLE>", 7 ) )            {                psz_backup = psz_parse+=7;                if( ( psz_parse = strcasestr( psz_parse, "</TITLE>" ) ) )                {                    StoreString( p_demux, (b_entry ? &psz_title_entry : &psz_title_asx), psz_backup, psz_parse );                    psz_parse += 8;                }                else continue;            }            else if( !strncasecmp( psz_parse, "<Author>", 8 ) )            {                psz_backup = psz_parse+=8;                if( ( psz_parse = strcasestr( psz_parse, "</Author>" ) ) )                {                    StoreString( p_demux, (b_entry ? &psz_artist_entry : &psz_artist_asx), psz_backup, psz_parse );                    psz_parse += 9;                }                else continue;            }            else if( !strncasecmp( psz_parse, "<Copyright", 10 ) )            {                psz_backup = psz_parse+=11;                if( ( psz_parse = strcasestr( psz_parse, "</Copyright>" ) ) )                {                    StoreString( p_demux, (b_entry ? &psz_copyright_entry : &psz_copyright_asx), psz_backup, psz_parse );                    psz_parse += 12;                }                else continue;            }            else if( !strncasecmp( psz_parse, "<MoreInfo ", 10 ) )            {                psz_parse = SkipBlanks(psz_parse+10, (unsigned)-1);                if( !strncasecmp( psz_parse, "HREF", 4 ) )                {                    if( ( psz_parse = strcasestr( psz_parse, "\"" ) ) )                    {                        psz_backup = ++psz_parse;                        if( ( psz_parse = strcasestr( psz_parse, "\"" ) ) )                        {                            StoreString( p_demux, (b_entry ? &psz_moreinfo_entry : &psz_moreinfo_asx), psz_backup, psz_parse );                        }                        else continue;                    }                    else continue;                }                if( ( psz_parse = strcasestr( psz_parse, "/>" ) ) )                    psz_parse += 2;                else continue;            }            else if( !strncasecmp( psz_parse, "<ABSTRACT>", 10 ) )            {                psz_backup = psz_parse+=10;                if( ( psz_parse = strcasestr( psz_parse, "</ABSTRACT>" ) ) )                {                    StoreString( p_demux, (b_entry ? &psz_abstract_entry : &psz_abstract_asx), psz_backup, psz_parse );                    psz_parse += 11;                }                else continue;            }            else if( !strncasecmp( psz_parse, "<EntryRef ", 10 ) )            {                psz_parse = SkipBlanks(psz_parse+10, (unsigned)-1);                if( !strncasecmp( psz_parse, "HREF", 4 ) )                {                    if( ( psz_parse = strcasestr( psz_parse, "\"" ) ) )                    {                        psz_backup = ++psz_parse;                        if( ( psz_parse = strcasestr( psz_parse, "\"" ) ) )                        {                            i_strlen = psz_parse-psz_backup;                            if( i_strlen < 1 ) continue;                            psz_string = malloc( i_strlen*sizeof( char ) +1);                            memcpy( psz_string, psz_backup, i_strlen );                            psz_string[i_strlen] = '\0';                            input_item_t *p_input;                            p_input = input_item_New( p_demux, psz_string, psz_title_asx );                            input_item_CopyOptions( p_current_input, p_input );                            input_item_AddSubItem( p_current_input, p_input );                            vlc_gc_decref( p_input );                            free( psz_string );                        }                        else continue;                    }                    else continue;                }                if( ( psz_parse = strcasestr( psz_parse, "/>" ) ) )                    psz_parse += 2;                else continue;            }            else if( !strncasecmp( psz_parse, "</Entry>", 8 ) )            {                input_item_t *p_entry = NULL;                char *psz_name = NULL;                char * ppsz_options[2];                int i_options = 0;                /* add a new entry */                psz_parse+=8;                if( !b_entry )                {                    msg_Err( p_demux, "end of entry without start?" );                    continue;                }                if( !psz_href )                {                    msg_Err( p_demux, "entry without href?" );                    continue;                }                if( p_sys->b_skip_ads && b_skip_entry )                {                    msg_Dbg( p_demux, "skipped entry %d %s (%s)",                    i_entry_count, ( psz_title_entry ? psz_title_entry : p_current_input->psz_name ), psz_href );                }                else                {                    if( i_starttime || i_duration )                    {                        if( i_starttime ) {                            asprintf(ppsz_options+i_options, ":start-time=%d", i_starttime);                            ++i_options;                        }                        if( i_duration ) {                            asprintf(ppsz_options+i_options, ":stop-time=%d", i_starttime + i_duration);                            ++i_options;                        }                    }                    /* create the new entry */                    asprintf( &psz_name, "%d %s", i_entry_count, ( psz_title_entry ? psz_title_entry : p_current_input->psz_name ) );                    p_entry = input_item_NewExt( p_demux, psz_href, psz_name, i_options, (const char * const *)ppsz_options, -1 );                    FREENULL( psz_name );                    input_item_CopyOptions( p_current_input, p_entry );                    while( i_options )                    {                        psz_name = ppsz_options[--i_options];                        FREENULL(psz_name);                    }                    if( psz_title_entry ) input_item_SetTitle( p_entry, psz_title_entry );                    if( psz_artist_entry ) input_item_SetArtist( p_entry, psz_artist_entry );                    if( psz_copyright_entry ) input_item_SetCopyright( p_entry, psz_copyright_entry );                    if( psz_moreinfo_entry ) input_item_SetURL( p_entry, psz_moreinfo_entry );                    if( psz_abstract_entry ) input_item_SetDescription( p_entry, psz_abstract_entry );                    input_item_AddSubItem( p_current_input, p_entry );                    vlc_gc_decref( p_entry );                }                /* cleanup entry */;                FREENULL( psz_href );                FREENULL( psz_title_entry );                FREENULL( psz_base_entry );                FREENULL( psz_artist_entry );                FREENULL( psz_copyright_entry );                FREENULL( psz_moreinfo_entry );                FREENULL( psz_abstract_entry );                b_entry = false;            }            else if( !strncasecmp( psz_parse, "<Entry", 6 ) )            {                char *psz_clientskip;                psz_parse+=6;                if( b_entry )                {                    msg_Err( p_demux, "We already are in an entry section" );                    continue;                }                i_entry_count += 1;                b_entry = true;                psz_clientskip = strcasestr( psz_parse, "clientskip=\"no\"" );                psz_parse = strcasestr( psz_parse, ">" );                /* If clientskip was enabled ... this is an ad */                b_skip_entry = (NULL != psz_clientskip) && (psz_clientskip < psz_parse);                // init entry details                FREENULL(psz_href);                psz_href = NULL;                i_starttime = 0;                i_duration = 0;            }            else if( !strncasecmp( psz_parse, "<Ref ", 5 ) )            {                psz_parse = SkipBlanks(psz_parse+5, (unsigned)-1);                if( !b_entry )                {                    msg_Err( p_demux, "A ref outside an entry section" );                    continue;                }                if( !strncasecmp( psz_parse, "HREF", 4 ) )                {                    if( ( psz_parse = strcasestr( psz_parse, "\"" ) ) )                    {                        psz_backup = ++psz_parse;                        psz_backup = SkipBlanks(psz_backup, (unsigned)-1);                        if( ( psz_parse = strcasestr( psz_parse, "\"" ) ) )                        {                            char *psz_tmp;                            i_strlen = psz_parse-psz_backup;                            if( i_strlen < 1 ) continue;                            FREENULL(psz_href);                            psz_href = malloc( i_strlen*sizeof( char ) +1);                            memcpy( psz_href, psz_backup, i_strlen );                            psz_href[i_strlen] = '\0';                            psz_tmp = psz_href + (i_strlen-1);                            while( psz_tmp >= psz_href &&                                 ( *psz_tmp == '\r' || *psz_tmp == '\n' ) )                            {                                *psz_tmp = '\0';                                psz_tmp++;                            }                        }                        else continue;                    }                    else continue;                }                if( ( psz_parse = strcasestr( psz_parse, ">" ) ) )                    psz_parse++;                else continue;            }            else if( !strncasecmp( psz_parse, "<starttime ", 11 ) )            {                psz_parse = SkipBlanks(psz_parse+11, (unsigned)-1);                if( !b_entry )                {                    msg_Err( p_demux, "starttime outside an entry section" );                    continue;                }                if( !strncasecmp( psz_parse, "value", 5 ) )                {                    if( ( psz_parse = strcasestr( psz_parse, "\"" ) ) )                    {                        psz_backup = ++psz_parse;                        if( ( psz_parse = strcasestr( psz_parse, "\"" ) ) )                        {                            i_strlen = psz_parse-psz_backup;                            if( i_strlen < 1 ) continue;                            i_starttime = ParseTime(psz_backup, i_strlen);                        }                        else continue;                    }                    else continue;                }                if( ( psz_parse = strcasestr( psz_parse, ">" ) ) )                    psz_parse++;                else continue;            }            else if( !strncasecmp( psz_parse, "<duration ", 11 ) )            {                psz_parse = SkipBlanks(psz_parse+5, (unsigned)-1);                if( !b_entry )                {                    msg_Err( p_demux, "duration outside an entry section" );                    continue;                }                if( !strncasecmp( psz_parse, "value", 5 ) )                {                    if( ( psz_parse = strcasestr( psz_parse, "\"" ) ) )                    {                        psz_backup = ++psz_parse;                        if( ( psz_parse = strcasestr( psz_parse, "\"" ) ) )                        {                            i_strlen = psz_parse-psz_backup;                            if( i_strlen < 1 ) continue;                            i_duration = ParseTime(psz_backup, i_strlen);                        }                        else continue;                    }                    else continue;                }                if( ( psz_parse = strcasestr( psz_parse, ">" ) ) )                    psz_parse++;                else continue;            }            else if( !strncasecmp( psz_parse, "</ASX", 5 ) )            {                if( psz_title_asx ) input_item_SetTitle( p_current_input, psz_title_asx );                if( psz_artist_asx ) input_item_SetArtist( p_current_input, psz_artist_asx );                if( psz_copyright_asx ) input_item_SetCopyright( p_current_input, psz_copyright_asx );                if( psz_moreinfo_asx ) input_item_SetURL( p_current_input, psz_moreinfo_asx );                if( psz_abstract_asx ) input_item_SetDescription( p_current_input, psz_abstract_asx );                FREENULL( psz_base_asx );                FREENULL( psz_title_asx );                FREENULL( psz_artist_asx );                FREENULL( psz_copyright_asx );                FREENULL( psz_moreinfo_asx );                FREENULL( psz_abstract_asx );                psz_parse++;            }            else psz_parse++;        }#if 0/* FIXME Unsupported elements */            PARAM            EVENT            REPEAT            ENDMARK            STARTMARK#endif    }    HANDLE_PLAY_AND_RELEASE;    return 0; /* Needed for correct operation of go back */}static int Control( demux_t *p_demux, int i_query, va_list args ){    VLC_UNUSED(p_demux); VLC_UNUSED(i_query); VLC_UNUSED(args);    return VLC_EGENERIC;}

⌨️ 快捷键说明

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