6#include <private/qplatformmediaintegration_p.h>
10#include <QtCore/qcoreevent.h>
11#include <QtCore/qmetaobject.h>
12#include <QtCore/qtimer.h>
13#include <QtCore/qdebug.h>
14#include <QtCore/qpointer.h>
15#include <QtCore/qfileinfo.h>
16#include <QtCore/qtemporaryfile.h>
17#include <QtCore/qdir.h>
18#include <QtCore/qcoreapplication.h>
20#if defined(Q_OS_ANDROID)
21# include <QtCore/qjniobject.h>
108 emit q->playbackStateChanged(ps);
116 emit q->mediaStatusChanged(
s);
123 auto prevError = std::exchange(this->error,
error);
124 auto prevErrorString = std::exchange(this->errorString,
errorString);
127 emit q->errorChanged();
138 std::unique_ptr<QFile>
file;
156#if QT_CONFIG(temporaryfile)
157#if defined(Q_OS_ANDROID)
161 if (!
tempFile->rename(tempFileName))
162 qWarning() <<
"Could not rename temporary file to:" << tempFileName;
193 qWarning(
"Qt was built with -no-feature-temporaryfile: playback from resource file is not supported!");
235 d->control = maybeControl.value();
236 d->state =
d->control->state();
238 qWarning() <<
"Failed to initialize QMediaPlayer" << maybeControl.error();
257 d->setVideoSink(
nullptr);
298 &&
d->state !=
d->control->state()) {
299 return d->control->state();
308 return d->control ?
d->control->mediaStatus() :
NoMedia;
321 return d->control ?
d->control->duration() : 0;
334 return d->control ?
d->control->position() : 0;
349 return d->control ?
d->control->bufferProgress() : 0;
380 return d->control &&
d->control->isAudioAvailable();
396 return d->control &&
d->control->isVideoAvailable();
408 return d->control &&
d->control->isSeekable();
423 return d->control ?
d->control->playbackRate() : 0.;
455 return d->control ?
d->control->loops() : 1;
464 d->control->setLoops(
loops);
472 return d_func()->error;
489 return d_func()->errorString;
569 if (!
d->control->isSeekable())
579 d->control->setPlaybackRate(
rate);
610 if (
d->source ==
source &&
d->stream ==
nullptr)
639 if (
d->source == sourceUrl &&
d->stream ==
device)
642 d->source = sourceUrl;
671 auto oldOutput =
d->audioOutput;
676 d->control->setAudioOutput(
nullptr);
678 oldOutput->setDisconnectFunction({});
682 d->control->setAudioOutput(
output->handle());
690 return d->audioOutput;
900 return d->videoOutput;
909 auto *
sink = qobject_cast<QVideoSink *>(
output);
915 d->setVideoSink(
sink);
925 d->videoOutput =
nullptr;
926 d->setVideoSink(
sink);
962 return bool(
d->control);
1347#include "moc_qmediaplayer.cpp"
IOBluetoothDevice * device
\qmltype AudioOutput \instantiates QAudioOutput
bool mkpath(const QString &dirPath) const
Creates the directory path dirPath.
static QString tempPath()
Returns the absolute canonical path of the system's temporary directory.
static QString currentPath()
Returns the absolute path of the application's current directory.
\inmodule QtCore \reentrant
QString suffix() const
Returns the suffix (extension) of the file.
bool open(OpenMode flags) override
Opens the file using OpenMode mode, returning true if successful; otherwise false.
QString fileName() const override
Returns the name set by setFileName() or to the QFile constructors.
\inmodule QtCore \reentrant
virtual bool reset()
Seeks to the start of input for random-access devices.
qint64 read(char *data, qint64 maxlen)
Reads at most maxSize bytes from the device into data, and returns the number of bytes read.
void append(parameter_type t)
\macro QT_RESTRICTED_CAST_FROM_ASCII
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
\inmodule QtCore \reentrant
static QTemporaryFile * createNativeFile(const QString &fileName)
This is an overloaded member function, provided for convenience. It differs from the above function o...
static QUrl fromLocalFile(const QString &localfile)
Returns a QUrl representation of localFile, interpreted as a local file.
QString url(FormattingOptions options=FormattingOptions(PrettyDecoded)) const
Returns a string representation of the URL.
static QUrl fromUserInput(const QString &userInput, const QString &workingDirectory=QString(), UserInputResolutionOptions options=DefaultResolution)
Returns a valid URL from a user supplied userInput string if one can be deduced.
bool isEmpty() const
Returns true if the URL has no data; otherwise returns false.
QString scheme() const
Returns the scheme of the URL.
QString path(ComponentFormattingOptions options=FullyDecoded) const
Returns the path of the URL.
The QVideoSink class represents a generic sink for video data.
Combined button and popup list for selecting options.
static QT_BEGIN_NAMESPACE const char tempFile[]
DBusConnection const char DBusError * error
constexpr const T & qMax(const T &a, const T &b)
#define Q_RETURN_ARG(Type, data)
GLenum GLenum GLsizei count
GLsizei GLsizei GLchar * source
GLdouble GLdouble GLdouble GLdouble q
GLsizei const GLchar *const * path
GLsizei GLenum GLboolean sink
static qreal position(const QQuickItem *item, QQuickAnchors::Anchor anchorLine)
QT_BEGIN_NAMESPACE typedef uchar * output
QUrl url("example.com")
[constructor-url-reference]
myObject disconnect()
[26]
\inmodule QtCore \reentrant
IUIAutomationTreeWalker __RPC__deref_out_opt IUIAutomationElement ** parent