Skip to content
Saunier Thibault edited this page Apr 24, 2015 · 1 revision

GstValidate frame comparision plugin design

Use cases:

* You want to make sure a frame with a specific running time is similar to a reference frame
* After an action (seek) you want to make sure the frame following is similar to a reference frame

Solution:

It will be a GstValidate Plugin (similar to http://cgit.freedesktop.org/gstreamer/gst-devtools/tree/validate/gst/plugins/gapplication/gstvalidategapplication.c )

Then In the plugin init function you need to :

// create an override :
override = gst_validate_override_new ();

// Set the function to be called when a buffer flows through a pad where the // override will be attached (see next) gst_validate_override_set_buffer_handler (override, _buffer_handler_func);

// Attach it to pads with a "Video/Decoder" klass:
gst_validate_override_registry_attach_by_klass ("Video/Decoder", override)

// in gst-validate-override-registry.c there is that todo // It needs to be done for Video/Decoder to be properly understood. 186 /* TODO It would be more correct to split it before comparing */ 187 if (strstr (klassname, entry->name) != NULL) { 188 gst_validate_monitor_attach_override (monitor, entry->override); 189 }

So now you can get the configration for the plugin (you get a GList of GstStructure) (look at http://cgit.freedesktop.org/gstreamer/gst-devtools/tree/validate/gst/plugins/gapplication/gstvalidategapplication.c#n52 to see how we get it)

The plugins configuration will contain the information about where to find the reference frame as well as the running time of the buffer to get compared. It will look like (given the plugin is called frame-comparator):

frame-comparator, buffer-timestamp=XXX, reference-frame=reference_frame.yuv

This configuration is passed through the GST_VALIDATE_CONFIG env var.

Lastly, you will also need a tool to generate that config file and the reference frames (should be YUV for now as the ssim function doesn't implement conversion yet, that should be added using the GstVideoConvert API)

Clone this wiki locally