mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Ignore additional video streams inside an audio file.
Fixes #5840, #5357 and #4327.
This commit is contained in:
parent
bb94507af1
commit
e31ffb699a
1 changed files with 10 additions and 7 deletions
|
@ -1531,15 +1531,12 @@ public:
|
||||||
int res = 0;
|
int res = 0;
|
||||||
char err[AV_ERROR_MAX_STRING_SIZE] = { 0 };
|
char err[AV_ERROR_MAX_STRING_SIZE] = { 0 };
|
||||||
|
|
||||||
int videoStreamId = av_find_best_stream(fmtContext, AVMEDIA_TYPE_VIDEO, -1, -1, &codec, 0);
|
|
||||||
if (videoStreamId >= 0) {
|
|
||||||
DEBUG_LOG(("Audio Read Error: Found video stream in file '%1', data size '%2', error %3, %4").arg(_file.name()).arg(_data.size()).arg(videoStreamId).arg(av_make_error_string(err, sizeof(err), streamId)));
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int32 i = 0, l = fmtContext->nb_streams; i < l; ++i) {
|
for (int32 i = 0, l = fmtContext->nb_streams; i < l; ++i) {
|
||||||
const auto stream = fmtContext->streams[i];
|
const auto stream = fmtContext->streams[i];
|
||||||
if (stream->disposition & AV_DISPOSITION_ATTACHED_PIC) {
|
if (stream->disposition & AV_DISPOSITION_ATTACHED_PIC) {
|
||||||
|
if (!_cover.isNull()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
const auto &packet = stream->attached_pic;
|
const auto &packet = stream->attached_pic;
|
||||||
if (packet.size) {
|
if (packet.size) {
|
||||||
const auto coverBytes = QByteArray(
|
const auto coverBytes = QByteArray(
|
||||||
|
@ -1555,9 +1552,15 @@ public:
|
||||||
if (!_cover.isNull()) {
|
if (!_cover.isNull()) {
|
||||||
_coverBytes = coverBytes;
|
_coverBytes = coverBytes;
|
||||||
_coverFormat = format;
|
_coverFormat = format;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else if (stream->codecpar->codec_type == AVMEDIA_TYPE_VIDEO) {
|
||||||
|
DEBUG_LOG(("Audio Read Error: Found video stream in file '%1', data size '%2', error %3, %4")
|
||||||
|
.arg(_file.name())
|
||||||
|
.arg(_data.size())
|
||||||
|
.arg(i)
|
||||||
|
.arg(av_make_error_string(err, sizeof(err), streamId)));
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue