<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"> <head> <title>Phonon.MediaSource</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta http-equiv="Content-Style-Type" content="text/css" /> <link rel="stylesheet" type="text/css" href="../common/doxygen.css" /> <link rel="stylesheet" media="screen" type="text/css" title="KDE Colors" href="../common/kde.css" /> </head> <body> <div id="container"> <div id="header"> <div id="header_top"> <div> <div> <img alt ="" src="../common/top-kde.jpg"/> KDE 4.4 PyKDE API Reference </div> </div> </div> <div id="header_bottom"> <div id="location"> <ul> <li>KDE's Python API</li> </ul> </div> <div id="menu"> <ul> <li><a href="../modules.html">Overview</a></li> <li><a href="http://techbase.kde.org/Development/Languages/Python">PyKDE Home</a></li> <li><a href="http://kde.org/family/">Sitemap</a></li> <li><a href="http://kde.org/contact/">Contact Us</a></li> </ul> </div> </div> </div> <div id="body_wrapper"> <div id="body"> <div id="right"> <div class="content"> <div id="main"> <div class="clearer"> </div> <h1>MediaSource Class Reference</h1> <code>from PyKDE4.phonon import *</code> <p> Namespace: Phonon.MediaSource<br /> <h2>Detailed Description</h2> <p>\class MediaSource mediasource.h Phonon/MediaSource Note that all constructors of this class are implicit, so that you can simply write <pre class="fragment"> MediaObject m; QString fileName("/home/foo/bar.ogg"); QUrl url("http://www.example.com/stream.mp3"); QBuffer *someBuffer; m.setCurrentSource(fileName); m.setCurrentSource(url); m.setCurrentSource(someBuffer); m.setCurrentSource(Phonon.Cd); </pre> </p> <p> <dl class="author" compact><dt><b>Author:</b></dt><dd> Matthias Kretz <kretz@kde.org> </dd></dl> </p> <table border="0" cellpadding="0" cellspacing="0"><tr><td colspan="2"><br><h2>Enumerations</h2></td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="el" href="#Type">Type</a> </td><td class="memItemRight" valign="bottom">{ Invalid, LocalFile, Url, Disc, Stream, Empty }</td></tr> <tr><td colspan="2"><br><h2>Methods</h2></td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="#MediaSource">__init__</a> (self)</td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="#MediaSource">__init__</a> (self, <a href="http://www.riverbankcomputing.co.uk/static/Docs/PyQt4/html/qstring.html">QString</a> fileName)</td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="#MediaSource">__init__</a> (self, <a href="http://www.riverbankcomputing.co.uk/static/Docs/PyQt4/html/qurl.html">QUrl</a> url)</td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="#MediaSource">__init__</a> (self, Phonon::DiscType discType, <a href="http://www.riverbankcomputing.co.uk/static/Docs/PyQt4/html/qstring.html">QString</a> deviceName=QString())</td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="#MediaSource">__init__</a> (self, <a href="../phonon/Phonon.AbstractMediaStream.html">Phonon.AbstractMediaStream</a> stream)</td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="#MediaSource">__init__</a> (self, <a href="http://www.riverbankcomputing.co.uk/static/Docs/PyQt4/html/qiodevice.html">QIODevice</a> ioDevice)</td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="#MediaSource">__init__</a> (self, <a href="../phonon/Phonon.MediaSource.html">Phonon.MediaSource</a> rhs)</td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="#autoDelete">autoDelete</a> (self)</td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top"><a href="http://www.riverbankcomputing.co.uk/static/Docs/PyQt4/html/qstring.html">QString</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="#deviceName">deviceName</a> (self)</td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top">Phonon::DiscType </td><td class="memItemRight" valign="bottom"><a class="el" href="#discType">discType</a> (self)</td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top"><a href="http://www.riverbankcomputing.co.uk/static/Docs/PyQt4/html/qstring.html">QString</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="#fileName">fileName</a> (self)</td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="#operator ==">operator ==</a> (self, <a href="../phonon/Phonon.MediaSource.html">Phonon.MediaSource</a> rhs)</td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="#setAutoDelete">setAutoDelete</a> (self, bool enable)</td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top"><a href="../phonon/Phonon.AbstractMediaStream.html">Phonon.AbstractMediaStream</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="#stream">stream</a> (self)</td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top"><a href="../phonon/Phonon.MediaSource.html#Type">Phonon.MediaSource.Type</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="#type">type</a> (self)</td></tr> <tr><td class="memItemLeft" nowrap align="right" valign="top"><a href="http://www.riverbankcomputing.co.uk/static/Docs/PyQt4/html/qurl.html">QUrl</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="#url">url</a> (self)</td></tr> </table> <hr><h2>Method Documentation</h2><a class="anchor" name="MediaSource"></a> <div class="memitem"> <div class="memproto"> <table class="memname"><tr> <td class="memname">__init__</td> <td>(</td> <td class="paramtype"> </td> <td class="paramname"><em>self</em> )</td> <td width="100%"> </td> </tr> </table> </div> <div class="memdoc"><p>Creates an empty MediaSource. </p> <p> An empty MediaSource is considered valid and can be set on a MediaObject to unload its current media. </p> <p> <dl class="see" compact><dt><b>See also:</b></dt><dd> Empty </dd></dl> </p></div></div><a class="anchor" name="MediaSource"></a> <div class="memitem"> <div class="memproto"> <table class="memname"><tr> <td class="memname">__init__</td> <td>(</td> <td class="paramtype"> <em>self</em>, </td> <td class="paramname"></td> </tr><tr> <td class="memname"></td> <td></td> <td class="paramtype"><a href="http://www.riverbankcomputing.co.uk/static/Docs/PyQt4/html/qstring.html">QString</a> </td> <td class="paramname"><em>fileName</em></td> </tr> <tr> <td></td> <td>)</td> <td></td> <td></td> <td width="100%"> </td> </tr></table> </div> <div class="memdoc"><p>Creates a MediaSource object for a local file or a Qt resource. </p> <p> </p><dl compact><dt><b>Parameters:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td></td><td valign="top"><em>fileName</em> </td><td> file name of a local media file or a Qt resource that was compiled in. </td></tr> </table></dl> <p> </p></div></div><a class="anchor" name="MediaSource"></a> <div class="memitem"> <div class="memproto"> <table class="memname"><tr> <td class="memname">__init__</td> <td>(</td> <td class="paramtype"> <em>self</em>, </td> <td class="paramname"></td> </tr><tr> <td class="memname"></td> <td></td> <td class="paramtype"><a href="http://www.riverbankcomputing.co.uk/static/Docs/PyQt4/html/qurl.html">QUrl</a> </td> <td class="paramname"><em>url</em></td> </tr> <tr> <td></td> <td>)</td> <td></td> <td></td> <td width="100%"> </td> </tr></table> </div> <div class="memdoc"><p>Creates a MediaSource object for a URL. </p> <p> </p><dl compact><dt><b>Parameters:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td></td><td valign="top"><em>url</em> </td><td> URL to a media file or stream. </td></tr> </table></dl> <p> </p></div></div><a class="anchor" name="MediaSource"></a> <div class="memitem"> <div class="memproto"> <table class="memname"><tr> <td class="memname">__init__</td> <td>(</td> <td class="paramtype"> <em>self</em>, </td> <td class="paramname"></td> </tr><tr> <td class="memname"></td> <td></td> <td class="paramtype">Phonon::DiscType </td> <td class="paramname"><em>discType</em>, </td> </tr> <tr> <td class="memname"></td> <td></td> <td class="paramtype"><a href="http://www.riverbankcomputing.co.uk/static/Docs/PyQt4/html/qstring.html">QString</a> </td> <td class="paramname"><em>deviceName=QString()</em></td> </tr> <tr> <td></td> <td>)</td> <td></td> <td></td> <td width="100%"> </td> </tr></table> </div> <div class="memdoc"><p>Creates a MediaSource object for discs. </p> <p> </p><dl compact><dt><b>Parameters:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td></td><td valign="top"><em>discType</em> </td><td> See DiscType </td></tr> </table></dl> <p> </p><dl compact><dt><b>Parameters:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td></td><td valign="top"><em>deviceName</em> </td><td> A platform dependent device name. This can be useful if the computer has more than one CD drive. It is recommended to use Solid to retrieve the device name in a portable way. </td></tr> </table></dl> <p> </p></div></div><a class="anchor" name="MediaSource"></a> <div class="memitem"> <div class="memproto"> <table class="memname"><tr> <td class="memname">__init__</td> <td>(</td> <td class="paramtype"> <em>self</em>, </td> <td class="paramname"></td> </tr><tr> <td class="memname"></td> <td></td> <td class="paramtype"><a href="../phonon/Phonon.AbstractMediaStream.html">Phonon.AbstractMediaStream</a> </td> <td class="paramname"><em>stream</em></td> </tr> <tr> <td></td> <td>)</td> <td></td> <td></td> <td width="100%"> </td> </tr></table> </div> <div class="memdoc"><p>Creates a MediaSource object for a data stream. </p> <p> Your application can provide the media data by subclassing AbstractMediaStream and passing a pointer to that object. %Phonon will never delete the <b>stream.</b> </p> <p> </p><dl compact><dt><b>Parameters:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td></td><td valign="top"><em>stream</em> </td><td> The AbstractMediaStream subclass to provide the media data. </td></tr> </table></dl> <p> <dl class="see" compact><dt><b>See also:</b></dt><dd> setAutoDelete </dd></dl> </p></div></div><a class="anchor" name="MediaSource"></a> <div class="memitem"> <div class="memproto"> <table class="memname"><tr> <td class="memname">__init__</td> <td>(</td> <td class="paramtype"> <em>self</em>, </td> <td class="paramname"></td> </tr><tr> <td class="memname"></td> <td></td> <td class="paramtype"><a href="http://www.riverbankcomputing.co.uk/static/Docs/PyQt4/html/qiodevice.html">QIODevice</a> </td> <td class="paramname"><em>ioDevice</em></td> </tr> <tr> <td></td> <td>)</td> <td></td> <td></td> <td width="100%"> </td> </tr></table> </div> <div class="memdoc"><p>Creates a MediaSource object for a QIODevice. </p> <p> This constructor can be very handy in the combination of QByteArray and QBuffer. </p> <p> </p><dl compact><dt><b>Parameters:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td></td><td valign="top"><em>ioDevice</em> </td><td> An arbitrary readable QIODevice subclass. If the device is not opened MediaSource will open it as QIODevice.ReadOnly. Sequential I/O devices are possible, too. For those MediaObject.isSeekable() will have to return false obviously. </td></tr> </table></dl> <p> <dl class="see" compact><dt><b>See also:</b></dt><dd> setAutoDelete </dd></dl> </p></div></div><a class="anchor" name="MediaSource"></a> <div class="memitem"> <div class="memproto"> <table class="memname"><tr> <td class="memname">__init__</td> <td>(</td> <td class="paramtype"> <em>self</em>, </td> <td class="paramname"></td> </tr><tr> <td class="memname"></td> <td></td> <td class="paramtype"><a href="../phonon/Phonon.MediaSource.html">Phonon.MediaSource</a> </td> <td class="paramname"><em>rhs</em></td> </tr> <tr> <td></td> <td>)</td> <td></td> <td></td> <td width="100%"> </td> </tr></table> </div> <div class="memdoc"><p>Constructs a copy of <b>rhs.</b> </p> <p> This constructor is fast thanks to explicit sharing. </p></div></div><a class="anchor" name="autoDelete"></a> <div class="memitem"> <div class="memproto"> <table class="memname"><tr> <td class="memname">bool autoDelete</td> <td>(</td> <td class="paramtype"> </td> <td class="paramname"><em>self</em> )</td> <td width="100%"> </td> </tr> </table> </div> <div class="memdoc"><p>Returns the setting of the auto-delete option. The default is <b>false.</b> </p> <p> <dl class="see" compact><dt><b>See also:</b></dt><dd> setAutoDelete </dd></dl> </p></div></div><a class="anchor" name="deviceName"></a> <div class="memitem"> <div class="memproto"> <table class="memname"><tr> <td class="memname"><a href="http://www.riverbankcomputing.co.uk/static/Docs/PyQt4/html/qstring.html">QString</a> deviceName</td> <td>(</td> <td class="paramtype"> </td> <td class="paramname"><em>self</em> )</td> <td width="100%"> </td> </tr> </table> </div> <div class="memdoc"><p>Returns the device name of the MediaSource if type() == Disc; otherwise returns QString(). </p></div></div><a class="anchor" name="discType"></a> <div class="memitem"> <div class="memproto"> <table class="memname"><tr> <td class="memname">Phonon::DiscType discType</td> <td>(</td> <td class="paramtype"> </td> <td class="paramname"><em>self</em> )</td> <td width="100%"> </td> </tr> </table> </div> <div class="memdoc"><p>Returns the disc type of the MediaSource if type() == Disc; otherwise returns NoDisc. </p></div></div><a class="anchor" name="fileName"></a> <div class="memitem"> <div class="memproto"> <table class="memname"><tr> <td class="memname"><a href="http://www.riverbankcomputing.co.uk/static/Docs/PyQt4/html/qstring.html">QString</a> fileName</td> <td>(</td> <td class="paramtype"> </td> <td class="paramname"><em>self</em> )</td> <td width="100%"> </td> </tr> </table> </div> <div class="memdoc"><p>Returns the file name of the MediaSource if type() == LocalFile; otherwise returns QString(). </p></div></div><a class="anchor" name="operator =="></a> <div class="memitem"> <div class="memproto"> <table class="memname"><tr> <td class="memname">bool operator ==</td> <td>(</td> <td class="paramtype"> <em>self</em>, </td> <td class="paramname"></td> </tr><tr> <td class="memname"></td> <td></td> <td class="paramtype"><a href="../phonon/Phonon.MediaSource.html">Phonon.MediaSource</a> </td> <td class="paramname"><em>rhs</em></td> </tr> <tr> <td></td> <td>)</td> <td></td> <td></td> <td width="100%"> </td> </tr></table> </div> <div class="memdoc"><p>Returns <b>true</b> if this MediaSource is equal to <b>rhs;</b> otherwise returns <b>false.</b> </p></div></div><a class="anchor" name="setAutoDelete"></a> <div class="memitem"> <div class="memproto"> <table class="memname"><tr> <td class="memname"> setAutoDelete</td> <td>(</td> <td class="paramtype"> <em>self</em>, </td> <td class="paramname"></td> </tr><tr> <td class="memname"></td> <td></td> <td class="paramtype">bool </td> <td class="paramname"><em>enable</em></td> </tr> <tr> <td></td> <td>)</td> <td></td> <td></td> <td width="100%"> </td> </tr></table> </div> <div class="memdoc"><p>Tell the MediaSource to take ownership of the AbstractMediaStream or QIODevice that was passed in the constructor. </p> <p> The default setting is <b>false,</b> for safety. If you turn it on, you should only access the AbstractMediaStream/QIODevice object as long as you yourself keep a MediaSource object around. As long as you keep the MediaSource object wrapping the stream/device the object will not get deleted. </p> <p> <dl class="see" compact><dt><b>See also:</b></dt><dd> autoDelete </dd></dl> </p></div></div><a class="anchor" name="stream"></a> <div class="memitem"> <div class="memproto"> <table class="memname"><tr> <td class="memname"><a href="../phonon/Phonon.AbstractMediaStream.html">Phonon.AbstractMediaStream</a> stream</td> <td>(</td> <td class="paramtype"> </td> <td class="paramname"><em>self</em> )</td> <td width="100%"> </td> </tr> </table> </div> <div class="memdoc"><p>Returns the media stream of the MediaSource if type() == Stream; otherwise returns 0. QIODevices are handled as streams, too. </p></div></div><a class="anchor" name="type"></a> <div class="memitem"> <div class="memproto"> <table class="memname"><tr> <td class="memname"><a href="../phonon/Phonon.MediaSource.html#Type">Phonon.MediaSource.Type</a> type</td> <td>(</td> <td class="paramtype"> </td> <td class="paramname"><em>self</em> )</td> <td width="100%"> </td> </tr> </table> </div> <div class="memdoc"><p>Returns the type of the MediaSource (depends on the constructor that was used). </p> <p> <dl class="see" compact><dt><b>See also:</b></dt><dd> Type </dd></dl> </p></div></div><a class="anchor" name="url"></a> <div class="memitem"> <div class="memproto"> <table class="memname"><tr> <td class="memname"><a href="http://www.riverbankcomputing.co.uk/static/Docs/PyQt4/html/qurl.html">QUrl</a> url</td> <td>(</td> <td class="paramtype"> </td> <td class="paramname"><em>self</em> )</td> <td width="100%"> </td> </tr> </table> </div> <div class="memdoc"><p>Returns the url of the MediaSource if type() == URL or type() == LocalFile; otherwise returns QUrl(). </p></div></div><hr><h2>Enumeration Documentation</h2><a class="anchor" name="Type"></a> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr><td class="memname">Type</td> </tr> </table> </div> <div class="memdoc"><p>Identifies the type of media described by the MediaSource object. </p> <p> <dl class="see" compact><dt><b>See also:</b></dt><dd> MediaSource.type() </dd></dl> </p><dl compact><dt><b>Enumerator: </b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"><tr><td valign="top"><em>Invalid</em> = -1</td><td><tr><td valign="top"><em>LocalFile</em> </td><td><tr><td valign="top"><em>Url</em> </td><td><tr><td valign="top"><em>Disc</em> </td><td><tr><td valign="top"><em>Stream</em> </td><td><tr><td valign="top"><em>Empty</em> </td><td></table> </dl> </div></div><p> </div> </div> </div> <div id="left"> <div class="menu_box"> <div class="nav_list"> <ul> <li><a href="../allclasses.html">Full Index</a></li> </ul> </div> <a name="cp-menu" /><div class="menutitle"><div> <h2 id="cp-menu-project">Modules</h2> </div></div> <div class="nav_list"> <ul><li><a href="../akonadi/index.html">akonadi</a></li> <li><a href="../dnssd/index.html">dnssd</a></li> <li><a href="../kdecore/index.html">kdecore</a></li> <li><a href="../kdeui/index.html">kdeui</a></li> <li><a href="../khtml/index.html">khtml</a></li> <li><a href="../kio/index.html">kio</a></li> <li><a href="../knewstuff/index.html">knewstuff</a></li> <li><a href="../kparts/index.html">kparts</a></li> <li><a href="../kutils/index.html">kutils</a></li> <li><a href="../nepomuk/index.html">nepomuk</a></li> <li><a href="../phonon/index.html">phonon</a></li> <li><a href="../plasma/index.html">plasma</a></li> <li><a href="../polkitqt/index.html">polkitqt</a></li> <li><a href="../solid/index.html">solid</a></li> <li><a href="../soprano/index.html">soprano</a></li> </ul></div></div> </div> </div> <div class="clearer"/> </div> <div id="end_body"></div> </div> <div id="footer"><div id="footer_text"> This documentation is maintained by <a href="mailto:simon@simonzone.com">Simon Edwards</a>.<br /> KDE<sup>®</sup> and <a href="../images/kde_gear_black.png">the K Desktop Environment<sup>®</sup> logo</a> are registered trademarks of <a href="http://ev.kde.org/" title="Homepage of the KDE non-profit Organization">KDE e.V.</a> | <a href="http://www.kde.org/contact/impressum.php">Legal</a> </div></div> </body> </html>