In some cases the available cross-platform Multimedia APIs or implementations are not sufficient, or not immediately available on a certain platform. In some cases the multimedia implementation on a platform might expose certain extra properties or functionality that other platforms do not, or a finer degree of control might be possible. For these cases, it is possible to use extended controls directly.
In addition, if you plan to port the Qt Multimedia APIs to a new platform, you do this by implementing certain control and service classes, as detailed below.
For the developer who wishes to extend the functionality of the Multimedia classes there are several classes of particular importance. The default classes are QMediaService, QMediaServiceProvider and QMediaControl.
Basically, the idea is that to use the Multimedia API you would use these three classes or classes derived from them as follows
Consider a developer creating, for example, a media player class called MyPlayer. It may have special requirements beyond ordinary media players and so may need a custom service and a custom control. We can subclass QMediaServiceProvider to create our MyServiceProvider class. Also we will create a MyMediaService, and the MyMediaControl to manipulate the media service.
The MyPlayer object calls MyServiceProvider::requestService() to get an instance of MyMediaService. Then the MyPlayer object calls this service object it has just received and calling requestControl() it will receive the control object derived from QMediaControl. Now we have all the parts necessary for our media application. We have the service provider, the service it provides and the control used to manipulate the service. Since our MyPlayer object has instances of the service and its control then it would be possible for these to be used by associated classes that could do additional actions, perhaps with their own control since the parameter to requestControl() is a c-type string, const char *, for the interface.
The base class for creating new service providers is QMediaServiceProvider. The user must implement the requestService() function
QMediaService* requestService(const QByteArray &type, const QMediaServiceProviderHint &hint);
The details of implementation will depend on the provider. Looking at the class QMediaServiceProvider for the default implementation. Notice that requestService() uses the QMediaServiceProviderHint to look for the appropriate plugin and then to insert it into the plugin map. However, for a specific service provider there is probably no need for this approach, it will simply depend on what the developer wants to implement.
Other methods that may be overloaded
void releaseService(QMediaService *service); QtMediaServices::SupportEstimate hasSupport(const QByteArray &serviceType, const QString &mimeType, const QStringList& codecs, int flags) const; QStringList supportedMimeTypes(const QByteArray &serviceType, int flags) const; QList<QByteArray> devices(const QByteArray &serviceType) const; QString deviceDescription(const QByteArray &serviceType, const QByteArray &device);
The choice of what needs to be done depends on what the developer wishes to do with the service.
Access to the settings of a media service that performs audio encoding | |
Control for setting the capture buffer format | |
Control for setting capture destination | |
Abstract base class for classes that control still cameras or video cameras | |
Supplies control for exposure related camera parameters | |
Supplies a camera flash control | |
Supplies control for focusing related camera parameters | |
Control interface for image capture services | |
Abstract class for controlling image processing parameters, like white balance, contrast, saturation, sharpening and denoising | |
Abstract base class for classes that control still cameras or video cameras | |
Access to the settings of a media service that performs image encoding | |
Access to the output container format of a QMediaService | |
Base interface for media service controls | |
Allows the setting of the Network Access Point for media related activities | |
Access to the media playing functionality of a QMediaService | |
Access to the playlist functionality of a QMediaService | |
Access to the playlist playback functionality of a QMediaService | |
Access to the recording functionality of a QMediaService | |
Common base class for media service implementations | |
Abstract allocator for media services | |
Describes what is required of a QMediaService | |
Media stream selection control | |
Read access to the meta-data of a QMediaService's media | |
Write access to the meta-data of a QMediaService's media | |
Access to the radio tuning functionality of a QMediaService | |
Video device selector media control | |
Access to the settings of a media service that performs video encoding | |
Control for rendering to a video surface | |
Media control which implements a video widget | |
Media control for rendering video to a window |