本文整理汇总了C++中CAtlList::RemoveHead方法的典型用法代码示例。如果您正苦于以下问题:C++ CAtlList::RemoveHead方法的具体用法?C++ CAtlList::RemoveHead怎么用?C++ CAtlList::RemoveHead使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CAtlList
的用法示例。
在下文中一共展示了CAtlList::RemoveHead方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: InitFilters
void COSPServiceMgr::InitFilters()
{
Filter** filters = g_filters;
while (*filters)
{
Filter* flt = *filters;
m_allFilters.push_back(flt);
int index = m_allFilters.size();
if (FT_SRC == flt->filterType)
{
SourceFilter* srcFilter = (SourceFilter*)flt;
m_sourceFilters.push_back(srcFilter);
if (srcFilter->pszProtocol)
{
CAtlList<CString> ls;
Explode(CString(srcFilter->pszProtocol), ls, L',');
while (ls.GetCount() >= 2)
{
CString protocal = ls.RemoveHead();
CString extension = ls.RemoveHead();
std::map<wstring, long>& extSource = m_protocalSource[(LPCTSTR)protocal];
extSource[(LPCTSTR)extension] = index;
}
}
else if (srcFilter->pszExtension)
{
CAtlList<CString> ls;
Explode(CString(srcFilter->pszExtension), ls, L',');
while (ls.GetCount() >= 2)
{
CString extension = ls.RemoveHead();
std::multimap<long, long, std::greater<long> >& source = m_extensionSource[(LPCTSTR)extension];
source.insert(std::make_pair(srcFilter->filterBase.dwMerit, index));
}
}
}
else if (FT_ADEC == flt->filterType)
{
m_audioTransform.insert(std::make_pair(flt->dwMerit, index));
}
else if (FT_VDEC == flt->filterType)
{
m_videoTransform.insert(std::make_pair(flt->dwMerit, index));
}
else if (FT_OTHER == flt->filterType || FT_SPLT == flt->filterType)
{
m_otherTransform.insert(std::make_pair(flt->dwMerit, index));
}
filters++;
}
}
示例2: Definition
Definition& Definition::operator[](LPCWSTR type)
{
Definition* pRetDef = NULL;
if(m_type2def.Lookup(type, pRetDef))
return *pRetDef;
pRetDef = DNew Definition(m_pnf, L"");
pRetDef->m_priority = PLow;
pRetDef->m_type = type;
m_type2def[type] = pRetDef;
CAtlList<Definition*> l;
GetChildDefs(l, type);
while(!l.IsEmpty())
{
Definition* pDef = l.RemoveHead();
pRetDef->m_priority = pDef->m_priority;
pRetDef->m_parent = pDef->m_parent;
if(pDef->IsValue())
{
pRetDef->SetAsValue(pDef->m_status, pDef->m_value, pDef->m_unit);
}
else
{
pRetDef->m_status = node;
pRetDef->m_nodes.AddTailList(&pDef->m_nodes);
}
}
return *pRetDef;
}
示例3: guard
void CInsRecycle::DoRecycle()
{
CAtlList<CResRoot*> tmplist;
{
CObjGuard guard( m_lock );
if ( m_resList.GetCount() )
{
tmplist.AddTailList( &m_resList );
m_resList.RemoveAll();
}
}
while( tmplist.GetCount() )
{
CResRoot* pi = tmplist.RemoveHead();
if ( pi )
{
pi->Destroy();
delete pi;
}
}
}
示例4: ParseDefs
void File::ParseDefs(InputStream& s, Reference* pParentRef)
{
while(s.SkipWhiteSpace(L";") != '}' && s.PeekChar() != Stream::EOS)
{
NodePriority priority = PNormal;
CAtlList<CStringW> types;
CStringW name;
int c = s.SkipWhiteSpace();
if(c == '*') {s.GetChar(); priority = PLow;}
else if(c == '!') {s.GetChar(); priority = PHigh;}
ParseTypes(s, types);
if(s.SkipWhiteSpace() == '#')
{
s.GetChar();
ParseName(s, name);
}
if(types.IsEmpty())
{
if(name.IsEmpty()) s.ThrowError(_T("syntax error"));
types.AddTail(L"?");
}
Reference* pRef = pParentRef;
while(types.GetCount() > 1)
pRef = CreateRef(CreateDef(pRef, types.RemoveHead()));
Definition* pDef = NULL;
if(!types.IsEmpty())
pDef = CreateDef(pRef, types.RemoveHead(), name, priority);
c = s.SkipWhiteSpace(L":=");
if(c == '"' || c == '\'') ParseQuotedString(s, pDef);
else if(iswdigit(c) || c == '+' || c == '-') ParseNumber(s, pDef);
else if(pDef->IsType(L"@")) ParseBlock(s, pDef);
else ParseRefs(s, pDef);
}
s.GetChar();
}
示例5: SetupList
void CFavoriteOrganizeDlg::SetupList(bool fSave)
{
int i = m_tab.GetCurSel();
if (fSave) {
CAtlList<CString> sl;
for (int j = 0; j < m_list.GetItemCount(); j++) {
CAtlList<CString> args;
ExplodeEsc(m_sl[i].GetAt((POSITION)m_list.GetItemData(j)), args, _T(';'));
args.RemoveHead();
args.AddHead(m_list.GetItemText(j, 0));
sl.AddTail(ImplodeEsc(args, _T(';')));
}
m_sl[i].RemoveAll();
m_sl[i].AddTailList(&sl);
} else {
m_list.DeleteAllItems();
POSITION pos = m_sl[i].GetHeadPosition(), tmp;
while (pos) {
tmp = pos;
CAtlList<CString> sl;
ExplodeEsc(m_sl[i].GetNext(pos), sl, _T(';'), 3);
int n = m_list.InsertItem(m_list.GetItemCount(), sl.RemoveHead());
m_list.SetItemData(n, (DWORD_PTR)tmp);
if (!sl.IsEmpty()) {
REFERENCE_TIME rt = 0;
if (1 == _stscanf_s(sl.GetHead(), _T("%I64d"), &rt) && rt > 0) {
DVD_HMSF_TIMECODE hmsf = RT2HMSF(rt);
CString str;
str.Format(_T("[%02d:%02d:%02d]"), hmsf.bHours, hmsf.bMinutes, hmsf.bSeconds);
m_list.SetItemText(n, 1, str);
}
}
}
UpdateColumnsSizes();
}
}
示例6: Load
bool CLibraryStream::Load(const WCHAR* fnw)
{
Clear();
CStringW url = CStringW(fnw);
CAtlList<CStringW> sl;
Explode(url, sl, ':');
CStringW protocol = sl.RemoveHead();
if (protocol != L"hsl") return false;
try
{
yami::parameters params;
params.set_long_long("local_channel", 37830072008705);
params.set_string("destination", name());
params.set_string("endpoint", YC.endpoint());
std::auto_ptr<yami::outgoing_message> message(AGENT.send(DISCOVERY.get("dvb-source"), "dvb-source", "create_streaming_session", params));
message->wait_for_completion();
if (message->get_state() == yami::replied)
{
int session_id = message->get_reply().get_integer("session");
params.clear();
params.set_integer("session", session_id);
AGENT.send(DISCOVERY.get("dvb-source"), "dvb-source", "start_streaming_session", params);
}
else
{
return false;
}
}
catch (const home_system::service_not_found&)
{
return false;
}
if (sl.GetCount() != 2 || FAILED(GUIDFromCString(CString(sl.GetTail()), m_subtype)))
{
m_subtype = MEDIASUBTYPE_MPEG2_TRANSPORT; // TODO: detect subtype
}
m_len = 0;
while(m_len < 1048576)
{
yami::parameters params;
params.set_integer("len", 65535);
params.set_long_long("pos", m_len);
std::auto_ptr<yami::outgoing_message> message(AGENT.send(DISCOVERY.get("dvb-source"), "dvb-source", "read", params));
message->wait_for_completion();
size_t len = 0;
PBYTE buf = (PBYTE)message->get_reply().get_binary("payload", len);
m_len += len;
for (size_t i = 0; i < len; ++i)
{
m_buffer.push_back(buf[i]);
}
Sleep(10);
}
boost::thread(boost::ref(*this));
return true;
}
示例7: Receive
//.........这里部分代码省略.........
}
else if(pData != 0 && len > 1 && *pData != 0)
{
CStringA str((char*)pData, len);
str.Replace("\r\n", "\n");
str.Trim();
if(!str.IsEmpty())
{
pRTS->Add(AToW(str), false, (int)(tStart / 10000), (int)(tStop / 10000));
fInvalidate = true;
}
}
}
else if(m_mt.majortype == MEDIATYPE_Subtitle)
{
CAutoLock cAutoLock(m_pSubLock);
if(m_mt.subtype == MEDIASUBTYPE_UTF8)
{
CRenderedTextSubtitle* pRTS = (CRenderedTextSubtitle*)(ISubStream*)m_pSubStream;
CStringW str = UTF8To16(CStringA((LPCSTR)pData, len)).Trim();
if(!str.IsEmpty())
{
pRTS->Add(str, true, (int)(tStart / 10000), (int)(tStop / 10000));
fInvalidate = true;
}
}
else if(m_mt.subtype == MEDIASUBTYPE_SSA || m_mt.subtype == MEDIASUBTYPE_ASS || m_mt.subtype == MEDIASUBTYPE_ASS2)
{
CRenderedTextSubtitle* pRTS = (CRenderedTextSubtitle*)(ISubStream*)m_pSubStream;
CStringW str = UTF8To16(CStringA((LPCSTR)pData, len)).Trim();
if(!str.IsEmpty())
{
STSEntry stse;
int fields = m_mt.subtype == MEDIASUBTYPE_ASS2 ? 10 : 9;
CAtlList<CStringW> sl;
Explode(str, sl, ',', fields);
if(sl.GetCount() == (size_t)fields)
{
stse.readorder = wcstol(sl.RemoveHead(), NULL, 10);
stse.layer = wcstol(sl.RemoveHead(), NULL, 10);
stse.style = sl.RemoveHead();
stse.actor = sl.RemoveHead();
stse.marginRect.left = wcstol(sl.RemoveHead(), NULL, 10);
stse.marginRect.right = wcstol(sl.RemoveHead(), NULL, 10);
stse.marginRect.top = stse.marginRect.bottom = wcstol(sl.RemoveHead(), NULL, 10);
if(fields == 10) stse.marginRect.bottom = wcstol(sl.RemoveHead(), NULL, 10);
stse.effect = sl.RemoveHead();
stse.str = sl.RemoveHead();
}
if(!stse.str.IsEmpty())
{
pRTS->Add(stse.str, true, (int)(tStart / 10000), (int)(tStop / 10000),
stse.style, stse.actor, stse.effect, stse.marginRect, stse.layer, stse.readorder);
fInvalidate = true;
}
}
}
else if(m_mt.subtype == MEDIASUBTYPE_SSF)
{
ssf::CRenderer* pSSF = (ssf::CRenderer*)(ISubStream*)m_pSubStream;
CStringW str = UTF8To16(CStringA((LPCSTR)pData, len)).Trim();
if(!str.IsEmpty())
{
pSSF->Append(tStart, tStop, str);
fInvalidate = true;
}
}
else if(m_mt.subtype == MEDIASUBTYPE_VOBSUB)
{
CVobSubStream* pVSS = (CVobSubStream*)(ISubStream*)m_pSubStream;
pVSS->Add(tStart, tStop, pData, len);
}
else if (IsHdmvSub(&m_mt))
{
CAutoLock cAutoLock(m_pSubLock);
CRenderedHdmvSubtitle* pHdmvSubtitle = (CRenderedHdmvSubtitle*)(ISubStream*)m_pSubStream;
pHdmvSubtitle->ParseSample (pSample);
}
}
if(fInvalidate)
{
TRACE(_T("InvalidateSubtitle(%I64d, ..)\n"), tStart);
// IMPORTANT: m_pSubLock must not be locked when calling this
InvalidateSubtitle(tStart, m_pSubStream);
}
hr = S_OK;
return hr;
}
示例8: OnUpdate
void CShaderEdit::OnUpdate()
{
if(m_nIDEvent == -1)
{
m_nIDEvent = SetTimer(1, 100, NULL);
}
CString text;
int nStartChar = 0, nEndChar = -1;
GetSel(nStartChar, nEndChar);
if(nStartChar == nEndChar)
{
GetWindowText(text);
while(nStartChar > 0 && _istalnum(text.GetAt(nStartChar-1)))
nStartChar--;
}
if(nStartChar < nEndChar)
{
text = text.Mid(nStartChar, nEndChar - nStartChar);
text.TrimRight('(');
text.MakeLower();
m_acdlg.m_list.ResetContent();
CString key, value;
POSITION pos = m_acdlg.m_inst.GetStartPosition();
while(pos)
{
POSITION cur = pos;
m_acdlg.m_inst.GetNextAssoc(pos, key, value);
if(key.Find(text) == 0)
{
CAtlList<CString> sl;
Explode(value, sl, '|', 2);
if(sl.GetCount() != 2) continue;
CString name = sl.RemoveHead();
CString description = sl.RemoveHead();
int i = m_acdlg.m_list.AddString(name);
m_acdlg.m_list.SetItemDataPtr(i, cur);
}
}
if(m_acdlg.m_list.GetCount() > 0)
{
int lineheight = GetLineHeight();
CPoint p = PosFromChar(nStartChar);
p.y += lineheight;
ClientToScreen(&p);
CRect r(p, CSize(100, 100));
m_acdlg.MoveWindow(r);
m_acdlg.SetWindowPos(&wndTopMost, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE|SWP_NOACTIVATE);
m_acdlg.ShowWindow(SW_SHOWNOACTIVATE);
m_nEndChar = nEndChar;
return;
}
}
m_acdlg.ShowWindow(SW_HIDE);
}
示例9: ParseMPCPlayList
bool CPlayerPlaylistBar::ParseMPCPlayList(CString fn)
{
CString str;
CAtlMap<int, CPlaylistItem> pli;
CAtlArray<int> idx;
CWebTextFile f;
if (!f.Open(fn) || !f.ReadString(str) || str != _T("MPCPLAYLIST")) {
return false;
}
if (f.GetEncoding() == CTextFile::ASCII) {
f.SetEncoding(CTextFile::ANSI);
}
CPath base(fn);
base.RemoveFileSpec();
while (f.ReadString(str)) {
CAtlList<CString> sl;
Explode(str, sl, ',', 3);
if (sl.GetCount() != 3) {
continue;
}
if (int i = _ttoi(sl.RemoveHead())) {
CString key = sl.RemoveHead();
CString value = sl.RemoveHead();
if (key == _T("type")) {
pli[i].m_type = (CPlaylistItem::type_t)_ttol(value);
idx.Add(i);
} else if (key == _T("label")) {
pli[i].m_label = value;
} else if (key == _T("filename")) {
value = CombinePath(base, value);
pli[i].m_fns.AddTail(value);
} else if (key == _T("subtitle")) {
value = CombinePath(base, value);
pli[i].m_subs.AddTail(value);
} else if (key == _T("video")) {
while (pli[i].m_fns.GetCount() < 2) {
pli[i].m_fns.AddTail(_T(""));
}
pli[i].m_fns.GetHead() = value;
} else if (key == _T("audio")) {
while (pli[i].m_fns.GetCount() < 2) {
pli[i].m_fns.AddTail(_T(""));
}
pli[i].m_fns.GetTail() = value;
} else if (key == _T("vinput")) {
pli[i].m_vinput = _ttol(value);
} else if (key == _T("vchannel")) {
pli[i].m_vchannel = _ttol(value);
} else if (key == _T("ainput")) {
pli[i].m_ainput = _ttol(value);
} else if (key == _T("country")) {
pli[i].m_country = _ttol(value);
}
}
}
qsort(idx.GetData(), idx.GetCount(), sizeof(int), s_int_comp);
for (size_t i = 0; i < idx.GetCount(); i++) {
m_pl.AddTail(pli[idx[i]]);
}
return pli.GetCount() > 0;
}
示例10: DecodeSample
REFERENCE_TIME CSubtitleInputPin::DecodeSample(const CAutoPtr<SubtitleSample>& pSample)
{
bool bInvalidate = false;
if (m_mt.majortype == MEDIATYPE_Text) {
CRenderedTextSubtitle* pRTS = (CRenderedTextSubtitle*)(ISubStream*)m_pSubStream;
char* pData = (char*)pSample->data.data();
if (!strncmp(pData, __GAB1__, strlen(__GAB1__))) {
char* ptr = &pData[strlen(__GAB1__) + 1];
char* end = &pData[pSample->data.size()];
while (ptr < end) {
WORD tag = *((WORD*)(ptr));
ptr += 2;
WORD size = *((WORD*)(ptr));
ptr += 2;
if (tag == __GAB1_LANGUAGE__) {
pRTS->m_name = CString(ptr);
} else if (tag == __GAB1_ENTRY__) {
pRTS->Add(AToW(&ptr[8]), false, *(int*)ptr, *(int*)(ptr + 4));
bInvalidate = true;
} else if (tag == __GAB1_LANGUAGE_UNICODE__) {
pRTS->m_name = (WCHAR*)ptr;
} else if (tag == __GAB1_ENTRY_UNICODE__) {
pRTS->Add((WCHAR*)(ptr + 8), true, *(int*)ptr, *(int*)(ptr + 4));
bInvalidate = true;
}
ptr += size;
}
} else if (!strncmp(pData, __GAB2__, strlen(__GAB2__))) {
char* ptr = &pData[strlen(__GAB2__) + 1];
char* end = &pData[pSample->data.size()];
while (ptr < end) {
WORD tag = *((WORD*)(ptr));
ptr += 2;
DWORD size = *((DWORD*)(ptr));
ptr += 4;
if (tag == __GAB1_LANGUAGE_UNICODE__) {
pRTS->m_name = (WCHAR*)ptr;
} else if (tag == __GAB1_RAWTEXTSUBTITLE__) {
pRTS->Open((BYTE*)ptr, size, DEFAULT_CHARSET, pRTS->m_name);
bInvalidate = true;
}
ptr += size;
}
} else if (pSample->data.size() > 1 && *pData != '\0') {
CStringA str(pData, (int)pSample->data.size());
str.Replace("\r\n", "\n");
str.Trim();
if (!str.IsEmpty()) {
pRTS->Add(AToW(str), false, (int)(pSample->rtStart / 10000), (int)(pSample->rtStop / 10000));
bInvalidate = true;
}
}
} else if (m_mt.majortype == MEDIATYPE_Subtitle) {
if (m_mt.subtype == MEDIASUBTYPE_UTF8) {
CRenderedTextSubtitle* pRTS = (CRenderedTextSubtitle*)(ISubStream*)m_pSubStream;
CStringW str = UTF8To16(CStringA((LPCSTR)pSample->data.data(), (int)pSample->data.size())).Trim();
if (!str.IsEmpty()) {
pRTS->Add(str, true, (int)(pSample->rtStart / 10000), (int)(pSample->rtStop / 10000));
bInvalidate = true;
}
} else if (m_mt.subtype == MEDIASUBTYPE_SSA || m_mt.subtype == MEDIASUBTYPE_ASS || m_mt.subtype == MEDIASUBTYPE_ASS2) {
CRenderedTextSubtitle* pRTS = (CRenderedTextSubtitle*)(ISubStream*)m_pSubStream;
CStringW str = UTF8To16(CStringA((LPCSTR)pSample->data.data(), (int)pSample->data.size())).Trim();
if (!str.IsEmpty()) {
STSEntry stse;
int fields = m_mt.subtype == MEDIASUBTYPE_ASS2 ? 10 : 9;
CAtlList<CStringW> sl;
Explode(str, sl, ',', fields);
if (sl.GetCount() == (size_t)fields) {
stse.readorder = wcstol(sl.RemoveHead(), nullptr, 10);
stse.layer = wcstol(sl.RemoveHead(), nullptr, 10);
stse.style = sl.RemoveHead();
stse.actor = sl.RemoveHead();
stse.marginRect.left = wcstol(sl.RemoveHead(), nullptr, 10);
stse.marginRect.right = wcstol(sl.RemoveHead(), nullptr, 10);
stse.marginRect.top = stse.marginRect.bottom = wcstol(sl.RemoveHead(), nullptr, 10);
if (fields == 10) {
stse.marginRect.bottom = wcstol(sl.RemoveHead(), nullptr, 10);
}
stse.effect = sl.RemoveHead();
stse.str = sl.RemoveHead();
}
if (!stse.str.IsEmpty()) {
pRTS->Add(stse.str, true, (int)(pSample->rtStart / 10000), (int)(pSample->rtStop / 10000),
//.........这里部分代码省略.........
示例11: Init
HRESULT CMpegSplitterFile::Init()
{
HRESULT hr;
SVP_LogMsg5(L"HRESULT CMpegSplitterFile::Init()");
// get the type first
m_type = us;
Seek(0);
if(m_type == us)
{
if(BitRead(32, true) == 'TFrc') Seek(0x67c);
int cnt = 0, limit = 4;
for(trhdr h; cnt < limit && Read(h); cnt++) Seek(h.next);
if(cnt >= limit) m_type = ts;
}
Seek(0);
if(m_type == us)
{
int cnt = 0, limit = 4;
for(pvahdr h; cnt < limit && Read(h); cnt++) Seek(GetPos() + h.length);
if(cnt >= limit) m_type = pva;
}
Seek(0);
if(m_type == us)
{
BYTE b;
for(int i = 0; (i < 4 || GetPos() < 65536) && m_type == us && NextMpegStartCode(b); i++)
{
if(b == 0xba)
{
pshdr h;
if(Read(h))
{
m_type = ps;
m_rate = int(h.bitrate/8);
break;
}
}
else if((b&0xe0) == 0xc0 // audio, 110xxxxx, mpeg1/2/3
|| (b&0xf0) == 0xe0 // video, 1110xxxx, mpeg1/2
// || (b&0xbd) == 0xbd) // private stream 1, 0xbd, ac3/dts/lpcm/subpic
|| b == 0xbd) // private stream 1, 0xbd, ac3/dts/lpcm/subpic
{
peshdr h;
if(Read(h, b) && BitRead(24, true) == 0x000001)
{
m_type = es;
}
}
}
}
Seek(0);
if(m_type == us)
{
return E_FAIL;
}
// min/max pts & bitrate
m_rtMin = m_posMin = _I64_MAX;
m_rtMax = m_posMax = 0;
if(IsRandomAccess() || IsStreaming())
{
if(IsStreaming())
{
for(int i = 0; i < 20 || i < 50 && S_OK != HasMoreData(1024*100, 100); i++);
}
CAtlList<__int64> fps;
for(int i = 0, j = 5; i <= j; i++)
fps.AddTail(i*GetLength()/j);
for(__int64 pfp = 0; fps.GetCount(); )
{
__int64 fp = fps.RemoveHead();
fp = min(GetLength() - MEGABYTE/8, fp);
fp = max(pfp, fp);
__int64 nfp = fp + (pfp == 0 ? 5*MEGABYTE : MEGABYTE/8);
if(FAILED(hr = SearchStreams(fp, nfp)))
return hr;
pfp = nfp;
}
}
else
{
if(FAILED(hr = SearchStreams(0, MEGABYTE/8)))
return hr;
}
if(m_posMax - m_posMin <= 0 || m_rtMax - m_rtMin <= 0)
return E_FAIL;
//.........这里部分代码省略.........
示例12: CompleteConnect
HRESULT CWavPackSplitterFilterInputPin::CompleteConnect(IPin *pReceivePin)
{
HRESULT hr = CBaseInputPin::CompleteConnect(pReceivePin);
if (FAILED(hr)) {
return hr;
}
if (m_pWavPackParser) {
wavpack_parser_free(m_pWavPackParser);
m_pWavPackParser = NULL;
}
m_pWavPackParser = wavpack_parser_new((stream_reader*)m_pIACBW, FALSE);
if (!m_pWavPackParser) {
return E_FAIL;
}
// Compute total duration
REFERENCE_TIME rtDuration;
rtDuration = m_pWavPackParser->first_wphdr.total_samples;
rtDuration = (rtDuration * 10000000) / m_pWavPackParser->sample_rate;
m_pParentFilter->SetDuration(rtDuration);
// parse APE Tag Header
stream_reader* io = m_pWavPackParser->io;
char buf[APE_TAG_FOOTER_BYTES];
memset(buf, 0, sizeof(buf));
uint32_t cur_pos = io->get_pos(io);
DWORD file_size = io->get_length(io);
if (cur_pos + APE_TAG_FOOTER_BYTES <= file_size) {
io->set_pos_rel(io, -APE_TAG_FOOTER_BYTES, SEEK_END);
if (io->read_bytes(io, buf, APE_TAG_FOOTER_BYTES) == APE_TAG_FOOTER_BYTES) {
CAPETag* APETag = DNew CAPETag;
if (APETag->ReadFooter((BYTE*)buf, APE_TAG_FOOTER_BYTES) && APETag->GetTagSize()) {
size_t tag_size = APETag->GetTagSize();
io->set_pos_rel(io, file_size - tag_size, SEEK_SET);
BYTE *p = DNew BYTE[tag_size];
if (io->read_bytes(io, p, tag_size) == tag_size) {
if (APETag->ReadTags(p, tag_size)) {
POSITION pos = APETag->TagItems.GetHeadPosition();
while (pos) {
CApeTagItem* item = APETag->TagItems.GetAt(pos);
CString TagKey = item->GetKey();
TagKey.MakeLower();
if (item->GetType() == CApeTagItem::APE_TYPE_BINARY) {
m_CoverMime = _T("");
if (!TagKey.IsEmpty()) {
CString ext = TagKey.Mid(TagKey.ReverseFind('.')+1);
if (ext == _T("jpeg") || ext == _T("jpg")) {
m_CoverMime = _T("image/jpeg");
} else if (ext == _T("png")) {
m_CoverMime = _T("image/png");
}
}
if (!m_Cover.GetCount() && !m_CoverMime.IsEmpty()) {
m_CoverFileName = TagKey;
m_Cover.SetCount(tag_size);
memcpy(m_Cover.GetData(), item->GetData(), item->GetDataLen());
}
} else {
CString TagValue = item->GetValue();
if (TagKey == _T("cuesheet")) {
CAtlList<Chapters> ChaptersList;
if (ParseCUESheet(TagValue, ChaptersList)) {
m_pParentFilter->ChapRemoveAll();
while (ChaptersList.GetCount()) {
Chapters cp = ChaptersList.RemoveHead();
m_pParentFilter->ChapAppend(cp.rt, cp.name);
}
}
}
if (TagKey == _T("artist")) {
m_pParentFilter->SetProperty(L"AUTH", TagValue);
} else if (TagKey == _T("comment")) {
m_pParentFilter->SetProperty(L"DESC", TagValue);
} else if (TagKey == _T("title")) {
m_pParentFilter->SetProperty(L"TITL", TagValue);
} else if (TagKey == _T("year")) {
m_pParentFilter->SetProperty(L"YEAR", TagValue);
} else if (TagKey == _T("album")) {
m_pParentFilter->SetProperty(L"ALBUM", TagValue);
}
}
APETag->TagItems.GetNext(pos);
}
}
}
delete [] p;
}
delete APETag;
}
io->set_pos_rel(io, cur_pos, SEEK_SET);
}
//.........这里部分代码省略.........
示例13: ParseCUESheet
bool ParseCUESheet(CString cueData, CAtlList<Chapters> &ChaptersList, CString& Title, CString& Performer)
{
BOOL fAudioTrack;
int track_no = -1, /*index, */index_cnt = 0;
REFERENCE_TIME rt = _I64_MIN;
CString TrackTitle;
CString title, performer;
Title.Empty();
Performer.Empty();
CAtlList<CString> cuelines;
Explode(cueData, cuelines, '\n');
if (cuelines.GetCount() <= 1) {
return false;
}
while (cuelines.GetCount()) {
CString cueLine = cuelines.RemoveHead().Trim();
CString cmd = GetCUECommand(cueLine);
if (cmd == _T("TRACK")) {
if (rt != _I64_MIN && track_no != -1 && index_cnt) {
MakeCUETitle(TrackTitle, title, performer, track_no);
if (!TrackTitle.IsEmpty()) {
ChaptersList.AddTail(Chapters(TrackTitle, rt));
}
}
rt = _I64_MIN;
index_cnt = 0;
TCHAR type[256];
swscanf_s(cueLine, _T("%d %s"), &track_no, type, _countof(type)-1);
fAudioTrack = (wcscmp(type, _T("AUDIO")) == 0);
TrackTitle.Format(_T("Track %02d"), track_no);
} else if (cmd == _T("TITLE")) {
cueLine.Trim(_T(" \""));
title = cueLine;
if (track_no == -1) {
Title = title;
}
} else if (cmd == _T("PERFORMER")) {
cueLine.Trim(_T(" \""));
performer = cueLine;
if (track_no == -1) {
Performer = performer;
}
} else if (cmd == _T("INDEX")) {
int idx, mm, ss, ff;
swscanf_s(cueLine, _T("%d %d:%d:%d"), &idx, &mm, &ss, &ff);
if (fAudioTrack) {
index_cnt++;
rt = MILLISECONDS_TO_100NS_UNITS((mm * 60 + ss) * 1000);
}
}
}
if (rt != _I64_MAX && track_no != -1 && index_cnt) {
MakeCUETitle(TrackTitle, title, performer, track_no);
if (!TrackTitle.IsEmpty()) {
ChaptersList.AddTail(Chapters(TrackTitle, rt));
}
}
if (ChaptersList.GetCount()) {
return true;
} else {
return false;
}
}
示例14: Receive
//.........这里部分代码省略.........
else if(!strncmp((char*)pData, __GAB2__, strlen(__GAB2__)))
{
char* ptr = (char*)&pData[strlen(__GAB2__)+1];
char* end = (char*)&pData[len];
while(ptr < end)
{
WORD tag = *((WORD*)(ptr)); ptr += 2;
DWORD size = *((DWORD*)(ptr)); ptr += 4;
if(tag == __GAB1_LANGUAGE_UNICODE__)
{
m_pRTS->m_name = (WCHAR*)ptr;
}
else if(tag == __GAB1_RAWTEXTSUBTITLE__)
{
m_pRTS->Open((BYTE*)ptr, size, DEFAULT_CHARSET, m_pRTS->m_name);
}
ptr += size;
}
}
else if(pData != 0 && len > 1 && *pData != 0)
{
CStringA str((char*)pData, len);
str.Replace("\r\n", "\n");
str.Trim();
if(!str.IsEmpty())
{
m_pRTS->Add(AToW(str), false, (int)(tStart / 10000), (int)(tStop / 10000));
}
}
else
{
XY_LOG_WARN("Unexpected data");
}
}
else if(m_mt.majortype == MEDIATYPE_Subtitle)
{
if(m_mt.subtype == MEDIASUBTYPE_UTF8)
{
CStringW str = UTF8To16(CStringA((LPCSTR)pData, len)).Trim();
if(!str.IsEmpty())
{
m_pRTS->Add(str, true, (int)(tStart / 10000), (int)(tStop / 10000));
}
else
{
XY_LOG_WARN("Empty data");
}
}
else if(m_mt.subtype == MEDIASUBTYPE_SSA || m_mt.subtype == MEDIASUBTYPE_ASS || m_mt.subtype == MEDIASUBTYPE_ASS2)
{
CStringW str = UTF8To16(CStringA((LPCSTR)pData, len)).Trim();
if(!str.IsEmpty())
{
STSEntry stse;
int fields = m_mt.subtype == MEDIASUBTYPE_ASS2 ? 10 : 9;
CAtlList<CStringW> sl;
Explode(str, sl, ',', fields);
if(sl.GetCount() == fields)
{
stse.readorder = wcstol(sl.RemoveHead(), NULL, 10);
stse.layer = wcstol(sl.RemoveHead(), NULL, 10);
stse.style = sl.RemoveHead();
stse.actor = sl.RemoveHead();
stse.marginRect.left = wcstol(sl.RemoveHead(), NULL, 10);
stse.marginRect.right = wcstol(sl.RemoveHead(), NULL, 10);
stse.marginRect.top = stse.marginRect.bottom = wcstol(sl.RemoveHead(), NULL, 10);
if(fields == 10) stse.marginRect.bottom = wcstol(sl.RemoveHead(), NULL, 10);
stse.effect = sl.RemoveHead();
stse.str = sl.RemoveHead();
}
if(!stse.str.IsEmpty())
{
m_pRTS->Add(stse.str, true, (int)(tStart / 10000), (int)(tStop / 10000),
stse.style, stse.actor, stse.effect, stse.marginRect, stse.layer, stse.readorder);
}
}
else
{
XY_LOG_WARN("Empty data");
}
}
else
{
XY_LOG_WARN("Unsupported media type "<<XyUuidToString(m_mt.subtype));
}
}
else
{
XY_LOG_WARN("Unsupported media type "<<XyUuidToString(m_mt.majortype));
}
return S_OK;
}
示例15:
// Define the integer list
CAtlList<int> myList;
// Populate the list
myList.AddTail(100);
myList.AddTail(200);
myList.AddTail(300);
// Confirm the head of the list
ATLASSERT(myList.GetHead() == 100);
// Remove the head of the list
ATLASSERT(myList.RemoveHead() == 100);
// Confirm the new head of the list
ATLASSERT(myList.GetHead() == 200);