| 1951 | } |
| 1952 | |
| 1953 | HRESULT |
| 1954 | CCmdQueue::Insert(__in CDeferredCommand *pCmd) |
| 1955 | { |
| 1956 | CAutoLock lock(&m_Lock); |
| 1957 | |
| 1958 | // addref the item |
| 1959 | pCmd->AddRef(); |
| 1960 | |
| 1961 | CGenericList<CDeferredCommand> *pList; |
| 1962 | if (pCmd->IsStreamTime()) |
| 1963 | { |
| 1964 | pList = &m_listStream; |
| 1965 | } |
| 1966 | else |
| 1967 | { |
| 1968 | pList = &m_listPresentation; |
| 1969 | } |
| 1970 | POSITION pos = pList->GetHeadPosition(); |
| 1971 | |
| 1972 | // seek past all items that are before us |
| 1973 | while (pos && (pList->GetValid(pos)->GetTime() <= pCmd->GetTime())) |
| 1974 | { |
| 1975 | |
| 1976 | pList->GetNext(pos); |
| 1977 | } |
| 1978 | |
| 1979 | // now at end of list or in front of items that come later |
| 1980 | if (!pos) |
| 1981 | { |
| 1982 | pList->AddTail(pCmd); |
| 1983 | } |
| 1984 | else |
| 1985 | { |
| 1986 | pList->AddBefore(pos, pCmd); |
| 1987 | } |
| 1988 | |
| 1989 | SetTimeAdvise(); |
| 1990 | return S_OK; |
| 1991 | } |
| 1992 | |
| 1993 | HRESULT |
| 1994 | CCmdQueue::Remove(__in CDeferredCommand *pCmd) |
no test coverage detected