|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.trolltech.qt.internal.QSignalEmitterInternal
com.trolltech.qt.QSignalEmitter
com.trolltech.qt.QtJambiObject
com.trolltech.qt.phonon.MediaSource
public class MediaSource
The MediaSource class provides multimedia data for media objects. The MediaSource class manages a source of multimedia content, such as a music or video file, of which data is given to a MediaObject
.
The media source knows how fetch its data from several sources, e.g., from files, a QIODevice
, or a CD. The possible source types are described by the Type
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 QIODevice
.
The class has several functions to acquire information about the source it manages, e.g., fileName()
and url()
. The return from these functions are dependent on the type()
of the media source.
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 MediaObject
.
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);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.
MediaObject
, and Phonon Module.
Nested Class Summary | |
---|---|
static class |
MediaSource.Type
Identifies the type of media described by the MediaSource object. |
Nested classes/interfaces inherited from class com.trolltech.qt.QSignalEmitter |
---|
QSignalEmitter.AbstractSignal, QSignalEmitter.Signal0, QSignalEmitter.Signal1, QSignalEmitter.Signal2, QSignalEmitter.Signal3, QSignalEmitter.Signal4, QSignalEmitter.Signal5, QSignalEmitter.Signal6, QSignalEmitter.Signal7, QSignalEmitter.Signal8, QSignalEmitter.Signal9 |
Nested classes/interfaces inherited from class com.trolltech.qt.internal.QSignalEmitterInternal |
---|
com.trolltech.qt.internal.QSignalEmitterInternal.AbstractSignalInternal |
Field Summary |
---|
Fields inherited from class com.trolltech.qt.internal.QSignalEmitterInternal |
---|
currentSender |
Constructor Summary | |
---|---|
MediaSource(MediaSource rhs)
Constructs a copy of the other media source. |
|
MediaSource(Phonon.DiscType discType)
Creates a MediaSource object for the type of disc specified by discType in the named device referred to by deviceName. |
|
MediaSource(Phonon.DiscType discType,
java.lang.String deviceName)
Creates a MediaSource object for the type of disc specified by discType in the named device referred to by deviceName. |
|
MediaSource(QIODevice ioDevice)
Creates a MediaSource object for the QIODevice specified by ioDevice. |
|
MediaSource(QUrl url)
Creates a MediaSource object for a the URL specified by url. |
|
MediaSource(java.lang.String fileName)
Creates a MediaSource object for the file specified by fileName. |
Method Summary | |
---|---|
boolean |
autoDelete()
Returns the setting of the auto-delete option. |
MediaSource |
clone()
This method is reimplemented for internal reasons |
java.lang.String |
deviceName()
Returns the device name of the MediaSource if type() == Disc; otherwise returns QString(). |
Phonon.DiscType |
discType()
Returns the disc type of the MediaSource if type() == Disc; otherwise returns NoDisc . |
java.lang.String |
fileName()
Returns the file name of the MediaSource if type() == LocalFile ; otherwise, returns QString(). |
void |
setAutoDelete(boolean enable)
If enable is true, the media source will take ownership of the object passed in the MediaSource's constructor object that was passed in the constructor; otherwise, the programmer is responsible for deletion of this object. |
MediaSource.Type |
type()
Returns the type of the MediaSource (depends on the constructor that was used). |
QUrl |
url()
Returns the URL of the MediaSource if type() == URL or type() == LocalFile ; otherwise returns QUrl(). |
Methods inherited from class com.trolltech.qt.QtJambiObject |
---|
dispose, disposed, equals, finalize, reassignNativeResources, tr, tr, tr |
Methods inherited from class com.trolltech.qt.QSignalEmitter |
---|
blockSignals, disconnect, disconnect, signalsBlocked, signalSender, thread |
Methods inherited from class com.trolltech.qt.internal.QSignalEmitterInternal |
---|
__qt_signalInitialization |
Methods inherited from class java.lang.Object |
---|
getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface com.trolltech.qt.QtJambiInterface |
---|
disableGarbageCollection, nativeId, nativePointer, reenableGarbageCollection, setJavaOwnership |
Constructor Detail |
---|
public MediaSource(Phonon.DiscType discType)
Note:deviceName 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.
public MediaSource(Phonon.DiscType discType, java.lang.String deviceName)
Note:deviceName 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.
public MediaSource(QIODevice ioDevice)
QIODevice
specified by ioDevice. This constructor can be very handy in the combination of QByteArray
and QBuffer
.
If you need to fetch multimedia data from a source that is not supported by MediaSource, you should subclass QIODevice
and use this MediaSource constructor. It is important that you reimplement QIODevice::isSequential()
, as it is used by MediaSource to determine if the media source is seekable.
ioDevice is an arbitrary readable QIODevice
subclass. If the device is not opened MediaSource will open it as QIODevice::ReadOnly
.
Note: Sequential devices can also be used, but MediaObject::isSeekable()
will return false as a result.
setAutoDelete()
.
public MediaSource(MediaSource rhs)
This constructor is fast thanks to explicit sharing.
public MediaSource(java.lang.String fileName)
public MediaSource(QUrl url)
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.
QUrl
.
Method Detail |
---|
public final boolean autoDelete()
setAutoDelete()
.
public final java.lang.String deviceName()
type()
== Disc; otherwise returns QString(). type()
.
public final Phonon.DiscType discType()
type()
== Disc; otherwise returns NoDisc
. type()
.
public final java.lang.String fileName()
type()
== LocalFile
; otherwise, returns QString(). type()
.
public final void setAutoDelete(boolean enable)
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.
autoDelete()
.
public final MediaSource.Type type()
Type
.
public final QUrl url()
type()
== URL or type()
== LocalFile
; otherwise returns QUrl(). type()
.
public MediaSource clone()
clone
in class java.lang.Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |