📄 ieds.pas
字号:
<A TIEDirectShow.Stop>
<A TIEDirectShow.TunerFindSignal>
<FM>Properties<FN>
<A TIEDirectShow.AudioCodecs>
<A TIEDirectShow.AudioInputs>
<A TIEDirectShow.ClockErrorTolerance>
<A TIEDirectShow.Connected>
<A TIEDirectShow.Duration>
<A TIEDirectShow.DVDInputPath>
<A TIEDirectShow.EnableSampleGrabber>
<A TIEDirectShow.EndOfStream>
<A TIEDirectShow.FileInput>
<A TIEDirectShow.FileOutput>
<A TIEDirectShow.NotifyWindow>
<A TIEDirectShow.Position>
<A TIEDirectShow.Rate>
<A TIEDirectShow.ReferenceClock>
<A TIEDirectShow.RenderAudio>
<A TIEDirectShow.RenderVideo>
<A TIEDirectShow.TimeFormat>
<A TIEDirectShow.TunerChannel>
<A TIEDirectShow.VideoCodecQuality>
<A TIEDirectShow.VideoCodecs>
<A TIEDirectShow.VideoFormats>
<A TIEDirectShow.VideoFormatsCount>
<A TIEDirectShow.VideoInputs>
<A TIEDirectShow.VideoInputSource>
<A TIEDirectShow.VideoInputSources>
!!}
TIEDirectShow = class
private
// capture filters lists
fAudioInputs: TStringList;
fVideoInputs: TStringList;
// compression filters list
fVideoCodecs: TStringList;
fAudioCodecs: TStringList;
//
fVideoFormats: TList; // array of TIEVideoFormat classes
fVideoInputSources: TStringList; // crossbar inputs
// conversion filters
fCurColor: IBaseFilter;
// currently input filters
fCurAudioInput: IBaseFilter;
fCurVideoInput: IBaseFilter;
fCurFileInput: IBaseFilter; // this implies that fCurAudioInput=nil and fCurVideoIinput=nil
// file input
fFileInput: string;
// currently compression filters
fCurVideoCodec: IBaseFilter;
fCurAudioCodec: IBaseFilter;
fIAMVideoCompression: IAMVideoCompression;
// output file name
fFileOutput: string;
// currenly filter graph
fGraph: IGraphBuilder;
fBuilder: ICaptureGraphBuilder2;
fControl: IMediaControl;
fMediaSeeking: IMediaSeeking;
fMediaEvent: IMediaEventEx;
fStreamConfig: IAMStreamConfig;
fCrossBarFilter: IBaseFilter; // the same of fcrossbar but viewed as IBaseFilter
fCrossBar: IAMCrossBar;
fTuner: IAMTvTuner;
fTunerFilter: IBaseFilter; // the same of fTuner but viewed as IBaseFilter
fVideoFrameStep:IVideoFrameStep;
fAnalogVideoDecoder:IAMAnalogVideoDecoder;
fClockSlave:IAMClockSlave;
// currenly sample grabber filter
fSampleGrabber: IBaseFilter;
fSampleGrabberFilter: ISampleGrabber; // ISampleGrabber queried from fSampleGrabber filter
fEnableSampleGrabber: boolean;
fSampleGrabberCB: TIESampleGrabberCB; // sample grabber callback
// renderer
fNullRenderer: IBaseFilter;
// video render
fRenderVideo:boolean;
fVideoMixingRenderer:IBaseFilter;
fVMRFilterConfig:IVMRFilterConfig;
fVMRWindowlessControl:IVMRWindowlessControl;
fVMRSavedPin1,fVMRSavedPin2:IPin;
// notification window
fNotifyWindow: THandle;
fNewFrameMessage: integer;
fEventMessage: integer;
// other
fRenderaudio: boolean;
fReferenceClock:TIEReferenceClock;
fClockErrorTolerance:integer;
fSystemClock:IReferenceClock;
// DVD
fDVDInputPath:widestring;
fDVDControl2:IDvdControl2;
// filter graph creation steps
function GetAudioInputs: TStringList;
function GetVideoInputs: TStringList;
function GetVideoCodecs: TStringList;
function GetAudioCodecs: TStringList;
//
procedure SetPosition(v: int64);
function GetPosition: int64;
function GetDuration: int64;
function GetEndOfStream: boolean;
function GetGraphCreated: boolean;
procedure SetRate(value: double);
function GetRate: double;
procedure SetXTimeFormat(value: TIETimeFormat);
function GetXTimeFormat: TIETimeFormat;
procedure SetVideoCodecQuality(value: double);
function GetVideoCodecQuality: double;
function ShowFilterPropertyPages(filter: IBaseFilter; checkOnly:boolean):boolean;
function ShowPinPropertyPages(pin: IPin; checkOnly:boolean):boolean;
procedure FillVideoFormats;
procedure ClearVideoFormats;
function GetVideoFormats(i: integer): TIEVideoFormat;
function GetVideoFormatsCount: integer;
procedure FillVideoInputSources;
function GetInputSource: integer;
procedure SetInputSource(value: integer);
procedure SetVideoTunerChannel(value: integer);
function GetVideoTunerChannel: integer;
procedure DVDConnect;
procedure StdConnect;
procedure VMRDisconnectInPin;
procedure VMRReconnectInPin;
procedure ConnectCrossbarAudioDecoder;
procedure VMRCreate;
public
constructor Create;
destructor Destroy; override;
property AudioInputs: TStringList read GetAudioInputs;
property VideoInputs: TStringList read GetVideoInputs;
property VideoCodecs: TStringList read GetVideoCodecs;
property AudioCodecs: TStringList read GetAudioCodecs;
procedure SetVideoInput(idx: integer; instanceIndex:integer=0);
procedure SetAudioInput(idx: integer; instanceIndex:integer=0);
procedure SetVideoCodec(idx: integer);
procedure SetAudioCodec(idx: integer);
{!!
<FS>TIEDirectShow.FileInput
<FM>Declaration<FC>
property FileInput:string;
<FM>Description<FN>
If you don't want get video from a capture card, but just from a file, you have to set FileInput property with a full path name and a multimedia file.
!!}
property FileInput: string read fFileInput write fFileInput;
{!!
<FS>TIEDirectShow.FileOutput
<FM>Declaration<FC>
property FileOutput:string;
<FM>Description<FN>
Specifies the full path of the output multimedia file.
!!}
property FileOutput: string read fFileOutput write fFileOutput;
procedure SaveGraph(filename: string); // save .grf files (readable with graphedit for debug)
procedure Connect;
procedure Disconnect;
property Connected: boolean read GetGraphCreated;
procedure Run;
procedure Stop;
procedure Pause;
property Rate: double read GetRate write SetRate;
function State: TIEDirectShowState;
property Position: int64 read GetPosition write SetPosition;
property Duration: int64 read GetDuration;
property EndOfStream: boolean read GetEndOfStream;
{!!
<FS>TIEDirectShow.EnableSampleGrabber
<FM>Declaration<FC>
property EnableSampleGrabber:boolean;
<FM>Description<FN>
If EnableSampleGrabber is True, then an event occurs whenever a new frame is available.
The event is TImageEnView.DShowOnNewFrame (unless you use <A TIEDirectShow.SetNotifyWindow> and use TIEDirectShow as stand alone object).
!!}
property EnableSampleGrabber: boolean read fEnableSampleGrabber write fEnableSampleGrabber;
procedure GetSample(DestBitmap: TIEBitmap);
property TimeFormat: TIETimeFormat read GetXTimeFormat write SetXTimeFormat;
procedure BufferToTIEBitmap(buffer: pbyte; len: integer; DestBitmap: TIEBitmap);
procedure SetNotifyWindow(WindowHandle: THandle; NewFrameMessage: integer; EventMessage: integer);
function GetEventCode(var Event: integer): boolean;
property VideoCodecQuality: double read GetVideoCodecQuality write SetVideoCodecQuality;
function ShowPropertyPages(proppages: TIEPropertyPages; proptype: TIEPropertyPagesType; checkOnly:boolean=false):boolean;
procedure SetCurrentVideoFormat(width, height: integer; format: string);
procedure GetCurrentVideoFormat(var width, height: integer; var format: string);
property VideoFormats[i: integer]: TIEVideoFormat read GetVideoFormats;
property VideoFormatsCount: integer read GetVideoFormatsCount;
{!!
<FS>TIEDirectShow.VideoInputSources
<FM>Declaration<FC>
property VideoInputSources:TStringList;
<FM>Description<FN>
Contains a list of video input sources available for the selected video input.
A video input source is a line input, like Video-Composite, Tuner, etc.
!!}
property VideoInputSources: TStringList read fVideoInputSources;
property VideoInputSource: integer read GetInputSource write SetInputSource;
property TunerChannel: integer read GetVideoTunerChannel write SetVideoTunerChannel;
function TunerFindSignal: boolean;
function GetSupportedTVStandards:TIETVStandards;
procedure SetTVStandard(Value:TIETVStandard);
procedure SetVCRHorizontalLocking(Value:boolean);
{!!
<FS>TIEDirectShow.RenderAudio
<FM>Declaration<FC>
property RenderAudio:boolean
<FM>Description<FN>
If True renders the audio stream to the default audio renderer.
Sometimes audio is not synchronized with video. To get audio/video synchronized we should interact directly with hardware devices, but this will loss compatibility.
Anyway you could try to play with <A TIEDirectShow.ReferenceClock> and <A TIEDirectShow.ClockErrorTolerance> properties to get better synchronization.
!!}
property RenderAudio:boolean read fRenderAudio write fRenderAudio;
function Step(frames:integer):boolean;
function ConvertTimeFormat(source:int64; sourceFormat:TIETimeFormat; targetFormat:TIETimeFormat):int64;
function GetAverageTimePerFrame:int64;
{!!
<FS>TIEDirectShow.NotifyWindow
<FM>Declaration<FC>
property NotifyWindow: THandle;
<FM>Description<FN>
Returns current notification window handle.
!!}
property NotifyWindow: THandle read fNotifyWindow;
{!!
<FS>TIEDirectShow.ReferenceClock
<FM>Declaration<FC>
property ReferenceClock:<A TIEReferenceClock>;
<FM>Description<FN>
Specifies the source of reference clock.
You should change it when audio and video aren't synchronized.
When <A TIEDirectShow.RenderAudio> and <A TIEDirectShow.RenderVideo> are true, it is suggested to set ReferenceClock=rcAudioOutput.
!!}
property ReferenceClock:TIEReferenceClock read fReferenceclock write fReferenceClock;
{!!
<FS>TIEDirectShow.ClockErrorTolerance
<FM>Declaration<FC>
property ClockErrorTolerance:integer;
<FM>Description<FN>
Sets the maximum tolerance, in milliseconds, of the audio renderer. The value must be from 1 to 1000, inclusive.
!!}
property ClockErrorTolerance:integer read fClockErrorTolerance write fClockErrorTolerance;
// video renderer
{!!
<FS>TIEDirectShow.RenderVideo
<FM>Declaration<FC>
property RenderVideo:boolean;
<FM>Description<FN>
When true the video input (from capture card, file or dvd) is displayed inside the component area.
This functionality is available only starting from Windows XP.
<FM>Demos<FN>
capture\VMR_camera
capture\VMR_capture
capture\VMR_DVD
capture\VMR_video
!!}
property RenderVideo:boolean read fRenderVideo write fRenderVideo;
{!!
<FS>TIEDirectShow.SetVideoRenderRect
<FM>Declaration<FC>
procedure SetVideoRenderRect(SrcRect, DstRect:TRect);
<FM>Description<FN>
Used internally by <A TImageEnView> in order to set source and destination rectangle when <A TIEDirectShow.RenderVideo> is true.
!!}
procedure SetVideoRenderRect(SrcRect, DstRect:TRect);
{!!
<FS>TIEDirectShow.GetVideoRenderRect
<FM>Declaration<FC>
procedure GetVideoRenderRect(var SrcRect:TRect; var DstRect:TRect);
<FM>Description<FN>
Used internally by <A TImageEnView> in order to get source and destination rectangle when <A TIEDirectShow.RenderVideo> is true.
!!}
procedure GetVideoRenderRect(var SrcRect:TRect; var DstRect:TRect);
{!!
<FS>TIEDirectShow.GetVideoRenderNativeSize
<FM>Declaration<FC>
procedure GetVideoRenderNativeSize(var Width:integer; var Height:integer);
<FM>Description<FN>
Returns the video frame size when <A TIEDirectShow.RenderVideo> is true.
You should set the background bitmap to the same size.
<FM>Example<FC>
TImageEnView.IO.DShowParams.GetVideoRenderNativeSize(w,h);
TImageEnView.Proc.ImageResize(w,h);
!!}
procedure GetVideoRenderNativeSize(var Width:integer; var Height:integer);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -