"Fossies" - the Fresh Open Source Software Archive

Member "audacious-plugins-3.10.1/src/console/M3u_Playlist.h" (26 Dec 2018, 1488 Bytes) of package /linux/misc/audacious-plugins-3.10.1.tar.bz2:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "M3u_Playlist.h" see the Fossies "Dox" file reference documentation.

    1 // M3U playlist file parser, with support for subtrack information
    2 
    3 // Game_Music_Emu 0.5.5
    4 #ifndef M3U_PLAYLIST_H
    5 #define M3U_PLAYLIST_H
    6 
    7 #include "blargg_common.h"
    8 #include "Data_Reader.h"
    9 
   10 class M3u_Playlist {
   11 public:
   12     // Load playlist data
   13     blargg_err_t load( const char* path );
   14     blargg_err_t load( Data_Reader& in );
   15     blargg_err_t load( void const* data, long size );
   16 
   17     // Line number of first parse error, 0 if no error. Any lines with parse
   18     // errors are ignored.
   19     int first_error() const { return first_error_; }
   20 
   21     struct info_t
   22     {
   23         const char* title;
   24         const char* composer;
   25         const char* engineer;
   26         const char* ripping;
   27         const char* tagging;
   28     };
   29     info_t const& info() const { return info_; }
   30 
   31     struct entry_t
   32     {
   33         const char* file; // filename without stupid ::TYPE suffix
   34         const char* type; // if filename has ::TYPE suffix, this will be "TYPE". "" if none.
   35         const char* name;
   36         bool decimal_track; // true if track was specified in hex
   37         // integers are -1 if not present
   38         int track;  // 1-based
   39         int length; // seconds
   40         int intro;
   41         int loop;
   42         int fade;
   43         int repeat; // count
   44     };
   45     entry_t const& operator [] ( int i ) const { return entries [i]; }
   46     int size() const { return entries.size(); }
   47 
   48     void clear();
   49 
   50 private:
   51     blargg_vector<entry_t> entries;
   52     blargg_vector<char> data;
   53     int first_error_;
   54     info_t info_;
   55 
   56     blargg_err_t parse();
   57     blargg_err_t parse_();
   58 };
   59 
   60 inline void M3u_Playlist::clear()
   61 {
   62     first_error_ = 0;
   63     entries.clear();
   64     data.clear();
   65 }
   66 
   67 #endif