2013年(92)
分类: 信息化
2013-03-16 05:37:42
? ? ?? 近段时辰由于工作上的需要,大概看了下DirectShow,写了个小的demo,便当知道。往后在深化的学习下DirectShow。贴出代码。 对音频所做的处置如下图: 1. common.h文件 #ifndef __COMMON_H__ #define __COMMON_H__ #include #include "qedit.h" #include #include#pragma comment(lib,"Strmiids.lib") //define release maco #define ReleaseInterface(x) \ if ( NULL != x ) \ { \ x->Release( ); \ x = NULL; \ } // Application-defined message to notify app of filter graph events #define WM_GRAPHNOTIFY WM_APP 100 void Msg(HWND hwnd,TCHAR *szFormat, ...); bool Bstr_Compare(BSTR bstrFilter,BSTR bstrDevice); #endif// __COMMON_H__ 完结: #include "common.h" void Msg(HWND hwnd,TCHAR *szFormat, ...) { TCHAR szBuffer[1024]; const size_t NUMCHARS = sizeof(szBuffer) / sizeof(szBuffer[0]); const int LASTCHAR = NUMCHARS - 1; va_list pArgs; va_start(pArgs, szFormat); (void)StringCchVPrintf(szBuffer, NUMCHARS - 1, szFormat, pArgs); va_end(pArgs); szBuffer[LASTCHAR] = TEXT('\0'); MessageBox(hwnd, szBuffer, TEXT("Message"), MB_OK | MB_ICONERROR); } bool Bstr_Compare(BSTR bstrFilter,BSTR bstrDevice) { bool flag = true; int strlenFilter = SysStringLen(bstrFilter); int strlenDevice = SysStringLen(bstrDevice); char* chrFilter = (char*)malloc(strlenFilter 1); char* chrDevice = (char*)malloc(strlenDevice 1); int j = 0; if (strlenFilter!=strlenDevice) flag = false; else { for(; j < strlenFilter;j ) { chrFilter[j] = (char)bstrFilter[j]; chrDevice[j] = (char)bstrDevice[j]; } chrFilter[strlenFilter] = '\0'; chrDevice[strlenDevice] = '\0'; for(j=0; j < strlenFilter;j ) { if(chrFilter[j] != chrDevice[j]) flag = false; } if(flag == true