<div dir="ltr"><div><div><div><div><div>Heya,<br><br></div>For Phonon5 it looks like the "Source" class needs a complete rewrite, as Harald pointed out to me on IRC.<br><br></div>Here is a quick draft API proposal for this:<br>
<br>=== Source needs to handle:<br>* Local file, URL, stream<br><br>* Audio CD, DVD:<br>- set track<br><br>* Video CD, DVD:<br>- navigate menus<br>- chapters, titles<br>- subtitle config<br>- audio channels<br><br>* Hardware devices:<br>
- set audio/video device<br>- device settings<br><br>=== Classes:<br>* GenericSource (set URL) - local files, URLs, streams<br>* AudioDisc (set track)<br>* VideoDisc (menus, chapters, titles, subtitles, audio channels)<br>
* MediaDevice (set video device, set audio device, configure device)<br><br>=== API sketch:<br>The thinking is that these multimedia sources like dvd's, hardware devices, etc. don't remove or drastically change features so the API shouldn't need to change. I'm not sure how this inheritance works with the frontend/backend system though...<br>
<br>* Source (namespace? or static functions in GenericSource?) (convenience functions)<br> - GenericSource * Source::create(QUrl) (detects source type, creates proper source class)<br> - bool Source::isAudioDisc(GenericSource *) (dumb cast, gives impression of friendliness)<br>
 - bool Source::isVideoDisc(GenericSource *) (same dumb cast)<br> - bool Source::isMediaDevice(GenericSource *) (same dumb cast)<br><br>* GenericSource<br> - bool isValid()<br> - get/setUrl(QUrl)<br>  a. local file: "file:///home/user/foo.avi"<br>
  b. some url: "<a href="http://foosite.tk/?w=abcd0000">http://foosite.tk/?w=abcd0000</a>"<br>  c. stream: "mms://<a href="http://barsite.tk:1234">barsite.tk:1234</a>"<br></div><div>  d. "file:///dev/video0" (url for video device?)<br>
</div><div>  e. "file:///dev/cd" (url for disc?)<br></div><div><br>* AudioDisc (derived from GenericSource)<br> - get/setTrackNumber(int)<br> - int getTrackCount<br><br>* VideoDisc (like the old MediaController) (derived from GenericSource)<br>
 - bool canChangeMenu()<br> - QList<enum> availableMenus<br> - setCurrentMenu(enum)<br><br> - bool canChangeChapter()<br> - int chapterCount()<br> - int currentChapter()<br> - setCurrentChapter(int)<br><br> - bool canChangeAngle()<br>
 - int angleCount()<br> - int currentAngle()<br> - setCurrentAngle(int)<br><br> - bool canChangeTitles()<br> - bool isAutoplayTitlesEnabled()<br> - setCurrentTitle(int)<br> - setAutoplayTitlesEnabled(bool)<br> - next/previousTitle()<br>
<br> - bool canChangeSubititle()<br> - Subtitle currentSubtitle()<br> - QList<Subtitle> availableSubtitles()<br> - setCurrentSubtitle(Subtitle)<br> - enableSubtitleAutodetection(bool)<br> - get/setSubtitleEncoding(QString)<br>
 - get/setSubtitleFont(QFont)<br><br> - bool canChangeAudioChannel()<br> - QList<AudioChannel> availableAudioChannels()<br> - get/setAudioChannel<br><br>* MediaDevice (derived from GenericSource)<br> - bool canSelectComplementaryDevice()<br>
 - setComplementaryDeviceUrl(QByteArray) (when selecting webcam + mic for av recording)<br> - bool canChangeVideoResolution()<br> - setVideoResolution(int x, int y)<br> - QList availableResolutions()<br> - bool canChangeAudioConfigThing()<br>
 - setAudioConfigThing(something)<br> - QList availableAudioConfigThings()<br><br>* FancyStreamFromTheFuture (derived from ???)<br> - bool canChangeWowFeature()<br> - QList availableWowFeatureOptions()<br> - setWowFeature(Wow)<br>
<br>=== Player (class) interaction:<br>- can get current source<br>- can set current source<br>- can get specialized source directly (or null)<br><br>=== Backend pov:<br>* The backends must implement GenericSource<br>* The backends implement AudioDisc, VideoDisc or MediaDevice if they support these kinds of devices<br>
* The backends can set source validity to false if they don't like it<br></div><div>* The backends might be able to provide info about what kind of source is for a URL<br></div><div><br></div>This is how I would like it to be, but... Now I'm not sure if this has critical flaws or weaknesses. Is it an acceptable solution? Can it be implemented? Do you like this kind of API?<br>
<br></div>What do you think?<br><br></div>Casian<br><br></div>