Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
AndroidMediaPlayer Class Reference

#include <androidmediaplayer_p.h>

+ Inheritance diagram for AndroidMediaPlayer:
+ Collaboration diagram for AndroidMediaPlayer:

Classes

struct  TrackInfo
 

Public Types

enum  MediaError {
  MEDIA_ERROR_UNKNOWN = 1 , MEDIA_ERROR_SERVER_DIED = 100 , MEDIA_ERROR_INVALID_STATE = -38 , MEDIA_ERROR_IO = -1004 ,
  MEDIA_ERROR_MALFORMED = -1007 , MEDIA_ERROR_UNSUPPORTED = -1010 , MEDIA_ERROR_TIMED_OUT = -110 , MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK = 200 ,
  MEDIA_ERROR_BAD_THINGS_ARE_GOING_TO_HAPPEN = -2147483648
}
 
enum  MediaInfo {
  MEDIA_INFO_UNKNOWN = 1 , MEDIA_INFO_VIDEO_TRACK_LAGGING = 700 , MEDIA_INFO_VIDEO_RENDERING_START = 3 , MEDIA_INFO_BUFFERING_START = 701 ,
  MEDIA_INFO_BUFFERING_END = 702 , MEDIA_INFO_BAD_INTERLEAVING = 800 , MEDIA_INFO_NOT_SEEKABLE = 801 , MEDIA_INFO_METADATA_UPDATE = 802
}
 
enum  MediaPlayerState {
  Uninitialized = 0x1 , Idle = 0x2 , Preparing = 0x4 , Prepared = 0x8 ,
  Initialized = 0x10 , Started = 0x20 , Stopped = 0x40 , Paused = 0x80 ,
  PlaybackCompleted = 0x100 , Error = 0x200
}
 
enum  TrackType {
  Unknown = 0 , Video , Audio , TimedText ,
  Subtitle , Metadata
}
 

Signals

void error (qint32 what, qint32 extra)
 
void bufferingChanged (qint32 percent)
 
void durationChanged (qint64 duration)
 
void progressChanged (qint64 progress)
 
void stateChanged (qint32 state)
 
void info (qint32 what, qint32 extra)
 
void videoSizeChanged (qint32 width, qint32 height)
 
void timedTextChanged (QString text)
 
void tracksInfoChanged ()
 
- Signals inherited from QObject
void destroyed (QObject *=nullptr)
 This signal is emitted immediately before the object obj is destroyed, after any instances of QPointer have been notified, and cannot be blocked.
 
void objectNameChanged (const QString &objectName, QPrivateSignal)
 This signal is emitted after the object's name has been changed.
 

Public Member Functions

 AndroidMediaPlayer ()
 
 ~AndroidMediaPlayer ()
 
void release ()
 
void reset ()
 
int getCurrentPosition ()
 
int getDuration ()
 
bool isPlaying ()
 
int volume ()
 
bool isMuted ()
 
qreal playbackRate ()
 
jobject display ()
 
void play ()
 
void pause ()
 
void stop ()
 
void seekTo (qint32 msec)
 
void setMuted (bool mute)
 
void setDataSource (const QNetworkRequest &request)
 
void prepareAsync ()
 
void setVolume (int volume)
 
bool setPlaybackRate (qreal rate)
 
void setDisplay (AndroidSurfaceTexture *surfaceTexture)
 
QList< TrackInfotracksInfo ()
 
int activeTrack (TrackType trackType)
 
void deselectTrack (int trackNumber)
 
void selectTrack (int trackNumber)
 
void blockAudio ()
 
void unblockAudio ()
 
- Public Member Functions inherited from QObject
Q_INVOKABLE QObject (QObject *parent=nullptr)
 Constructs an object with parent object parent.
 
virtual ~QObject ()
 Destroys the object, deleting all its child objects.
 
virtual bool event (QEvent *event)
 This virtual function receives events to an object and should return true if the event e was recognized and processed.
 
virtual bool eventFilter (QObject *watched, QEvent *event)
 Filters events if this object has been installed as an event filter for the watched object.
 
QString objectName () const
 
Q_WEAK_OVERLOAD void setObjectName (const QString &name)
 Sets the object's name to name.
 
void setObjectName (QAnyStringView name)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
QBindable< QStringbindableObjectName ()
 
