This is preview!
2.1. Your wrapper class crashes in every ocassion if the "Close()" method is called more than once, or if it is called before having opened a video. The class' destructor calls Close(), so if you had a video closed and then end the program, it will also crash. If the wrapper instance hasn't called Open() and the program ends, it will crash too.
2.1.1. I figured this one out. This crash is because you always call g_main_loop_quit() inside Close(). If there is no video open, the Glib main loop won't be running and it will crash. To prevent this, I added an "if" statemente to check whether the thread that runs the Glib main loop is running. If it isn't running, then g_main_loop_quit() isn't called, and all is well now!2.2. Practically everytime I close a video, it crashes when trying to unref the gstreamer video sink. I commented that line and it is a temporary (although not very good) solution. This lets me work quite well except for the fact that randomly it crashes when setting the state of the pipeline to NULL. Sometimes it takes a lot of calls to Close() to crash, sometimes it happens the first time. I don't know what causes this, there is an error trying to write to an invalid memory address. I struggled a long time with this, without success. I thought it might be because of some threads still using the pipeline, but giving time for threads to finish didn't help. I checked if there had been a problem when stopping the video before this, but it all seems well. Nothing seems wrong but it still dies at random. I believe this might be the same problem Mike Creighton had with his prototype and his experience with gstreamer in processing and OpenFrameworks, and I'm at a loss for now. I might have to go for a different library, at least for now.
- m_GstPipeline = gst_element_factory_make( "playbin2", "pipeline" );