![]() |
1.12 |
Audio player. More...
#include <audio.h>

Public Member Functions | |
| AudioPlayer () | |
| AudioPlayer (AudioPlayer &&)=default | |
| AudioPlayer (const AudioPlayer &)=delete | |
| AudioPlayer (const std::string &uri) | |
| Construct and set the media file URI to the current pipeline. | |
| ~AudioPlayer () noexcept override | |
| EGT_NODISCARD uint64_t | duration () const |
| Get the duration of the audio stream. | |
| bool | media (const std::string &uri) |
| Sets the media file URI to the current pipeline. | |
| bool | mute (bool mute) |
| Mutes the audio being played. | |
| AudioPlayer & | operator= (AudioPlayer &&)=default |
| AudioPlayer & | operator= (const AudioPlayer &)=delete |
| bool | pause () |
| pause Send Pipeline to pause state | |
| bool | play () |
| Send pipeline to play state. | |
| EGT_NODISCARD bool | playing () const |
| Returns true if the stream is currently playing. | |
| EGT_NODISCARD uint64_t | position () const |
| Get the current position of the audio stream. | |
| bool | seek (uint64_t pos) |
| Seek to a position. | |
| EGT_NODISCARD int | volume () const |
| Get the volume. | |
| bool | volume (int volume) |
| Adjusts the volume of the audio being played. | |
Public Member Functions inherited from Object | |
| Object () noexcept=default | |
| Object (const Object &)=delete | |
| Object (Object &&)=default | |
| virtual | ~Object () noexcept=default |
| void | clear_handlers () |
| Clear all registered event handlers. | |
| void | invoke_handlers (Event &event) |
| Invoke all handlers with the specified event. | |
| void | invoke_handlers (EventId event) |
| Invoke all handlers with the specified EventId. | |
| EGT_NODISCARD const std::string & | name () const |
| Get the name of the Object. | |
| void | name (const std::string &name) |
| Set the name of the Object. | |
| RegisterHandle | on_event (const EventCallback &handler, const FilterFlags &mask={}) |
| Add an event handler to be called when the widget generates an event. | |
| Object & | operator= (const Object &)=delete |
| Object & | operator= (Object &&)=default |
| void | remove_handler (RegisterHandle handle) |
| Remove an event handler. | |
Public Attributes | |
| SignalW< int64_t > | on_position_changed |
| Event signal. | |
| SignalW< const std::string & > | on_error |
| Invoked when an error occurs. | |
| SignalW | on_eos |
| Invoked on end of stream. | |
| SignalW | on_state_changed |
| Invoked when the state of the player changes. | |
Protected Attributes | |
| std::unique_ptr< detail::GstDecoderImpl > | m_impl |
| Implementation pointer. | |
Protected Attributes inherited from Object | |
| detail::CopyOnWriteAllocate< CallbackArray > | m_callbacks |
| Array of callbacks. | |
| RegisterHandle | m_handle_counter {0} |
| Counter used to generate unique handles for each callback registration. | |
| std::string | m_name |
| A user defined name for the Object. | |
Additional Inherited Members | |
Public Types inherited from Object | |
| using | EventCallback = std::function< void(Event &event)> |
| Event handler callback function. | |
| using | FilterFlags = FlagsBase< EventId > |
| Event handler EventId filter. | |
| using | RegisterHandle = uint64_t |
| Handle type. | |
Protected Types inherited from Object | |
| using | CallbackArray = std::vector< CallbackMeta > |
| Helper type for an array of callbacks. | |
Audio player.
| AudioPlayer | ( | ) |
|
explicit |
Construct and set the media file URI to the current pipeline.
| uri | file URI |
|
delete |
|
default |
|
overridenoexcept |
| EGT_NODISCARD uint64_t duration | ( | ) | const |
Get the duration of the audio stream.
| bool media | ( | const std::string & | uri | ) |
Sets the media file URI to the current pipeline.
| uri | file URI |
| bool mute | ( | bool | mute | ) |
Mutes the audio being played.
| mute | When true, audio is to be muted. |
|
default |
|
delete |
| bool pause | ( | ) |
pause Send Pipeline to pause state
| bool play | ( | ) |
Send pipeline to play state.
| EGT_NODISCARD bool playing | ( | ) | const |
Returns true if the stream is currently playing.
| EGT_NODISCARD uint64_t position | ( | ) | const |
Get the current position of the audio stream.
| bool seek | ( | uint64_t | pos | ) |
Seek to a position.
The position is given by the position() function and the duration is given by the duration() method.
| pos | Position in nanoseconds. |
| EGT_NODISCARD int volume | ( | ) | const |
Get the volume.
| bool volume | ( | int | volume | ) |
Adjusts the volume of the audio being played.
| volume | Value in the range 0 - 100. |
|
protected |
Implementation pointer.
| SignalW on_eos |
Invoked on end of stream.
| SignalW<const std::string&> on_error |
Invoked when an error occurs.
| SignalW on_state_changed |
Invoked when the state of the player changes.