Phonon::MediaSource

Search for usage in LXR

#include <phonon/MediaSource>

Inherited by Phonon::Experimental::MediaSource.

Public Types

enum  Type {
  Invalid = -1, LocalFile, Url, Disc,
  Stream, CaptureDevice, Empty, AudioVideoCapture
}
 

Public Member Functions

 MediaSource ()
 
PHONON_DEPRECATED MediaSource (const QString &fileName)
 
 MediaSource (const QUrl &url)
 
 MediaSource (DiscType discType, const QString &deviceName=QString())
 
 MediaSource (const AudioCaptureDevice &device)
 
 MediaSource (const VideoCaptureDevice &device)
 
 MediaSource (Capture::DeviceType deviceType, CaptureCategory category=NoCaptureCategory)
 
 MediaSource (CaptureCategory category)
 
 MediaSource (AbstractMediaStream *stream)
 
 MediaSource (QIODevice *ioDevice)
 
 MediaSource (const MediaSource &rhs)
 
 ~MediaSource ()
 
AudioCaptureDevice audioCaptureDevice () const
 
const DeviceAccessListaudioDeviceAccessList () const
 
bool autoDelete () const
 
const DeviceAccessListdeviceAccessList () const
 
QString deviceName () const
 
DiscType discType () const
 
QString fileName () const
 
Mrl mrl () const
 
MediaSourceoperator= (const MediaSource &rhs)
 
bool operator== (const MediaSource &rhs) const
 
void setAutoDelete (bool enable)
 
AbstractMediaStreamstream () const
 
Type type () const
 
QUrl url () const
 
VideoCaptureDevice videoCaptureDevice () const
 
const DeviceAccessListvideoDeviceAccessList () const
 

Protected Member Functions

 MediaSource (MediaSourcePrivate &)
 
PHONON_DEPRECATED MediaSource (const DeviceAccess &access)
 

Protected Attributes

QExplicitlySharedDataPointer< MediaSourcePrivate > d
 

Friends

PHONON_EXPORT QDebug operator<< (QDebug dbg, const Phonon::MediaSource &)
 

Detailed Description

Note that all constructors of this class are implicit, so that you can simply write.

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);
Author
Matthias Kretz kretz[email protected]@kde[email protected].org

Definition at line 62 of file mediasource.h.

Member Enumeration Documentation

Identifies the type of media described by the MediaSource object.

See also
MediaSource::type()
Enumerator
Invalid 

The MediaSource object does not describe any valid source.

LocalFile 

The MediaSource object describes a local file.

Url 

The MediaSource object describes a URL, which can be both a local file and a file on the network.

Disc 

The MediaSource object describes a disc.

Stream 

The MediaSource object describes a data stream.

This is also the type used for QIODevices.

See also
AbstractMediaStream
CaptureDevice 

The MediaSource object describes a single capture device.

This could be either audio or video.

Empty 

An empty MediaSource.

It can be used to unload the current media from a MediaObject.

See also
MediaSource()
AudioVideoCapture 

The MediaSource object describes one device for video capture and one for audio capture.

Facilitates capturing both audio and video at the same time, from different devices. It's essentially like two CaptureDevice media sources (one of video type, one of audio type) merged together.

Definition at line 72 of file mediasource.h.

Constructor & Destructor Documentation

Phonon::MediaSource::MediaSource ( )

Creates an empty MediaSource.

An empty MediaSource is considered valid and can be set on a MediaObject to unload its current media.

See also
Empty

Definition at line 40 of file mediasource.cpp.

Phonon::MediaSource::MediaSource ( const QString fileName)

Creates a MediaSource object for a local file or a Qt resource.

Deprecated:
Use MediaSource(QUrl("qrc:///...")) for a Qt resource, MediaSource(QUrl::fromLocalFile("...")) for a local file, or MediaSource(QUrl("...")) for an URL.
Parameters
fileNamefile name of a local media file or a Qt resource that was compiled in.

Definition at line 45 of file mediasource.cpp.

Phonon::MediaSource::MediaSource ( const QUrl url)

Creates a MediaSource object for a URL.

A Qt resource can be specified by using an url with a qrc scheme.

Parameters
urlURL to a media file or stream.

Definition at line 85 of file mediasource.cpp.

Phonon::MediaSource::MediaSource ( DiscType  discType,
const QString deviceName = QString() 
)

Creates a MediaSource object for discs.

Parameters
discTypeSee DiscType
deviceNameA 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.

Definition at line 111 of file mediasource.cpp.

Phonon::MediaSource::MediaSource ( const AudioCaptureDevice device)

Creates a MediaSource object for audio capture devices.

If the device is valid, this creates a 'CaptureDevice' type MediaSource.

Definition at line 129 of file mediasource.cpp.

Phonon::MediaSource::MediaSource ( const VideoCaptureDevice device)

Creates a MediaSource object for video capture devices.

If the device is valid, this creates a 'CaptureDevice' type MediaSource

Definition at line 137 of file mediasource.cpp.

Phonon::MediaSource::MediaSource ( Capture::DeviceType  deviceType,
CaptureCategory  category = NoCaptureCategory 
)

Sets the source to the preferred audio capture device for the specified category If a valid device is found, this creates a 'CaptureDevice' type MediaSource.

Definition at line 151 of file mediasource.cpp.

Phonon::MediaSource::MediaSource ( CaptureCategory  category)

Creates a MediaSource object that tries to describe a video capture device and an audio capture device, together.

