음.. 인터넷 예제를 보면서 하고 있는데, 잘 안되네요..;; 왜 그럴까요.. 출력쪽의 문제 같은데..
Video Renderer만 연결하면 첨부 스샷의 에러가 뜨면서 Graphedit가 종료됩니다..
그나저나 지금까지 C++로만 하다가 델파이로 짜보니까 신세경이네요..;;
unit AppMain;
interface
uses Windows, ActiveX, BaseClass, DirectShow9, DSUtil;
const
CLSID_TTestTrans: TGUID = '{8DCA7ABE-0B48-4165-911A-31C21D2F6B1B}';
type
TTestTrans = class(TBCTransInPlaceFilter)
function Transform(Sample: IMediaSample): HRESULT; override;
function CheckInputType(mtin: PAMMediaType): HRESULT; override;
end;
implementation
{ TTestTrans }
function TTestTrans.CheckInputType(mtin: PAMMediaType): HRESULT;
var
pvi: PVIDEOINFO;
begin
result := S_FALSE;
if IsEqualGUID(mtin.majortype, MEDIATYPE_Video) and
IsEqualGUID(mtin.subtype, MEDIASUBTYPE_RGB24) and
IsEqualGUID(mtin.formattype, FORMAT_VideoInfo) then
begin
pvi := mtin.pbFormat;
if (pvi.bmiHeader.biWidth = 640) and
(pvi.bmiHeader.biHeight = 480) and
(pvi.bmiHeader.biCompression = BI_RGB) then
result := S_OK;
end;
end;
function TTestTrans.Transform(Sample: IMediaSample): HRESULT;
var
lpBuff: PByte;
x, y: Integer;
begin
Sample.GetPointer(lpBuff);
for x := 0 to 639 do
for y := 0 to 479 do
begin
Byte(lpBuff[1]) := 0;
lpBuff := lpBuff + 3;
end;
result := NOERROR;
end;
initialization
TBCClassFactory.CreateFilter(TTestTrans, '_TestTrans', CLSID_TTestTrans, CLSID_LegacyAmFilterCategory, MERIT_DO_NOT_USE, 0, nil);
end.
|