Skip to content

Commit

Permalink
DSMMuxer: уходим контейнеры стандартной библиотеки.
Browse files Browse the repository at this point in the history
  • Loading branch information
v0lt committed Jul 13, 2024
1 parent f5f5cc0 commit e719045
Showing 1 changed file with 15 additions and 17 deletions.
32 changes: 15 additions & 17 deletions src/filters/muxer/DSMMuxer/DSMMuxer.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* (C) 2003-2006 Gabest
* (C) 2006-2023 see Authors.txt
* (C) 2006-2024 see Authors.txt
*
* This file is part of MPC-BE.
*
Expand Down Expand Up @@ -121,31 +121,30 @@ void CDSMMuxerFilter::MuxPacketHeader(IBitStream* pBS, dsmp_t type, UINT64 len)
void CDSMMuxerFilter::MuxFileInfo(IBitStream* pBS)
{
int len = 1;
CSimpleMap<CStringA, CStringA> si;
std::list<CStringA> entries;

for (int i = 0; i < m_properties.GetSize(); i++) {
CStringA key = CStringA(CString(m_properties.GetKeyAt(i))), value = WStrToUTF8(m_properties.GetValueAt(i));
CStringA key = CStringA(m_properties.GetKeyAt(i));
if (key.GetLength() != 4) {
continue;
}
si.Add(key, value);
CStringA value = WStrToUTF8(m_properties.GetValueAt(i));
entries.emplace_back(key + value);
len += 4 + value.GetLength() + 1;
}

MuxPacketHeader(pBS, DSMP_FILEINFO, len);
pBS->BitWrite(DSMF_VERSION, 8);
for (int i = 0; i < si.GetSize(); i++) {
CStringA key = si.GetKeyAt(i), value = si.GetValueAt(i);
pBS->ByteWrite((LPCSTR)key, 4);
pBS->ByteWrite((LPCSTR)value, value.GetLength() + 1);
for (const auto& entry : entries) {
pBS->ByteWrite((LPCSTR)entry, entry.GetLength() + 1);
}

}

void CDSMMuxerFilter::MuxStreamInfo(IBitStream* pBS, CBaseMuxerInputPin* pPin)
{
int len = 1;
CSimpleMap<CStringA, CStringA> si;
std::list<CStringA> entries;

auto props = pPin->LockProps();
if (props) {
Expand All @@ -155,7 +154,7 @@ void CDSMMuxerFilter::MuxStreamInfo(IBitStream* pBS, CBaseMuxerInputPin* pPin)
continue;
}
CStringA value = WStrToUTF8(props->GetValueAt(i));
si.Add(key, value);
entries.emplace_back(key + value);
len += 4 + value.GetLength() + 1;
}
}
Expand All @@ -164,10 +163,8 @@ void CDSMMuxerFilter::MuxStreamInfo(IBitStream* pBS, CBaseMuxerInputPin* pPin)
if (len > 1) {
MuxPacketHeader(pBS, DSMP_STREAMINFO, len);
pBS->BitWrite(pPin->GetID(), 8);
for (int i = 0; i < si.GetSize(); i++) {
CStringA key = si.GetKeyAt(i), value = si.GetValueAt(i);
pBS->ByteWrite((LPCSTR)key, 4);
pBS->ByteWrite((LPCSTR)value, value.GetLength() + 1);
for (const auto& entry : entries) {
pBS->ByteWrite((LPCSTR)entry, entry.GetLength() + 1);
}
}
}
Expand Down Expand Up @@ -265,12 +262,13 @@ void CDSMMuxerFilter::MuxHeader(IBitStream* pBS)
// chapters

if (pCB) {
std::list<CDSMChapter> chapters;
pCB->ChapSort();

std::vector<CDSMChapter> chapters;
chapters.reserve(pCB->ChapGetCount());
REFERENCE_TIME rtPrev = 0;
int len = 0;

pCB->ChapSort();

for (DWORD i = 0; i < pCB->ChapGetCount(); i++) {
CDSMChapter c;
CComBSTR name;
Expand Down

0 comments on commit e719045

Please sign in to comment.