TTKMusicPlayer  3.7.0.0
TTKMusicPlayer imitates Kugou UI, the music player uses of qmmp core library based on Qt for windows and linux
cueparser.h
Go to the documentation of this file.
1 /***************************************************************************
2  * Copyright (C) 2008-2024 by Ilya Kotov *
3  * forkotov02@ya.ru *
4  * *
5  * This program is free software; you can redistribute it and/or modify *
6  * it under the terms of the GNU General Public License as published by *
7  * the Free Software Foundation; either version 2 of the License, or *
8  * (at your option) any later version. *
9  * *
10  * This program is distributed in the hope that it will be useful, *
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13  * GNU General Public License for more details. *
14  * *
15  * You should have received a copy of the GNU General Public License *
16  * along with this program; if not, write to the *
17  * Free Software Foundation, Inc., *
18  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
19  ***************************************************************************/
20 
21 #ifndef CUEPARSER_H
22 #define CUEPARSER_H
23 
24 #include <QByteArray>
25 #include <QStringList>
26 #include <QTextCodec>
27 #include <QFileInfo>
28 #include "trackinfo.h"
29 
34 {
35 public:
39  CueParser() = default;
45  CueParser(const QByteArray &data, const QByteArray &codecName = QByteArray());
49  ~CueParser();
50 
56  void loadData(const QByteArray &data, const QByteArray &codecName = QByteArray());
62  void loadData(const QByteArray &data, QTextCodec *codec);
67  QList<TrackInfo*> createPlayList(int track = -1) const;
71  const QStringList &files() const;
75  qint64 offset(int track) const;
79  qint64 duration(int track) const;
83  QString file(int track) const;
87  QString url(int track) const;
91  int count() const;
95  bool isEmpty() const;
99  TrackInfo *info(int track) const;
105  void setDuration(const QString &file, qint64 duration);
110  void setDuration(qint64 duration);
116  void setProperties(const QString &file, const QMap<Qmmp::TrackProperty, QString> &properties);
121  void setProperties(const QMap<Qmmp::TrackProperty, QString> &properties);
128  void setMetaData(int track, Qmmp::MetaData key, const QVariant &value);
135  void setUrl(const QString &scheme, const QString &path);
139  void clear();
140 
141 private:
142  struct CUETrack
143  {
145  QString file;
146  qint64 offset = 0;
147  };
148 
149  QList<CUETrack *> m_tracks;
150  QStringList m_files;
151 
152  QStringList splitLine(const QString &line);
153  qint64 getLength(const QString &str);
154 
155 };
156 
157 #endif
static constexpr wchar_t key[]
voidpf uLong offset
Definition: ioapi.h:142
MetaData
Definition: qmmp.h:88
The TrackInfo class stores metadata and other information about track.
Definition: trackinfo.h:32
QStringList m_files
Definition: cueparser.h:150
#define QMMP_EXPORT
Definition: qmmp_export.h:29
The CueParser class provides CUE parser.
Definition: cueparser.h:33
QList< CUETrack * > m_tracks
Definition: cueparser.h:149