More ... | 編集履歴:差分記録開始以来のDirectShowの変更箇所
- DirectShowで動画を再生させます。 - - - [[$$toc]] - - →[[HSP3・サンプルスクリプト]]に戻る - - ---- - - HSP3.1β1 XPsp2 で動作確認~% - - * スクリプト - - {{{ - ; <<<< HSP 3.1β1 サンプル >>>> - ; - ; DirectShowで動画を再生 - ; - - onexit gosub *exit - - #define WS_CHILD 0x40000000 - #define WS_CLIPSIBLINGS 0x4000000 - #define WS_CLIPCHILDREN 0x2000000 - - //---インターフェイス登録 - #define CLSID_FilterGraph "{e436ebb3-524f-11ce-9f53-0020af0ba770}" - #define IID_IGraphBuilder "{56A868A9-0AD4-11CE-B03A-0020AF0BA770}" - - #usecom IGraphBuilder IID_IGraphBuilder CLSID_FilterGraph - #comfunc GraphBuilder_RenderFile 13 wstr,nullptr - - #usecom IMediaControl "{56A868B1-0AD4-11CE-B03A-0020AF0BA770}" - #comfunc MediaControl_Run 7 - #comfunc MediaControl_Pause 8 - #comfunc MediaControl_Stop 9 - #comfunc MediaControl_GetState 10 int,var - - #usecom IVideoWindow "{56A868B4-0AD4-11CE-B03A-0020AF0BA770}" - #comfunc VideoWindow_put_WindowStyle 9 int - #comfunc VideoWindow_put_Visible 19 int - #comfunc VideoWindow_put_Owner 29 int - #comfunc VideoWindow_SetWindowPosition 39 int,int,int,int - - #usecom IBasicVideo "{56A868B5-0AD4-11CE-B03A-0020AF0BA770}" - #comfunc BasicVideo_get_VideoWidth 10 var - #comfunc BasicVideo_get_VideoHeight 11 var - #comfunc BasicVideo_GetCurrentImage 36 int,int - - //------------------------------------------------------- - - screen 0,640,500 - - objsize 50,20 - pos 0,0 : button gosub "ファイル", *go1 - pos 50,0 : button gosub "Run" , *go2 - pos 100,0 : button gosub "Stop" , *go3 - pos 150,0 : button gosub "Pause" , *go4 - pos 200,0 : button gosub "Capture" , *go5 - - stop - - *go1 - sdim path,560 - dialog "mpg;*.avi;*.wmv;*.ram",16,"Movie" - if stat == 0 {return} - path=refstr - - //---一度delcomしないとダメ。 - if vartype(pMediaControl)=6 {MediaControl_Stop pMediaControl} - pVideoWindow=0 - pMediaControl=0 - pGraphBuilder=0 - //------------- - - newcom pGraphBuilder, IGraphBuilder - GraphBuilder_RenderFile pGraphBuilder,path - - querycom pMediaControl,pGraphBuilder,IMediaControl - querycom pVideoWindow ,pGraphBuilder,IVideoWindow - - VideoWindow_put_Owner pVideoWindow,hwnd - VideoWindow_put_WindowStyle pVideoWindow,WS_CHILD|WS_CLIPCHILDREN|WS_CLIPSIBLINGS - VideoWindow_SetWindowPosition pVideoWindow,0,20,640,480 - VideoWindow_put_Visible pVideoWindow,-1 - - MediaControl_Run pMediaControl - - return - - *go2 - if vartype(pMediaControl)=6 {MediaControl_Run pMediaControl} - return - - *go3 - if vartype(pMediaControl)=6 {MediaControl_Stop pMediaControl} - return - - *go4 - if vartype(pMediaControl)=6 {MediaControl_Pause pMediaControl} - return - - *go5 - if vartype(pGraphBuilder)!6 {return} - - MediaControl_Pause pMediaControl - - pfs=0 - MediaControl_GetState pMediaControl,50,pfs - if pfs!1{ - dialog "失敗" - MediaControl_Run pMediaControl - return - } - - querycom pBasicVideo ,pGraphBuilder,IBasicVideo - - BufferSize=0 - BasicVideo_GetCurrentImage pBasicVideo,varptr(BufferSize),0 - - sdim DIBImage,BufferSize+14 - BasicVideo_GetCurrentImage pBasicVideo,varptr(BufferSize),varptr(DIBImage) - - MediaControl_Run pMediaControl - - pBasicVideo=0 - - memcpy DIBImage,DIBImage,BufferSize,14 - - wpoke DIBImage,0,0x4D42 - lpoke DIBImage,2,BufferSize+14 - lpoke DIBImage,6,0 - lpoke DIBImage,10,54 - - bsave "test.bmp",DIBImage : sdim DIBImage,1 - - return - - *exit - if vartype(pMediaControl)=6 { - MediaControl_Stop pMediaControl - VideoWindow_put_Visible pVideoWindow,0 - VideoWindow_put_Owner pVideoWindow,0 - } - - pVideoWindow=0 - pMediaControl=0 - pGraphBuilder=0 - end - - }}} - * memo - 復活~% - - 2006/04/08 14:00:01 JST~% - 変更~% - onexit *exit -> onexit gosub *exit |