6#include <private/qmultimediautils_p.h>
7#include <private/qplatformmediaintegration_p.h>
11#include <QtCore/qcoreevent.h>
12#include <QtCore/qmetaobject.h>
13#include <QtCore/qtimer.h>
14#include <QtCore/qdebug.h>
15#include <QtCore/qdir.h>
16#include <QtCore/qpointer.h>
17#include <QtCore/qfileinfo.h>
18#include <QtCore/qtemporaryfile.h>
19#include <QtCore/qcoreapplication.h>
21#if defined(Q_OS_ANDROID)
22# include <QtCore/qjniobject.h>
105 if (toState !=
state) {
106 const auto fromState = std::exchange(
state, toState);
109 emit q->playbackStateChanged(toState);
117 emit q->mediaStatusChanged(
s);
124 this->error.setAndNotify(
error, errorString, *
q);
132 std::unique_ptr<QFile>
file;
150#if QT_CONFIG(temporaryfile)
151#if defined(Q_OS_ANDROID)
154 QTemporaryFile *
tempFile = QTemporaryFile::createNativeFile(*
file);
155 if (!
tempFile->rename(tempFileName))
156 qWarning() <<
"Could not rename temporary file to:" << tempFileName;
158 QTemporaryFile *
tempFile =
new QTemporaryFile;
187 qWarning(
"Qt was built with -no-feature-temporaryfile: playback from resource file is not supported!");
206 QList<QMediaMetaData> tracks;
227 d->control = maybeControl.value();
228 d->state =
d->control->state();
230 qWarning() <<
"Failed to initialize QMediaPlayer" << maybeControl.error();
253 d->setVideoSink(
nullptr);
294 &&
d->state !=
d->control->state()) {
295 return d->control->state();
304 return d->control ?
d->control->mediaStatus() :
NoMedia;
317 return d->control ?
d->control->duration() : 0;
330 return d->control ?
d->control->position() : 0;
345 return d->control ?
d->control->bufferProgress() : 0;
376 return d->control &&
d->control->isAudioAvailable();
392 return d->control &&
d->control->isVideoAvailable();
404 return d->control &&
d->control->isSeekable();
419 return d->control ?
d->control->playbackRate() : 0.;
451 return d->control ?
d->control->loops() : 1;
460 d->control->setLoops(
loops);
468 return d_func()->error.code();
485 return d_func()->error.description();
565 if (!
d->control->isSeekable())
575 d->control->setPlaybackRate(
rate);
606 if (
d->source ==
source &&
d->stream ==
nullptr)
635 if (
d->source == sourceUrl &&
d->stream ==
device)
638 d->source = sourceUrl;
667 auto oldOutput =
d->audioOutput;
672 d->control->setAudioOutput(
nullptr);
674 oldOutput->setDisconnectFunction({});
678 d->control->setAudioOutput(
output->handle());
686 return d->audioOutput;
896 return d->videoOutput;
905 auto *
sink = qobject_cast<QVideoSink *>(
output);
911 d->setVideoSink(
sink);
921 d->videoOutput =
nullptr;
922 d->setVideoSink(
sink);
958 return bool(
d->control);
1351#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.
QString suffix() const
Returns the suffix (extension) of the file.
QFILE_MAYBE_NODISCARD 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.
Exception-safe wrapper around QObject::blockSignals().
\macro QT_RESTRICTED_CAST_FROM_ASCII
bool isEmpty() const noexcept
Returns true if the string has no characters; otherwise returns false.
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.
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]
\inmodule QtCore \reentrant