[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[pygame] request for pygame/src/movie.c



Hi Pete --

Any chance I can get you to add the function below into the
main pygame source tree for the Movie class?  I desperately
need to be able to single step the SMPEG stream (by frame
number and not by time) and don't really want people to HAVE
to use a patched version of pygame :-)

On a related note, does anyone know the "correct" method to
determine the length (in frames) of an MPEG stream using the
SMPEG library (without skipping to the end of the file, which
can take a very long time)?

Thanks,
/jamie


    /*DOC*/ static char doc_movie_render_frame[] =
    /*DOC*/    "Movie.render_frame(framenum) -> bool\n"
    /*DOC*/    "Render a specfic numbered frame.\n"    
    /*DOC*/    "\n"                                
    /*DOC*/    "Returns the current frame number.\n"
    /*DOC*/    "(JM 25-aug-02)\n"                   
    /*DOC*/ ;                    
             
static PyObject* movie_render_frame(PyObject* self, PyObject* args)
{            
        SMPEG* movie = PyMovie_AsSMPEG(self);
        SMPEG_Info info;                     
        int framenum;   
                     
        if(!PyArg_ParseTuple(args, "i", &framenum))
                return NULL;                       
        Py_BEGIN_ALLOW_THREADS
        SMPEG_renderFrame(movie, framenum);
        SMPEG_getinfo(movie, &info);       
        Py_END_ALLOW_THREADS        
        return PyInt_FromLong(info.current_frame);
}

static PyMethodDef movie_builtins[] =
...
        { "render_frame", movie_render_frame, 1, doc_movie_render_frame},
...

-- 
office: 510-643-3573                mail: 3210 Tolman Hall #1650
   lab: 510-642-1950                      U.C. Berkeley
   fax: 801-697-4179			  Berkeley, CA 94720-1650
 email: mazer@socrates.berkeley.edu
____________________________________
pygame mailing list
pygame-users@seul.org
http://pygame.seul.org