Itseez/opencv — pull request #684 by vhdirk (2013-03-21 10:28:15+00:00)
Title: bomb commit of gstreamer videocapture and videowriter

This is a large patch addressing multiple issues I had with opencv.
First of all, this patch adds support for GStreamer 1.x, which was released in June 2012. Since v0.10 is still very widespread, support for v1.x has to be enabled explicitely by setting ```WITH_GSTREAMER_1_X=ON``` in cmake.

As a part of the process, I added more features to both VideoCapture and VideoWriter.

**VideoCapture**:
* added support for grayscale and bayer format buffer types
* v4l2 does not support caps renegotiation, meaning that wrapping it in an uridecodebin does not allow setting frame size and frame rate any longer. This is solved by making a single v4l2src element from uri for v4l2 uris explicitely
* added support for width, height and framerate in the getProperty method, but only after the first frame was received.
* recording is only started when a first frame is grabbed. Properties are usually set before grabbing frames, and setting properties is done by restarting the pipeline. So by delaying starting the pipeline, less time is wasted.

**VideoWriter**:
* creating the correct encoder/muxer element is now fully handled by GStreamer itself. GStreamer automatically selects the correct encoder from the supplied FOURCC, and the container is selected from the supplied filename's extension. This means that any codec/container combination supported by GStreamer is now available.
* manual pipelines (like in VideoCapture) are now also supported for VideoWriter. (e.g. appsrc ! videoconvert ! rtpmp4vpay )
* Buffer timestamps are now generated from the framerate supplied in open() and the number of frames received so far. This makes the produced video much more fluent.
* Video is finished properly by waiting for the end-of-stream message to be handled fully by the whole pipeline.