MCPcopy Create free account
hub / github.com/Nevcairiel/LAVFilters / ProcessMenuCommand

Method ProcessMenuCommand

demuxer/LAVSplitter/LAVSplitterTrayIcon.cpp:135–186  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

133}
134
135HRESULT 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}

Callers

nothing calls this directly

Calls 7

SUCCEEDEDFunction · 0.85
SafeReleaseFunction · 0.85
EnableMethod · 0.80
QueryFilterInfoMethod · 0.80
QueryInterfaceMethod · 0.45
GetMarkerTimeMethod · 0.45
SetPositionsMethod · 0.45

Tested by

no test coverage detected