The devices are appropriate for the specified category.

If valid devices are found for both audio and video, then the resulting MediaSource is of type 'AudioVideoCapture'. If only an audio or a video valid device is found, the resulting type is 'CaptureDevice'. If no valid devices are found, the resulting type is 'Invalid'.

Definition at line 145 of file mediasource.cpp.

Phonon::MediaSource::MediaSource ( AbstractMediaStream stream)

Creates a MediaSource object for a data stream.

Your application can provide the media data by subclassing AbstractMediaStream and passing a pointer to that object. Phonon will never delete the stream.

Parameters
streamThe AbstractMediaStream subclass to provide the media data.
See also
setAutoDelete

Definition at line 159 of file mediasource.cpp.

Phonon::MediaSource::MediaSource ( QIODevice ioDevice)

Creates a MediaSource object for a QIODevice.

This constructor can be very handy in the combination of QByteArray and QBuffer.

Parameters
ioDeviceAn 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.
See also
setAutoDelete

Definition at line 169 of file mediasource.cpp.

Phonon::MediaSource::~MediaSource ( )

Destroys the MediaSource object.

Definition at line 197 of file mediasource.cpp.

Phonon::MediaSource::MediaSource ( const MediaSource rhs)

Constructs a copy of rhs.

This constructor is fast thanks to explicit sharing.

Definition at line 215 of file mediasource.cpp.

Member Function Documentation

AudioCaptureDevice Phonon::MediaSource::audioCaptureDevice ( ) const

Returns the audio capture device for the media source if applicable.

Definition at line 314 of file mediasource.cpp.

const DeviceAccessList & Phonon::MediaSource::audioDeviceAccessList ( ) const

Returns the access list for the audio device used for capture.

Valid for type() == CaptureDevice or type() == AudioVideoCapture. If used with CaptureDevice, the kind of device should be Audio, for a valid result.

Definition at line 286 of file mediasource.cpp.

bool Phonon::MediaSource::autoDelete ( ) const

Returns the setting of the auto-delete option.

The default is false.

See also
setAutoDelete

Definition at line 236 of file mediasource.cpp.

const DeviceAccessList & Phonon::MediaSource::deviceAccessList ( ) const

Returns the access list for the device of this media source.

Valid for capture devices.

Warning
use only with MediaSource with type() == CaptureDevice

Definition at line 271 of file mediasource.cpp.

QString Phonon::MediaSource::deviceName ( ) const

Returns the device name of the MediaSource if type() == Disc; otherwise returns QString().

Definition at line 296 of file mediasource.cpp.

DiscType Phonon::MediaSource::discType ( ) const

Returns the disc type of the MediaSource if type() == Disc; otherwise returns NoDisc.

Definition at line 266 of file mediasource.cpp.

QString Phonon::MediaSource::fileName ( ) const

Returns the file name of the MediaSource if type() == LocalFile; otherwise returns QString().

Definition at line 251 of file mediasource.cpp.

Mrl Phonon::MediaSource::mrl ( ) const

Returns the MRL of the MediaSource if type() == URL or type() == LocalFile; otherwise returns Mrl().

Phonon::Mrl is based on QUrl and adds some additional functionality that is necessary to ensure proper encoding usage in the Phonon backends.

Usually you will not have to use this in an application.

Since
4.5

Definition at line 256 of file mediasource.cpp.

MediaSource & Phonon::MediaSource::operator= ( const MediaSource rhs)

Assigns rhs to this MediaSource and returns a reference to this MediaSource.

This operation is fast thanks to explicit sharing.

Definition at line 220 of file mediasource.cpp.

bool Phonon::MediaSource::operator== ( const MediaSource rhs) const

Returns true if this MediaSource is equal to rhs; otherwise returns false.

Definition at line 226 of file mediasource.cpp.

void Phonon::MediaSource::setAutoDelete ( bool  enable)

Tell the MediaSource to take ownership of the AbstractMediaStream or QIODevice that was passed in the constructor.

The default setting is false, 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.

See also
autoDelete

Definition at line 231 of file mediasource.cpp.

AbstractMediaStream * Phonon::MediaSource::stream ( ) const

Returns the media stream of the MediaSource if type() == Stream; otherwise returns 0.

QIODevices are handled as streams, too.

Definition at line 302 of file mediasource.cpp.

MediaSource::Type Phonon::MediaSource::type ( ) const

Returns the type of the MediaSource (depends on the constructor that was used).

See also
Type

Definition at line 241 of file mediasource.cpp.

QUrl Phonon::MediaSource::url ( ) const

Returns the url of the MediaSource if type() == URL or type() == LocalFile; otherwise returns QUrl().

Definition at line 261 of file mediasource.cpp.

VideoCaptureDevice Phonon::MediaSource::videoCaptureDevice ( ) const

Returns the video capture device for the media source if applicable.

Definition at line 321 of file mediasource.cpp.

const DeviceAccessList & Phonon::MediaSource::videoDeviceAccessList ( ) const

Returns the access list for the video device used for capture.

Valid for type() == CaptureDevice or type() == AudioVideoCapture. If used with CaptureDevice, the kind of device should be Video, for a valid result.

Definition at line 291 of file mediasource.cpp.


The documentation for this class was generated from the following files:
This file is part of the KDE documentation.
Documentation copyright © 1996-2022 The KDE developers.
Generated on Thu Jan 27 2022 22:59:43 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.