ASFWriter如何把当前时间显示在画面上并存入文件? ( 积分: 200 )

S

sz_toto

Unregistered / Unconfirmed
GUEST, unregistred user!
how to get the system date/time(such as 2006-06-05 17:27) over video and save to a file? some one said shall write a new filter and connect pins,but how todo
it?

code:

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

with (PinList.First as IAMStreamConfig)do

SetFormat(VideoMediaTypes.Items[VideoFormats.ItemIndex].AMMediaType^);

PinList.Free;

end;




// now render streams
with CaptureGraph as IcaptureGraphBuilder2do

begin

CheckDSError(RenderStream(@PIN_CATEGORY_PREVIEW, nil, VideoSourceFilter as IBaseFilter, nil, VideoWindow as IBaseFilter));

CheckDSError(RenderStream(@PIN_CATEGORY_CAPTURE, nil, VideoSourceFilter as IBaseFilter, nil, ASFWriter as IBaseFilter));

CheckDSError(RenderStream(nil, nil, AudioSourceFilter as IBaseFilter, nil, ASFWriter as IBaseFilter));


end;
 
写个filter,参考dspack的DEMO下的NullIP,你会有收获的.
 
接受答案了.
 
顶部