Menu

Prototype required.

Developers
2003-10-21
2003-10-27
  • Mujtaba Hasni

    Mujtaba Hasni - 2003-10-21

    Marcus wants a Prototype for the play back of an
    mpeg video file. The goal is to make a program like
    the following work:

    function play_movie
    var pligame:Surface screen
    var pligame:Event event
    var pligame:Movie

    pligame init #initialize SDL.

    #Load mpeg file stream
    movie := pligame:movie:Load "mympeg.mpg"

    #Set screen size to movie size.
    var Int w := movie:get_width
    var Int h  := movie:get_height
    screen := pligame:display:set_mode w h
    #default bit-depth, eg for 16-bit: set_mode w h 16

    var Int movie_length := movie:get_length
    console "Movie is  " movie_length  "seconds long." eol

    movie:set_display screen  #draw to screen
    movie:play(0) # 0 infinte loop

      Cbool done := false
      while not done
        while event:poll
          eif event:get(QUIT) # User Closes window
            done := true
         movie:stop
       pligame quit
      #end play_movie

    play_movie # execute play_movie

     
    • Mujtaba Hasni

      Mujtaba Hasni - 2003-10-21

      here's a link to the .pli file. Forums don't
      perserve indents.

      http://pligame.sf.net/files/mympeg.pli

       
    • Ken Seto

      Ken Seto - 2003-10-27

      SMPEG is done in c++, however, it comes with a C interface also.  I'm now writting the wrapper for it, should I use the C interface?  or stick with C++. (the C interface seems to have less control, but I am not really sure)  Let me hear your comments. Thanks.

       
      • Ken Seto

        Ken Seto - 2003-10-27

        nevermind what i said early, pliant can own create interfaces to external C libraries, not C++.

        ken

         
      • Mujtaba Hasni

        Mujtaba Hasni - 2003-10-27

        If SMPEG has a C interface, then its fine. I have yet
        to take a look at it myself. We only need to wrap
        eneough of SDL and SMPEG to make the code
        snipped (or something very close to it) to work.

        Could you give me a code snippet of what a program
        like I described above would look like in C? What are
        the essential C functions for loading a clip, attaching
        it to a surface and begin playback?

         

Log in to post a comment.