(Bringing up an old post...)
[snip]
Here's what I think an application using ext. subtitles with Phonon could look
like:
using Phonon::MediaObject;
using Phonon::AudioOutput;
using Phonon::VideoWidget;
using Phonon::SubtitleWidget;
using Phonon::Port;
MediaObject m;
m.setCurrentSource(Phonon::Dvd);
MediaObject sm;
sm.setCurrentSource(urlToSubtitles);
Synchronizer sync;
sync.addMediaObject(&m);
sync.addMediaObject(&sm);
AudioOutput ao(Phonon::VideoCategory);
VideoWidget vw;
vw.show();
Phonon::createPath(&m, &ao);
Phonon::createPath(&m, Port(Phonon::Video), &vw);
Port port = sm.openPort(Phonon::Subtitles, "pixmap");
SubtitleWidget swidget;
Phonon::createPath(&sm, port, &swidget);
This code uses several ideas that are not yet implemented in Phonon but will
probably get started on in the near future. Those are:
a) Synchronizer: Some class to combine multiple MediaObjects (sources) into
one or just to start/stop multiple sources in sync. This will also be a
requirement for audio/video editors.
b) Port: this class will be added to allow more fine grained control over what
actually gets connected. E.g. the line
Phonon::createPath(&m, Port(Phonon::Video), &vw);
will only create a video connection between m and vw. Per default also a
subtitle connection would have been made and the subtitles of the DVD would
be shown on the VideoWidget. Now no subtitles will be shown at all.
The openPort call tells the MediaObject to create a stream of pixmaps where
the subtitles are rendered on to ("pixmap" and "image" would be in the same
scale as an unscaled video frame and will work with any subtitle format.
Another format we should look into is "text" which would allow the
application to draw the subtitles manually in whatever obscure form it
wants.).
[snip]