Delphi Programming Forum
C++Builder  |  Delphi  |  FireMonkey  |  C/C++  |  Free Pascal  |  Firebird
볼랜드포럼 BorlandForum
 경고! 게시물 작성자의 사전 허락없는 메일주소 추출행위 절대 금지
델파이 포럼
Q & A
FAQ
팁&트릭
강좌/문서
자료실
컴포넌트/라이브러리
FreePascal/Lazarus
볼랜드포럼 홈
헤드라인 뉴스
IT 뉴스
공지사항
자유게시판
해피 브레이크
공동 프로젝트
구인/구직
회원 장터
건의사항
운영진 게시판
회원 메뉴
북마크
델마당
볼랜드포럼 광고 모집

델파이 Q&A
Delphi Programming Q&A
[13790] 간단한 필터 프로그래밍.. 예제 에러..
용맨소녀 [doyongid] 1457 읽음    2011-08-11 23:24
음.. 인터넷 예제를 보면서 하고 있는데, 잘 안되네요..;; 왜 그럴까요.. 출력쪽의 문제 같은데..

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.

+ -

관련 글 리스트
13790 간단한 필터 프로그래밍.. 예제 에러.. 용맨소녀 1457 2011/08/11
Google
Copyright © 1999-2015, borlandforum.com. All right reserved.