Index: branches/avi_play/src/lib/graphics/importer/media_container.cc
===================================================================
--- branches/avi_play/src/lib/graphics/importer/media_container.cc	(revision 6160)
+++ branches/avi_play/src/lib/graphics/importer/media_container.cc	(revision 6163)
@@ -42,16 +42,4 @@
   fps = 0;
 
-  /* SDL interprets each pixel as a 32-bit number, so our masks must depend
-     on the endianness (byte order) of the machine */
-#if SDL_BYTEORDER == SDL_BIG_ENDIAN
-  rmask = 0xff000000;
-  gmask = 0x00ff0000;
-  bmask = 0x0000ff00;
-#else
-  rmask = 0x000000ff;
-  gmask = 0x0000ff00;
-  bmask = 0x00ff0000;
-#endif
-
   if (filename != NULL)
     this->loadMedia(filename);
@@ -64,4 +52,11 @@
 MediaContainer::~MediaContainer()
 {
+  // delete all surfaces in the list
+  while(!this->surface_list.empty())
+  {
+    SDL_FreeSurface(this->surface_list.back());
+    this->surface_list.pop_back();
+  }
+  SDL_FreeSurface(surface);
 
   // Free the RGB image
@@ -97,17 +92,16 @@
       int frame_finished;
       // Decode video frame
-      avcodec_decode_video(codec_context, frame, &frame_finished, packet.data, packet.size);
+      avcodec_decode_video(codec_context, frame, &frame_finished,
+                           packet.data, packet.size);
 
       // Did we get a video frame?
       if(frame_finished)
       {
-        PRINTF(1)("frame_number: %i\n", codec_context->frame_number);
-
         // Conversion from YUV to RGB
         // Most codecs return images in YUV 420 format
         // (one luminance and two chrominance channels, with the chrominance
         // channels samples at half the spatial resolution of the luminance channel)
-        img_convert((AVPicture*)RGB_frame, PIX_FMT_RGB24, (AVPicture*)frame, codec_context->pix_fmt,
-                                        codec_context->width, codec_context->height);
+        img_convert((AVPicture*)RGB_frame, PIX_FMT_RGB24, (AVPicture*)frame,
+                    codec_context->pix_fmt, codec_context->width, codec_context->height);
 
         picture = (AVPicture*)RGB_frame;
@@ -119,6 +113,19 @@
           memcpy(&data[i*codec_context->width*3], picture->data[0]+i * picture->linesize[0],codec_context->width*sizeof(uint8_t)*3);
 
-        surface = SDL_CreateRGBSurfaceFrom(data, codec_context->width, codec_context->height,
-                                           24, codec_context->width*sizeof(uint8_t)*3, rmask, gmask, bmask, 0);
+        surface = SDL_CreateRGBSurfaceFrom(data, codec_context->width,
+                                           codec_context->height,24,
+                                           codec_context->width*sizeof(uint8_t)*3,
+#if SDL_BYTEORDER == SDL_LIL_ENDIAN /* OpenGL RGBA masks */
+                                           0x000000FF,
+                                           0x0000FF00,
+                                           0x00FF0000,
+                                           0
+#else
+                                           0xFF000000,
+                                           0x00FF0000,
+                                           0x0000FF00,
+                                           0
+#endif
+                                            );
 
         return surface;
@@ -130,4 +137,13 @@
   else
     return NULL;
+}
+
+vector<SDL_Surface*> MediaContainer::getFrameList()
+{
+
+  while((surface = this->getNextFrame()) != NULL)
+    surface_list.push_back(surface);
+
+  return surface_list;
 }
 
@@ -200,5 +216,5 @@
   // Allocate video frame
   frame = avcodec_alloc_frame();
-        RGB_frame = avcodec_alloc_frame();
+  RGB_frame = avcodec_alloc_frame();
 
   // Determine required buffer size and allocate buffer
Index: branches/avi_play/src/lib/graphics/importer/media_container.h
===================================================================
--- branches/avi_play/src/lib/graphics/importer/media_container.h	(revision 6160)
+++ branches/avi_play/src/lib/graphics/importer/media_container.h	(revision 6163)
@@ -8,4 +8,6 @@
 #define _MEDIA_CONTAINER
 
+#include <SDL.h>
+#include <vector>
 
 #ifdef HAVE_AVFORMAT_H
@@ -15,11 +17,6 @@
 #endif
 
-
-#include "glincl.h"
-
 /* include base_object.h since all classes are derived from this one */
 #include "base_object.h"
-
-#include <SDL.h>
 
 /* using namespace std is default, this needs to be here */
@@ -32,6 +29,5 @@
 
   double fps;
-  Uint32 rmask, gmask, bmask;
-  SDL_Surface *surface;
+  SDL_Surface* surface;
   uint8_t* data;
 
@@ -41,10 +37,12 @@
   AVFrame* frame;
   AVPacket packet;
+  AVFrame* RGB_frame;
   AVPicture* picture;
-  AVFrame* RGB_frame;
 
   int num_bytes;
   uint8_t *buffer;
   int video_stream;
+
+  vector<SDL_Surface*>    surface_list;
 
 public:
@@ -55,4 +53,5 @@
   SDL_Surface* getFrame(int frame_number);
   SDL_Surface* getNextFrame();
+  vector<SDL_Surface*> getFrameList();
   void loadMedia(const char* filename);
 
@@ -62,13 +61,11 @@
   double getFPS();
 
-  /* prints some information about the
-     media file for debug reasons */
+  void saveCurrentFrame();
+
   void printMediaInformation();
   void printPacketInformation();
-  void saveCurrentFrame();
 
 };
 
 
-
 #endif /* _MEDIA_CONTAINER */
Index: branches/avi_play/src/lib/graphics/importer/texture_sequence.cc
===================================================================
--- branches/avi_play/src/lib/graphics/importer/texture_sequence.cc	(revision 6160)
+++ branches/avi_play/src/lib/graphics/importer/texture_sequence.cc	(revision 6163)
@@ -150,7 +150,12 @@
   this->setAlpha(hasAlpha);
 
-  //PRINTF(1)("added frame");
+  return true;
+}
 
-  return true;
+bool TextureSequence::addFrameList(std::vector<SDL_Surface*> surfaces)
+{
+  // add the surfaces to the list
+  for(int i = 0; i < surfaces.size(); i++)
+    this->addFrame(surfaces[i]);
 }
 
Index: branches/avi_play/src/lib/graphics/importer/texture_sequence.h
===================================================================
--- branches/avi_play/src/lib/graphics/importer/texture_sequence.h	(revision 6160)
+++ branches/avi_play/src/lib/graphics/importer/texture_sequence.h	(revision 6163)
@@ -30,4 +30,5 @@
     bool addFrame(SDL_Surface* surface);
     bool addFrame(GLuint texture);
+    bool addFrameList(std::vector<SDL_Surface*> surfaces);
 
     virtual bool rebuild();
