v4l2: sort formats in the right order so that non-emulated formats are prefered

The format list should be sorted from high ranks to low ranks. In the GSList
sorting function this means the compare needs to return a positive value if
format a has a lower rank than format b.

Among other things this fixes v4l2src to prefer non-emulated formats
to emulated formats when built against libv4l.
This commit is contained in:
Sjoerd Simons 2010-08-06 18:07:46 +01:00 committed by Tim-Philipp Müller
parent 19c8226c6d
commit dcea1b2dfc

View file

@ -864,8 +864,8 @@ format_cmp_func (gconstpointer a, gconstpointer b)
if (fa->pixelformat == fb->pixelformat) if (fa->pixelformat == fb->pixelformat)
return 0; return 0;
return gst_v4l2_object_format_get_rank (fa) - return gst_v4l2_object_format_get_rank (fb) -
gst_v4l2_object_format_get_rank (fb); gst_v4l2_object_format_get_rank (fa);
} }
/****************************************************** /******************************************************