本文整理汇总了C++中MediaInfo::setCueStartIndex方法的典型用法代码示例。如果您正苦于以下问题:C++ MediaInfo::setCueStartIndex方法的具体用法?C++ MediaInfo::setCueStartIndex怎么用?C++ MediaInfo::setCueStartIndex使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MediaInfo
的用法示例。
在下文中一共展示了MediaInfo::setCueStartIndex方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: load
void CUEParser::load() {
QTime timeElapsed;
timeElapsed.start();
_stop = false;
QList<MediaInfo> files;
qDebug() << __FUNCTION__ << "Playlist:" << _filename;
//See http://regexlib.com/DisplayPatterns.aspx
//REM GENRE "Alternative rock"
//REM GENRE Pop
static QRegExp rx_genre("^REM GENRE (.*)$");
//REM DATE 1994
static QRegExp rx_date("^REM DATE (\\d+)$");
//PERFORMER "Weezer"
static QRegExp rx_root_performer("^PERFORMER \"(.*)\"$");
//TITLE "Weezer (The Blue Album)"
static QRegExp rx_root_title("^TITLE \"(.*)\"$");
//FILE "01. My Name Is Jonas - [Weezer] .wav" WAVE
static QRegExp rx_file("^FILE \"(.*)\"");
// TRACK 01 AUDIO
static QRegExp rx_track("^ TRACK (\\d+)");
// TITLE "No One Else"
static QRegExp rx_title("^ TITLE \"(.*)\"$");
// PERFORMER "Weezer"
static QRegExp rx_performer("^ PERFORMER \"(.*)\"$");
// INDEX 01 00:00:00
static QRegExp rx_index("^ INDEX 01 (.*)$");
QFile file(_filename);
if (file.open(QIODevice::ReadOnly)) {
QString path(QFileInfo(_filename).path());
QTextStream stream(&file);
MediaInfo mediaInfo;
//Root elements
QString genre;
QString date;
QString albumArtist;
QString album;
///
QString filename;
while (!stream.atEnd() && !_stop) {
//Line of text, don't use trimmed()
//since CUE sheet files contain indentation spaces
QString line(stream.readLine());
if (line.isEmpty()) {
//Do nothing
}
else if (rx_genre.indexIn(line) != -1) {
genre = rx_genre.cap(1);
}
else if (rx_date.indexIn(line) != -1) {
date = rx_date.cap(1);
}
else if (rx_root_performer.indexIn(line) != -1) {
albumArtist = rx_root_performer.cap(1);
}
else if (rx_root_title.indexIn(line) != -1) {
album = rx_root_title.cap(1);
}
else if (rx_file.indexIn(line) != -1) {
filename = rx_file.cap(1);
}
else if (rx_track.indexIn(line) != -1) {
QString track(rx_track.cap(1));
mediaInfo.insertMetadata(MediaInfo::TrackNumber, track);
}
else if (rx_title.indexIn(line) != -1) {
QString title(rx_title.cap(1));
mediaInfo.insertMetadata(MediaInfo::Title, title);
}
else if (rx_performer.indexIn(line) != -1) {
QString performer(rx_performer.cap(1));
mediaInfo.insertMetadata(MediaInfo::Artist, performer);
}
else if (rx_index.indexIn(line) != -1) {
QString index(rx_index.cap(1));
mediaInfo.setCueStartIndex(index);
if (!files.isEmpty()) {
//Now we know the CUE end index from the previous media
files.last().setCueEndIndex(index);
//.........这里部分代码省略.........
示例2: readTrack
//.........这里部分代码省略.........
//Comment
else if (element == XSPF_ANNOTATION) {
QString annotation(xml.readElementText());
if (mediaInfo.metadataValue(MediaInfo::Title).isEmpty()) {
//Some people didn't understand how XSPF works
//and confused annotation with title
mediaInfo.insertMetadata(MediaInfo::Title, annotation);
}
mediaInfo.insertMetadata(MediaInfo::Comment, annotation);
}
//Length
else if (element == XSPF_DURATION) {
int duration = xml.readElementText().toInt();
//XSPF gives us the duration in milliseconds
//Let's convert it to seconds
mediaInfo.setLength(duration / 1000);
}
//Album art URL
else if (element == XSPF_IMAGE) {
QString image(xml.readElementText());
//FIXME not implemented yet
//mediaInfo.insertMetadata(MediaInfo::AlbumArt, image);
}
//URL of the original web page
else if (element == XSPF_INFO) {
QString info(xml.readElementText());
mediaInfo.insertMetadata(MediaInfo::URL, info);
}
//Meta
else if (element == XSPF_META) {
//These tags are specific to foobar2000 XSPF plugin
QXmlStreamAttributes attributes = xml.attributes();
//Date
if (attributes.hasAttribute(XSPF_FOOBAR2000_DATE)) {
QString date(attributes.value(XSPF_FOOBAR2000_DATE).toString());
mediaInfo.insertMetadata(MediaInfo::Year, date);
}
//Genre
else if (attributes.hasAttribute(XSPF_FOOBAR2000_GENRE)) {
QString genre(attributes.value(XSPF_FOOBAR2000_GENRE).toString());
mediaInfo.insertMetadata(MediaInfo::Genre, genre);
}
}
else if (element == XSPF_EXTENSION) {
QString xspfNamespace(xml.attributes().value(XSPF_APPLICATION).toString());
if (xspfNamespace == XSPF_QUARKPLAYER_NAMESPACE) {
while (!xml.atEnd() && !_stop) {
xml.readNext();
QString extensionElement(xml.name().toString());
if (xml.isStartElement()) {
if (extensionElement == XSPF_QUARKPLAYER_CUE_START_INDEX) {
QString cueStartIndex(xml.readElementText());
mediaInfo.setCueStartIndex(cueStartIndex);
}
else if (extensionElement == XSPF_QUARKPLAYER_CUE_END_INDEX) {
QString cueEndIndex(xml.readElementText());
mediaInfo.setCueEndIndex(cueEndIndex);
}
else if (extensionElement == XSPF_QUARKPLAYER_YEAR) {
QString year(xml.readElementText());
mediaInfo.insertMetadata(MediaInfo::Year, year);
}
else if (extensionElement == XSPF_QUARKPLAYER_GENRE) {
QString genre(xml.readElementText());
mediaInfo.insertMetadata(MediaInfo::Genre, genre);
}
}
if (xml.isEndElement()) {
if (extensionElement == XSPF_EXTENSION) {
break;
}
}
}
}
}
}
if (xml.isEndElement()) {
if (element == XSPF_TRACK) {
return;
}
}
}
}