vector and ofVideoPlayer

Hello,

I have a problem with ofVideoPlayer and vector, I tried everything I know but without success.

So basically, I have a quad class which contains a ofVideoPlayer that I map on my quad with ofTextureAdv.

  
	  
class mdQuad{  
  
	public:  
		mdQuad();  
		void draw();  
		void drawPoint(int p);  
		void create(int x, int y);  
		void loadMovie(string name);  
		void idleMovie();  
		void updateP1(int x, int y);  
		void updateP2(int x, int y);  
		void updateP3(int x, int y);  
		void updateP4(int x, int y);  
		  
		int x1,x2,x3,x4,y1,y2,y3,y4;  
		int width;  
		ofVideoPlayer vPlayer;  
		ofTextureAdv videoTexture;  
		bool videoOn;  
		  
	private:  
	  
};  
  

On my TestApp, I can draw quads and assign videos to them - the quads are stored in a vector.

It works fine until i draw a new quad and call the push_back function to store the quad into the vector ONCE a video has been already assigned…so:

  1. draw quad – works
  2. draw quad – works
  3. draw quad – works
  4. assign video to quad 1 – works
  5. assign video to quad 2 – works
  6. draw quad – FAIL

Does the push_back function delete the previous objects ? How could I deal with this problem?

Thanks in advance!

—edit

posting here brings me luck…i managed to do it. it’s working fine by using the solution by joshuajnoble found here: http://forum.openframeworks.cc/t/video-stuck-problem/3851/2

so i have a separate vector of ofVideoPlayer* in my testapp.

however i’m still interested to know if the push_back function delete stuff in previous objects! :slight_smile:

yes, push_back will make a copy and that will delete your previous object due to some bug in how videoPlayers are being copied. you can create a vector of video players like:

  
vector<ofVideoPlayer> videos;  
  
videos.resize(10);  
videos[0].loadMovie("mymovie.avi");  
videos[0].play();  
...  

ok, thanks arturo!