Code: Alles auswählen
;wenn ein Movie mit RenderMovieFrame auf ein Sprite gerendert wird,
;sind einige der Movie-Funktionen nicht verfügbar
;in der Hilfe ist das nicht erwähnt, soweit ich weiss
;der Fehler tritt auch bei PB3.9 auf
;if a movie is rendered with RenderMovieFrame on a sprite
;some of the Movie-functions are not available
;it's not mentioned in the help-file afaik
;the error occured at PB3.9 to
;MovieLength(0) OK, returns the number of frames
;PauseMovie(0) OK
;ResumeMovie(0) OK
;StopMovie(0) OK
;MovieSeek(0, 0) failed, no influence
;MovieAudio(0, 100, 0) failed, no change in volume
;MovieStatus(0)) failed, always returns 0 (stopped)
;tested with WinXP on 2 PCs, DirectX 9.0c, AVI and MPG-movies
;PB4b6 2006-03-11 Sven
;nice that #Movie is now in all functions, UseMovie no longer needed, thanks
If InitSprite() And InitMovie() And InitKeyboard()
;file.s = "test.AVI"
file.s = "test.mpg"
sxw.w = 640 ;Screen-Size
syw.w = 480
If OpenWindow(0, 10, 10, sxw, syw, "Test") = 0
End
EndIf
If OpenWindowedScreen(WindowID(0), 0, 0, sxw, syw, 0, 0, 0) = 0
End
EndIf
If LoadMovie(0, file)
Sprite.l = CreateSprite(0, sxw, syw)
If Sprite
ResizeMovie(0, 0, 0, sxw, syw)
PlayMovie(0, #PB_Movie_Rendered)
Debug "Length " + Str(MovieLength(0))
Repeat
Delay(1)
RenderMovieFrame(0, Sprite)
DisplaySprite(0, 0, 0)
FlipBuffers()
ExamineKeyboard()
If KeyboardPushed(#PB_Key_P) ;P to pause
PauseMovie(0)
Debug "Paused"
EndIf
If KeyboardPushed(#PB_Key_R) ;R to resume
ResumeMovie(0)
Debug "Resumed"
EndIf
If KeyboardPushed(#PB_Key_Q) ;Q to stop
StopMovie(0)
Debug "Stopped"
EndIf
If KeyboardPushed(#PB_Key_S) ;S to jump to start
MovieSeek(0, 0)
Debug "Jump to start"
EndIf
If KeyboardPushed(#PB_Key_V) ;V to set volume
MovieAudio(0, 100, 0)
Debug "Volume full"
EndIf
If KeyboardPushed(#PB_Key_M) ;M to mute volume
MovieAudio(0, 0, 0)
Debug "Volume mute"
EndIf
If KeyboardPushed(#PB_Key_Space) ;Space to get state (paused, stopped)
Debug "State " + Str(MovieStatus(0))
EndIf
Until KeyboardPushed(#PB_Key_Escape)
FreeMovie(0)
EndIf
EndIf
EndIf
Code: Alles auswählen
;bei folgendem Code wird RenderMovieFrame nicht ausgeführt
;und FreeMovie führt zu "Invalid Memory Access", wenn
;die Screen-Größe verringert wird
;die Größe des Sprites ist dabei egal
;IsMovie bringt eine gültige ID <> 0
;der Fehler tritt auch bei PB3.9 auf
;in the following code RenderMovieFrame is not executet
;and FreeMovie leads to "Invalid Memory Access" if
;the screen size is decreased
;the size of the sprite has no effect
;IsMovie returns a valid ID <> 0
;the error occured at PB3.9 to
;tested with WinXP on 2 PCs, DirectX 9.0c
;PB4b6 2006-03-11 Sven
;200x150 dont work with 640x480 AVI
;320x240 dont work with 352x288 MPG
If InitSprite() And InitMovie() And InitKeyboard()
;file.s = "test.AVI"
file.s = "test.mpg"
sxw.w = 320 ;400 ;200 ;Screen-Size, test this
syw.w = 240 ;300 ;150
txw.w = sxw ;320 ;Sprite-Size
tyw.w = syw ;240
If OpenWindow(0, 10, 10, sxw, syw, "Test") = 0
End
EndIf
If OpenWindowedScreen(WindowID(0), 0, 0, sxw, syw, 0, 0, 0) = 0
End
EndIf
If LoadMovie(0, file)
Sprite.l = CreateSprite(0, txw, tyw)
If Sprite
ResizeMovie(0, 0, 0, txw, tyw)
PlayMovie(0, #PB_Movie_Rendered)
Debug IsMovie(0)
Repeat
Delay(1)
RenderMovieFrame(0, Sprite)
DisplaySprite(0, 0, 0)
FlipBuffers()
ExamineKeyboard()
Until KeyboardPushed(#PB_Key_Escape)
Debug IsMovie(0)
FreeMovie(0)
EndIf
EndIf
EndIf