Here is a much-simplified version of my program.
Code: Select all
;*************** TURN OFF THE DEBUGGER! ****************
DisableDebugger
#CAPTUREBLT = $40000000 ; Necessary for BitBlt to get layered windows if present on screen
InitMovie()
Global width = 640
Global height = 360
dc = CreateDC_("DISPLAY",0,0,0)
ndc = CreateCompatibleDC_(0)
bmi.BITMAPINFO
bmi\bmiHeader\biSize = SizeOf(BITMAPINFOHEADER)
bmi\bmiHeader\biWidth = width
bmi\bmiHeader\biHeight = -height ; Otherwise colors in the buffer will be backwards, "bottom-up" which we don't want
bmi\bmiHeader\biPlanes = 1
bmi\bmiHeader\biBitCount = 32
bmi\bmiHeader\biCompression = #BI_RGB
; hImage = CreateDIBSection_(ndc, bmi, #DIB_RGB_COLORS, @*buffer1, 0, 0)
; If hImage
; DeleteObject_(SelectObject_(ndc, hImage))
; BitBlt_(ndc, 0,0,width,height,dc,0,0,#SRCCOPY|#CAPTUREBLT)
; DeleteDC_(dc)
; DeleteDC_(ndc)
; EndIf
LoadMovie(1,"handsfree big load.mp4")
;LoadMovie(1,"your movie title.mp4")
MovieAudio(1,0,0)
ResizeMovie(1,0,0,640,360)
hWnd = OpenWindow(1,0,0,1280,720,"",#PB_Window_SystemMenu)
AddKeyboardShortcut(1, #PB_Shortcut_Control|#PB_Shortcut_Q, 113);CTL Q TO QUIT
;FOR TESTING BLITTER
; StartDrawing(WindowOutput(1))
; Box(0,0,200,200,#Blue)
; StopDrawing()
CreateImage(1,width,height,24)
PlayMovie(1,WindowID(1)) ;: Delay(duration * 1000)
Delay(500):PauseMovie(1)
Repeat: Until MovieStatus(1) <= 0
hImage = CreateDIBSection_(ndc, bmi, #DIB_RGB_COLORS, @*buffer1, 0, 0)
If hImage
DeleteObject_(SelectObject_(ndc, hImage))
BitBlt_(ndc, 0,0,width,height,dc,0,0,#SRCCOPY|#CAPTUREBLT)
DeleteDC_(dc)
DeleteDC_(ndc)
EndIf
;hdcDest = StartDrawing(ImageOutput(1))
;hDCsrc = GetDC_(WindowID(1))
;BitBlt_(hdcDest, 0, 0, 640, 360,hDCsrc, 0,0,#SRCCOPY|#CAPTUREBLT)
;StopDrawing()
StartDrawing(WindowOutput(1))
DrawImage(ImageID(1),0,360)
StopDrawing()
Repeat:Until WaitWindowEvent() = #PB_Event_CloseWindow
FreeMovie(1)
FreeImage(1)
ReleaseDC_(hWnd,hDCsrc)
CloseWindow(1)