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

[pygame] problems with using video



Hi,

I am new to using pygame, and I have just started making my first application 
with it.  I have been tasked to create a slideshow type of application for a 
client.  Basically, it just displays a picture in the background with a text 
message scrolling along the bottom of the screen for each scene in the 
slideshow.  I have been trying to incorporate videos into this application, 
but I've been having problems with this.

I've been able to get the videos to play, and I've made it so that they appear 
framed in the center of the screen so the scrolling text doesn't look messed 
up when scrolling by on the bottom (In the future, I'm probably going to fix 
it so the whole background will play the video, and the text will be drawn 
with the current frame as a background, but that's too involved for me at the 
moment).  I've made it so that the video will loop for the duration of the 
scene, which is timed according to the text on the bottom of the screen 
scrolling completely past.

The problem is that most of the time (almost 100%) the video (and whole scene) 
will freeze up, and pygame will become unresponsive.  Occasionally, the whole 
thing will crash leaving this error message:

python: ../../src/xcb_lock.c:77: _XGetXCBBuffer: Assertion `((int) 
((xcb_req) - (dpy->request)) >= 0)' failed.

This only seems to happen when I'm testing on my local desktop, using 
windowed, instead of fullscreen mode.  On my desktop, I get more xcb_lock 
errors, than I do freezes.

The application is to be run on a dedicated machine, and the signal is to go 
through the tv-out of the video card and be split among several tv's.  I am 
using debian/lenny for the OS of the machine, and X11 for the display (to be 
able to use the tv-out).  I'm saying this, because I believe that the bug may 
be in X, or the way that X is being used by either sdl or pygame, although 
I'm not really sure.  Since I'm new to programming with pygame, it's very 
possible that the bug is in my code, and I have overlooked something 
important.

I test the system using virtualbox, and on the VM, the xcb_lock error never 
occurs, rather, the scene will freeze, and the cpu will be pegged at 100%.

Here is a snipped of strace when the scene is frozen:

futex(0x8314b94, FUTEX_WAIT_PRIVATE, 2, NULL) = -1 EAGAIN (Resource 
temporarily unavailable)
futex(0x8314b94, FUTEX_WAKE_PRIVATE, 1) = 1
futex(0x8314bb8, FUTEX_WAKE_PRIVATE, 1) = 1
futex(0x8314bbc, FUTEX_WAIT_PRIVATE, 34199, NULL) = -1 EAGAIN (Resource 
temporarily unavailable)
futex(0x8314b94, FUTEX_WAIT_PRIVATE, 2, NULL) = -1 EAGAIN (Resource 
temporarily unavailable)
futex(0x8314b94, FUTEX_WAKE_PRIVATE, 1) = 1
futex(0x8314bb8, FUTEX_WAKE_PRIVATE, 1) = 1
futex(0x8314bbc, FUTEX_WAIT_PRIVATE, 34201, NULL) = -1 EAGAIN (Resource 
temporarily unavailable)
futex(0x8314b94, FUTEX_WAIT_PRIVATE, 2, NULL) = -1 EAGAIN (Resource 
temporarily unavailable)
futex(0x8314b94, FUTEX_WAKE_PRIVATE, 1) = 0
futex(0x8314bb8, FUTEX_WAKE_PRIVATE, 1) = 1
futex(0x8314bbc, FUTEX_WAIT_PRIVATE, 34203, NULL) = -1 EAGAIN (Resource 
temporarily unavailable)
futex(0x8314b94, FUTEX_WAIT_PRIVATE, 2, NULL) = -1 EAGAIN (Resource 
temporarily unavailable)
futex(0x8314b94, FUTEX_WAIT_PRIVATE, 2, NULL) = -1 EAGAIN (Resource 
temporarily unavailable)
futex(0x8314b94, FUTEX_WAKE_PRIVATE, 1) = 1
futex(0x8314bbc, FUTEX_CMP_REQUEUE_PRIVATE, 1, 2147483647, 0x8314b94, 34206) = 
1
futex(0x8314b94, FUTEX_WAKE_PRIVATE, 1) = 1

-----------------------------------------
This is repeated, over and over.

I am attaching the code and a test show with a script to download the 
pictures, truetype font, and a short video from the internet.  You can use 
any pictures and video that you want, but I've tried to make it easy for you 
by selecting components that I'm sure will be available.  The script is in 
the test-show.tar.gz archive.

The marquee script must be run in the "test-show" directory that will be 
created when extracting that archive.  The application can be run locally by 
adjusting the PYTHONPATH, or by editing the marquee script and appending the 
sys.path object.

I would really like some help in figuring this out.  This is literally a 
show-stopper for me (pun intended).  I apologize in advance if the bug is in 
my code, as I don't want to be wasting your time.  If the bug is in pygame, 
sdl, or X, I think that you should be made aware of it.

BTW,  I started to look for an application that would fit the requirements 
that my client wanted, but I couldn't find anything.  The closest thing I can 
think of would be flash, but I don't know much about how to use that either, 
and the tools are not cheap.  It occurred to me at a point to give pygame a 
try and see how that works, and it turns out be be pretty easy.  Much of this 
code was written after a few glances at the docs, and mostly done before I 
learned about the sprite objects.  I think that the code will look a lot 
better once I get more accustomed to using the library and start using the 
sprites.  If anybody thinks that this type of application could be used by 
others, I can make a project on berlios so that others can use it too.  At 
the moment, it's just a quick and dirty hack to get a particular job done.


-- 
Thanks:
Joseph Rawson

Attachment: marquee_0.0.9.tar.gz
Description: application/tgz

Attachment: test-show.tar.gz
Description: application/tgz

Attachment: signature.asc
Description: This is a digitally signed message part.