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

Re: [pygame] Movie module information



On, Sun Apr 26, 2009, Tyler Laing wrote:

> Hello all,
> 
> One of the first steps I need to take for the GSoC project is to get user
> stories so I can build acceptance tests.
> 
> I want to hear what you guys(the users) want out of an updated movie module.
> What do you want to be able to do, and how?

Here's my wish list:

 * format support (avi, mpeg, etc...)
 * seperate stream manipulation and handling, if possible
   - mute, play, stop, rewind for audio and video streams
     within the main stream of the video file.
 * simple(!) video handling

How might that look like? 

  # Create a new movie instance.
  video = pygame.movie.Video ("video.avi")

  # Bind the surface on which the video stream will be rendered.
  video.surface = outputsurface

  # Bind a handler for updates of the video output surface, so we can
  # handle changed frames and update anything accordingly.
  # 
  # This is optional for specialised/optimised update loops.
  video.cb_update = update_callback

  # Start async. playback of the video.
  video.play ()

  # Stop/pause/... playback
  video.stop()
  video.pause()
  video.rewind(time_pos)

  # Play only a seperate stream, e.g. one of the audio streams of the video.
  video.streams[streamid].play()
  
  # This heavily depends on the video (P/I-Frames, etc.):
  raw_buffer = video.get_frame (streamid, time_pos)
  raw_buffer = video.streams[streamid].get_frame (time_pos)
  ...

  video.streams[streamid].cb_update = update_callback
  video.streams[streamid].outobj = outputobject

So what I'd basically would like to have is some video container object
that gives me access to the available streams and lets me handle them
seperately on demand. If I do not want ot make use of those, generic
video object methods should take care of dealing with play, pause,
etc. and update all streams accordingly.

This would mean, there are two types of classes, a 'VideoStream' class (or
whatever) that allows one to bind callbacks and objects for updated
buffers (so we can move the raw data around in the pipes or let them be
movied automatically). And a container class 'Video' that contains
multiple 'VideoStream' objects and keeps them in sync. on playback.

Regards
Marcus

Attachment: pgpRyDv3MNlub.pgp
Description: PGP signature