Index: branches/avi_play/src/lib/graphics/importer/media_container.cc
===================================================================
--- branches/avi_play/src/lib/graphics/importer/media_container.cc	(revision 6127)
+++ branches/avi_play/src/lib/graphics/importer/media_container.cc	(revision 6149)
@@ -52,4 +52,5 @@
 MediaContainer::~MediaContainer()
 {
+
   // Free the RGB image
   delete [] buffer;
@@ -72,5 +73,5 @@
 }
 
-GLuint MediaContainer::getNextFrame()
+SDL_Surface * MediaContainer::getNextFrame()
 {
   /* get next frame */
@@ -91,5 +92,8 @@
         PRINTF(1)("frame_number: %i\n", codec_context->frame_number);
 
-        // Convert the image from its native format to RGB
+        // 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);
@@ -101,9 +105,26 @@
         data = new uint8_t[codec_context->width*codec_context->height*3*sizeof(uint8_t)];
         for(int i = 0; i < codec_context->height; i++)
-          memcpy(&data[i*codec_context->width*3],
-                 picture->data[0]+i * picture->linesize[0],codec_context->width*sizeof(uint8_t)*3);
-
-
-        glGenTextures(1, &texture);
+          memcpy(&data[i*codec_context->width*3], picture->data[0]+i * picture->linesize[0],codec_context->width*sizeof(uint8_t)*3);
+
+Uint32 rmask, gmask, bmask, amask;
+
+    /* 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;
+    amask = 0x000000ff;
+#else
+    rmask = 0x000000ff;
+    gmask = 0x0000ff00;
+    bmask = 0x00ff0000;
+    amask = 0xff000000;
+#endif
+surface = SDL_CreateRGBSurfaceFrom(data, codec_context->width, codec_context->height,
+                                   32, codec_context->width*sizeof(uint8_t)*3, rmask, gmask, bmask, 0);
+
+return surface;
+        /*glGenTextures(1, &texture);
         glBindTexture(GL_TEXTURE_2D, texture);
         glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
@@ -113,5 +134,5 @@
         //{
           // build the texture
-        glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, codec_context->width, codec_context->height, 0, GL_RGB, GL_UNSIGNED_BYTE, data);
+        glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, codec_context->width, codec_context->height, 0, GL_RGB, GL_UNSIGNED_BYTE, picture->data);
         //}
         // if its not the first use glTexSubImage2D <-- faster then creating always a new texture
@@ -120,5 +141,5 @@
 
 
-        glBindTexture(GL_TEXTURE_2D, 0);
+        glBindTexture(GL_TEXTURE_2D, 0);*/
         //////////////////////////////////////////////
         /////////////////////////////////////////////
@@ -127,5 +148,5 @@
         //this->saveCurrentFrame();
 
-        return texture;
+        //return texture;
       }
     }
@@ -285,8 +306,2 @@
   PRINTF(1)("========================\n");
 }
-
-
-//pts = av_q2d(is->video_st->time_base)*pkt->dts;
-//pkt = packet
-//avstrream = viedo_st
-//pts = double
Index: branches/avi_play/src/lib/graphics/importer/media_container.h
===================================================================
--- branches/avi_play/src/lib/graphics/importer/media_container.h	(revision 6127)
+++ branches/avi_play/src/lib/graphics/importer/media_container.h	(revision 6149)
@@ -21,4 +21,6 @@
 #include "base_object.h"
 
+#include <SDL.h>
+
 /* using namespace std is default, this needs to be here */
 using namespace std;
@@ -31,4 +33,5 @@
   double fps;
   GLuint texture;
+  SDL_Surface *surface;
   uint8_t* data;
 
@@ -51,5 +54,5 @@
 
   GLuint getFrame(int frame_number);
-  GLuint getNextFrame();
+  SDL_Surface * getNextFrame();
   void loadMedia(const char* filename);
 
Index: branches/avi_play/src/lib/graphics/importer/texture_sequence.cc
===================================================================
--- branches/avi_play/src/lib/graphics/importer/texture_sequence.cc	(revision 6127)
+++ branches/avi_play/src/lib/graphics/importer/texture_sequence.cc	(revision 6149)
@@ -149,4 +149,7 @@
   }
   this->setAlpha(hasAlpha);
+
+  //PRINTF(1)("added frame");
+
   return true;
 }
Index: branches/avi_play/src/subprojects/importer/multitex.cc
===================================================================
--- branches/avi_play/src/subprojects/importer/multitex.cc	(revision 6127)
+++ branches/avi_play/src/subprojects/importer/multitex.cc	(revision 6149)
@@ -42,5 +42,5 @@
 void Framework::moduleInit(int argc, char** argv)
 {
-  movie = new MediaContainer("/home/david/Desktop/Face2.avi");
+  movie = new MediaContainer(argv[2]);
 
   // print information about the media file
@@ -52,15 +52,14 @@
 
   seq = new TextureSequence();
-  for (int i = 1; i < argc; i++)
-  {
-    seq->addFrame(argv[i]);
-    printf("%s\n", argv[i]);
-  }
+  //for (int i = 1; i < argc; i++)
+  //{
+  //  seq->addFrame(argv[i]);
+  //  printf("%s\n", argv[i]);
+  //}
 
   // add one frame from the movie
-  seq->addFrame(movie->getNextFrame());
-  GLuint tex;
-  //while((tex = movie->getNextFrame()) != NULL)
-  //  seq->addFrame(tex);
+  //seq->addFrame(movie->getNextFrame());
+  //GLuint tex;
+  while(seq->addFrame(movie->getNextFrame()) != NULL)
 
   test = new Texture(argv[1]);
@@ -102,5 +101,5 @@
 void Framework::moduleTick(float dt)
 {
-  counter += dt;
+  counter += 0.2;
 
   seq->gotoFrame((unsigned int)counter);