bool isWidgetType () const
 Returns true if the object is a widget; otherwise returns false.
 
bool isWindowType () const
 Returns true if the object is a window; otherwise returns false.
 
bool isQuickItemType () const
 Returns true if the object is a QQuickItem; otherwise returns false.
 
bool signalsBlocked () const noexcept
 Returns true if signals are blocked; otherwise returns false.
 
bool blockSignals (bool b) noexcept
 If block is true, signals emitted by this object are blocked (i.e., emitting a signal will not invoke anything connected to it).
 
QThreadthread () const
 Returns the thread in which the object lives.
 
bool moveToThread (QThread *thread QT6_DECL_NEW_OVERLOAD_TAIL)
 Changes the thread affinity for this object and its children and returns true on success.
 
int startTimer (int interval, Qt::TimerType timerType=Qt::CoarseTimer)
 This is an overloaded function that will start a timer of type timerType and a timeout of interval milliseconds.
 
int startTimer (std::chrono::nanoseconds time, Qt::TimerType timerType=Qt::CoarseTimer)
 
void killTimer (int id)
 Kills the timer with timer identifier, id.
 
void killTimer (Qt::TimerId id)
 
template<typename T >
findChild (QAnyStringView aName, Qt::FindChildOptions options=Qt::FindChildrenRecursively) const
 Returns the child of this object that can be cast into type T and that is called name, or \nullptr if there is no such object.
 
template<typename T >
QList< T > findChildren (QAnyStringView aName, Qt::FindChildOptions options=Qt::FindChildrenRecursively) const
 Returns all children of this object with the given name that can be cast to type T, or an empty list if there are no such objects.
 
template<typename T >
findChild (Qt::FindChildOptions options=Qt::FindChildrenRecursively) const
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
template<typename T >
QList< T > findChildren (Qt::FindChildOptions options=Qt::FindChildrenRecursively) const
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
const QObjectListchildren () const
 Returns a list of child objects.
 
void setParent (QObject *parent)
 Makes the object a child of parent.
 
void installEventFilter (QObject *filterObj)
 Installs an event filter filterObj on this object.
 
void removeEventFilter (QObject *obj)
 Removes an event filter object obj from this object.
 
QMetaObject::Connection connect (const QObject *sender, const char *signal, const char *member, Qt::ConnectionType type=Qt::AutoConnection) const
 
bool disconnect (const char *signal=nullptr, const QObject *receiver=nullptr, const char *member=nullptr) const
 
bool disconnect (const QObject *receiver, const char *member=nullptr) const
 
void dumpObjectTree () const
 Dumps a tree of children to the debug output.
 
void dumpObjectInfo () const
 Dumps information about signal connections, etc.
 
bool setProperty (const char *name, const QVariant &value)
 Sets the value of the object's name property to value.
 
bool setProperty (const char *name, QVariant &&value)
 
QVariant property (const char *name) const
 Returns the value of the object's name property.
 
QList< QByteArraydynamicPropertyNames () const
 
QBindingStoragebindingStorage ()
 
const QBindingStoragebindingStorage () const
 
QObjectparent () const
 Returns a pointer to the parent object.
 
bool inherits (const char *classname) const
 Returns true if this object is an instance of a class that inherits className or a QObject subclass that inherits className; otherwise returns false.
 

Static Public Member Functions

static void startSoundStreaming (const int inputId, const int outputId)
 
static void stopSoundStreaming ()
 
static bool setAudioOutput (const QByteArray &deviceId)
 
static bool registerNativeMethods ()
 
- Static Public Member Functions inherited from QObject
static QMetaObject::Connection connect (const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
 \threadsafe
 
static QMetaObject::Connection connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type=Qt::AutoConnection)
 
template<typename Func1 , typename Func2 >
static QMetaObject::Connection connect (const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, const typename QtPrivate::ContextTypeForFunctor< Func2 >::ContextType *context, Func2 &&slot, Qt::ConnectionType type=Qt::AutoConnection)
 
template<typename Func1 , typename Func2 >
static QMetaObject::Connection connect (const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, Func2 &&slot)
 
static bool disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *member)
 \threadsafe
 
static bool disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &member)
 
static bool disconnect (const QMetaObject::Connection &)
 Disconnect a connection.
 
template<typename Func1 , typename Func2 >
static bool disconnect (const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, const typename QtPrivate::FunctionPointer< Func2 >::Object *receiver, Func2 slot)
 
template<typename Func1 >
static bool disconnect (const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, const QObject *receiver, void **zero)
 

Additional Inherited Members

- Public Slots inherited from QObject
void deleteLater ()
 \threadsafe
 
- Protected Member Functions inherited from QObject
QObjectsender () const
 Returns a pointer to the object that sent the signal, if called in a slot activated by a signal; otherwise it returns \nullptr.
 
int senderSignalIndex () const
 
int receivers (const char *signal) const
 Returns the number of receivers connected to the signal.
 
bool isSignalConnected (const QMetaMethod &signal) const
 
virtual void timerEvent (QTimerEvent *event)
 This event handler can be reimplemented in a subclass to receive timer events for the object.
 
virtual void childEvent (QChildEvent *event)
 This event handler can be reimplemented in a subclass to receive child events.
 
virtual void customEvent (QEvent *event)
 This event handler can be reimplemented in a subclass to receive custom events.
 
virtual void connectNotify (const QMetaMethod &signal)
 
virtual void disconnectNotify (const QMetaMethod &signal)
 
 QObject (QObjectPrivate &dd, QObject *parent=nullptr)
 
- Protected Attributes inherited from QObject
QScopedPointer< QObjectDatad_ptr
 
- Properties inherited from QObject
QString objectName
 the name of this object
 

Detailed Description

Definition at line 27 of file androidmediaplayer_p.h.

Member Enumeration Documentation

◆ MediaError

Enumerator
MEDIA_ERROR_UNKNOWN 
MEDIA_ERROR_SERVER_DIED 
MEDIA_ERROR_INVALID_STATE 
MEDIA_ERROR_IO 
MEDIA_ERROR_MALFORMED 
MEDIA_ERROR_UNSUPPORTED 
MEDIA_ERROR_TIMED_OUT 
MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK 
MEDIA_ERROR_BAD_THINGS_ARE_GOING_TO_HAPPEN 

Definition at line 34 of file androidmediaplayer_p.h.

◆ MediaInfo

Enumerator
MEDIA_INFO_UNKNOWN 
MEDIA_INFO_VIDEO_TRACK_LAGGING 
MEDIA_INFO_VIDEO_RENDERING_START 
MEDIA_INFO_BUFFERING_START 
MEDIA_INFO_BUFFERING_END 
MEDIA_INFO_BAD_INTERLEAVING 
MEDIA_INFO_NOT_SEEKABLE 
MEDIA_INFO_METADATA_UPDATE 

Definition at line 49 of file androidmediaplayer_p.h.

◆ MediaPlayerState

Enumerator
Uninitialized 
Idle 
Preparing 
Prepared 
Initialized 
Started 
Stopped 
Paused 
PlaybackCompleted 
Error 

Definition at line 61 of file androidmediaplayer_p.h.

◆ TrackType

Enumerator
Unknown 
Video 
Audio 
TimedText 
Subtitle 
Metadata 

Definition at line 74 of file androidmediaplayer_p.h.

Constructor & Destructor Documentation

◆ AndroidMediaPlayer()

AndroidMediaPlayer::AndroidMediaPlayer ( )

◆ ~AndroidMediaPlayer()

AndroidMediaPlayer::~AndroidMediaPlayer ( )

Definition at line 35 of file androidmediaplayer.cpp.

References i, and Q_ASSERT.

Member Function Documentation

◆ activeTrack()

int AndroidMediaPlayer::activeTrack ( TrackType trackType)

Definition at line 173 of file androidmediaplayer.cpp.

Referenced by QAndroidMediaPlayer::activeTrack().

+ Here is the caller graph for this function:

◆ blockAudio()

void AndroidMediaPlayer::blockAudio ( )

Definition at line 245 of file androidmediaplayer.cpp.

◆ bufferingChanged

void AndroidMediaPlayer::bufferingChanged ( qint32 percent)
signal

Referenced by QAndroidMediaPlayer::QAndroidMediaPlayer().

+ Here is the caller graph for this function:

◆ deselectTrack()

void AndroidMediaPlayer::deselectTrack ( int trackNumber)

Definition at line 179 of file androidmediaplayer.cpp.

◆ display()

jobject AndroidMediaPlayer::display ( )

Definition at line 102 of file androidmediaplayer.cpp.

Referenced by QAndroidMediaPlayer::setMedia().

+ Here is the caller graph for this function:

◆ durationChanged

void AndroidMediaPlayer::durationChanged ( qint64 duration)
signal

Referenced by QAndroidMediaPlayer::QAndroidMediaPlayer().

+ Here is the caller graph for this function:

◆ error

void AndroidMediaPlayer::error ( qint32 what,
qint32 extra )
signal

Referenced by QAndroidMediaPlayer::QAndroidMediaPlayer().

+ Here is the caller graph for this function:

◆ getCurrentPosition()

int AndroidMediaPlayer::getCurrentPosition ( )

Definition at line 53 of file androidmediaplayer.cpp.

Referenced by QAndroidMediaPlayer::pause(), QAndroidMediaPlayer::position(), and QAndroidMediaPlayer::setPosition().

+ Here is the caller graph for this function:

◆ getDuration()

int AndroidMediaPlayer::getDuration ( )

Definition at line 58 of file androidmediaplayer.cpp.

Referenced by QAndroidMediaPlayer::duration().

+ Here is the caller graph for this function:

◆ info

void AndroidMediaPlayer::info ( qint32 what,
qint32 extra )
signal

Referenced by QAndroidMediaPlayer::QAndroidMediaPlayer().

+ Here is the caller graph for this function:

◆ isMuted()

bool AndroidMediaPlayer::isMuted ( )

Definition at line 73 of file androidmediaplayer.cpp.

◆ isPlaying()

bool AndroidMediaPlayer::isPlaying ( )

Definition at line 63 of file androidmediaplayer.cpp.

◆ pause()

void AndroidMediaPlayer::pause ( )

Definition at line 194 of file androidmediaplayer.cpp.

Referenced by QAndroidMediaPlayer::pause().

+ Here is the caller graph for this function:

◆ play()

void AndroidMediaPlayer::play ( )

Definition at line 189 of file androidmediaplayer.cpp.

Referenced by QAndroidMediaPlayer::play().

+ Here is the caller graph for this function:

◆ playbackRate()

qreal AndroidMediaPlayer::playbackRate ( )

Definition at line 78 of file androidmediaplayer.cpp.

References player.

Referenced by QAndroidMediaPlayer::play().

+ Here is the caller graph for this function:

◆ prepareAsync()

void AndroidMediaPlayer::prepareAsync ( )

Definition at line 232 of file androidmediaplayer.cpp.

Referenced by QAndroidMediaPlayer::setMedia().

+ Here is the caller graph for this function:

◆ progressChanged

void AndroidMediaPlayer::progressChanged ( qint64 progress)
signal

Referenced by QAndroidMediaPlayer::QAndroidMediaPlayer().

+ Here is the caller graph for this function:

◆ registerNativeMethods()

bool AndroidMediaPlayer::registerNativeMethods ( )
static

Definition at line 513 of file androidmediaplayer.cpp.

References methods, onBufferingUpdateNative(), onDurationChangedNative(), onErrorNative(), onInfoNative(), onProgressUpdateNative(), onStateChangedNative(), onTimedTextChangedNative(), onTrackInfoChangedNative(), onVideoSizeChangedNative(), and QtAndroidMediaPlayerClassName.

Referenced by JNI_OnLoad().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ release()

void AndroidMediaPlayer::release ( )

Definition at line 43 of file androidmediaplayer.cpp.

Referenced by QAndroidMediaPlayer::~QAndroidMediaPlayer().

+ Here is the caller graph for this function:

◆ reset()

void AndroidMediaPlayer::reset ( )

Definition at line 48 of file androidmediaplayer.cpp.

◆ seekTo()

void AndroidMediaPlayer::seekTo ( qint32 msec)

Definition at line 204 of file androidmediaplayer.cpp.

Referenced by QAndroidMediaPlayer::setPosition().

+ Here is the caller graph for this function:

◆ selectTrack()

void AndroidMediaPlayer::selectTrack ( int trackNumber)

Definition at line 184 of file androidmediaplayer.cpp.

Referenced by QAndroidMediaPlayer::setActiveTrack().

+ Here is the caller graph for this function:

◆ setAudioOutput()

bool AndroidMediaPlayer::setAudioOutput ( const QByteArray & deviceId)
static

Definition at line 287 of file androidmediaplayer.cpp.

References qCWarning, ret, and QByteArray::toInt().

Referenced by QAndroidCaptureSession::setAudioOutput(), and QAndroidMediaPlayer::updateAudioDevice().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setDataSource()

void AndroidMediaPlayer::setDataSource ( const QNetworkRequest & request)

Definition at line 217 of file androidmediaplayer.cpp.

References QUrl::FullyEncoded, header(), QNetworkRequest::rawHeader(), QNetworkRequest::rawHeaderList(), request, QUrl::toString(), and QNetworkRequest::url().

Referenced by QAndroidMediaPlayer::setMedia().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setDisplay()

void AndroidMediaPlayer::setDisplay ( AndroidSurfaceTexture * surfaceTexture)

Definition at line 280 of file androidmediaplayer.cpp.

References AndroidSurfaceTexture::surfaceHolder().

Referenced by QAndroidMediaPlayer::setActiveTrack(), QAndroidMediaPlayer::setMedia(), and QAndroidMediaPlayer::setVideoSink().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setMuted()

void AndroidMediaPlayer::setMuted ( bool mute)

Definition at line 209 of file androidmediaplayer.cpp.

Referenced by QAndroidMediaPlayer::setActiveTrack().

+ Here is the caller graph for this function:

◆ setPlaybackRate()

bool AndroidMediaPlayer::setPlaybackRate ( qreal rate)

Definition at line 269 of file androidmediaplayer.cpp.

References qWarning.

Referenced by QAndroidMediaPlayer::play(), and QAndroidMediaPlayer::setPlaybackRate().

+ Here is the caller graph for this function:

◆ setVolume()

void AndroidMediaPlayer::setVolume ( int volume)

Definition at line 237 of file androidmediaplayer.cpp.

References volume().

+ Here is the call graph for this function:

◆ startSoundStreaming()

void AndroidMediaPlayer::startSoundStreaming ( const int inputId,
const int outputId )
static

Definition at line 255 of file androidmediaplayer.cpp.

◆ stateChanged

void AndroidMediaPlayer::stateChanged ( qint32 state)
signal

Referenced by QAndroidMediaPlayer::QAndroidMediaPlayer().

+ Here is the caller graph for this function:

◆ stop()

void AndroidMediaPlayer::stop ( )

Definition at line 199 of file androidmediaplayer.cpp.

Referenced by QAndroidMediaPlayer::stop().

+ Here is the caller graph for this function:

◆ stopSoundStreaming()

void AndroidMediaPlayer::stopSoundStreaming ( )
static

Definition at line 263 of file androidmediaplayer.cpp.

Referenced by QAndroidCaptureSession::~QAndroidCaptureSession().

+ Here is the caller graph for this function:

◆ timedTextChanged

void AndroidMediaPlayer::timedTextChanged ( QString text)
signal

Referenced by QAndroidMediaPlayer::setVideoSink().

+ Here is the caller graph for this function:

◆ tracksInfo()

QList< AndroidMediaPlayer::TrackInfo > AndroidMediaPlayer::tracksInfo ( )

Definition at line 139 of file androidmediaplayer.cpp.

References convertTrackInfo().

+ Here is the call graph for this function:

◆ tracksInfoChanged

void AndroidMediaPlayer::tracksInfoChanged ( )
signal

Referenced by QAndroidMediaPlayer::QAndroidMediaPlayer().

+ Here is the caller graph for this function:

◆ unblockAudio()

void AndroidMediaPlayer::unblockAudio ( )

Definition at line 250 of file androidmediaplayer.cpp.

Referenced by QAndroidMediaPlayer::setActiveTrack().

+ Here is the caller graph for this function:

◆ videoSizeChanged

void AndroidMediaPlayer::videoSizeChanged ( qint32 width,
qint32 height )
signal

Referenced by QAndroidMediaPlayer::QAndroidMediaPlayer().

+ Here is the caller graph for this function:

◆ volume()

int AndroidMediaPlayer::volume ( )

Definition at line 68 of file androidmediaplayer.cpp.

Referenced by setVolume().

+ Here is the caller graph for this function:

The documentation for this class was generated from the following files: