tee: Check for the removed pad flag also in the slow pushing path
[platform/upstream/gstreamer.git] / docs / random / types
1 GstTypes exist to try to make sure data eveyrone is talking about the
2 right kind of data.  They aid quite a bit in autoplugging, in fact make it
3 possible.  Each well-formed type includes a function (typefind) that will
4 take one or more buffers and determine whether or not it is indeed a
5 stream of that type, and possible a metadata to go with it.  It may
6 provide related metadata structure IDs (and must if it provides metadata
7 from the typefind function).
8
9 Because multiple elements and plugins are very likely to be using the same
10 types, the process of creating/finding types is designed to be done with a
11 single function call.  All operations on GstTypes occur via their guint16
12 ID numbers, with the GstType structure "private" to the GST library.  A
13 plugin wishing to use a give type would contain a static struct of type
14 GstTypeFactory, which lists the MIME type, possible extensions (which may
15 overlap the mime-types file), a typefind function, and any other cruft I
16 decide to add.
17
18 A plugin init function would take this typefactory and hand it to the
19 gst_type_new() (FIXME: badly named) function, which would first search for
20 that same MIME type in the current list.  If it found one, it would
21 compare the two to see if the new one is "better".  Better is defined as
22 having more extensions (to be merged) or a typefind function verses none.
23
24 The point of returning an existing MIME type is a result of the goal of
25 unifying types enough to guarantee that, for instance, all MP3 decoders
26 will work interchangeably.  If MP3 decoder A says "MIME type 'audio/mpeg'
27 with extensions 'mpeg3'" and decoder B says "MIME type 'audio/mpeg' with
28 extensions 'mp3'", we don't want to have two types defined, possibly with
29 two typefind functions. If we did, it's not obvious which of the two would
30 be tried first (luck) and if both would really identify streams as mp3
31 correctly in all cases.  And whichever wins, we're stuck using the
32 associated decoder to play that stream.  We lose the choice between any
33 valid mp3 decoder, and thus the whole point of the type system.