KMediaPlayer expansion/standardisation

Will Stephenson lists at stevello.free-online.co.uk
Mon Apr 12 22:08:43 BST 2004


On Monday 12 April 2004 11:53, Neil Stevens wrote:
> I think it's an interesting idea, but your biggest challenge will be
> getting all those app maintainers on board.

Hopefully patches talk :).

Ok, here are my draft expanded KMediaPlayer and new KAudioControl interfaces:

I have updated the table at 
http://homepages.cs.ncl.ac.uk/william.stephenson/home.informal/player_dcop_comparison.pdf
to include the new functions on KMediaPlayer.  You'll see that most of the 
changes to apps will be renaming functions and changing argument types.

A couple of arbitrary choices I made are:  
*) Use of the neutral 'Item' instead of 'track' as this interface should work 
for all types of media player.
*) Millisecond resolution when seeking within an item - if your player can't 
support this, round to the nearest unit you can support?
*) Use of KURLs for media management - if you don't/can't support network IO 
(KsCD) these methods have a bool return type you can use to signal the 
operation failed.
*) Include a mediaType()/mimeType() operation to see what media the app is 
currently playing.

I think it might be neat to include a posix-style errno() method to use if an 
operation fails, but this might be more work to implement usefully in apps - 
opinions?

And I already thought of another application of this interface - a 'media 
bookmarker' to remember interesting points in various media using the 
currentItem() and position() methods - maybe only of interest to film 
students though.

Will

KMediaPlayer interface
======================
Media Management
open URL			bool openURL(const KURL &file)
append URL			bool appendURL( const KURL &file )				NEW
append list of URLs		bool appendURLList( const KURL::List &files )	NEW
clear playlist			void clear()									NEW

App Capabilities
curr media type			QString mediaType() // Audio, Video, Image - could be a 
mimetype?	NEW
usable mime types		QStringList mimeTypes()							NEW
is medium seekable?		bool isSeekable()
medium has length?		bool hasLength()

App State Control
pause				void pause()
play				void play()
stop				void stop()
play/pause			void playPause()								NEW
seek in track			void seek( unsigned long msec )
prev 				void previous()									NEW
next				void next()										NEW
go to track			void setItem( int item )						NEW
seek backwards			void seekBack()									NEW
seek forwards			void seekForward()								NEW
start looping			void setLooping( bool looping)					
set state			void setState( int state)		/ enumerated states, Play, Pause, Stop 
toggle shuffle			void setShuffle( bool shuffle )					NEW

App State Info
position			unsigned long position()			// position within item
track length			unsigned long length()				// total length of item
looping state			bool isLooping()
play state			int state()
shuffle state			bool isShuffling()								NEW

Media Info
track number			int currentItemNumber()							NEW
track title			QString currentTitle()							NEW
album name			QString currentAlbum()							NEW
artist name			QString currentArtist()							NEW
track list			QStringList trackList()							NEW
media URL			KURL currentItem()		NEW

KAudioControl interface													NEW
=======================
volume down			void volumeDown()
volume up			void volumeUp()
set abs volume			void setVolume( int v )
get volume			int  getVolume()
mute				void mute( bool muted )


-- 
Will Stephenson
IRC: Bille



More information about the kde-multimedia mailing list