Music Hub  ..
A session-wide music playback service
gstreamer::Playbin Struct Reference

#include <playbin.h>

+ 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
}
 

Public Member Functions

 Playbin (const core::ubuntu::media::Player::PlayerKey key)
 
 ~Playbin ()
 
void reset ()
 
void reset_pipeline ()
 
void on_new_message (const Bus::Message &message)
 
void on_new_message_async (const Bus::Message &message)
 
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 (core::ubuntu::media::Player::Lifetime)
 
core::ubuntu::media::Player::Orientation orientation_lut (const gchar *orientation)
 
void set_audio_stream_role (core::ubuntu::media::Player::AudioStreamRole new_audio_role)
 
uint64_t position () const
 
uint64_t duration () const
 
void set_uri (const std::string &uri, const core::ubuntu::media::Player::HeadersType &headers, bool do_pipeline_reset=true)
 
std::string uri () const
 
void setup_source (GstElement *source)
 
bool set_state_and_wait (GstState new_state, bool use_main_thread=false)
 
bool seek (const std::chrono::microseconds &ms)
 
core::ubuntu::media::video::Dimensions get_video_dimensions () const
 
void emit_video_dimensions_changed_if_changed (const core::ubuntu::media::video::Dimensions &new_dimensions)
 
std::string file_info_from_uri (const std::string &uri) const
 
std::string encode_uri (const std::string &uri) const
 
std::string decode_uri (const std::string &uri) const
 
std::string get_file_content_type (const std::string &uri) const
 
bool is_audio_file (const std::string &uri) const
 
bool is_video_file (const std::string &uri) const
 
MediaFileType media_file_type () const
 
bool can_play_streams () const
 

Static Public Member Functions

static std::string get_audio_role_str (core::ubuntu::media::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 gboolean set_state_in_main_thread (gpointer user_data)
 

Public Attributes

GstElement * pipeline
 
gstreamer::Bus bus
 
MediaFileType file_type
 
GstElement * video_sink
 
GstElement * audio_sink
 
core::Connection on_new_message_connection_async
 
bool is_seeking
 
uint64_t previous_position
 
core::ubuntu::media::video::Dimensions cached_video_dimensions
 
core::ubuntu::media::Player::HeadersType request_headers
 
core::ubuntu::media::Player::Lifetime player_lifetime
 
gulong about_to_finish_handler_id
 
gulong source_setup_handler_id
 
struct {
   core::Signal< void >   about_to_finish
 
   core::Signal< Bus::Message::Detail::ErrorWarningInfo >   on_error
 
   core::Signal< Bus::Message::Detail::ErrorWarningInfo >   on_warning
 
   core::Signal< Bus::Message::Detail::ErrorWarningInfo >   on_info
 
   core::Signal< Bus::Message::Detail::Tag >   on_tag_available
 
   core::Signal< std::pair< Bus::Message::Detail::StateChanged, std::string > >   on_state_changed
 
   core::Signal< uint64_t >   on_seeked_to
 
   core::Signal< void >   on_end_of_stream
 
   core::Signal< core::ubuntu::media::Player::PlaybackStatus >   on_playback_status_changed
 
   core::Signal< core::ubuntu::media::Player::Orientation >   on_orientation_changed
 
   core::Signal< core::ubuntu::media::video::Dimensions >   on_video_dimensions_changed
 
   core::Signal< void >   client_disconnected
 
   core::Signal< int >   on_buffering_changed
 
signals
 
bool is_missing_audio_codec
 
bool is_missing_video_codec
 
gint audio_stream_id
 
gint video_stream_id
 
GstState current_new_state
 

Detailed Description

Definition at line 43 of file playbin.h.

Member Enumeration Documentation

◆ MediaFileType

Enumerator
MEDIA_FILE_TYPE_NONE 
MEDIA_FILE_TYPE_AUDIO 
MEDIA_FILE_TYPE_VIDEO 

Definition at line 52 of file playbin.h.

◆ PlayFlags

Enumerator
GST_PLAY_FLAG_VIDEO 
GST_PLAY_FLAG_AUDIO 
GST_PLAY_FLAG_TEXT 

Definition at line 45 of file playbin.h.

Constructor & Destructor Documentation

◆ Playbin()

◆ ~Playbin()

gstreamer::Playbin::~Playbin ( )

Definition at line 190 of file playbin.cpp.

References about_to_finish_handler_id, pipeline, and source_setup_handler_id.

Member Function Documentation

◆ about_to_finish()

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

◆ can_play_streams()

bool gstreamer::Playbin::can_play_streams ( ) const

◆ create_video_sink()

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

Definition at line 421 of file playbin.cpp.

References video_sink.

◆ decode_uri()

std::string gstreamer::Playbin::decode_uri ( const std::string &  uri) const

Definition at line 848 of file playbin.cpp.

Referenced by set_uri().

◆ duration()

uint64_t gstreamer::Playbin::duration ( ) const

Returns the current stream duration in nanoseconds

Definition at line 517 of file playbin.cpp.

References pipeline.

Referenced by position().

◆ emit_video_dimensions_changed_if_changed()

void gstreamer::Playbin::emit_video_dimensions_changed_if_changed ( const core::ubuntu::media::video::Dimensions new_dimensions)

Definition at line 735 of file playbin.cpp.

References cached_video_dimensions, and signals.

Referenced by set_state_and_wait().

◆ encode_uri()

std::string gstreamer::Playbin::encode_uri ( const std::string &  uri) const

Definition at line 782 of file playbin.cpp.

References MH_DEBUG, MH_WARNING, and uri().

Referenced by get_file_content_type(), and set_uri().

+ Here is the call graph for this function:

◆ file_info_from_uri()

std::string gstreamer::Playbin::file_info_from_uri ( const std::string &  uri) const

Definition at line 743 of file playbin.cpp.

Referenced by get_file_content_type().

◆ get_audio_role_str()

std::string gstreamer::Playbin::get_audio_role_str ( core::ubuntu::media::Player::AudioStreamRole  audio_role)
static

Translate the AudioStreamRole enum into a string

Definition at line 437 of file playbin.cpp.

Referenced by set_audio_stream_role().

◆ get_file_content_type()

std::string gstreamer::Playbin::get_file_content_type ( const std::string &  uri) const

Definition at line 862 of file playbin.cpp.

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

Referenced by is_audio_file(), and is_video_file().

+ Here is the call graph for this function:

◆ get_video_dimensions()

core::ubuntu::media::video::Dimensions gstreamer::Playbin::get_video_dimensions ( ) const

Definition at line 696 of file playbin.cpp.

References MH_DEBUG, and video_sink.

Referenced by set_state_and_wait().

◆ is_audio_file()

bool gstreamer::Playbin::is_audio_file ( const std::string &  uri) const

Definition at line 881 of file playbin.cpp.

References get_file_content_type(), and MH_INFO.

Referenced by set_uri().

+ Here is the call graph for this function:

◆ is_video_file()

bool gstreamer::Playbin::is_video_file ( const std::string &  uri) const

Definition at line 895 of file playbin.cpp.

References get_file_content_type(), and MH_INFO.

Referenced by set_uri().

+ Here is the call graph for this function:

◆ media_file_type()

gstreamer::Playbin::MediaFileType gstreamer::Playbin::media_file_type ( ) const

Definition at line 909 of file playbin.cpp.

References file_type.

◆ message_bus()

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

Definition at line 377 of file playbin.cpp.

References bus.

◆ on_new_message()

void gstreamer::Playbin::on_new_message ( const Bus::Message message)

◆ on_new_message_async()

◆ orientation_lut()

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

Definition at line 459 of file playbin.cpp.

Referenced by on_new_message_async().

◆ pipeline_name()

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

Definition at line 99 of file playbin.cpp.

References about_to_finish, and signals.

◆ position()

uint64_t gstreamer::Playbin::position ( ) const

Returns the current stream position in nanoseconds

Definition at line 497 of file playbin.cpp.

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

+ Here is the call graph for this function:

◆ process_message_element()

◆ reset()

void gstreamer::Playbin::reset ( )

Definition at line 212 of file playbin.cpp.

References MH_INFO, player_lifetime, reset_pipeline(), and signals.

+ Here is the call graph for this function:

◆ reset_pipeline()

void gstreamer::Playbin::reset_pipeline ( )

◆ seek()

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

Definition at line 686 of file playbin.cpp.

References is_seeking, and pipeline.

◆ set_audio_stream_role()

void gstreamer::Playbin::set_audio_stream_role ( core::ubuntu::media::Player::AudioStreamRole  new_audio_role)

Sets the new audio stream role on the pulsesink in playbin

Definition at line 474 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 ( core::ubuntu::media::Player::Lifetime  )

Definition at line 492 of file playbin.cpp.

References player_lifetime.

◆ set_state_and_wait()

bool gstreamer::Playbin::set_state_and_wait ( GstState  new_state,
bool  use_main_thread = false 
)

◆ set_state_in_main_thread()

gboolean gstreamer::Playbin::set_state_in_main_thread ( gpointer  user_data)
static

Definition at line 597 of file playbin.cpp.

References MH_TRACE.

Referenced by set_state_and_wait().

◆ set_uri()

void gstreamer::Playbin::set_uri ( const std::string &  uri,
const core::ubuntu::media::Player::HeadersType headers = core::ubuntu::media::Player::HeadersType(),
bool  do_pipeline_reset = true 
)

◆ set_volume()

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

Definition at line 431 of file playbin.cpp.

References pipeline.

◆ setup_pipeline_for_audio_video()

void gstreamer::Playbin::setup_pipeline_for_audio_video ( )

Definition at line 382 of file playbin.cpp.

References GST_PLAY_FLAG_AUDIO, GST_PLAY_FLAG_TEXT, GST_PLAY_FLAG_VIDEO, and pipeline.

Referenced by Playbin().

◆ setup_source()

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

Definition at line 564 of file playbin.cpp.

References request_headers.

◆ source_setup()

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

Definition at line 111 of file playbin.cpp.

Referenced by Playbin().

◆ uri()

std::string gstreamer::Playbin::uri ( ) const

Definition at line 586 of file playbin.cpp.

References pipeline.

Referenced by encode_uri(), and set_uri().

Member Data Documentation

◆ about_to_finish

void gstreamer::Playbin::about_to_finish

Definition at line 141 of file playbin.h.

Referenced by pipeline_name(), and Playbin().

◆ about_to_finish_handler_id

gulong gstreamer::Playbin::about_to_finish_handler_id

Definition at line 137 of file playbin.h.

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

◆ audio_sink

GstElement* gstreamer::Playbin::audio_sink

Definition at line 130 of file playbin.h.

Referenced by Playbin(), and set_audio_stream_role().

◆ audio_stream_id

gint gstreamer::Playbin::audio_stream_id

Definition at line 157 of file playbin.h.

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

◆ bus

gstreamer::Bus gstreamer::Playbin::bus

Definition at line 127 of file playbin.h.

Referenced by message_bus(), and Playbin().

◆ cached_video_dimensions

core::ubuntu::media::video::Dimensions gstreamer::Playbin::cached_video_dimensions

◆ client_disconnected

core::Signal<void> gstreamer::Playbin::client_disconnected

Definition at line 152 of file playbin.h.

◆ current_new_state

GstState gstreamer::Playbin::current_new_state

Definition at line 159 of file playbin.h.

Referenced by Playbin(), and set_state_and_wait().

◆ file_type

MediaFileType gstreamer::Playbin::file_type

Definition at line 128 of file playbin.h.

Referenced by media_file_type(), Playbin(), reset_pipeline(), and set_uri().

◆ is_missing_audio_codec

bool gstreamer::Playbin::is_missing_audio_codec

Definition at line 155 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 156 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_async(), Playbin(), position(), and seek().

◆ on_buffering_changed

core::Signal<int> gstreamer::Playbin::on_buffering_changed

Definition at line 153 of file playbin.h.

◆ on_end_of_stream

core::Signal<void> gstreamer::Playbin::on_end_of_stream

Definition at line 148 of file playbin.h.

◆ on_error

core::Signal<Bus::Message::Detail::ErrorWarningInfo> gstreamer::Playbin::on_error

Definition at line 142 of file playbin.h.

◆ on_info

core::Signal<Bus::Message::Detail::ErrorWarningInfo> gstreamer::Playbin::on_info

Definition at line 144 of file playbin.h.

◆ on_new_message_connection_async

core::Connection gstreamer::Playbin::on_new_message_connection_async

Definition at line 131 of file playbin.h.

Referenced by Playbin().

◆ on_orientation_changed

core::Signal<core::ubuntu::media::Player::Orientation> gstreamer::Playbin::on_orientation_changed

Definition at line 150 of file playbin.h.

◆ on_playback_status_changed

core::Signal<core::ubuntu::media::Player::PlaybackStatus> gstreamer::Playbin::on_playback_status_changed

Definition at line 149 of file playbin.h.

◆ on_seeked_to

core::Signal<uint64_t> gstreamer::Playbin::on_seeked_to

Definition at line 147 of file playbin.h.

◆ on_state_changed

core::Signal<std::pair<Bus::Message::Detail::StateChanged,std::string> > gstreamer::Playbin::on_state_changed

Definition at line 146 of file playbin.h.

◆ on_tag_available

core::Signal<Bus::Message::Detail::Tag> gstreamer::Playbin::on_tag_available

Definition at line 145 of file playbin.h.

◆ on_video_dimensions_changed

core::Signal<core::ubuntu::media::video::Dimensions> gstreamer::Playbin::on_video_dimensions_changed

Definition at line 151 of file playbin.h.

◆ on_warning

core::Signal<Bus::Message::Detail::ErrorWarningInfo> gstreamer::Playbin::on_warning

Definition at line 143 of file playbin.h.

◆ pipeline

◆ player_lifetime

core::ubuntu::media::Player::Lifetime gstreamer::Playbin::player_lifetime

Definition at line 136 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

core::ubuntu::media::Player::HeadersType gstreamer::Playbin::request_headers

Definition at line 135 of file playbin.h.

Referenced by set_uri(), and setup_source().

◆ signals

struct { ... } gstreamer::Playbin::signals

◆ source_setup_handler_id

gulong gstreamer::Playbin::source_setup_handler_id

Definition at line 138 of file playbin.h.

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

◆ video_sink

GstElement* gstreamer::Playbin::video_sink

Definition at line 129 of file playbin.h.

Referenced by create_video_sink(), get_video_dimensions(), and Playbin().

◆ video_stream_id

gint gstreamer::Playbin::video_stream_id

Definition at line 158 of file playbin.h.

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


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