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

Re: [pygame] fix to get_busy() (using movieext (patch attached))



was gathering further notes to a single e-mail on Tuesday to not flood the 
list, and then of course forgot to send the message before leaving work :o

am currently suffering from a segfault when looping a clip using movieext 
-- probably related to the kludgy way .rewind() is implemented currently 
(reopening, due to not supporting seek..). that segfault only occurs in a 
long run (like when i leave it looping overnight or something), probably 
some basic c memory management thing.

also pymedia segfaults at import on this box, haven't looked into that 
yet, perhaps related to having different versions of the ffmpeg lib 
(pymedia cvs has some own copies of some old versions)

now trying another route by using mplayer for playback (as it supports 
also http, dvd etc. nicely and is robust and stable), getting the video 
out using the using -vo yuv4mpeg, and adding things like text overlay to 
that stream in LiVES.

any insights to whether/how i could either

a) get video out of pygame (sdl) as that kind of yuv4mpeg stream too?
(LiVES can capture video from a X11 window too, probably works for pygame, 
but might be a bit hacky for a production system)

b) make a module for pygame for getting in such streams (e.g. from 
mplayer)?

i suppose both are well possible but haven't looked too deeply yet.

travelling soon today, back to work on these on Monday .. dunno if anyone 
is interested in these monologies or do they just pollute the list, any 
kind of weedback welcome :)

~Toni

oh and below the later little patches made back then on Tuesday, haven't 
touched the Pygame sources since:

On Tue, 11 Jan 2005, Toni Alatalo wrote:

> .get_busy() was always returning true in error. luckily was easily fixed:

that one helped to the case where the file had been opened,
but play not started, or when it had been stopped/paused in the middle

this was still needed for it to work when the end of the movie is reached:

in ffmovie.c line 585 or something:
if (av_read_packet(movie->context, pkt) < 0) {
	ffmovie_stop(movie); /*so that get_busy() will tell has  stopped.. */
	break;
}

an unsolved problem is in .rewind(): it ends up in ffmovie.c's 
ffmovie_reopen, where the surface setting was preserved if the movie 
object had a dest_overlay - i didn't get the logic in that, so changed so 
that dest_surface and dest_rect are always preserved.

this made .rewind() work ok, except in the case where the video has ended 
(and with my change, hence stopped) before the rewind, in which case the 
surface is lost (nothing shows unless set_display is re-done, which is my 
current workaround on the Python side). couldn't find the reason for this.

> in movieext.c
> 385c385
> <       return PyInt_FromLong(movie->context != NULL);
> ---
> >       return PyInt_FromLong(movie->paused == 0);
> 
> > thanks again Pete for the hard work,
> > ~Toni
> same.

again