Video streams must come first

Fix to #206 so that video streams always come first in the stream list.
This commit is contained in:
jcdr428 2020-03-12 22:06:09 +02:00 committed by GitHub
parent eecf6b0c00
commit 84ee12d48c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -574,7 +574,7 @@ DetectStreamRez METADemuxer::DetectStreamReader(BufferedReaderManager& readManag
{
AVChapters chapters;
int64_t fileDuration = 0;
vector<CheckStreamRez> streams;
vector<CheckStreamRez> streams, Vstreams;
AbstractDemuxer* demuxer = 0;
string tmpname = strToLowerCase(unquoteStr(fileName));
AbstractStreamReader::ContainerType containerType = AbstractStreamReader::ctNone;
@ -661,7 +661,10 @@ DetectStreamRez METADemuxer::DetectStreamReader(BufferedReaderManager& readManag
trackRez.isSecondary = true;
}
addTrack(streams, trackRez);
if (strStartWith(trackRez.codecInfo.programName, "V_"))
addTrack(Vstreams, trackRez);
else
addTrack(streams, trackRez);
}
chapters = demuxer->getChapters();
if (calcDuration)
@ -685,14 +688,19 @@ DetectStreamRez METADemuxer::DetectStreamReader(BufferedReaderManager& readManag
containerType = AbstractStreamReader::ctSRT;
CheckStreamRez trackRez = detectTrackReader(tmpBuffer, len, containerType, 0, 0);
addTrack(streams, trackRez);
if (strStartWith(trackRez.codecInfo.programName, "V_"))
addTrack(Vstreams, trackRez);
else
addTrack(streams, trackRez);
delete[] tmpBuffer;
}
Vstreams.insert(Vstreams.end(), streams.begin(), streams.end());
DetectStreamRez rez;
rez.chapters = chapters;
rez.fileDurationNano = fileDuration;
rez.streams = streams;
rez.streams = Vstreams;
return rez;
}