全國最多中醫師線上諮詢網站-台灣中醫網
發文 回覆 瀏覽次數:4345
推到 Plurk!
推到 Facebook!

請問關於DSPack使用的問題

答題得分者是:cmf
Ricky_567
一般會員


發表:34
回覆:38
積分:19
註冊:2006-11-09

發送簡訊給我
#1 引用回覆 回覆 發表時間:2003-08-14 08:33:31 IP:211.21.xxx.xxx 未訂閱
各位大大: 小弟經 cmf大大指導後用DSPack來抓影像但下面這個函式(指定視訊來源)傳入的1,2參數還是失敗ShowFilterPropertyPage(xx,xx,ppVFWCapSource)原型如下: HRESULT ShowFilterPropertyPage(THandle parent,IBaseFilter Filter,                                TPropertyPage PropertyPage);    以下是小弟的程式,懇請知道的人能幫我解答,謝謝。    用了DSPack的四個元件 TFilter,TFilterGraph,TSampleGrabber,TVideoWindow //-------------------------------------------------------------------- #include  #pragma hdrstop #include "Unit2.h" //-------------------------------------------------------------------- #pragma package(smart_init) #pragma link "DSPack" #pragma resource "*.dfm" TForm2 *Form2; TComboBox *ComboBox; TSysDevEnum *SysDev = NULL; ICaptureGraphBuilder2 *Graph = NULL; IBaseFilter *SourceFilter = NULL; IBaseFilter *VideoFilter = NULL; //-------------------------------------------------------------------- __fastcall TForm2::TForm2(TComponent* Owner) : TForm(Owner) { } //-------------------------------------------------------------------- void __fastcall TForm2::FormCreate(TObject *Sender) { Form2->DoubleBuffered = true; SysDev = new TSysDevEnum(CLSID_VideoInputDeviceCategory); if (SysDev->CountFilters > 0) { int i; //TComboBox記錄影像卡裝置 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ComboBox = new TComboBox(this); ComboBox->Parent = this; ComboBox->Left = 0; ComboBox->Top = 0; ComboBox->Width = 200; ComboBox->Height = 25; for (i = 0; i < SysDev->CountFilters; i ) { ComboBox->Items->Add(SysDev->Filters[i].FriendlyName); ComboBox->OnClick = XXXClick; } //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ } ComboBox->ItemIndex = 0; } //-------------------------------------------------------------------- void __fastcall TForm2::XXXClick(TObject *Sender)//啟動裝置按鈕 { FilterGraph->ClearGraph(); FilterGraph->Active = false; Filter->BaseFilter->Moniker = SysDev->GetMoniker(((TComboBox *)Sender)->ItemIndex); FilterGraph->Active = true; CheckDSError(FilterGraph->QueryInterface(IID_ICaptureGraphBuilder2, &Graph)); CheckDSError(VideoWindow->QueryInterface(IID_IBaseFilter, &VideoFilter)); CheckDSError(Filter->QueryInterface(IID_IBaseFilter, &SourceFilter)); Graph->RenderStream(&PIN_CATEGORY_PREVIEW, NULL, SourceFilter, NULL, VideoFilter); FilterGraph->Play(); Graph->Release(); VideoFilter->Release(); SourceFilter->Release(); } //-------------------------------------------------------------------- void __fastcall TForm2::FormCloseQuery(TObject *Sender, bool &CanClose) { delete ComboBox; delete SysDev; FilterGraph->ClearGraph(); FilterGraph->Active = false; } //--------------------------------------------------------------------
cmf
尊榮會員


發表:84
回覆:918
積分:1032
註冊:2002-06-26

發送簡訊給我
#2 引用回覆 回覆 發表時間:2003-08-14 09:32:22 IP:61.218.xxx.xxx 未訂閱
HRESULT ShowFilterPropertyPage(THandle parent,IBaseFilter Filter, TPropertyPage PropertyPage); 第一個參數 請加入 Form2->Handle; 第二個參數 請加入 SourceFilter ; Filter->BaseFilter->Moniker = SysDev->GetMoniker(((TComboBox *)Sender)->ItemIndex); Filter->BaseFilter->Moniker->BindToObject(NULL,NULL,IBaseFilter, (void**)&SourceFilter);
------
︿︿
Ricky_567
一般會員


發表:34
回覆:38
積分:19
註冊:2006-11-09

