Merge remote-tracking branch 'origin/0.10'
[platform/upstream/gstreamer.git] / docs / design / draft-tagreading.txt
1 Tagreading
2 ----------
3
4 The tagreading (metadata reading) use case for mediacenter applications is not
5 to well supported by the current GStreamer architecture. It uses demuxers on the
6 files, which generelly said takes too long (building seek-index, prerolling).
7 What we want is specialized elements / parsing modes that just do the
8 tag-reading.
9
10 The idea is to define a TagReadIFace. Tag-demuxers, classic demuxers and decoder
11 plugins can just implement the interface or provide a separate element that
12 implements the interface.
13
14 In addition we need a tagreadbin, that similar to decodebin does a typefind and
15 then plugs the right tagread element(s). If will only look at elements that
16 implement the interface. It can plug serval if possible.
17
18 For optimal performance typefind and tagread could share the list of already
19 peeked buffers (a queue element after sink, but that would change pull to push).
20
21
22 Design
23 ~~~~~~
24
25 The plan is that applications can do the following:
26   pipeline = "filesrc ! tagbin"
27   for (file_path in list_of_files) {
28     filesrc.location=file_path
29     pipeline.set_state(PAUSED)
30     // wait for TAGS & EOS
31     pipeline.set_state(READY)
32   }
33
34 * it should have one sinkpad of type ANY
35 * it should send EOS when all metadata has been read
36   "done"-signal from all tagread-elements
37 * special tagread-elements should have RANK_NONE to be not autoplugged by
38   decodebin
39
40 Interface
41 ~~~~~~~~~
42
43 * gboolean iface property "tag-reading"
44   Switches the element to tagreading mode. Needed if normal element implement
45   that behaviour. Elements will skip parsing unneeded data, don't build a
46   seeking index, etc.
47 * signal "done"
48   Equivalent of EOS.
49
50 Use Cases
51 ~~~~~~~~~
52
53 * mp3 with id3- and apetags
54   * plug id3demux ! apedemux
55 * avi with vorbis audio
56   * plug avidemux
57   * new pad -> audio/vorbis
58   * plug vorbisdec or special vorbiscomment reader
59
60 Additional Thoughts
61 ~~~~~~~~~~~~~~~~~~~
62
63 * would it make sense to have 2-phase tag-reading (property on tagbin and/or
64   tagread elements)
65   * 1st phase: get tag-data that are directly embedded in the data
66   * 2nd phase: get tag-data that has to be generated
67     * e.g. album-art via web, video-thumbnails
68 * what about caching backends
69   * it would be good to allow applications to supply tagbin with a tagcache-
70     object instance. Whenever tagbin gets a 'location' to tagread, it consults
71     the cache first. whenever there is a cache-miss it will tag-read and then
72     store in the cache
73
74     GstTagList *gst_tag_cache_load_tag_data (GstTagCache *self, const gchar *uri);
75     gst_tag_cache_store_tag_data (GstTagCache *self, const gchar *uri, GstTagList *tags);
76
77 Tests
78 ~~~~~
79
80 * write a generic test for parsers/demuxers to ensure they send tags until they
81   reached PAUSED (elements need to parse file for prerolling anyway):
82   set pipeline to paused, check for tags, set to playing, error out if tags come
83   after paused
84
85 Code Locations
86 ~~~~~~~~~~~~~~
87
88 * tagreadbin -> gst-plugins-base/gst/tagread
89 * tagreaderiface -> gst-plugins-base/gst-libs/gst/tag
90
91 Reuse
92 ~~~~~
93
94 * ogg : gst-plugins-base/ext/ogg
95 * avi : gst-plugins-good/gst/avi
96 * mp3 : gst-plugins-good/gst/id3demux
97 * wav : gst-plugins-good/gst/wavparse
98 * qt  : gst-plugins-bad/gst/qtdemux
99