Sophie

Sophie

distrib > Mandriva > current > i586 > media > main-updates > by-pkgid > 8e6051afcdb111a0317a58fb64c2abf5 > files > 3225

qt4-doc-4.6.3-0.2mdv2010.2.i586.rpm

<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
    PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<!-- phonon-api.qdoc -->
<head>
  <title>Qt 4.6: MediaSource Class Reference</title>
  <link href="classic.css" rel="stylesheet" type="text/css" />
</head>
<body>
<a name="//apple_ref/cpp/cl/Phonon/MediaSource"></a>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td align="left" valign="top" width="32"><a href="http://qt.nokia.com/"><img src="images/qt-logo.png" align="left" border="0" /></a></td>
<td width="1">&nbsp;&nbsp;</td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a>&nbsp;&middot; <a href="classes.html"><font color="#004faf">All&nbsp;Classes</font></a>&nbsp;&middot; <a href="functions.html"><font color="#004faf">All&nbsp;Functions</font></a>&nbsp;&middot; <a href="overviews.html"><font color="#004faf">Overviews</font></a></td></tr></table><h1 class="title">MediaSource Class Reference<br /><span class="small-subtitle">(Phonon::MediaSource)<br />[<a href="phonon.html">Phonon</a> module]</span>
</h1>
<p>The MediaSource class provides multimedia data for media objects. <a href="#details">More...</a></p>
<pre> #include &lt;Phonon/MediaSource&gt;</pre><p><b>This class is not part of the Qt GUI Framework Edition.</b></p>
<p>This class was introduced in Qt 4.4.</p>
<ul>
<li><a href="phonon-mediasource-members.html">List of all members, including inherited members</a></li>
</ul>
<hr />
<a name="public-types"></a>
<h2>Public Types</h2>
<table class="alignedsummary" border="0" cellpadding="0" cellspacing="0" width="100%">
<tr><td class="memItemLeft" align="right" valign="top">enum </td><td class="memItemRight" valign="bottom"><b><a href="phonon-mediasource.html#Type-enum">Type</a></b> { Invalid, LocalFile, Url, Disc, Stream, Empty }</td></tr>
</table>
<hr />
<a name="public-functions"></a>
<h2>Public Functions</h2>
<table class="alignedsummary" border="0" cellpadding="0" cellspacing="0" width="100%">
<tr><td class="memItemLeft" align="right" valign="top"></td><td class="memItemRight" valign="bottom"><b><a href="phonon-mediasource.html#MediaSource">MediaSource</a></b> ( const QString &amp; <i>fileName</i> )</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"></td><td class="memItemRight" valign="bottom"><b><a href="phonon-mediasource.html#MediaSource-3">MediaSource</a></b> ( const QUrl &amp; <i>url</i> )</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"></td><td class="memItemRight" valign="bottom"><b><a href="phonon-mediasource.html#MediaSource-4">MediaSource</a></b> ( Phonon::DiscType <i>discType</i>, const QString &amp; <i>deviceName</i> = QString() )</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"></td><td class="memItemRight" valign="bottom"><b><a href="phonon-mediasource.html#MediaSource-6">MediaSource</a></b> ( QIODevice * <i>ioDevice</i> )</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"></td><td class="memItemRight" valign="bottom"><b><a href="phonon-mediasource.html#MediaSource-7">MediaSource</a></b> ( const MediaSource &amp; <i>other</i> )</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"></td><td class="memItemRight" valign="bottom"><b><a href="phonon-mediasource.html#dtor.MediaSource">~MediaSource</a></b> ()</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><b><a href="phonon-mediasource.html#autoDelete">autoDelete</a></b> () const</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">QString </td><td class="memItemRight" valign="bottom"><b><a href="phonon-mediasource.html#deviceName">deviceName</a></b> () const</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">Phonon::DiscType </td><td class="memItemRight" valign="bottom"><b><a href="phonon-mediasource.html#discType">discType</a></b> () const</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">QString </td><td class="memItemRight" valign="bottom"><b><a href="phonon-mediasource.html#fileName">fileName</a></b> () const</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><b><a href="phonon-mediasource.html#setAutoDelete">setAutoDelete</a></b> ( bool <i>enable</i> )</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">Type </td><td class="memItemRight" valign="bottom"><b><a href="phonon-mediasource.html#type">type</a></b> () const</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">QUrl </td><td class="memItemRight" valign="bottom"><b><a href="phonon-mediasource.html#url">url</a></b> () const</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">MediaSource &amp; </td><td class="memItemRight" valign="bottom"><b><a href="phonon-mediasource.html#operator-eq">operator=</a></b> ( const MediaSource &amp; <i>other</i> )</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><b><a href="phonon-mediasource.html#operator-eq-eq">operator==</a></b> ( const MediaSource &amp; <i>other</i> ) const</td></tr>
</table>
<a name="details"></a>
<hr />
<h2>Detailed Description</h2>
<p>The MediaSource class provides multimedia data for media objects.</p>
<p>The MediaSource class manages a source of multimedia content, such as a music or video file, of which data is given to a <a href="phonon-mediaobject.html">MediaObject</a>.</p>
<p>The media source knows how fetch its data from several sources, e.g&#x2e;, from files, a <a href="qiodevice.html">QIODevice</a>, or a CD. The possible source types are described by the <a href="phonon-mediasource.html#Type-enum">Type</a> enum. The type of the source is set by the media source itself, and is dependent on the constructor used to create it. Note that it is possible to provide data from any source by implementing a <a href="qiodevice.html">QIODevice</a>.</p>
<p>The class has several functions to acquire information about the source it manages, e.g&#x2e;, <a href="phonon-mediasource.html#fileName">fileName</a>() and <a href="phonon-mediasource.html#url">url</a>(). The return from these functions are dependent on the <a href="phonon-mediasource.html#type">type</a>() of the media source.</p>
<p>Normally, a programmer does not need to be concerned with media sources. It's constructors are implicit, so one can, for instance, send an URL or filename directly to the constructors of the <a href="phonon-mediaobject.html">MediaObject</a>.</p>
<pre> MediaObject m;
 QString fileName(&quot;/home/foo/bar.ogg&quot;);
 QUrl url(&quot;http://www.example.com/stream.mp3&quot;);
 QBuffer *someBuffer;
 m.setCurrentSource(fileName);
 m.setCurrentSource(url);
 m.setCurrentSource(someBuffer);
 m.setCurrentSource(Phonon::Cd);</pre>
<p>A MediaSource object cannot be reused for another multimedia source. It is possible to play the same source again, and also stop and start a non-seekable media source, such as a radio stream, with the same MediaSource object.</p>
<a name="qt-backends"></a>
<h3>Qt Backends</h3>
<p>Currently, Qt's backends support files in local and remote locations. Support for other sources, such as CD/DVD, are planned for the future.</p>
<p>See also <a href="phonon-mediaobject.html">MediaObject</a> and <a href="phonon-module.html">Phonon Module</a>.</p>
<hr />
<h2>Member Type Documentation</h2>
<a name="//apple_ref/cpp/tag/Phonon::MediaSource/Type"></a>
<a name="//apple_ref/cpp/econst/Phonon::MediaSource/Invalid"></a>
<a name="//apple_ref/cpp/econst/Phonon::MediaSource/LocalFile"></a>
<a name="//apple_ref/cpp/econst/Phonon::MediaSource/Url"></a>
<a name="//apple_ref/cpp/econst/Phonon::MediaSource/Disc"></a>
<a name="//apple_ref/cpp/econst/Phonon::MediaSource/Stream"></a>
<a name="//apple_ref/cpp/econst/Phonon::MediaSource/Empty"></a>
<h3 class="fn"><a name="Type-enum"></a>enum MediaSource::Type</h3>
<p>Identifies the type of media described by the <a href="phonon-mediasource.html">MediaSource</a> object.</p>
<p><table class="valuelist" border="1" cellpadding="2" cellspacing="1" width="100%">
<tr><th width="25%">Constant</th><th width="15%">Value</th><th width="60%">Description</th></tr>
<tr><td valign="top"><tt>Phonon::MediaSource::Invalid</tt></td><td align="center" valign="top"><tt>-1</tt></td><td valign="top">The <a href="phonon-mediasource.html">MediaSource</a> object does not describe any valid source.</td></tr>
<tr><td valign="top"><tt>Phonon::MediaSource::LocalFile</tt></td><td align="center" valign="top"><tt>0</tt></td><td valign="top">The <a href="phonon-mediasource.html">MediaSource</a> object describes a local file.</td></tr>
<tr><td valign="top"><tt>Phonon::MediaSource::Url</tt></td><td align="center" valign="top"><tt>1</tt></td><td valign="top">The <a href="phonon-mediasource.html">MediaSource</a> object describes an URL, which can be either a local file or a file on the network.</td></tr>
<tr><td valign="top"><tt>Phonon::MediaSource::Disc</tt></td><td align="center" valign="top"><tt>2</tt></td><td valign="top">The <a href="phonon-mediasource.html">MediaSource</a> object describes a disc, e.g&#x2e;, a CD.</td></tr>
<tr><td valign="top"><tt>Phonon::MediaSource::Stream</tt></td><td align="center" valign="top"><tt>3</tt></td><td valign="top">The <a href="phonon-mediasource.html">MediaSource</a> object describes a data stream. This is the type used for <a href="qiodevice.html">QIODevice</a>s. Note that a stream opened with a <a href="qurl.html">QUrl</a>, will still be of the Url type.</td></tr>
<tr><td valign="top"><tt>Phonon::MediaSource::Empty</tt></td><td align="center" valign="top"><tt>4</tt></td><td valign="top">The media source doesn't have a source.</td></tr>
</table></p>
<p>See also <a href="phonon-mediasource.html#type">MediaSource::type</a>().</p>
<hr />
<h2>Member Function Documentation</h2>
<a name="//apple_ref/cpp/instm/Phonon::MediaSource/MediaSource"></a>
<h3 class="fn"><a name="MediaSource"></a>MediaSource::MediaSource ( const <a href="qstring.html">QString</a> &amp; <i>fileName</i> )</h3>
<p>Creates a <a href="phonon-mediasource.html">MediaSource</a> object for the file specified by <i>fileName</i>. You can also use this constructor with <a href="resources.html">Qt resources</a></p>
<h3 class="fn"><a name="MediaSource-3"></a>MediaSource::MediaSource ( const <a href="qurl.html">QUrl</a> &amp; <i>url</i> )</h3>
<p>Creates a <a href="phonon-mediasource.html">MediaSource</a> object for a the URL specified by <i>url</i>.</p>
<p>If the multimedia content you would like to play back is on a remote network location, you should use this constructor; though, it also possible to specify an URL to a local file.</p>
<p>See also <a href="qurl.html">QUrl</a>.</p>
<h3 class="fn"><a name="MediaSource-4"></a>MediaSource::MediaSource ( <a href="phonon.html#DiscType-enum">Phonon::DiscType</a> <i>discType</i>, const <a href="qstring.html">QString</a> &amp; <i>deviceName</i> = QString() )</h3>
<p>Creates a <a href="phonon-mediasource.html">MediaSource</a> object for the type of disc specified by <i>discType</i> in the named device referred to by <i>deviceName</i>.</p>
<p><b>Note:</b> <i>deviceName</i> is a platform dependent device name. It can be useful to specify this if the computer has more than one CD drive. On KDE, it is recommended to use the Solid hardware discovery framework to retrieve the device name in a portable way.</p>
<h3 class="fn"><a name="MediaSource-6"></a>MediaSource::MediaSource ( <a href="qiodevice.html">QIODevice</a> * <i>ioDevice</i> )</h3>
<p>Creates a <a href="phonon-mediasource.html">MediaSource</a> object for the <a href="qiodevice.html">QIODevice</a> specified by <i>ioDevice</i>.</p>
<p>This constructor can be very handy in the combination of <a href="qbytearray.html">QByteArray</a> and <a href="qbuffer.html">QBuffer</a>.</p>
<p>If you need to fetch multimedia data from a source that is not supported by <a href="phonon-mediasource.html">MediaSource</a>, you should subclass <a href="qiodevice.html">QIODevice</a> and use this <a href="phonon-mediasource.html">MediaSource</a> constructor. It is important that you reimplement <a href="qiodevice.html#isSequential">QIODevice::isSequential</a>(), as it is used by <a href="phonon-mediasource.html">MediaSource</a> to determine if the media source is seekable.</p>
<p><i>ioDevice</i> is an arbitrary readable <a href="qiodevice.html">QIODevice</a> subclass. If the device is not opened <a href="phonon-mediasource.html">MediaSource</a> will open it as <a href="qiodevice.html#OpenModeFlag-enum">QIODevice::ReadOnly</a>.</p>
<p><b>Note:</b> Sequential devices can also be used, but <a href="phonon-mediaobject.html#isSeekable">MediaObject::isSeekable</a>() will return false as a result.</p>
<p><b>Warning:</b> On Windows, we only support <a href="qiodevice.html">QIODevice</a>s containing the <tt>avi</tt>, <tt>mp3</tt>, or <tt>mpg</tt> formats. Use the constructor that takes a file name to open files (the Qt backend does not use a <a href="qfile.html">QFile</a> internally).</p>
<p>See also <a href="phonon-mediasource.html#setAutoDelete">setAutoDelete</a>().</p>
<h3 class="fn"><a name="MediaSource-7"></a>MediaSource::MediaSource ( const MediaSource &amp; <i>other</i> )</h3>
<p>Constructs a copy of the <i>other</i> media source.</p>
<p>This constructor is fast thanks to explicit sharing.</p>
<a name="//apple_ref/cpp/instm/Phonon::MediaSource/~MediaSource"></a>
<h3 class="fn"><a name="dtor.MediaSource"></a>MediaSource::~MediaSource ()</h3>
<p>Destroys the <a href="phonon-mediasource.html">MediaSource</a> object. You should never delete a <a href="phonon-mediasource.html">MediaSource</a> yourself, the <a href="phonon-mediaobject.html">MediaObject</a> will handle this.</p>
<a name="//apple_ref/cpp/instm/Phonon::MediaSource/autoDelete"></a>
<h3 class="fn"><a name="autoDelete"></a>bool MediaSource::autoDelete () const</h3>
<p>Returns the setting of the auto-delete option. The default is false.</p>
<p>See also <a href="phonon-mediasource.html#setAutoDelete">setAutoDelete</a>().</p>
<a name="//apple_ref/cpp/instm/Phonon::MediaSource/deviceName"></a>
<h3 class="fn"><a name="deviceName"></a><a href="qstring.html">QString</a> MediaSource::deviceName () const</h3>
<p>Returns the device name of the <a href="phonon-mediasource.html">MediaSource</a> if <a href="phonon-mediasource.html#type">type</a>() == Disc; otherwise returns QString().</p>
<p>See also <a href="phonon-mediasource.html#type">type</a>().</p>
<a name="//apple_ref/cpp/instm/Phonon::MediaSource/discType"></a>
<h3 class="fn"><a name="discType"></a><a href="phonon.html#DiscType-enum">Phonon::DiscType</a> MediaSource::discType () const</h3>
<p>Returns the disc type of the <a href="phonon-mediasource.html">MediaSource</a> if <a href="phonon-mediasource.html#type">type</a>() == Disc; otherwise returns <a href="phonon.html#DiscType-enum">NoDisc</a>.</p>
<p>See also <a href="phonon-mediasource.html#type">type</a>().</p>
<a name="//apple_ref/cpp/instm/Phonon::MediaSource/fileName"></a>
<h3 class="fn"><a name="fileName"></a><a href="qstring.html">QString</a> MediaSource::fileName () const</h3>
<p>Returns the file name of the <a href="phonon-mediasource.html">MediaSource</a> if <a href="phonon-mediasource.html#type">type</a>() == <a href="phonon-mediasource.html#Type-enum">LocalFile</a>; otherwise, returns QString().</p>
<p>See also <a href="phonon-mediasource.html#type">type</a>().</p>
<a name="//apple_ref/cpp/instm/Phonon::MediaSource/setAutoDelete"></a>
<h3 class="fn"><a name="setAutoDelete"></a>void MediaSource::setAutoDelete ( bool <i>enable</i> )</h3>
<p>If <i>enable</i> is true, the media source will take ownership of the object passed in the <a href="phonon-mediasource.html">MediaSource</a>'s constructor object that was passed in the constructor; otherwise, the programmer is responsible for deletion of this object.</p>
<p>This setting is false by default. If you enable it, you should only access the stream or device as long as you keep the media source object around. As long as you keep the media source wrapping the stream or device, the object will not get deleted.</p>
<p>See also <a href="phonon-mediasource.html#autoDelete">autoDelete</a>().</p>
<a name="//apple_ref/cpp/instm/Phonon::MediaSource/type"></a>
<h3 class="fn"><a name="type"></a><a href="phonon-mediasource.html#Type-enum">Type</a> MediaSource::type () const</h3>
<p>Returns the type of the <a href="phonon-mediasource.html">MediaSource</a> (depends on the constructor that was used).</p>
<p>See also <a href="phonon-mediasource.html#Type-enum">Type</a>.</p>
<a name="//apple_ref/cpp/instm/Phonon::MediaSource/url"></a>
<h3 class="fn"><a name="url"></a><a href="qurl.html">QUrl</a> MediaSource::url () const</h3>
<p>Returns the URL of the <a href="phonon-mediasource.html">MediaSource</a> if <a href="phonon-mediasource.html#type">type</a>() == URL or <a href="phonon-mediasource.html#type">type</a>() == <a href="phonon-mediasource.html#Type-enum">LocalFile</a>; otherwise returns <a href="porting4.html#qurl">QUrl</a>().</p>
<p>See also <a href="phonon-mediasource.html#type">type</a>().</p>
<a name="//apple_ref/cpp/instm/Phonon::MediaSource/operator="></a>
<h3 class="fn"><a name="operator-eq"></a>MediaSource &amp; MediaSource::operator= ( const MediaSource &amp; <i>other</i> )</h3>
<p>Assigns the <i>other</i> media source to this media source and returns a reference to it.</p>
<p>This operation is fast thanks to explicit sharing.</p>
<a name="//apple_ref/cpp/instm/Phonon::MediaSource/operator=="></a>
<h3 class="fn"><a name="operator-eq-eq"></a>bool MediaSource::operator== ( const MediaSource &amp; <i>other</i> ) const</h3>
<p>Returns true if this media source is equal to the <i>other</i> media source; otherwise returns false.</p>
<p /><address><hr /><div align="center">
<table width="100%" cellspacing="0" border="0"><tr class="address">
<td width="40%" align="left">Copyright &copy; 2010 Nokia Corporation and/or its subsidiary(-ies)</td>
<td width="20%" align="center"><a href="trademarks.html">Trademarks</a></td>
<td width="40%" align="right"><div align="right">Qt 4.6.3</div></td>
</tr></table></div></address></body>
</html>