S
spd260
Unregistered / Unconfirmed
GUEST, unregistred user!
以下是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.Countdo
if PinList.PinInfo.dir = PINDIR_OUTPUT then
begin
if AudioFormats.ItemIndex <> -1 then
with (PinList.Items 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 IcaptureGraphBuilder2do
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;
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.Countdo
if PinList.PinInfo.dir = PINDIR_OUTPUT then
begin
if AudioFormats.ItemIndex <> -1 then
with (PinList.Items 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 IcaptureGraphBuilder2do
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;