TTKMusicPlayer  4.3.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-2026 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 <QFileInfo>
27 #include "trackinfo.h"
28 
29 class QmmpTextCodec;
30 
35 {
36 public:
40  CueParser() = default;
46  CueParser(const QByteArray &data, const QByteArray &codecName = QByteArray());
50  ~CueParser();
51 
57  void loadData(const QByteArray &data, const QByteArray &codecName = "UTF-8");
63  void loadData(const QByteArray &data, QmmpTextCodec *codec);
68  QList<TrackInfo*> createPlayList(int track = -1) const;
72  const QStringList &files() const;
76  qint64 offset(int track) const;
80  qint64 duration(int track) const;
84  QString file(int track) const;
88  QString url(int track) const;
92  int count() const;
96  bool isEmpty() const;
100  const TrackInfo *info(int track) const;
106  void setDuration(const QString &file, qint64 duration);
111  void setDuration(qint64 duration);
117  void setProperties(const QString &file, const QMap<Qmmp::TrackProperty, QString> &properties);
122  void setProperties(const QMap<Qmmp::TrackProperty, QString> &properties);
129  void setMetaData(int track, Qmmp::MetaData key, const QVariant &value);
136  void setUrl(const QString &scheme, const QString &path);
140  void clear();
141 
142 private:
143  struct CUETrack
144  {
146  QString file;
147  qint64 offset = 0;
148  };
149 
150  QList<CUETrack *> m_tracks;
151  QStringList m_files;
152 
153  QStringList splitLine(const QString &line);
154  qint64 getLength(const QString &str);
155 
156 };
157 
158 #endif
voidpf uLong offset
Definition: ioapi.h:142
MetaData
Definition: qmmp.h:107
The TrackInfo class stores metadata and other information about track.
Definition: trackinfo.h:32
static constexpr wchar_t key[]
QStringList m_files
Definition: cueparser.h:151
The QmmpTextCodec class provides text encoding conversion.
Definition: qmmptextcodec.h:33
#define QMMP_EXPORT
Definition: qmmp_export.h:29
The CueParser class provides CUE parser.
Definition: cueparser.h:34
QList< CUETrack * > m_tracks
Definition: cueparser.h:150