| 133 | } |
| 134 | |
| 135 | HRESULT CLAVSplitterTrayIcon::ProcessMenuCommand(HMENU hMenu, int cmd) |
| 136 | { |
| 137 | CheckPointer(m_pFilter, E_FAIL); |
| 138 | DbgLog((LOG_TRACE, 10, L"Menu Command %d", cmd)); |
| 139 | if (cmd >= STREAM_CMD_OFFSET && cmd < m_NumStreams + STREAM_CMD_OFFSET) |
| 140 | { |
| 141 | IAMStreamSelect *pStreamSelect = nullptr; |
| 142 | if (SUCCEEDED(m_pFilter->QueryInterface(&pStreamSelect))) |
| 143 | { |
| 144 | pStreamSelect->Enable(cmd - STREAM_CMD_OFFSET, AMSTREAMSELECTENABLE_ENABLE); |
| 145 | SafeRelease(&pStreamSelect); |
| 146 | } |
| 147 | } |
| 148 | else if (cmd > CHAPTER_CMD_OFFSET && cmd <= m_NumChapters + CHAPTER_CMD_OFFSET) |
| 149 | { |
| 150 | IAMExtendedSeeking *pExSeeking = nullptr; |
| 151 | if (SUCCEEDED(m_pFilter->QueryInterface(IID_IAMExtendedSeeking, (void **)&pExSeeking))) |
| 152 | { |
| 153 | double markerTime; |
| 154 | if (FAILED(pExSeeking->GetMarkerTime(cmd - CHAPTER_CMD_OFFSET, &markerTime))) |
| 155 | goto failchapterseek; |
| 156 | |
| 157 | REFERENCE_TIME rtMarkerTime = (REFERENCE_TIME)(markerTime * 10000000.0); |
| 158 | |
| 159 | // Try to get the graph to seek on, its much safer than directly trying to seek on LAV |
| 160 | FILTER_INFO info; |
| 161 | if (FAILED(m_pFilter->QueryFilterInfo(&info)) || !info.pGraph) |
| 162 | goto failchapterseek; |
| 163 | |
| 164 | IMediaSeeking *pSeeking = nullptr; |
| 165 | if (SUCCEEDED(info.pGraph->QueryInterface(&pSeeking))) |
| 166 | { |
| 167 | pSeeking->SetPositions(&rtMarkerTime, AM_SEEKING_AbsolutePositioning, nullptr, |
| 168 | AM_SEEKING_NoPositioning); |
| 169 | SafeRelease(&pSeeking); |
| 170 | } |
| 171 | SafeRelease(&info.pGraph); |
| 172 | |
| 173 | failchapterseek: |
| 174 | SafeRelease(&pExSeeking); |
| 175 | } |
| 176 | } |
| 177 | else if (cmd == STREAM_CMD_OFFSET - 1) |
| 178 | { |
| 179 | OpenPropPage(); |
| 180 | } |
| 181 | else |
| 182 | { |
| 183 | return E_UNEXPECTED; |
| 184 | } |
| 185 | return S_OK; |
| 186 | } |
nothing calls this directly
no test coverage detected