DirectShow interface actual articles (three)

zhaozj2021-02-16  51

DirectShow interface actual articles (3)

Playing speed setting

A method of using iMediaPosition is required.

MediaPosition.put_rate (1); // Normal

MediaPosition.put_rate (0.25); // Slow

MediaPosition.put_rate (2); // Fast

Single frame playback control

Need to use iVideoFramestep

VideoFramestep.Step (1, nil);

volume control

Need to use ibasicaudio

Increase volume: Basicaudio.get_volume (& volume); // Get volume Volume: = Volume VolumeStep; Basicaudio.Put_Volume (Volume); // Add a decibel minus volume: Basicaudio.get_volume (& volume); // Get Volume: = Volume -VolumeStep; Basicaudio.putVolume (Volume); // Decrease a certain amount of decibels

Display zoomal reduction control

Simply change the size of Edit1, then use the iVideoWindow interface method

VideoDow.SetWindowPosition (0, 0, Edit1.Width, Edit1.Height);

Single frame capture, grasp

In fact, many interfaces provide this feature, but I prefer to use the isamplegrabber interface to implement, relatively, efficient.

This control is a little more, first, when opening the file

Var MediaType: TAM_MEDIA_TYPE;

ZeromeMory (@MediaType, sizeof (tam_media_type));

MediaType.majortype: = mediatype_video; // video stream

MediaType.subtype: = MediaSubType_RGB24; // 24 bit image

MediaType.formattype: = format_videoInfo;

Samplegrabber.setMediatype (MediaType); // Association interface

Samplegrabber.setBuffersamples (TRUE);

Then you operate in the graphic button event

VAR

MediaType: TAM_MEDIA_TYPE;

VideoInfoHeader: TVideoInfoHead;

BitmapInfo: TbitmapInfo;

Bitmap: hbitmap;

Buffer: Pointer;

Buffersize: integer;

Begin

Samplegrabber.getConnectedMediatype (MediaType);

ZeromeMory (@VideoInfoHeader);

CopyMemory (@VideoInfoHeader, MediaType.pbformat, sizeof (VideoInfoHeader);

ZeromeMory (@bitmapinfo, sizeof (tbitmapinfo);

CopyMemory (@BitmapInfo, @ VideoInfoHeader.bmiheader, sizeof (VideoInfoHeader.bmihead);

Bitmap: = Createdibsection (0, BitmapInfo, DIB_RGB_COLORS, BUFFER, 0, 0);

Samplegrabber.getcurrentBuffer (Buffersize, Buffer);

Image1.Picture.bitmap.handle: = Bitmapend;

I.e.

Here, first summarize so much, I hope to help everyone, these is only a fur of DirectX, it can be implemented very powerful, I just summed up the problems I encountered in actual, back There are still many work, I think I will gradually summarize this experience in this area, I have to share it with you, ok, DirectShow interface is here, if you have addition or ideas, please express it. Summarize the finishing, thank you.

end

转载请注明原文地址:https://www.9cbs.com/read-24952.html

New Post(0)