Playmovie with openscreen/resizing
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by Cloak.
Hi all,
I'm fearly new to pb, so this might be a dumb question, but here goes:
For my game i am using DivX movies.
Now when i open a screen, and play the movie at it's original size, it works perfectly. But when i resize the movie (width=800, height is calculated to be in perspective) it is blocky and slow.
But when i try the movieplayer (dunno the author, it,s 3:24 ) and i doubleclick the titlebar (maximize the window) it resizes perfectly, and is all smooth.
How can i do this when i play the movie in a screen?
---messy code followes---
DefType.f
If InitMovie() = 0
MessageRequester("Error", "Can't initialize movie playback !", 0)
End
EndIf
;MovieName$ = OpenFileRequester("Choose the movie to play", "", "Movie/Audio files|*.avi;*.mpg;*.asf;*.mp3;*.wav|All Files|*.*", 0)
moviename$="d:\movies\evol-dmn.avi"
InitSprite()
InitKeyboard()
Result = OpenScreen(800, 600, 32, "Movie")
SetRefreshRate(60)
SetFrameRate(60)
If MovieName$
If LoadMovie(0, MovieName$)
mw=MovieWidth()
mh=MovieHeight()
new_width=799
scale.f = new_width / mw
new_height=mh*scale.f
starty=(600-new_height)/2
ResizeMovie(0,starty,new_width,new_height)
;ResizeMovie(0,0,800,mh)
PlayMovie(0, ScreenID())
Repeat
ExamineKeyboard()
x=KeyboardPushed(#PB_Key_Escape)
Delay(20)
Until x0
Else
MessageRequester("Error", "Can't load the movie...", 0)
EndIf
EndIf
---End of messy code---
The movie played here is not part of my game, but a DivX test.
I also code in blitz, and when i use the same resizer code, it is smooth.
Both PB and Blitz are using directshow..
PLEASE help me with this one...
Regards, Cloak.
Hi all,
I'm fearly new to pb, so this might be a dumb question, but here goes:
For my game i am using DivX movies.
Now when i open a screen, and play the movie at it's original size, it works perfectly. But when i resize the movie (width=800, height is calculated to be in perspective) it is blocky and slow.
But when i try the movieplayer (dunno the author, it,s 3:24 ) and i doubleclick the titlebar (maximize the window) it resizes perfectly, and is all smooth.
How can i do this when i play the movie in a screen?
---messy code followes---
DefType.f
If InitMovie() = 0
MessageRequester("Error", "Can't initialize movie playback !", 0)
End
EndIf
;MovieName$ = OpenFileRequester("Choose the movie to play", "", "Movie/Audio files|*.avi;*.mpg;*.asf;*.mp3;*.wav|All Files|*.*", 0)
moviename$="d:\movies\evol-dmn.avi"
InitSprite()
InitKeyboard()
Result = OpenScreen(800, 600, 32, "Movie")
SetRefreshRate(60)
SetFrameRate(60)
If MovieName$
If LoadMovie(0, MovieName$)
mw=MovieWidth()
mh=MovieHeight()
new_width=799
scale.f = new_width / mw
new_height=mh*scale.f
starty=(600-new_height)/2
ResizeMovie(0,starty,new_width,new_height)
;ResizeMovie(0,0,800,mh)
PlayMovie(0, ScreenID())
Repeat
ExamineKeyboard()
x=KeyboardPushed(#PB_Key_Escape)
Delay(20)
Until x0
Else
MessageRequester("Error", "Can't load the movie...", 0)
EndIf
EndIf
---End of messy code---
The movie played here is not part of my game, but a DivX test.
I also code in blitz, and when i use the same resizer code, it is smooth.
Both PB and Blitz are using directshow..
PLEASE help me with this one...
Regards, Cloak.
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by Franco.
If nobody answers, than you are the first diving into it (I suppose...)
Have a nice day...
Franco
Sometimes you have to go a lonely way to accomplish genius things.
Sorry never played with DivX or the movie library.No-one knows the answer?
Or is this forum just dead...
If nobody answers, than you are the first diving into it (I suppose...)
Have a nice day...
Franco
Sometimes you have to go a lonely way to accomplish genius things.
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by PB.
> For my game i am using DivX movies.
> when i open a screen, and play the movie at it's original size, it works.
> when i resize the movie [...] it is blocky and slow.
Are other videos (such as MPGs) also blocky when resized? If not, then DivX is
the problem... and from what I've read, DivX is a failed format anyway and you'd
probably be better off using MPGs or other AVI types.
PB - Registered PureBasic Coder
> For my game i am using DivX movies.
> when i open a screen, and play the movie at it's original size, it works.
> when i resize the movie [...] it is blocky and slow.
Are other videos (such as MPGs) also blocky when resized? If not, then DivX is
the problem... and from what I've read, DivX is a failed format anyway and you'd
probably be better off using MPGs or other AVI types.
PB - Registered PureBasic Coder
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by Cloak.
er, are you from mars or something?
DiVX is the best format ever (until now)
And it has to be divx, because my hardware project is mainly a divx player box
anyway, other formats also get blocky and slow
but only fullscreen
in a window it (all formats) works great, also when the window is maximized
Regards, Cloak.
er, are you from mars or something?
DiVX is the best format ever (until now)
And it has to be divx, because my hardware project is mainly a divx player box
anyway, other formats also get blocky and slow
but only fullscreen
in a window it (all formats) works great, also when the window is maximized
Regards, Cloak.
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by traumatic.
and display it again with
regards,
traumatic
Edited by - traumatic on 10 August 2002 23:12:36
don't know if this helps, but in windows you can hide the taskbar withis there a way to open a borderless black fullscreen window?
wich hides even the taskbar?
Code: Select all
hWnd = FindWindow_("Shell_traywnd", "")
SetWindowPos_(hWnd, 0, 0, 0, 0, 0, #SWP_HIDEWINDOW)
Code: Select all
SetWindowPos_(hWnd, 0, 0, 0, 0, 0, #SWP_SHOWWINDOW)
traumatic
Edited by - traumatic on 10 August 2002 23:12:36
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by freak.
Yes, and this one creates a fullscreen, borderless Window:
Doesn't have to be black, since you'll display a movie in it.
Otherwise, use this:
Combine all those three things, and you'll have a black, borderless, fullscreen Window hiding the Taskbar.
That's it, hope it helps...
Timo
--
If it stinks, it's chemistry. If it moves, it's biology.
If it does not work, It's computer science.
Yes, and this one creates a fullscreen, borderless Window:
Code: Select all
If OpenWindow(0, 0, 0, GetSystemMetrics_(#SM_CXSCREEN), GetSystemMetrics_(#SM_CYSCREEN), #PB_Window_BorderLess, "Movie")
EndIf
Otherwise, use this:
Code: Select all
StartDrawing(WindowOutput())
FrontColor(0,0,0)
Box(0,0, GetSystemMetrics_(#SM_CXSCREEN), GetSystemMetrics_(#SM_CYSCREEN))
StopDrawing()
That's it, hope it helps...
Timo
--
If it stinks, it's chemistry. If it moves, it's biology.
If it does not work, It's computer science.
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by freak.
I don't know, what is wrong with your code,
you'll have to post it, so i can debug it.
Well, anyway, here's a working example playing a Video in fullscreen:
That's it, hope it helps a bit...
Timo
--
If it stinks, it's chemistry. If it moves, it's biology.
If it does not work, It's computer science.
I don't know, what is wrong with your code,
you'll have to post it, so i can debug it.
Well, anyway, here's a working example playing a Video in fullscreen:
Code: Select all
If InitKeyboard()
If InitMovie()
file.s = OpenFileRequester("Play Movie", "C:\*.*","All Files | *.*",0) ; get Filename from user
If file = "": End: EndIf
If LoadMovie(0, file) ; load
hWnd = FindWindow_("Shell_traywnd", "") ; hide Taskbar
SetWindowPos_(hWnd, 0, 0, 0, 0, 0, #SWP_HIDEWINDOW)
If OpenWindow(0, 0, 0, GetSystemMetrics_(#SM_CXSCREEN), GetSystemMetrics_(#SM_CYSCREEN), #PB_Window_BorderLess, "Movie") ; fullscreen Window
PlayMovie(0, WindowID()) ; play Movie
ResizeMovie(0, 0, GetSystemMetrics_(#SM_CXSCREEN), GetSystemMetrics_(#SM_CYSCREEN)) ; resize to screensize
Repeat ; wait for ESC-key to be pressed
ExamineKeyboard()
x=KeyboardPushed(#PB_Key_Escape)
Delay(20)
Until x0
SetWindowPos_(hWnd, 0, 0, 0, 0, 0, #SWP_SHOWWINDOW) ; show Taskbar
End
EndIf
EndIf
EndIf
EndIf
MessageRequester("Movie","Some Error occured!",0) ; in case of an error
SetWindowPos_(hWnd, 0, 0, 0, 0, 0, #SWP_SHOWWINDOW)
End
Timo
--
If it stinks, it's chemistry. If it moves, it's biology.
If it does not work, It's computer science.
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by traumatic.
of course, this doesn't make any difference to the behaviour of your program...
btw. you shouldn't use 'hWnd' as the variable-name since hWnd often refers to the main window handle, i.e. the return-value of OpenWindow().hWnd = FindWindow_("Shell_traywnd", "")
of course, this doesn't make any difference to the behaviour of your program...
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm