From: Benjamin O. <in...@pu...> - 2003-12-29 23:50:35
|
On Sun, 28 Dec 2003, Colin Walters wrote: > On Sat, 2003-12-27 at 05:42, Benjamin Otte wrote: > > > The correct solution for me seems to be plugging the complete pipeline as > > you'd plug it on playback since that's the only way you can be sure to get > > all the tags. > > I'm not sure I understand. How do you propose get the tags? Would it > be by connecting to a signal on the decoder? How will tag writing work? > Tag writing is completely different from tag reading. This is because you extract metadata from files, that cannot be changed (like length or bitrate). I'll illustrate the reading part some more: src ! typefind ! spider ! audio/x-raw-int ! fakesink (maybe replacing fakesink with a tagsink that supports tag reading better) This pipeline should be close to what you use for playback. If you use this for an mp3, spider will (soon again) plug this to the equivalent of src ! typefind ! id3tag ! mad ! fakesink id3tag will then read the id3 tags. It can however not read audio specific tags like bitrate or length. This should however be easy to implement in mad. Now you set this pipeline to playing and wait for the first buffer to arrive on the sink. Tag events arrive before buffers do, so you'll have the tags by then - including length. If you used a tagsink or similar you'd collect the tags from the events there and have some "done-reading" signal, after which you stop the pipeline and get the tags from the tagsink. If you use fakesink, youll just connect to the "found-tag" signal on the pipeline which should give you the tags, too. Hm, I hope that was clearer... :) Benjamin |