發送簡訊給我
#3 引用回覆 回覆 發表時間:2003-08-14 10:26:19 IP:211.21.xxx.xxx 未訂閱
引言: HRESULT ShowFilterPropertyPage(THandle parent,IBaseFilter Filter, TPropertyPage PropertyPage); 第一個參數 請加入 Form2->Handle; 第二個參數 請加入 SourceFilter ; Filter->BaseFilter->Moniker = SysDev->GetMoniker(((TComboBox *)Sender)->ItemIndex); Filter->BaseFilter->Moniker->BindToObject(NULL,NULL,IBaseFilter, (void**)&SourceFilter);
請問 cmf大大: 第一個參數我昨天也是傳入Form2->Handle但出現以下錯誤: Cannot convert 'void *' to 'unsigned int' Type mismatch in parameter 'parent' (wanted 'unsigned int', got 'void *') 再請教另一個問題: 小弟在Project->Options->Packages頁內Runtime packages的Build with runtime packages選項若是不勾選,發行時則必須加入很多DLL檔,是不是我少include或少加入那些檔案。 目前專案的設定: (1)有加入wmvcore.lib,quartz.lib,amstrmid.lib,d3d9.lib 四個Lib 若不加入d3d9.lib 則Build with runtime packages選項必須要勾選且要加入DirectX9_BCB6.bpl ---------> 資質愚眛一直搞不懂 ( > 非常感謝
cmf
尊榮會員


發表:84
回覆:918
積分:1032
註冊:2002-06-26

發送簡訊給我
#4 引用回覆 回覆 發表時間:2003-08-14 10:51:57 IP:61.218.xxx.xxx 未訂閱
第一個 問題 : 改變它的資料形態 (unsigned int)Form2->Handle; 第二個 問題: 我沒遇過 ,所以請 自行 try try see
------
︿︿
Ricky_567
一般會員


發表:34
回覆:38
積分:19
註冊:2006-11-09

發送簡訊給我
#5 引用回覆 回覆 發表時間:2003-08-14 11:08:35 IP:211.21.xxx.xxx 未訂閱
引言: 第一個 問題 : 改變它的資料形態 (unsigned int)Form2->Handle; 第二個 問題: 我沒遇過 ,所以請 自行 try try see
cmf 大大您好: 第一個 問題 : 可組繹但執行後沒有反應 謝謝您不厭其煩的指導
cmf
尊榮會員


發表:84
回覆:918
積分:1032
註冊:2002-06-26

發送簡訊給我
#6 引用回覆 回覆 發表時間:2003-08-14 11:19:49 IP:61.218.xxx.xxx 未訂閱
首先你須判斷 SourceFilter 是否提供 ppVFWCapSource PropertyPage 請改用 ppDefault 使用預設的 PropertyPage;
------
︿︿
Ricky_567
一般會員


發表:34
回覆:38
積分:19
註冊:2006-11-09

發送簡訊給我
#7 引用回覆 回覆 發表時間:2003-08-14 12:24:10 IP:211.21.xxx.xxx 未訂閱
cmf大大您好: (1) 小弟改用ppDefault有一Dlg畫面: 但小弟用ppVFWCapSource則無畫面, cmf大大您所謂的【判斷SourceFilter是否提供ppVFWCapSource】是什塺意思? 難道是卡的問題(亞邁V-Gear)?但用vfw API或JLCVideo元件搭配的方式可以顯示畫面如下:
 
void __fastcall TForm2::Video1Click(TObject *Sender)
{
FilterGraph->ClearGraph();
FilterGraph->Active = false;    JLCVideo1->Activo = true;
JLCVideo1->SeleccionarFuente();//JLCVideo元件的方式--->視訊來源
JLCVideo1->Activo = false;    FilterGraph->Active = true;
CheckDSError(FilterGraph->QueryInterface(IID_ICaptureGraphBuilder2, &Graph));
CheckDSError(VideoWindow->QueryInterface(IID_IBaseFilter, &VideoFilter));
CheckDSError(Filter->QueryInterface(IID_IBaseFilter, &SourceFilter));
Graph->RenderStream(&PIN_CATEGORY_PREVIEW, NULL, SourceFilter, NULL, VideoFilter);
FilterGraph->Play();
Graph->Release();
VideoFilter->Release();
SourceFilter->Release();
}
(2) 小弟引用 Filter->BaseFilter->Moniker->BindToObject(NULL,NULL,IID_IBaseFilter,(void**)&SourceFilter); 當程式關閉時會出現如下錯誤畫面,不用就不會,這是什麼原因呢? 所顯示的路徑很奇怪????? (3) BindToObject 這個用法小弟在Help及Samples裡怎麼都查不到使用方法呢? 謝謝!!!
cmf
尊榮會員


發表:84
回覆:918
積分:1032
註冊:2002-06-26

發送簡訊給我
#8 引用回覆 回覆 發表時間:2003-08-14 13:53:21 IP:61.218.xxx.xxx 未訂閱
Display VFW Capture Dialog Boxes // Query the capture filter for the IAMVfwCaptureDialogs interface. IAMVfwCaptureDialogs *pVfw = 0; hr = SourceFilter->QueryInterface(IID_IAMVfwCaptureDialogs, (void**)&pVfw); if (SUCCEEDED(hr)) { // Check if the device supports this dialog box. if (S_OK == SourceFilter->HasDialog(VfwCaptureDialog_Source)) { // Show the dialog box. hr = SourceFilter->ShowDialog(VfwCaptureDialog_Source, Handle); } } 發表人 - cmf 於 2003/08/14 13:56:28
------
︿︿
Ricky_567
一般會員


發表:34
回覆:38
積分:19
註冊:2006-11-09

發送簡訊給我
#9 引用回覆 回覆 發表時間:2003-08-14 16:22:44 IP:211.21.xxx.xxx 未訂閱
引言: Display VFW Capture Dialog Boxes // Query the capture filter for the IAMVfwCaptureDialogs interface. IAMVfwCaptureDialogs *pVfw = 0; hr = SourceFilter->QueryInterface(IID_IAMVfwCaptureDialogs, (void**)&pVfw); if (SUCCEEDED(hr)) { // Check if the device supports this dialog box. if (S_OK == pVfw->HasDialog(VfwCaptureDialog_Source)) { // Show the dialog box. hr = pVfw->ShowDialog(VfwCaptureDialog_Source, Handle); } } 發表人 - cmf 於 2003/08/14 13:56:28
小弟之前也試過QueryInterface(xxxx), FindInterface(xxxx); 還是不行。 先結案了 非常感謝 cmf大大。
cmf
尊榮會員


發表:84
回覆:918
積分:1032
註冊:2002-06-26

發送簡訊給我
#10 引用回覆 回覆 發表時間:2003-08-14 23:08:49 IP:61.70.xxx.xxx 未訂閱
如果你的是 WDM 擷取卡的話 在 DIRECTSHOW 裡是無法顯示 VfwCaptureDialog_Source DLG 必須使用 IAMCrossbar interface 選擇 VIDEO INPUT // Helper function to associate a name with the type. const char * GetPhysicalPinName(long lType) { switch (lType) { case PhysConn_Video_Tuner: return "Video Tuner"; case PhysConn_Video_Composite: return "Video Composite"; case PhysConn_Video_SVideo: return "S-Video"; case PhysConn_Video_RGB: return "Video RGB"; case PhysConn_Video_YRYBY: return "Video YRYBY"; case PhysConn_Video_SerialDigital: return "Video Serial Digital"; case PhysConn_Video_ParallelDigital: return "Video Parallel Digital"; case PhysConn_Video_SCSI: return "Video SCSI"; case PhysConn_Video_AUX: return "Video AUX"; case PhysConn_Video_1394: return "Video 1394"; case PhysConn_Video_USB: return "Video USB"; case PhysConn_Video_VideoDecoder: return "Video Decoder"; case PhysConn_Video_VideoEncoder: return "Video Encoder"; case PhysConn_Audio_Tuner: return "Audio Tuner"; case PhysConn_Audio_Line: return "Audio Line"; case PhysConn_Audio_Mic: return "Audio Microphone"; case PhysConn_Audio_AESDigital: return "Audio AES/EBU Digital"; case PhysConn_Audio_SPDIFDigital: return "Audio S/PDIF"; case PhysConn_Audio_SCSI: return "Audio SCSI"; case PhysConn_Audio_AUX: return "Audio AUX"; case PhysConn_Audio_1394: return "Audio 1394"; case PhysConn_Audio_USB: return "Audio USB"; case PhysConn_Audio_AudioDecoder: return "Audio Decoder"; default: return "Unknown Type"; } } void DisplayCrossbarInfo(IAMCrossbar *pXBar) { HRESULT hr; long cOutput = -1, cInput = -1; hr = pXBar->get_PinCounts(&cOutput, &cInput); for (long i = 0; i < cOutput; i ) { long lRelated = -1, lType = -1, lRouted = -1; hr = pXBar->get_CrossbarPinInfo(FALSE, i, &lRelated, &lType); hr = pXBar->get_IsRouted(i, &lRouted); printf("Output pin %d: %s\n", i, GetPhysicalPinName(lType)); printf("\tRelated out: %d, Routed in: %d\n", lRelated, lRouted); printf("\tSwitching Matrix: "); for (long j = 0; j < cInput; j ) { hr = pXBar->CanRoute(i, j); printf("%d-%s", j, (S_OK == hr ? "Yes" : "No")); } printf("\n\n"); } for (i = 0; i < cInput; i ) { long lRelated = -1, lType = -1; hr = pXBar->get_CrossbarPinInfo(TRUE, i, &lRelated, &lType); printf("Input pin %d - %s\n", i, GetPhysicalPinName(lType)); printf("\tRelated in: %d\n", lRelated); } }
------
︿︿
Ricky_567
一般會員


發表:34
回覆:38
積分:19
註冊:2006-11-09

發送簡訊給我
#11 引用回覆 回覆 發表時間:2003-08-15 15:00:03 IP:211.21.xxx.xxx 未訂閱
引言: 如果你的是 WDM 擷取卡的話 在 DIRECTSHOW 裡是無法顯示 VfwCaptureDialog_Source DLG 必須使用 IAMCrossbar interface 選擇 VIDEO INPUT // Helper function to associate a name with the type. const char * GetPhysicalPinName(long lType) { switch (lType) { case PhysConn_Video_Tuner: return "Video Tuner"; case PhysConn_Video_Composite: return "Video Composite"; case PhysConn_Video_SVideo: return "S-Video"; case PhysConn_Video_RGB: return "Video RGB"; case PhysConn_Video_YRYBY: return "Video YRYBY"; case PhysConn_Video_SerialDigital: return "Video Serial Digital"; case PhysConn_Video_ParallelDigital: return "Video Parallel Digital"; case PhysConn_Video_SCSI: return "Video SCSI"; case PhysConn_Video_AUX: return "Video AUX"; case PhysConn_Video_1394: return "Video 1394"; case PhysConn_Video_USB: return "Video USB"; case PhysConn_Video_VideoDecoder: return "Video Decoder"; case PhysConn_Video_VideoEncoder: return "Video Encoder"; case PhysConn_Audio_Tuner: return "Audio Tuner"; case PhysConn_Audio_Line: return "Audio Line"; case PhysConn_Audio_Mic: return "Audio Microphone"; case PhysConn_Audio_AESDigital: return "Audio AES/EBU Digital"; case PhysConn_Audio_SPDIFDigital: return "Audio S/PDIF"; case PhysConn_Audio_SCSI: return "Audio SCSI"; case PhysConn_Audio_AUX: return "Audio AUX"; case PhysConn_Audio_1394: return "Audio 1394"; case PhysConn_Audio_USB: return "Audio USB"; case PhysConn_Audio_AudioDecoder: return "Audio Decoder"; default: return "Unknown Type"; } } void DisplayCrossbarInfo(IAMCrossbar *pXBar) { HRESULT hr; long cOutput = -1, cInput = -1; hr = pXBar->get_PinCounts(&cOutput, &cInput); for (long i = 0; i < cOutput; i++) { long lRelated = -1, lType = -1, lRouted = -1; hr = pXBar->get_CrossbarPinInfo(FALSE, i, &lRelated, &lType); hr = pXBar->get_IsRouted(i, &lRouted); printf("Output pin %d: %s\n", i, GetPhysicalPinName(lType)); printf("\tRelated out: %d, Routed in: %d\n", lRelated, lRouted); printf("\tSwitching Matrix: "); for (long j = 0; j < cInput; j++) { hr = pXBar->CanRoute(i, j); printf("%d-%s", j, (S_OK == hr ? "Yes" : "No")); } printf("\n\n"); } for (i = 0; i < cInput; i++) { long lRelated = -1, lType = -1; hr = pXBar->get_CrossbarPinInfo(TRUE, i, &lRelated, &lType); printf("Input pin %d - %s\n", i, GetPhysicalPinName(lType)); printf("\tRelated in: %d\n", lRelated); } }
請問 cmf大大: 那如何指定視訊來源為S-Video。 謝謝!!
void __fastcall TForm2::Video3Click(TObject *Sender)
{
HRESULT hr;    IAMCrossbar *pXBar1 = NULL;
hr = Graph->FindInterface(&LOOK_UPSTREAM_ONLY, NULL, SourceFilter,
        IID_IAMCrossbar, (void**)&pXBar1);
  if (SUCCEEDED(hr))
  {
  DisplayCrossbarInfo(pXBar1);
  pXBar1->Release();
  }
}    
cmf
尊榮會員


發表:84
回覆:918
積分:1032
註冊:2002-06-26

發送簡訊給我
#12 引用回覆 回覆 發表時間:2003-08-15 16:26:56 IP:61.218.xxx.xxx 未訂閱
//HRESULT Route ( long OutputPinIndex, long InputPinIndex); pXBar1->Route (0,2);
------
︿︿
Ricky_567
一般會員


發表:34
回覆:38
積分:19
註冊:2006-11-09

發送簡訊給我
#13 引用回覆 回覆 發表時間:2003-08-15 17:11:57 IP:211.21.xxx.xxx 未訂閱
以經可行了 感謝 cmf大大不厭其煩的指導 非常感謝!!
系統時間:2024-11-25 12:53:06
聯絡我們 | Delphi K.Top討論版
本站聲明
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。
2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。
3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇!