#include <playbin.h>
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::Bus & | message_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) |
gstreamer::Playbin::Playbin | ( | const core::ubuntu::media::Player::PlayerKey | key | ) |
Definition at line 121 of file playbin.cpp.
References about_to_finish, about_to_finish_handler_id, audio_sink, audio_stream_id, bus, cached_video_dimensions, current_new_state, file_type, core::ubuntu::media::AVBackend::get_backend_type(), is_missing_audio_codec, is_missing_video_codec, is_seeking, MEDIA_FILE_TYPE_NONE, MH_DEBUG, on_new_message_async(), gstreamer::Bus::on_new_message_async, on_new_message_connection_async, pipeline, player_lifetime, previous_position, setup_pipeline_for_audio_video(), source_setup(), source_setup_handler_id, video_sink, and video_stream_id.
gstreamer::Playbin::~Playbin | ( | ) |
Definition at line 190 of file playbin.cpp.
References about_to_finish_handler_id, pipeline, and source_setup_handler_id.
|
static |
bool gstreamer::Playbin::can_play_streams | ( | ) | const |
Definition at line 914 of file playbin.cpp.
References audio_stream_id, is_missing_audio_codec, is_missing_video_codec, MH_DEBUG, MH_ERROR, and video_stream_id.
void gstreamer::Playbin::create_video_sink | ( | uint32_t | texture_id | ) |
Definition at line 421 of file playbin.cpp.
References video_sink.
std::string gstreamer::Playbin::decode_uri | ( | const std::string & | uri | ) | const |
Definition at line 848 of file playbin.cpp.
Referenced by set_uri().
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().
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().
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().
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().
|
static |
Translate the AudioStreamRole enum into a string
Definition at line 437 of file playbin.cpp.
Referenced by set_audio_stream_role().
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().
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().
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().
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().
gstreamer::Playbin::MediaFileType gstreamer::Playbin::media_file_type | ( | ) | const |
Definition at line 909 of file playbin.cpp.
References file_type.
gstreamer::Bus & gstreamer::Playbin::message_bus | ( | ) |
Definition at line 377 of file playbin.cpp.
References bus.
void gstreamer::Playbin::on_new_message | ( | const Bus::Message & | message | ) |
void gstreamer::Playbin::on_new_message_async | ( | const Bus::Message & | message | ) |
Definition at line 319 of file playbin.cpp.
References audio_stream_id, gstreamer::Bus::Message::Detail::buffering, gstreamer::Bus::Message::detail, gstreamer::Bus::Message::Detail::error_warning_info, is_seeking, gstreamer::Bus::Message::message, orientation_lut(), gstreamer::Bus::Message::Detail::percent, pipeline, process_message_element(), signals, gstreamer::Bus::Message::source, gstreamer::Bus::Message::Detail::state_changed, gstreamer::Bus::Message::Detail::tag, gstreamer::Bus::Message::Detail::Tag::tag_list, gstreamer::Bus::Message::type, and video_stream_id.
Referenced by Playbin().
media::Player::Orientation gstreamer::Playbin::orientation_lut | ( | const gchar * | orientation | ) |
Definition at line 459 of file playbin.cpp.
Referenced by on_new_message_async().
|
static |
Definition at line 99 of file playbin.cpp.
References about_to_finish, and signals.
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.
void gstreamer::Playbin::process_message_element | ( | GstMessage * | message | ) |
Definition at line 285 of file playbin.cpp.
References core::ubuntu::media::video::BufferMetadata::fourcc, core::ubuntu::media::video::BufferMetadata::height, MH_DEBUG, MH_ERROR, core::ubuntu::media::video::BufferMetadata::offset, core::ubuntu::media::video::BufferMetadata::stride, and core::ubuntu::media::video::BufferMetadata::width.
Referenced by on_new_message_async().
void gstreamer::Playbin::reset | ( | ) |
Definition at line 212 of file playbin.cpp.
References MH_INFO, player_lifetime, reset_pipeline(), and signals.
void gstreamer::Playbin::reset_pipeline | ( | ) |
Definition at line 227 of file playbin.cpp.
References audio_stream_id, file_type, is_missing_audio_codec, is_missing_video_codec, MEDIA_FILE_TYPE_NONE, MH_ERROR, MH_TRACE, MH_WARNING, pipeline, and video_stream_id.
bool gstreamer::Playbin::seek | ( | const std::chrono::microseconds & | ms | ) |
Definition at line 686 of file playbin.cpp.
References is_seeking, and pipeline.
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.
void gstreamer::Playbin::set_lifetime | ( | core::ubuntu::media::Player::Lifetime | ) |
Definition at line 492 of file playbin.cpp.
References player_lifetime.
bool gstreamer::Playbin::set_state_and_wait | ( | GstState | new_state, |
bool | use_main_thread = false |
||
) |
Definition at line 607 of file playbin.cpp.
References cached_video_dimensions, current_new_state, emit_video_dimensions_changed_if_changed(), get_video_dimensions(), MH_DEBUG, MH_WARNING, pipeline, and set_state_in_main_thread().
|
static |
Definition at line 597 of file playbin.cpp.
References MH_TRACE.
Referenced by set_state_and_wait().
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 |
||
) |
Definition at line 526 of file playbin.cpp.
References decode_uri(), encode_uri(), file_type, is_audio_file(), is_video_file(), MEDIA_FILE_TYPE_AUDIO, MEDIA_FILE_TYPE_VIDEO, MH_DEBUG, pipeline, request_headers, reset_pipeline(), and uri().
void gstreamer::Playbin::set_volume | ( | double | new_volume | ) |
Definition at line 431 of file playbin.cpp.
References pipeline.
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().
void gstreamer::Playbin::setup_source | ( | GstElement * | source | ) |
Definition at line 564 of file playbin.cpp.
References request_headers.
|
static |
Definition at line 111 of file playbin.cpp.
Referenced by Playbin().
std::string gstreamer::Playbin::uri | ( | ) | const |
Definition at line 586 of file playbin.cpp.
References pipeline.
Referenced by encode_uri(), and set_uri().
void gstreamer::Playbin::about_to_finish |
Definition at line 141 of file playbin.h.
Referenced by pipeline_name(), and Playbin().
gulong gstreamer::Playbin::about_to_finish_handler_id |
Definition at line 137 of file playbin.h.
Referenced by Playbin(), and ~Playbin().
GstElement* gstreamer::Playbin::audio_sink |
Definition at line 130 of file playbin.h.
Referenced by Playbin(), and set_audio_stream_role().
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().
gstreamer::Bus gstreamer::Playbin::bus |
Definition at line 127 of file playbin.h.
Referenced by message_bus(), and Playbin().
core::ubuntu::media::video::Dimensions gstreamer::Playbin::cached_video_dimensions |
Definition at line 134 of file playbin.h.
Referenced by emit_video_dimensions_changed_if_changed(), Playbin(), and set_state_and_wait().
core::Signal<void> gstreamer::Playbin::client_disconnected |
GstState gstreamer::Playbin::current_new_state |
Definition at line 159 of file playbin.h.
Referenced by Playbin(), and set_state_and_wait().
MediaFileType gstreamer::Playbin::file_type |
Definition at line 128 of file playbin.h.
Referenced by media_file_type(), Playbin(), reset_pipeline(), and set_uri().
bool gstreamer::Playbin::is_missing_audio_codec |
Definition at line 155 of file playbin.h.
Referenced by can_play_streams(), Playbin(), and reset_pipeline().
bool gstreamer::Playbin::is_missing_video_codec |
Definition at line 156 of file playbin.h.
Referenced by can_play_streams(), Playbin(), and reset_pipeline().
bool gstreamer::Playbin::is_seeking |
Definition at line 132 of file playbin.h.
Referenced by on_new_message_async(), Playbin(), position(), and seek().
core::Signal<int> gstreamer::Playbin::on_buffering_changed |
core::Signal<Bus::Message::Detail::ErrorWarningInfo> gstreamer::Playbin::on_error |
core::Signal<Bus::Message::Detail::ErrorWarningInfo> gstreamer::Playbin::on_info |
core::Connection gstreamer::Playbin::on_new_message_connection_async |
core::Signal<core::ubuntu::media::Player::Orientation> gstreamer::Playbin::on_orientation_changed |
core::Signal<core::ubuntu::media::Player::PlaybackStatus> gstreamer::Playbin::on_playback_status_changed |
core::Signal<std::pair<Bus::Message::Detail::StateChanged,std::string> > gstreamer::Playbin::on_state_changed |
core::Signal<Bus::Message::Detail::Tag> gstreamer::Playbin::on_tag_available |
core::Signal<core::ubuntu::media::video::Dimensions> gstreamer::Playbin::on_video_dimensions_changed |
core::Signal<Bus::Message::Detail::ErrorWarningInfo> gstreamer::Playbin::on_warning |
GstElement* gstreamer::Playbin::pipeline |
Definition at line 126 of file playbin.h.
Referenced by duration(), on_new_message_async(), Playbin(), position(), reset_pipeline(), seek(), set_state_and_wait(), set_uri(), set_volume(), setup_pipeline_for_audio_video(), uri(), and ~Playbin().
core::ubuntu::media::Player::Lifetime gstreamer::Playbin::player_lifetime |
Definition at line 136 of file playbin.h.
Referenced by Playbin(), reset(), and set_lifetime().
|
mutable |
Definition at line 133 of file playbin.h.
Referenced by Playbin(), and position().
core::ubuntu::media::Player::HeadersType gstreamer::Playbin::request_headers |
Definition at line 135 of file playbin.h.
Referenced by set_uri(), and setup_source().
struct { ... } gstreamer::Playbin::signals |
Referenced by emit_video_dimensions_changed_if_changed(), on_new_message_async(), pipeline_name(), and reset().
gulong gstreamer::Playbin::source_setup_handler_id |
Definition at line 138 of file playbin.h.
Referenced by Playbin(), and ~Playbin().
GstElement* gstreamer::Playbin::video_sink |
Definition at line 129 of file playbin.h.
Referenced by create_video_sink(), get_video_dimensions(), and Playbin().
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().