Index: /branches/avi_play/src/lib/graphics/importer/media_container.cc
===================================================================
--- /branches/avi_play/src/lib/graphics/importer/media_container.cc	(revision 6111)
+++ /branches/avi_play/src/lib/graphics/importer/media_container.cc	(revision 6112)
@@ -92,25 +92,31 @@
         PRINTF(1)("current_frame: %i\n", current_frame);
 
-		    // Convert the image from its native format to RGB
+                    // Convert the image from its native format to RGB
         img_convert((AVPicture*)RGB_frame, PIX_FMT_RGB24, (AVPicture*)frame, codec_context->pix_fmt,
-					codec_context->width, codec_context->height);
+                                        codec_context->width, codec_context->height);
 
         picture = (AVPicture*)RGB_frame;
-			
-        //////////////////////////////////////////////
-        ////////// FIX THIS //////////////////////////
+
+
+        data = 0;
+        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);
         glBindTexture(GL_TEXTURE_2D, texture);
+        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
+        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
         // if it is the first frame create texture
-        if(current_frame == 1)
-        {
-          glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
-          glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
-				  // build the texture
-          glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, codec_context->width, codec_context->height, 0, GL_RGBA, GL_UNSIGNED_BYTE, picture->data[0]);
-        }
+        //if(current_frame == 1)
+        //{
+          // build the texture
+        glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, codec_context->width, codec_context->height, 0, GL_RGB, GL_UNSIGNED_BYTE, data);
+        //}
         // if its not the first use glTexSubImage2D <-- faster then creating always a new texture
-        else
-          glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, codec_context->width, codec_context->height, GL_RGBA, GL_UNSIGNED_BYTE, picture->data[0]);
+        //else
+        //  glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, codec_context->width, codec_context->height, GL_RGB, GL_UNSIGNED_BYTE, data);
 
 
@@ -142,5 +148,5 @@
   file = fopen(filename, "wb");
   if(file == NULL)
-  	return;
+        return;
 
   // Write header
@@ -163,5 +169,5 @@
   /* Retrieve stream information */
   if (av_find_stream_info(format_context) < 0)
-    PRINTF(1)("Could not find stream information in %s\n", filename); 
+    PRINTF(1)("Could not find stream information in %s\n", filename);
 
   // Dump information about file onto standard error
@@ -173,5 +179,5 @@
   {
     // NOTE: different code for the 0.4.9-pre1 release of ffmpeg (tardis)
-    // if(format_context->streams[i]->codec.codec_type == CODEC_TYPE_VIDEO)		
+    // if(format_context->streams[i]->codec.codec_type == CODEC_TYPE_VIDEO)
     if(format_context->streams[i]->codec->codec_type == CODEC_TYPE_VIDEO)
     {
@@ -180,5 +186,5 @@
     }
   }
-  
+
   if(video_stream == -1)
     PRINTF(1)("Could not find a video stream in %s\n", filename);
@@ -200,5 +206,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
@@ -207,5 +213,5 @@
 
   // Assign appropriate parts of buffer to image planes in pFrameRGB
-  avpicture_fill((AVPicture *)RGB_frame, buffer, PIX_FMT_RGB24, codec_context->width, codec_context->height);	
+  avpicture_fill((AVPicture *)RGB_frame, buffer, PIX_FMT_RGB24, codec_context->width, codec_context->height);
 
 }
Index: /branches/avi_play/src/lib/graphics/importer/media_container.h
===================================================================
--- /branches/avi_play/src/lib/graphics/importer/media_container.h	(revision 6111)
+++ /branches/avi_play/src/lib/graphics/importer/media_container.h	(revision 6112)
@@ -32,4 +32,5 @@
   int num_frames;
   GLuint texture;
+  uint8_t* data;
 
   AVFormatContext* format_context;
@@ -40,5 +41,5 @@
   AVPicture* picture;
   AVFrame* RGB_frame;
-	
+
   int num_bytes;
   uint8_t *buffer;
@@ -53,8 +54,8 @@
   GLuint getNextFrame();
   void loadMedia(const char* filename);
-	
+
   int getHeight();
   int getWidth();
-	int getCurrentFrame();
+  int getCurrentFrame();
   int getFrameRate();
   void getStream(/* stream */);
Index: /branches/avi_play/src/lib/graphics/importer/texture_sequence.cc
===================================================================
--- /branches/avi_play/src/lib/graphics/importer/texture_sequence.cc	(revision 6111)
+++ /branches/avi_play/src/lib/graphics/importer/texture_sequence.cc	(revision 6112)
@@ -158,8 +158,8 @@
 bool TextureSequence::addFrame(GLuint texture)
 {
-  if (texture == NULL)
+  if (texture == 0)
     return false;
   this->textures.push_back(texture);
-  
+
   return true;
 }
Index: /branches/avi_play/src/lib/sound/sound_engine.cc
===================================================================
--- /branches/avi_play/src/lib/sound/sound_engine.cc	(revision 6111)
+++ /branches/avi_play/src/lib/sound/sound_engine.cc	(revision 6112)
@@ -292,5 +292,5 @@
   ALubyte deviceName[] =
 #else
-  ALCchar deviceName[] =
+  ALubyte deviceName[] =
 #endif
 
Index: /branches/avi_play/src/subprojects/importer/multitex.cc
===================================================================
--- /branches/avi_play/src/subprojects/importer/multitex.cc	(revision 6111)
+++ /branches/avi_play/src/subprojects/importer/multitex.cc	(revision 6112)
@@ -37,10 +37,10 @@
 MediaContainer* movie;
 
-float counter = 0;
+int counter = 0;
 
 
 void Framework::moduleInit(int argc, char** argv)
 {
-  movie = new MediaContainer("/home/david/Desktop/Face2.avi");
+  movie = new MediaContainer("/home/lieni/Desktop/Face2.avi");
 
   // print information about the media file
@@ -52,12 +52,15 @@
 
   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());
+  // add one frame from the movie
+  //seq->addFrame(movie->getNextFrame());
+  GLuint tex;
+  while((tex = movie->getNextFrame()) != NULL)
+    seq->addFrame(tex);
 
   test = new Texture(argv[1]);
@@ -99,9 +102,11 @@
 void Framework::moduleTick(float dt)
 {
-  counter+=dt;
+  counter++;
 
-  seq->gotoFrame((unsigned int)counter);
-  if ((unsigned int)counter > seq->getFrameCount())
+  seq->gotoFrame(counter);
+
+  if (counter > seq->getFrameCount())
     counter = 0;
+
 }
 
