HSPでmp4を再生するサンプル(MCI)
2009.05.01 20:37
// HSPでmp4を再生するサンプル(MCI)
#define NICO_W 512
#define NICO_H 384
#define WINID_MAIN 0
#define EXETITLE "testmci"
#uselib "shell32.dll"
#func DragAcceptFiles "DragAcceptFiles" int,int
#func DragQueryFile "DragQueryFileA" int,int,int,int
#func DragQueryPoint "DragQueryPoint" int,int
#func DragFinish "DragFinish" int
#const global WM_DROPFILES 0x0233
redraw 0
screen WINID_MAIN,NICO_W,NICO_H: title EXETITLE
sdim fname,1024: sdim filedrop,65535
onexit *exitds
oncmd gosub *OnDropFiles,WM_DROPFILES: DragAcceptFiles hwnd,1
dialog "swf;*.flv;*.mp4;*.mpg;*.avi;*.wmv;*.mp3;*.wma;*.wav;*.ogg;*.m3u;*.m4u",16,"Flashを含む動画&音声ファイル"
if stat!=0{
flvname=refstr: gosub *openmove: goto *main
}
stop
*main
redraw 1: wait 1: redraw 0
mci "status flv position": flv_pos=stat
mci "status flv mode": flv_mode=refstr
title ""+strf("[%6.3f]",double(flv_pos)/1000)+"/"+strf("[%6.3f]",double(flv_len)/1000)+" mode="+flv_mode
getkey ky,13: if ky{ mci "play flv" }
getkey ky,32: if ky{ mci "stop flv" }
goto *main
*openmove
mci "open \""+flvname+"\" alias flv type mpegvideo"
mci "window flv handle "+hwnd
mci "put flv destination at "+0+" "+0+" "+NICO_W+" "+NICO_H
mci "set flv time format milliseconds"
mci "status flv length": flv_len=stat
mci "play flv"
return
*OnDropFiles
hdrop=wParam: DragQueryFile hdrop,-1,0,0: ndrop=stat
fileaddlist=""
repeat ndrop
DragQueryFile hdrop,cnt,varptr(filedrop),260
fileaddlist+=filedrop+"\n"
loop
mci "stop flv": mci "close all": wait 1
DragFinish hdrop
notesel fileaddlist
noteget flvname,0
noteunsel
gosub *openmove
return
*exitds
mci "stop flv"
mci "close all"
redraw 1: wait 1
end
//[マルチメディア自由自在!高レベルMCIを使う] http://www.int21.co.jp/pcdn/vb/noriolib/vbmag/9802/mci/
#define NICO_W 512
#define NICO_H 384
#define WINID_MAIN 0
#define EXETITLE "testmci"
#uselib "shell32.dll"
#func DragAcceptFiles "DragAcceptFiles" int,int
#func DragQueryFile "DragQueryFileA" int,int,int,int
#func DragQueryPoint "DragQueryPoint" int,int
#func DragFinish "DragFinish" int
#const global WM_DROPFILES 0x0233
redraw 0
screen WINID_MAIN,NICO_W,NICO_H: title EXETITLE
sdim fname,1024: sdim filedrop,65535
onexit *exitds
oncmd gosub *OnDropFiles,WM_DROPFILES: DragAcceptFiles hwnd,1
dialog "swf;*.flv;*.mp4;*.mpg;*.avi;*.wmv;*.mp3;*.wma;*.wav;*.ogg;*.m3u;*.m4u",16,"Flashを含む動画&音声ファイル"
if stat!=0{
flvname=refstr: gosub *openmove: goto *main
}
stop
*main
redraw 1: wait 1: redraw 0
mci "status flv position": flv_pos=stat
mci "status flv mode": flv_mode=refstr
title ""+strf("[%6.3f]",double(flv_pos)/1000)+"/"+strf("[%6.3f]",double(flv_len)/1000)+" mode="+flv_mode
getkey ky,13: if ky{ mci "play flv" }
getkey ky,32: if ky{ mci "stop flv" }
goto *main
*openmove
mci "open \""+flvname+"\" alias flv type mpegvideo"
mci "window flv handle "+hwnd
mci "put flv destination at "+0+" "+0+" "+NICO_W+" "+NICO_H
mci "set flv time format milliseconds"
mci "status flv length": flv_len=stat
mci "play flv"
return
*OnDropFiles
hdrop=wParam: DragQueryFile hdrop,-1,0,0: ndrop=stat
fileaddlist=""
repeat ndrop
DragQueryFile hdrop,cnt,varptr(filedrop),260
fileaddlist+=filedrop+"\n"
loop
mci "stop flv": mci "close all": wait 1
DragFinish hdrop
notesel fileaddlist
noteget flvname,0
noteunsel
gosub *openmove
return
*exitds
mci "stop flv"
mci "close all"
redraw 1: wait 1
end
//[マルチメディア自由自在!高レベルMCIを使う] http://www.int21.co.jp/pcdn/vb/noriolib/vbmag/9802/mci/
posted by qd_flare
http://quill.to/qd_flare/95cf5d4c18
