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

Method GetFileExtension

decoder/LAVVideo/LAVVideo.cpp:485–512  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

483}
484
485STDMETHODIMP_(LPWSTR) CLAVVideo::GetFileExtension()
486{
487 if (m_strExtension.empty())
488 {
489 m_strExtension = L"";
490
491 IFileSourceFilter *pSource = nullptr;
492 if (SUCCEEDED(FindIntefaceInGraph(m_pInput, IID_IFileSourceFilter, (void **)&pSource)))
493 {
494 LPOLESTR pwszFile = nullptr;
495 if (SUCCEEDED(pSource->GetCurFile(&pwszFile, nullptr)) && pwszFile)
496 {
497 LPWSTR pwszExtension = PathFindExtensionW(pwszFile);
498 m_strExtension = std::wstring(pwszExtension);
499 CoTaskMemFree(pwszFile);
500 }
501 SafeRelease(&pSource);
502 }
503 }
504
505 size_t len = m_strExtension.size() + 1;
506 LPWSTR pszExtension = (LPWSTR)CoTaskMemAlloc(sizeof(WCHAR) * len);
507 if (!pszExtension)
508 return nullptr;
509
510 wcscpy_s(pszExtension, len, m_strExtension.c_str());
511 return pszExtension;
512}
513
514// CTransformFilter
515

Callers

nothing calls this directly

Calls 4

SUCCEEDEDFunction · 0.85
FindIntefaceInGraphFunction · 0.85
SafeReleaseFunction · 0.85
GetCurFileMethod · 0.80

Tested by

no test coverage detected