[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] movie flip/update



Here is my little test app. If I move the window around I lose video. If I
uncomment the flip() I lose video. I have not clue if I could even rendor
mplayer which is opened in a popen to a surface. You guys can just tell me
this is a pipe dream in pygame and I'll move on.

Thanks for all the help
Mike





import pygame
from pygame.locals import *
import popen2
import os
import commands
import sys



def main():

	pygame.init()
	screen = pygame.display.set_mode((640, 480))
	pygame.display.set_caption('Test App')


	# getting the window ID
	windId = commands.getoutput("xwininfo -tree -name \"Test App\" | grep
640x480 | awk {\' print $1 \'}")
	print windId

	pygame.mixer.quit()
	mplayer_cmd = 'mplayer -vo xv -quiet -slave -wid %s
/dump/mp3s/11/1short.mpeg' % (windId)
	mplayer_cmd = mplayer_cmd.encode ('iso-8859-15')

	mplayer = popen2.Popen3(mplayer_cmd)

	while 1:
		for event in pygame.event.get():
			if event.type == QUIT:
				sys.exit(2)
			if event.type == KEYDOWN:
				print "OMG keydown!"
			if event.type == MOUSEBUTTONDOWN:
				print "we got a mouse button down!"

		#pygame.display.flip()


if __name__ == '__main__': main()

> On Wednesday 17 September 2003 06:50, mike@zcentric.com wrote:
>> Ya i can easily get the window ID in linux at least with xwininfo, but
>> my problem is if I want to make buttons around an embeded mplayer
>> window it just gets overwritten.. so thats why I wanted to look into
>> the second surface idea which I guess I need to read into since I have
>> no clue what it is. I'm still fairly new to pygame
>>
>> Mike
>>
>
> I think what he means is you have 2 surfaces. ( + the screen, which is a
>  surface in hardware ).
>
> You render Mplayer to one surface in memory
> You render your 'controls' to another.
> Then you compose both surfaces to the screen.
>
> With the proper selection of transparency in the button-surface ( a hole
> for  mplayer to show through ), this should work...
>
> -Daniel