Background: cover art and other images in tags are usually stored as a blob of binary image data, often accompanied by a MIME type or some other content type string (e.g. 'png', 'jpeg', 'jpg'). Sometimes there is also an 'image type' to indicate what kind of image this is (e.g. front cover, back cover, artist, etc.). The image data may also be an URI to the image rather than the image itself.
In GStreamer, image tags are Samples containing the raw image data, with the sample caps describing the content type of the image (e.g. image/jpeg, image/png, text/uri-list). The sample info may contain an additional 'image-type' field of ImageType to describe the type of image (front cover, back cover etc.). PREVIEW_IMAGE tags should not carry an image type, their type is already indicated via the special tag name.
This function will do various checks and typefind the encoded image data (we can't trust the declared mime type).
the (encoded) image
the length of the encoded image data at
a newly-allocated image sample for use in tag lists, or NULL