dspack中如何才能更改 preview的解析度?(我指定的影像的解析度为何只能在capture可以,) |
|
phoenix_spd
一般會員 發表:1 回覆:2 積分:0 註冊:2007-03-26 發送簡訊給我 |
以下是dspack中的DSPACK234\Demos\D6-D7\videocap例子,但是我指定的影像的解析度为何只能在capture可以,
preview的仍是320X240呢,哪好心人帮帮忙看一下,如何才能更改 preview的解析度? var multiplexer: IBaseFilter; Writer: IFileSinkFilter; PinList: TPinList; i: integer; begin // Activate the filter graph, at this stage the source filters are added to the graph CaptureGraph.Active := true; // configure output Audio media type source if AudioSourceFilter.FilterGraph <> nil then begin PinList := TPinList.Create(AudioSourceFilter as IBaseFilter); i := 0; while i < PinList.Count do if PinList.PinInfo[i].dir = PINDIR_OUTPUT then begin if AudioFormats.ItemIndex <> -1 then with (PinList.Items[i] as IAMStreamConfig) do SetFormat(AudioMediaTypes.Items[AudioFormats.ItemIndex].AMMediaType^); PinList.Delete(i); end else inc(i); if InputLines.ItemIndex <> -1 then with (PinList.Items[InputLines.ItemIndex] as IAMAudioInputMixer) do put_Enable(true); PinList.Free; end; // configure output Video media type if VideoSourceFilter.FilterGraph <> nil then begin PinList := TPinList.Create(VideoSourceFilter as IBaseFilter); if VideoFormats.ItemIndex <> -1 then (PinList.First as IAMStreamConfig). with (PinList.First as IID_IAMStreamConfig) do SetFormat(VideoMediaTypes.Items[VideoFormats.ItemIndex].AMMediaType^); PinList.Free; end; // now render streams with CaptureGraph as IcaptureGraphBuilder2 do begin // set the output filename SetOutputFileName(MEDIASUBTYPE_Avi, PWideChar(CapFile), multiplexer, Writer); // Connect Video preview (VideoWindow) if VideoSourceFilter.BaseFilter.DataLength > 0 then RenderStream(@PIN_CATEGORY_PREVIEW, nil, VideoSourceFilter as IBaseFilter, SampleGrabber1 as IBaseFilter , VideoWindow as IBaseFilter); // Connect Video capture streams if VideoSourceFilter.FilterGraph <> nil then RenderStream(@PIN_CATEGORY_CAPTURE, nil, VideoSourceFilter as IBaseFilter, nil, multiplexer as IBaseFilter); //Connect Audio capture streams if AudioSourceFilter.FilterGraph <> nil then begin RenderStream(nil, nil, AudioSourceFilter as IBaseFilter, nil, multiplexer as IBaseFilter); end; end; CaptureGraph.Play; StopButton.Enabled := true; StartButton.Enabled := false; AudioFormats.Enabled := false; AudioCapFilters.Enabled := false; VideoFormats.Enabled := false; VideoCapFilters.Enabled := false; Timer.Enabled := true; end; |
phoenix_spd
一般會員 發表:1 回覆:2 積分:0 註冊:2007-03-26 發送簡訊給我 |
以下是我在DSPCK的http://progdigy.com 网站台上找到的,看来不是我一个人发现这个问题,肯定有人解决这个问题了,
就行行好帮帮我吧! //=============== hi,guys what's up! there are some problems in my recent project development. i use averEZcapture video card in my project,and i want set the video size 320X240 on the preview pin and 768*576 on the capture pin! but i can't preview the video well(i render it onto the videorender filter),it's quite freeze. but the capture pin work well(i render it onto the null render filter,and it can grabber the sample with 768*576); i just want to it's possible to render output different video size on preview pin and capture pin,if can,how ? thank u! and my source code just like below : Graphabuilder.findinterface(@PIN_CATEGORY_CAPTURE,........);captureconfig //get the Iamstreamconfig on the Preview pin // set the am_media_type each captureconfig.setformat(); previewconfig.setformat(); |
phoenix_spd
一般會員 發表:1 回覆:2 積分:0 註冊:2007-03-26 發送簡訊給我 |
看来还是没个回我的问题,自已解决了
procedure TVideoForm.SetVideoConfig( CaptureGraph : ICaptureGraphBuilder2; pCategory : PGUID; SourceFilter : IBaseFilter; W,H,BitCount : integer ); var StreamConf : IAMStreamConfig; hr : HRESULT; pmt : PAMMediaType; scc : VIDEO_STREAM_CONFIG_CAPS; pVIH : PVIDEOINFOHEADER; Count, Size, iFormat : Integer; begin hr:= CaptureGraph.FindInterface(pCategory, @MEDIATYPE_Video, SourceFilter, IID_IAMStreamConfig, StreamConf); if SUCCEEDED(hr) then begin iFormat:=0; Count:=0; Size:=0; hr:= StreamConf.GetNumberOfCapabilities(Count, Size); for iFormat:=0 to Count-1 do begin // Get the format hr:= StreamConf.GetStreamCaps(iFormat, pmt, scc); if SUCCEEDED(hr) then begin // Modify the format block. if ( IsEqualGUID(pmt.majortype,MEDIATYPE_Video) and IsEqualGUID(pmt.subtype, MEDIASUBTYPE_RGB24) and IsEqualGUID(pmt.formattype, FORMAT_VideoInfo) and (pmt.cbFormat >= sizeof (VIDEOINFOHEADER)) and (pmt.pbFormat <> nil) ) then begin PVIDEOINFOHEADER(pmt^.pbFormat)^.bmiHeader.biWidth := W; PVIDEOINFOHEADER(pmt^.pbFormat)^.bmiHeader.biHeight := H; //PVIDEOINFOHEADER(pmt^.pbFormat)^.bmiHeader.biBitCount := BitCount; // Set the sample size and image size. // (Be sure to round the image width up to four.) //((W 3) & ~3) * height * cbPixel; //pmt^.lSampleSize:=((W 3) and (not(3))) * H; //PVIDEOINFOHEADER(pmt^.pbFormat)^.bmiHeader.biSizeImage:=((W 3) and (not(3))) * H; // Now set the format. hr := StreamConf.SetFormat(pmt^); if (FAILED(hr)) then MessageBox(NULL, 'SetFormat() Failed!', '', MB_OK); end; end; DeleteMediaType(pmt); end; end; StreamConf := nil; end; |
本站聲明 |
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。 2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。 3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇! |