如何在source filter 中获取外部输入的URL-CSDN论坛
1个回答
2016-03-13
展开全部
STDMETHODIMP Load(LPCOLESTR lpwszFileName, const AM_MEDIA_TYPE *pmt)
{
CheckPointer(lpwszFileName, E_POINTER);
int cch = lstrlenW(lpwszFileName) + 1;
#ifndef UNICODE
TCHAR *lpszFileName=0;
lpszFileName = new char[cch * 2];
if (!lpszFileName) {
return E_OUTOFMEMORY;
}
WideCharToMultiByte(GetACP(), 0, lpwszFileName, -1,
lpszFileName, cch, NULL, NULL);
#else
TCHAR lpszFileName[MAX_PATH]={0};
lstrcpy(lpszFileName, lpwszFileName);
#endif
/* Check the file type */
CMediaType cmt;
if (NULL == pmt) {
cmt.SetType(&MEDIATYPE_Video);
cmt.SetSubtype(&MEDIASUBTYPE_RGB32);
} else {
cmt = *pmt;
}
if (!OpenStream(lpszFileName)) //lpszFileName是一个URL,
//在OpenStream中我实现了根据URL登陆相机获取视频的操作
{
#ifndef UNICODE
delete [] lpszFileName;
#endif
return E_FAIL;
}
/* Work out file type */
cmt.bTemporalCompression = FALSE; //???
cmt.lSampleSize = 1;
return S_OK;
}
{
CheckPointer(lpwszFileName, E_POINTER);
int cch = lstrlenW(lpwszFileName) + 1;
#ifndef UNICODE
TCHAR *lpszFileName=0;
lpszFileName = new char[cch * 2];
if (!lpszFileName) {
return E_OUTOFMEMORY;
}
WideCharToMultiByte(GetACP(), 0, lpwszFileName, -1,
lpszFileName, cch, NULL, NULL);
#else
TCHAR lpszFileName[MAX_PATH]={0};
lstrcpy(lpszFileName, lpwszFileName);
#endif
/* Check the file type */
CMediaType cmt;
if (NULL == pmt) {
cmt.SetType(&MEDIATYPE_Video);
cmt.SetSubtype(&MEDIASUBTYPE_RGB32);
} else {
cmt = *pmt;
}
if (!OpenStream(lpszFileName)) //lpszFileName是一个URL,
//在OpenStream中我实现了根据URL登陆相机获取视频的操作
{
#ifndef UNICODE
delete [] lpszFileName;
#endif
return E_FAIL;
}
/* Work out file type */
cmt.bTemporalCompression = FALSE; //???
cmt.lSampleSize = 1;
return S_OK;
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询