本文整理匯總了C++中CAtlList::SwapElements方法的典型用法代碼示例。如果您正苦於以下問題:C++ CAtlList::SwapElements方法的具體用法?C++ CAtlList::SwapElements怎麽用?C++ CAtlList::SwapElements使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類CAtlList
的用法示例。
在下文中一共展示了CAtlList::SwapElements方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。
示例1: FindMainMovie
HRESULT CHdmvClipInfo::FindMainMovie(LPCTSTR strFolder, CString& strPlaylistFile, CAtlList<PlaylistItem>& MainPlaylist, CAtlList<PlaylistItem>& MPLSPlaylists)
{
HRESULT hr = E_FAIL;
CString strPath(strFolder);
CString strFilter;
MPLSPlaylists.RemoveAll();
CAtlList<PlaylistItem> Playlist;
WIN32_FIND_DATA fd = {0};
strPath.Replace(_T("\\PLAYLIST\\"), _T("\\"));
strPath.Replace(_T("\\STREAM\\"), _T("\\"));
strPath += _T("\\BDMV\\");
strFilter.Format(_T("%sPLAYLIST\\*.mpls"), strPath);
HANDLE hFind = FindFirstFile(strFilter, &fd);
if (hFind != INVALID_HANDLE_VALUE) {
REFERENCE_TIME rtMax = 0;
REFERENCE_TIME rtCurrent;
CString strCurrentPlaylist;
do {
strCurrentPlaylist.Format(_T("%sPLAYLIST\\%s"), strPath, fd.cFileName);
Playlist.RemoveAll();
// Main movie shouldn't have duplicate M2TS filename...
if (ReadPlaylist(strCurrentPlaylist, rtCurrent, Playlist) == S_OK) {
if (rtCurrent > rtMax) {
rtMax = rtCurrent;
strPlaylistFile = strCurrentPlaylist;
MainPlaylist.RemoveAll();
POSITION pos = Playlist.GetHeadPosition();
while (pos) {
MainPlaylist.AddTail(Playlist.GetNext(pos));
}
hr = S_OK;
}
if (rtCurrent >= (REFERENCE_TIME)MIN_LIMIT * 600000000) {
PlaylistItem Item;
Item.m_strFileName = strCurrentPlaylist;
Item.m_rtIn = 0;
Item.m_rtOut = rtCurrent;
MPLSPlaylists.AddTail(Item);
}
}
} while (FindNextFile(hFind, &fd));
FindClose(hFind);
}
if (MPLSPlaylists.GetCount() > 1) {
// bubble sort
for (size_t j = 0; j < MPLSPlaylists.GetCount(); j++) {
for (size_t i = 0; i < MPLSPlaylists.GetCount() - 1; i++) {
if (MPLSPlaylists.GetAt(MPLSPlaylists.FindIndex(i)).Duration() < MPLSPlaylists.GetAt(MPLSPlaylists.FindIndex(i + 1)).Duration()) {
MPLSPlaylists.SwapElements(MPLSPlaylists.FindIndex(i), MPLSPlaylists.FindIndex(i + 1));
}
}
}
}
return hr;
}