Music Hub  ..
A session-wide music playback service
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()

gstreamer::Playbin::Playbin ( const lomiri::MediaHubService::Player::PlayerKey  key)

Definition at line 137 of file playbin.cpp.

References pipeline.

◆ ~Playbin()

gstreamer::Playbin::~Playbin ( )

Definition at line 209 of file playbin.cpp.

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 aboutToFinish().

◆ aboutToFinish

void gstreamer::Playbin::aboutToFinish ( )
signal

Referenced by about_to_finish().

◆ bufferingChanged

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

◆ can_play_streams()

bool gstreamer::Playbin::can_play_streams ( ) const

Definition at line 817 of file playbin.cpp.

◆ 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.

◆ duration()

uint64_t gstreamer::Playbin::duration ( ) const

Returns the current stream duration in nanoseconds

Definition at line 576 of file playbin.cpp.

◆ 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.

◆ get_audio_role_str()

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

Translate the AudioStreamRole enum into a string

Definition at line 496 of file playbin.cpp.

◆ get_file_content_type()

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

Definition at line 761 of file playbin.cpp.

References MH_INFO, and MH_WARNING.

◆ get_video_dimensions()

QSize gstreamer::Playbin::get_video_dimensions ( ) const

Definition at line 720 of file playbin.cpp.

References MH_DEBUG.

◆ 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 MH_INFO.

◆ is_video_file()

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

Definition at line 798 of file playbin.cpp.

References MH_INFO.

◆ mediaFileType()

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

Definition at line 812 of file playbin.cpp.

◆ mediaFileTypeChanged

void gstreamer::Playbin::mediaFileTypeChanged ( )
signal

◆ message_bus()

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

Definition at line 432 of file playbin.cpp.

◆ on_new_message()

◆ orientation_lut()

media::Player::Orientation gstreamer::Playbin::orientation_lut ( const gchar *  orientation)

Definition at line 518 of file playbin.cpp.

◆ 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.

◆ position()

uint64_t gstreamer::Playbin::position ( ) const

Returns the current stream position in nanoseconds

Definition at line 556 of file playbin.cpp.

◆ process_message_element()

◆ processVideoSinkStateChanged()

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

◆ reset()

void gstreamer::Playbin::reset ( )

Definition at line 233 of file playbin.cpp.

References MH_INFO.

◆ reset_pipeline()

void gstreamer::Playbin::reset_pipeline ( )

Definition at line 246 of file playbin.cpp.

References MH_TRACE, and MH_WARNING.

◆ seek()

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

Definition at line 710 of file playbin.cpp.

◆ 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 MH_INFO, and MH_WARNING.

◆ set_lifetime()

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

Definition at line 551 of file playbin.cpp.

◆ set_state()

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

Definition at line 690 of file playbin.cpp.

References MH_DEBUG.

◆ 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.

◆ set_volume()

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

Definition at line 490 of file playbin.cpp.

◆ setMediaFileType()

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

Definition at line 927 of file playbin.cpp.

◆ setup_pipeline_for_audio_video()

void gstreamer::Playbin::setup_pipeline_for_audio_video ( )

Definition at line 437 of file playbin.cpp.

◆ setup_source()

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

Definition at line 618 of file playbin.cpp.

◆ source_setup()

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

Definition at line 117 of file playbin.cpp.

◆ 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.

◆ 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 MH_DEBUG.

◆ uri()

QUrl gstreamer::Playbin::uri ( ) const

Definition at line 679 of file playbin.cpp.

◆ 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.

◆ audio_sink

GstElement* gstreamer::Playbin::audio_sink

Definition at line 131 of file playbin.h.

◆ audio_stream_id

gint gstreamer::Playbin::audio_stream_id

Definition at line 142 of file playbin.h.

◆ bus

gstreamer::Bus gstreamer::Playbin::bus

Definition at line 128 of file playbin.h.

◆ current_new_state

GstState gstreamer::Playbin::current_new_state

Definition at line 144 of file playbin.h.

◆ is_missing_audio_codec

bool gstreamer::Playbin::is_missing_audio_codec

Definition at line 140 of file playbin.h.

◆ is_missing_video_codec

bool gstreamer::Playbin::is_missing_video_codec

Definition at line 141 of file playbin.h.

◆ is_seeking

bool gstreamer::Playbin::is_seeking

Definition at line 132 of file playbin.h.

◆ m_audioChangedHandlerId

gulong gstreamer::Playbin::m_audioChangedHandlerId

Definition at line 138 of file playbin.h.

◆ m_fileType

MediaFileType gstreamer::Playbin::m_fileType

Definition at line 129 of file playbin.h.

◆ m_videoChangedHandlerId

gulong gstreamer::Playbin::m_videoChangedHandlerId

Definition at line 139 of file playbin.h.

◆ pipeline

GstElement* gstreamer::Playbin::pipeline

Definition at line 127 of file playbin.h.

Referenced by Playbin().

◆ player_lifetime

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

Definition at line 135 of file playbin.h.

◆ previous_position

uint64_t gstreamer::Playbin::previous_position
mutable

Definition at line 133 of file playbin.h.

◆ request_headers

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

Definition at line 134 of file playbin.h.

◆ source_setup_handler_id

gulong gstreamer::Playbin::source_setup_handler_id

Definition at line 137 of file playbin.h.

◆ video_sink

GstElement* gstreamer::Playbin::video_sink

Definition at line 130 of file playbin.h.

◆ video_stream_id

gint gstreamer::Playbin::video_stream_id

Definition at line 143 of file playbin.h.


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