DSPACK TV Capture 無法顯示出畫面(附上程式碼)( 只差臨門一腳) |
答題得分者是:sryang
|
elevenball
一般會員 發表:2 回覆:2 積分:0 註冊:2011-10-31 發送簡訊給我 |
Dear 目前已經Google 相關資訊,及搜尋ktop 相關資料. 及參考相關程式測試,都無法顯示出相關的畫面.
不知道是那個地方或步驟出錯. 請大家多多指教,謝謝 ( TV capture 是 713x BDA Analog Capture ) unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, DSPack,DSUtil,DSIntf,DSProd,DirectShow9, StdCtrls; type TForm1 = class(TForm) TVGraph: TFilterGraph; TvWindow: TDSVideoWindowEx2; Button1: TButton; Button2: TButton; Edit1: TEdit; Video_dev: TComboBox; Filter1: TFilter; procedure FormCreate(Sender: TObject); procedure FormDestroy(Sender: TObject); procedure Button1Click(Sender: TObject); procedure Button2Click(Sender: TObject); private { Private declarations } Procedure Set_TVTuner(CapEnum : TSysDevEnum; IDCapture : Integer; Var TVGraph : TFilterGraph; Var TVScreen : TDSVideoWindowEx2; Var CrossBar : IAMCrossbar; var TVTuner : IAMTVTuner; var DeviceReady : Boolean); public { Public declarations } end; var Form1: TForm1; TVEnum : TSysDevEnum; CrossBar : IAMCrossbar; TVTuner : IAMTVTuner; TVVolume : IbasicAudio; TVReady : Boolean; ListDevice : TstringList; Const DefaultCountry = 62; DefaultChanel = 309; implementation {$R *.dfm} Procedure TForm1.Set_TVTuner(CapEnum : TSysDevEnum; IDCapture : Integer; Var TVGraph : TFilterGraph; Var TVScreen : TDSVideoWindowEx2; Var CrossBar : IAMCrossbar; var TVTuner : IAMTVTuner; var DeviceReady : Boolean); var TvFilter,TunerF,CrossBarF : IbaseFilter; CaptureFInfo : String; s : String; VideoDecoder : IAMAnalogVideoDecoder; TVDeviceName : String; Hr : Cardinal; OutPin : Ipin; Procedure XError; Begin DeviceReady := false; End; begin TVFilter := CapEnum.GetBaseFilter(IDCapture); try CaptureFInfo := CapEnum.Filters[IDCapture].FriendlyName; TVDeviceName := CaptureFInfo; except XError; Exit; end; capEnum.SelectGUIDCategory(AM_KSCATEGORY_TVTUNER); TunerF := CapEnum.GetBaseFilter(0); try s := CapEnum.Filters[0].FriendlyName; except XError; Exit; end; try TVFilter.QueryInterface(IID_IAMAnalogVideoDecoder, VideoDecoder); Try VideoDecoder.put_TVFormat(AnalogVideo_NTSC_M); Except XError; Exit; end; except xError; Exit; end; capEnum.SelectGUIDCategory(AM_KSCATEGORY_CROSSBAR); CrossbarF := CapEnum.GetBaseFilter(0); try s := CapEnum.Filters[0].FriendlyName; except XError; Exit; end; CrossbarF.QueryInterface(IID_IAMCrossBar,CrossBar); Crossbar.Route(0,0); TunerF.QueryInterface(IID_IAMTVTuner, TVTuner); TvTuner.put_InputType(0,TunerInputCable); TvTuner.put_TuningSpace(0); TvTuner.put_CountryCode(DefaultCountry); TvTuner.put_Channel(DefaultChanel,0,0); (TVGraph as IGraphBuilder).AddFilter(TVFilter, PwideChar(CaptureFInfo)); hr := TVFilter.FindPin('3', OutPin); if hr = 0 then (TVGraph as IGraphBuilder).Render(OutPin); with TVGraph as ICaptureGraphBuilder2 do RenderStream(@PIN_CATEGORY_PREVIEW, nil, TVFilter as IBaseFilter, nil, TVScreen as IBaseFilter); sleep(1); DeviceReady := True;End; procedure TForm1.FormCreate(Sender: TObject); var tvDevice : string; i : integer; begin tvgraph.GraphEdit := True; tvgraph.Mode := gmCapture; tvgraph.Active := true; tvDevice := '713x BDA Analog Capture'; ListDevice := TstringList.Create; TvEnum := TsysDevEnum.Create; TVEnum.SelectGUIDCategory(AM_KSCATEGORY_Capture); for i:= 0 to TvEnum.CountFilters - 1 do ListDevice.Add(TVEnum.Filters[i].FriendlyName); for i := 0 to ListDevice.Count-1 do begin if ListDevice.Strings[i] = tvDevice Then Break; end; Set_TVTuner(TvEnum,i, TvGraph, TVWindow, CrossBar, TVTuner, TVReady); If Not TVReady Then begin Showmessage('Failed To Initialized ' tvDevice); application.Terminate end; end; procedure TForm1.FormDestroy(Sender: TObject); begin TVEnum.Free; end; procedure TForm1.Button1Click(Sender: TObject); begin tvgraph.Play; end; procedure TForm1.Button2Click(Sender: TObject); begin TvTuner.put_Channel(strtoint(edit1.Text),0,0); end; end.
|
sryang
尊榮會員 發表:39 回覆:762 積分:920 註冊:2002-06-27 發送簡訊給我 |
可以參考一下這個
http://www.delphipages.com/comp/tvideocapture-4731.html <embed width="0" hidden="true" height="0" type="application/lingoes-npruntime-capture-word-plugin" id="lingoes_plugin_object"></embed>
------
歡迎參訪 "腦殘賤貓的備忘錄" http://maolaoda.blogspot.com/ |
elevenball
一般會員 發表:2 回覆:2 積分:0 註冊:2011-10-31 發送簡訊給我 |
本站聲明 |
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。 2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。 3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇! |