Music Hub ..
A session-wide music playback service
Loading...
Searching...
No Matches
gstreamer::Playbin Class Reference

#include <playbin.h>

Inheritance diagram for gstreamer::Playbin:
Collaboration diagram for gstreamer::Playbin:

Public Types

enum  PlayFlags {
  GST_PLAY_FLAG_VIDEO = (1 << 0) ,
  GST_PLAY_FLAG_AUDIO = (1 << 1) ,
  GST_PLAY_FLAG_TEXT = (1 << 2)
}
enum  MediaFileType {
  MEDIA_FILE_TYPE_NONE ,
  MEDIA_FILE_TYPE_AUDIO ,
  MEDIA_FILE_TYPE_VIDEO
}

Signals

void errorOccurred (const Bus::Message::Detail::ErrorWarningInfo &)
void warningOccurred (const Bus::Message::Detail::ErrorWarningInfo &)
void infoOccurred (const Bus::Message::Detail::ErrorWarningInfo &)
void aboutToFinish ()
void seekedTo (uint64_t offset)
void stateChanged (const Bus::Message::Detail::StateChanged &state, const QByteArray &source)
void mediaFileTypeChanged ()
void tagAvailable (Bus::Message::Detail::Tag tag)
void orientationChanged (lomiri::MediaHubService::Player::Orientation o)
void videoDimensionChanged (const QSize &size)
void bufferingChanged (int progress)
void clientDisconnected ()
void endOfStream ()

Public Member Functions

 Playbin (const lomiri::MediaHubService::Player::PlayerKey key)
 ~Playbin ()
void reset ()
void reset_pipeline ()
void on_new_message (const Bus::Message &message)
void processVideoSinkStateChanged (const Bus::Message::Detail::StateChanged &state)
void process_message_element (GstMessage *message)
gstreamer::Busmessage_bus ()
void setup_pipeline_for_audio_video ()
void create_video_sink (uint32_t texture_id)
void set_volume (double new_volume)
void set_lifetime (lomiri::MediaHubService::Player::Lifetime)
lomiri::MediaHubService::Player::Orientation orientation_lut (const gchar *orientation)
void set_audio_stream_role (lomiri::MediaHubService::Player::AudioStreamRole new_audio_role)
uint64_t position () const
uint64_t duration () const
void set_uri (const QUrl &uri, const lomiri::MediaHubService::Player::HeadersType &headers, bool do_pipeline_reset=true)
QUrl uri () const
void setup_source (GstElement *source)
void updateMediaFileType ()
bool set_state (GstState new_state)
bool seek (const std::chrono::microseconds &ms)
QSize get_video_dimensions () const
QString file_info_from_uri (const QUrl &uri) const
QString get_file_content_type (const QUrl &uri) const
bool is_audio_file (const QUrl &uri) const
bool is_video_file (const QUrl &uri) const
MediaFileType mediaFileType () const
bool can_play_streams () const

Static Public Member Functions

static std::string get_audio_role_str (lomiri::MediaHubService::Player::AudioStreamRole audio_role)
static const std::string & pipeline_name ()
static void about_to_finish (GstElement *, gpointer user_data)
static void source_setup (GstElement *, GstElement *source, gpointer user_data)
static void streams_changed (GstElement *, gpointer user_data)

Public Attributes

GstElement * pipeline
gstreamer::Bus bus
MediaFileType m_fileType
GstElement * video_sink
GstElement * audio_sink
bool is_seeking
uint64_t previous_position
lomiri::MediaHubService::Player::HeadersType request_headers
lomiri::MediaHubService::Player::Lifetime player_lifetime
gulong about_to_finish_handler_id
gulong source_setup_handler_id
gulong m_audioChangedHandlerId
gulong m_videoChangedHandlerId
bool is_missing_audio_codec
bool is_missing_video_codec
gint audio_stream_id
gint video_stream_id
GstState current_new_state

Protected Member Functions

void setMediaFileType (MediaFileType fileType)

Detailed Description

Definition at line 46 of file playbin.h.

Member Enumeration Documentation

◆ MediaFileType

Enumerator
MEDIA_FILE_TYPE_NONE 
MEDIA_FILE_TYPE_AUDIO 
MEDIA_FILE_TYPE_VIDEO 

Definition at line 58 of file playbin.h.

◆ PlayFlags

Enumerator
GST_PLAY_FLAG_VIDEO 
GST_PLAY_FLAG_AUDIO 
GST_PLAY_FLAG_TEXT 

Definition at line 51 of file playbin.h.

Constructor & Destructor Documentation

◆ Playbin()

◆ ~Playbin()

gstreamer::Playbin::~Playbin ( )

Member Function Documentation

◆ about_to_finish()

void gstreamer::Playbin::about_to_finish ( GstElement * ,
gpointer user_data )
static

Definition at line 111 of file playbin.cpp.

References Playbin().

Referenced by Playbin().

Here is the call graph for this function:

◆ aboutToFinish

void gstreamer::Playbin::aboutToFinish ( )
signal

◆ bufferingChanged

void gstreamer::Playbin::bufferingChanged ( int progress)
signal

◆ can_play_streams()

bool gstreamer::Playbin::can_play_streams ( ) const

◆ clientDisconnected

void gstreamer::Playbin::clientDisconnected ( )
signal

◆ create_video_sink()

void gstreamer::Playbin::create_video_sink ( uint32_t texture_id)

Definition at line 480 of file playbin.cpp.

References video_sink.

◆ duration()

uint64_t gstreamer::Playbin::duration ( ) const

Returns the current stream duration in nanoseconds

Definition at line 576 of file playbin.cpp.

References pipeline.

Referenced by position().

◆ endOfStream

void gstreamer::Playbin::endOfStream ( )
signal

◆ errorOccurred

void gstreamer::Playbin::errorOccurred ( const Bus::Message::Detail::ErrorWarningInfo & )
signal

◆ file_info_from_uri()

QString gstreamer::Playbin::file_info_from_uri ( const QUrl & uri) const

Definition at line 755 of file playbin.cpp.

References uri().

Referenced by get_file_content_type().

Here is the call graph for this function:

◆ get_audio_role_str()

std::string gstreamer::Playbin::get_audio_role_str ( lomiri::MediaHubService::Player::AudioStreamRole audio_role)
static

◆ get_file_content_type()

QString gstreamer::Playbin::get_file_content_type ( const QUrl & uri) const

Definition at line 761 of file playbin.cpp.

References file_info_from_uri(), MH_INFO, MH_WARNING, and uri().

Referenced by is_audio_file(), and is_video_file().

Here is the call graph for this function:

◆ get_video_dimensions()

QSize gstreamer::Playbin::get_video_dimensions ( ) const

Definition at line 720 of file playbin.cpp.

References MH_DEBUG, and video_sink.

Referenced by processVideoSinkStateChanged().

◆ infoOccurred

void gstreamer::Playbin::infoOccurred ( const Bus::Message::Detail::ErrorWarningInfo & )
signal

◆ is_audio_file()

bool gstreamer::Playbin::is_audio_file ( const QUrl & uri) const

Definition at line 784 of file playbin.cpp.

References get_file_content_type(), MH_INFO, and uri().

Referenced by set_uri().

Here is the call graph for this function:

◆ is_video_file()

bool gstreamer::Playbin::is_video_file ( const QUrl & uri) const

Definition at line 798 of file playbin.cpp.

References get_file_content_type(), MH_INFO, and uri().

Referenced by set_uri().

Here is the call graph for this function:

◆ mediaFileType()

gstreamer::Playbin::MediaFileType gstreamer::Playbin::mediaFileType ( ) const

Definition at line 812 of file playbin.cpp.

References m_fileType.

◆ mediaFileTypeChanged

void gstreamer::Playbin::mediaFileTypeChanged ( )
signal

◆ message_bus()

gstreamer::Bus & gstreamer::Playbin::message_bus ( )

Definition at line 432 of file playbin.cpp.

References bus.

◆ on_new_message()

◆ orientation_lut()

◆ orientationChanged

void gstreamer::Playbin::orientationChanged ( lomiri::MediaHubService::Player::Orientation o)
signal

◆ pipeline_name()

const std::string & gstreamer::Playbin::pipeline_name ( )
static

Definition at line 105 of file playbin.cpp.

Referenced by Playbin().

◆ position()

uint64_t gstreamer::Playbin::position ( ) const

Returns the current stream position in nanoseconds

Definition at line 556 of file playbin.cpp.

References duration(), is_seeking, pipeline, and previous_position.

Here is the call graph for this function:

◆ process_message_element()

◆ processVideoSinkStateChanged()

void gstreamer::Playbin::processVideoSinkStateChanged ( const Bus::Message::Detail::StateChanged & state)

Definition at line 304 of file playbin.cpp.

References get_video_dimensions(), MH_WARNING, gstreamer::Bus::Message::Detail::StateChanged::new_state, and videoDimensionChanged().

Referenced by on_new_message().

Here is the call graph for this function:

◆ reset()

void gstreamer::Playbin::reset ( )

Definition at line 233 of file playbin.cpp.

References MH_INFO, player_lifetime, reset_pipeline(), and lomiri::MediaHubService::Player::resumable.

Here is the call graph for this function:

◆ reset_pipeline()

void gstreamer::Playbin::reset_pipeline ( )

Definition at line 246 of file playbin.cpp.

References audio_stream_id, is_missing_audio_codec, is_missing_video_codec, MEDIA_FILE_TYPE_NONE, MH_TRACE, MH_WARNING, pipeline, setMediaFileType(), and video_stream_id.

Referenced by reset(), and set_uri().

Here is the call graph for this function:

◆ seek()

bool gstreamer::Playbin::seek ( const std::chrono::microseconds & ms)

Definition at line 710 of file playbin.cpp.

References is_seeking, and pipeline.

◆ seekedTo

void gstreamer::Playbin::seekedTo ( uint64_t offset)
signal

◆ set_audio_stream_role()

void gstreamer::Playbin::set_audio_stream_role ( lomiri::MediaHubService::Player::AudioStreamRole new_audio_role)

Sets the new audio stream role on the pulsesink in playbin

Definition at line 533 of file playbin.cpp.

References audio_sink, get_audio_role_str(), MH_INFO, and MH_WARNING.

Here is the call graph for this function:

◆ set_lifetime()

void gstreamer::Playbin::set_lifetime ( lomiri::MediaHubService::Player::Lifetime lifetime)

Definition at line 551 of file playbin.cpp.

References player_lifetime.

◆ set_state()

bool gstreamer::Playbin::set_state ( GstState new_state)

Definition at line 690 of file playbin.cpp.

References MH_DEBUG, and pipeline.

◆ set_uri()

void gstreamer::Playbin::set_uri ( const QUrl & uri,
const lomiri::MediaHubService::Player::HeadersType & headers,
bool do_pipeline_reset = true )

Definition at line 585 of file playbin.cpp.

References is_audio_file(), is_video_file(), MEDIA_FILE_TYPE_AUDIO, MEDIA_FILE_TYPE_VIDEO, pipeline, request_headers, reset_pipeline(), setMediaFileType(), and uri().

Here is the call graph for this function:

◆ set_volume()

void gstreamer::Playbin::set_volume ( double new_volume)

Definition at line 490 of file playbin.cpp.

References pipeline.

◆ setMediaFileType()

void gstreamer::Playbin::setMediaFileType ( MediaFileType fileType)
protected

Definition at line 927 of file playbin.cpp.

References m_fileType, and mediaFileTypeChanged().

Referenced by reset_pipeline(), set_uri(), and updateMediaFileType().

Here is the call graph for this function:

◆ setup_pipeline_for_audio_video()

void gstreamer::Playbin::setup_pipeline_for_audio_video ( )

◆ setup_source()

void gstreamer::Playbin::setup_source ( GstElement * source)

Definition at line 618 of file playbin.cpp.

References request_headers.

Referenced by source_setup().

◆ source_setup()

void gstreamer::Playbin::source_setup ( GstElement * ,
GstElement * source,
gpointer user_data )
static

Definition at line 117 of file playbin.cpp.

References Playbin(), and setup_source().

Referenced by Playbin().

Here is the call graph for this function:

◆ stateChanged

void gstreamer::Playbin::stateChanged ( const Bus::Message::Detail::StateChanged & state,
const QByteArray & source )
signal

◆ streams_changed()

void gstreamer::Playbin::streams_changed ( GstElement * pipeline,
gpointer user_data )
static

Definition at line 127 of file playbin.cpp.

References pipeline.

Referenced by Playbin().

◆ tagAvailable

void gstreamer::Playbin::tagAvailable ( Bus::Message::Detail::Tag tag)
signal

◆ updateMediaFileType()

void gstreamer::Playbin::updateMediaFileType ( )

Definition at line 665 of file playbin.cpp.

References MEDIA_FILE_TYPE_AUDIO, MEDIA_FILE_TYPE_VIDEO, MH_DEBUG, pipeline, and setMediaFileType().

Referenced by process_message_element().

Here is the call graph for this function:

◆ uri()

QUrl gstreamer::Playbin::uri ( ) const

Definition at line 679 of file playbin.cpp.

References pipeline.

Referenced by file_info_from_uri(), get_file_content_type(), is_audio_file(), is_video_file(), and set_uri().

◆ videoDimensionChanged

void gstreamer::Playbin::videoDimensionChanged ( const QSize & size)
signal

◆ warningOccurred

void gstreamer::Playbin::warningOccurred ( const Bus::Message::Detail::ErrorWarningInfo & )
signal

Member Data Documentation

◆ about_to_finish_handler_id

gulong gstreamer::Playbin::about_to_finish_handler_id

Definition at line 136 of file playbin.h.

Referenced by Playbin(), and ~Playbin().

◆ audio_sink

GstElement* gstreamer::Playbin::audio_sink

Definition at line 131 of file playbin.h.

Referenced by Playbin(), set_audio_stream_role(), and setup_pipeline_for_audio_video().

◆ audio_stream_id

gint gstreamer::Playbin::audio_stream_id

Definition at line 142 of file playbin.h.

Referenced by can_play_streams(), on_new_message(), Playbin(), and reset_pipeline().

◆ bus

gstreamer::Bus gstreamer::Playbin::bus

Definition at line 128 of file playbin.h.

Referenced by message_bus(), and Playbin().

◆ current_new_state

GstState gstreamer::Playbin::current_new_state

Definition at line 144 of file playbin.h.

Referenced by Playbin().

◆ is_missing_audio_codec

bool gstreamer::Playbin::is_missing_audio_codec

Definition at line 140 of file playbin.h.

Referenced by can_play_streams(), Playbin(), and reset_pipeline().

◆ is_missing_video_codec

bool gstreamer::Playbin::is_missing_video_codec

Definition at line 141 of file playbin.h.

Referenced by can_play_streams(), Playbin(), and reset_pipeline().

◆ is_seeking

bool gstreamer::Playbin::is_seeking

Definition at line 132 of file playbin.h.

Referenced by on_new_message(), Playbin(), position(), and seek().

◆ m_audioChangedHandlerId

gulong gstreamer::Playbin::m_audioChangedHandlerId

Definition at line 138 of file playbin.h.

Referenced by Playbin(), and ~Playbin().

◆ m_fileType

MediaFileType gstreamer::Playbin::m_fileType

Definition at line 129 of file playbin.h.

Referenced by mediaFileType(), Playbin(), and setMediaFileType().

◆ m_videoChangedHandlerId

gulong gstreamer::Playbin::m_videoChangedHandlerId

Definition at line 139 of file playbin.h.

Referenced by Playbin(), and ~Playbin().

◆ pipeline

◆ player_lifetime

lomiri::MediaHubService::Player::Lifetime gstreamer::Playbin::player_lifetime

Definition at line 135 of file playbin.h.

Referenced by Playbin(), reset(), and set_lifetime().

◆ previous_position

uint64_t gstreamer::Playbin::previous_position
mutable

Definition at line 133 of file playbin.h.

Referenced by Playbin(), and position().

◆ request_headers

lomiri::MediaHubService::Player::HeadersType gstreamer::Playbin::request_headers

Definition at line 134 of file playbin.h.

Referenced by set_uri(), and setup_source().

◆ source_setup_handler_id

gulong gstreamer::Playbin::source_setup_handler_id

Definition at line 137 of file playbin.h.

Referenced by Playbin(), and ~Playbin().

◆ video_sink

GstElement* gstreamer::Playbin::video_sink

◆ video_stream_id

gint gstreamer::Playbin::video_stream_id

Definition at line 143 of file playbin.h.

Referenced by can_play_streams(), on_new_message(), Playbin(), and reset_pipeline().


The documentation for this class was generated from the following files:
  • /build/media-hub-4.7~20260316060616.27~fbd9644+ubports26.04.1/src/service/gstreamer/playbin.h
  • /build/media-hub-4.7~20260316060616.27~fbd9644+ubports26.04.1/src/service/gstreamer/playbin.cpp