Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 1 addition & 26 deletions src/common/fileanalyzer.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright (C) 2014-2024, Kevin Andre <hyperquantum@gmail.com>
Copyright (C) 2014-2026, Kevin André <hyperquantum@gmail.com>

This file is part of PMP (Party Music Player).

Expand Down Expand Up @@ -183,31 +183,6 @@ namespace PMP
return extensionEnum != Extension::None;
}

bool FileAnalyzer::preprocessFileForPlayback(QByteArray& fileContents,
QString extension)
{
/* only need to do something for MP3 files */
if (getExtension(extension) != Extension::MP3) return true;

/* strip the ID3v2 tag because DirectShow chokes on ID3v2.4 */

TagLib::ByteVector scratch(fileContents.data(), uint(fileContents.length()));
TagLib::ByteVectorStream stream(scratch);
TagLib::MPEG::File tagFile(&stream, TagLib::ID3v2::FrameFactory::instance());
if (!tagFile.isValid())
{
return false;
}

tagFile.strip(TagLib::MPEG::File::ID3v2); /* strip the ID3v2 */
scratch = *stream.data(); /* get the stripped file contents */

QByteArray strippedData(scratch.data(), int(scratch.size()));
fileContents = strippedData;

return true; /* success */
}

FileAnalyzer::Extension FileAnalyzer::getExtension(QString extension)
{
auto lower = extension.toLower();
Expand Down
5 changes: 1 addition & 4 deletions src/common/fileanalyzer.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright (C) 2014-2021, Kevin Andre <hyperquantum@gmail.com>
Copyright (C) 2014-2026, Kevin André <hyperquantum@gmail.com>

This file is part of PMP (Party Music Player).

Expand Down Expand Up @@ -55,9 +55,6 @@ namespace PMP
static bool isExtensionSupported(QString const& extension,
bool enableExperimentalFileFormats = false);

static bool preprocessFileForPlayback(QByteArray& fileContents,
QString extension);

void analyze();

bool hadError() const;
Expand Down
8 changes: 1 addition & 7 deletions src/server/preloader.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright (C) 2016-2025, Kevin André <hyperquantum@gmail.com>
Copyright (C) 2016-2026, Kevin André <hyperquantum@gmail.com>

This file is part of PMP (Party Music Player).

Expand Down Expand Up @@ -398,12 +398,6 @@ namespace PMP::Server
qDebug() << "Preloader: read" << contents.size() << "bytes from"
<< originalFilename << "for queue ID" << queueId;

if (!FileAnalyzer::preprocessFileForPlayback(contents, extension))
{
qWarning() << "Preloader: failed to preprocess file" << originalFilename;
return failure;
}

QString tempDir;
if (QDir::temp().mkpath("PMP-preload-cache"))
tempDir = QDir::temp().absolutePath() + "/PMP-preload-cache";
Expand Down
Loading