zoukankan      html  css  js  c++  java
  • vlc 的代码里面只有解析 标准 m3u 文件的代码

    //Open and parse a M3U file:
    int M3U_open(char *fileName){
        FILE *f;
        char lineText[512];
        char chrLength[20];
        char title[264];
        struct M3U_songEntry *singleEntry;
        int playListCount = lPlayList.songCount;
     
        f = fopen(fileName, "rt");
        if (f == NULL){
            //Error opening file:
            return(-1);
        }
     
        while(fgets(lineText, 256, f) != NULL){
            if (!strncmp(lineText, "#EXTINF:", 8)){
                //Length and title:
                splitSongInfo(lineText, chrLength, title);
            }else if (!strncmp(lineText, "#EXTM3U", 7)){
                //Nothing to do. :)
            }else if (strlen(lineText) > 2){
                //Store song info:
                singleEntry = &lPlayList.songs[playListCount++];
                strncpy(singleEntry->fileName, lineText, 263);
                singleEntry->fileName[263] = '\0';
                if ((int)singleEntry->fileName[strlen(singleEntry->fileName) - 1] == 10 || (int)singleEntry->fileName[strlen(singleEntry->fileName) - 1] == 13 ){
                    singleEntry->fileName[strlen(singleEntry->fileName) - 1] = '\0';
                }
                if ((int)singleEntry->fileName[strlen(singleEntry->fileName) - 1] == 10 || (int)singleEntry->fileName[strlen(singleEntry->fileName) - 1] == 13 ){
                    singleEntry->fileName[strlen(singleEntry->fileName) - 1] = '\0';
                }
     
                if (strlen(title)){
                    strncpy(singleEntry->title, title, 263);
                }else{
                    getFileName(singleEntry->fileName, singleEntry->title);
                }
                singleEntry->title[263] = '\0';
                singleEntry->length = atoi(chrLength);
                if (playListCount == MAX_SONGS){
                    break;
                }
            }
        }
        fclose(f);
     
        lPlayList.modified = 0;
        lPlayList.songCount = playListCount;
        strcpy(lPlayList.fileName, fileName);
        return(0);
    }
  • 相关阅读:
    vue vue-canvas-poster 生成海报
    vue 移动端拖曳指令
    小程序如何调起H5页面的支付
    vue H5微信支付代码
    java8的新特性
    java前端知识点整理
    java基础知识点整理
    ArcGis中地理数据库(sde)中概念及常见函数
    使用Arcgis时,在sde空间库常用的相关函数
    CentOS7虚拟机的网络模式-桥接模式配置
  • 原文地址:https://www.cnblogs.com/canphp/p/2788754.html
Copyright © 2011-2022 走看看