1.10
Public Member Functions | Protected Member Functions | Protected Attributes | Friends | List of all members
VideoWindow Class Reference

A VideoWindow is a widget to decode video and render it to a screen. More...

#include <video.h>

Inheritance diagram for VideoWindow:
Inheritance graph
[legend]

Public Member Functions

 VideoWindow (const Rect &rect, const std::string &uri, PixelFormat format=PixelFormat::xrgb8888, WindowHint hint=WindowHint::overlay)
 Create a video window to decode video and render it to a screen.
 
 VideoWindow (const Rect &rect={}, PixelFormat format=PixelFormat::xrgb8888, WindowHint hint=WindowHint::overlay)
 Create a video window to decode video and render it to a screen.
 
 VideoWindow (const VideoWindow &)=delete
 
 VideoWindow (Serializer::Properties &props)
 Construct a video window.
 
 VideoWindow (VideoWindow &&) noexcept
 
 ~VideoWindow () noexcept override
 
void do_draw () override
 Perform the actual drawing.
 
void draw (Painter &painter, const Rect &rect) override
 Draw the widget.
 
EGT_NODISCARD int64_t duration () const
 Get the total duration of the video.
 
void gst_custom_pipeline (const std::string &pipeline_desc)
 
EGT_NODISCARD bool has_audio () const
 check for audio is supported.
 
EGT_NODISCARD bool loopback () const
 Get loop-back state.
 
void loopback (bool enable)
 Enable/disable continues loop-back mode of the video being played.
 
EGT_NODISCARD std::string media () const
 get the media file used of video playback.
 
bool media (const std::string &uri)
 Initialize gstreamer pipeline for specified media file.
 
VideoWindowoperator= (const VideoWindow &)=delete
 
VideoWindowoperator= (VideoWindow &&) noexcept
 
bool pause ()
 Pause the video.
 
bool play ()
 Play the video.
 
EGT_NODISCARD bool playing () const
 Check is video in play state.
 
EGT_NODISCARD int64_t position () const
 Get the current position of the video being played.
 
void resize (const Size &s) override
 Resize the widget.
 
void resize (const Size &size) override
 Resize the widget.
 
void scale (float hscale, float vscale) override
 Set the scale of the widget.
 
void scale (float hscale, float vscale) override
 Set the scale of the widget.
 
bool seek (int64_t pos)
 Seek to a position.
 
void serialize (Serializer &serializer) const override
 Serialize the widget to the specified serializer.
 
EGT_NODISCARD int volume () const
 Get the volume value for the video being played.
 
bool volume (int volume)
 Adjust volume of the video being played.
 
- Public Member Functions inherited from Window
 Window (const Rect &rect, PixelFormat format_hint=DEFAULT_FORMAT, WindowHint hint=WindowHint::automatic)
 Construct a window.
 
 Window (const Window &)=delete
 
 Window (Frame &parent, const Rect &rect, PixelFormat format_hint=DEFAULT_FORMAT, WindowHint hint=WindowHint::automatic)
 Construct a window.
 
 Window (PixelFormat format_hint=DEFAULT_FORMAT, WindowHint hint=WindowHint::automatic)
 Construct a window.
 
 Window (Serializer::Properties &props)
 Construct a window.
 
 Window (Window &&) noexcept
 
 ~Window () noexcept override
 
void begin_draw () override
 Cause the widget to draw itself and all of its children.
 
void damage (const Rect &rect) override
 Mark the specified rect as a damaged area of the widget.
 
EGT_NODISCARD PixelFormat format () const
 Get the pixel format of the window.
 
EGT_NODISCARD PixelFormat format_hint () const
 Get the pixel format hint of the window.
 
void format_hint (PixelFormat format_hint)
 Set the pixel format hint of the window.
 
EGT_NODISCARD bool has_screen () const override
 Does this Widget have a screen?
 
void hide () override
 Hide the Widget.
 
EGT_NODISCARD float hscale () const
 Get horizontal scale value.
 
void move (const Point &point) override
 Move the Widget to a new position.
 
Windowoperator= (const Window &)=delete
 
Windowoperator= (Window &&) noexcept
 
void paint (Painter &painter) override
 Paint the Widget using a Painter.
 
void resize (const Size &size) override
 Resize the widget.
 
void scale (float hscale, float vscale) override
 Set the scale of the widget.
 
EGT_NODISCARD Screenscreen () const override
 The buck stops on this call to Widget::screen() with a Window because the Window contains the screen.
 
void serialize (Serializer &serializer) const override
 Serialize the widget to the specified serializer.
 
void show () override
 Show the Widget.
 
EGT_NODISCARD float vscale () const
 Get vertical scale value.
 
EGT_NODISCARD WindowHint window_hint () const
 Get the window hint.
 
void window_hint (WindowHint hint)
 Set the window hint.
 
- Public Member Functions inherited from Frame
 Frame (const Frame &)=delete
 
 Frame (const Rect &rect={}, const Flags &flags={}) noexcept
 
 Frame (Frame &&) noexcept=default
 
 Frame (Frame &parent, const Rect &rect, const Flags &flags={}) noexcept
 
 Frame (Serializer::Properties &props) noexcept
 
 ~Frame () noexcept override
 
template<class T >
void add (const std::shared_ptr< T > &widget)
 Utility wrapper around add()
 
virtual void add (const std::shared_ptr< Widget > &widget)
 Add a child widget.
 
void add (Widget &widget)
 Add a child widget.
 
EGT_NODISCARD std::shared_ptr< Widgetchild_at (size_t index) const
 Get a child widget at a specific index.
 
EGT_NODISCARD detail::Range< SubordinatesArray > & children ()
 Return the array of child widgets.
 
EGT_NODISCARD const detail::Range< SubordinatesArray > & children () const
 Return the array of child widgets.
 
EGT_NODISCARD size_t count_children () const
 Get the number of children widgets.
 
void deserialize_children (const Deserializer &deserializer) override
 Deserialize the children of this widget.
 
template<class T >
std::shared_ptr< T > find_child (const std::string &name)
 Find a child Widget in the entire tree by name.
 
Widgethit_test (const DisplayPoint &point)
 Get the widget under the given DisplayPoint.
 
bool is_child (Widget *widget) const
 Returns true if the child exists.
 
void on_screen_resized () override
 Overridden to be called recursively on all children.
 
Frameoperator= (const Frame &)=delete
 
Frameoperator= (Frame &&) noexcept=default
 
void paint_children_to_file ()
 Paint individual children to file.
 
void paint_to_file (const std::string &filename={}) override
 Save the entire frame surface to a file.
 
virtual void remove (Widget *widget)
 Remove a child widget.
 
void remove_all ()
 Remove all child widgets.
 
void serialize_children (Serializer &serializer) const override
 Serialize the widget's children to the specified serializer.
 
template<typename T , typename... Args>
std::shared_ptr< T > spawn (Args &&... args)
 Create a child widget of the specified type.
 
EGT_NODISCARD ChildDrawCallback special_child_draw_callback () const
 Get the special child draw callback.
 
void special_child_draw_callback (ChildDrawCallback func)
 Set the special child draw callback.
 
EGT_NODISCARD ChildDrawCallback special_child_draw_callback (Widget *parent) const
 Get the child draw callback of the parent.
 
virtual EGT_NODISCARD Point to_child (const Point &p) const
 
EGT_NODISCARD Rect to_child (Rect rect) const
 
EGT_NODISCARD bool top_level () const override
 Return true if this is a top level frame, with no parent.
 
void walk (const WalkCallback &callback, int level=0) override
 Walk the Widget tree and call callback with each Widget.
 
virtual EGT_NODISCARD size_t zorder () const
 Get the zorder of the widget.
 
size_t zorder (const Widget *widget) const
 Get the zorder of the widget.
 
void zorder (const Widget *widget, size_t rank)
 Set the zorder of the widget.
 
virtual void zorder (size_t rank)
 Set the zorder of the widget.
 
virtual void zorder_bottom ()
 Move the widget to the bottom.
 
void zorder_bottom (const Widget *widget)
 Move the specified widget zorder to the bottom of the current list of widgets with the same parent.
 
virtual void zorder_down ()
 Move this widgets zorder down relative to other widgets with the same parent.
 
void zorder_down (const Widget *widget)
 Move the specified widget zorder down relative to other widgets with the same parent.
 
virtual void zorder_top ()
 Move the widget to the top.
 
void zorder_top (const Widget *widget)
 Move the specified widget zorder to the top of the current list of widgets with the same parent.
 
virtual void zorder_up ()
 Move this widgets zorder up relative to other widgets with the same parent.
 
void zorder_up (const Widget *widget)
 Move the specified widget zorder up relative to other widgets with the same parent.
 
- Public Member Functions inherited from Widget
 Widget (const Rect &rect={}, const Widget::Flags &flags={}) noexcept
 
 Widget (const Widget &)=delete
 
 Widget (Frame &parent, const Rect &rect={}, const Widget::Flags &flags={}) noexcept
 
 Widget (Serializer::Properties &props) noexcept
 
 Widget (Widget &&) noexcept=default
 
 ~Widget () noexcept override
 
EGT_NODISCARD bool active () const
 Get the active state.
 
void active (bool value)
 Set the active state.
 
AlignFlagsalign ()
 Get the alignment.
 
EGT_NODISCARD const AlignFlagsalign () const
 Get the alignment.
 
void align (const AlignFlags &a)
 Align the widget.
 
EGT_NODISCARD float alpha () const
 Get the alpha property.
 
void alpha (float alpha)
 Set the alpha property.
 
EGT_NODISCARD bool autoresize () const
 Return the autoresize state of the widget.
 
void autoresize (bool value)
 Set the autoresize state.
 
EGT_NODISCARD Imagebackground (bool allow_fallback=false) const
 Get the background image, if any, for the current group.
 
void background (const Image &image, Palette::GroupId group=Palette::GroupId::normal)
 Add an image background to the widget's box.
 
EGT_NODISCARD Imagebackground (Palette::GroupId group, bool allow_fallback=false) const
 Get the background image, if any, for the given group.
 
EGT_NODISCARD DefaultDim border () const
 Get the border width.
 
void border (DefaultDim border)
 Set the border width.
 
EGT_NODISCARD Theme::BorderFlags border_flags () const
 Get the border flags.
 
void border_flags (const Theme::BorderFlags &flags)
 Set the border flags.
 
EGT_NODISCARD float border_radius () const
 Get the border radius.
 
void border_radius (float radius)
 Set the border radius.
 
EGT_NODISCARD const Rectbox () const
 Bounding box for the Widget.
 
void box (const Rect &rect)
 Change the bounding box of the widget.
 
bool can_handle_event () const
 Returns true if the widget is capable of handling an event.
 
EGT_NODISCARD Point center () const
 Get the center point of the widget's box().
 
EGT_NODISCARD bool checked () const
 Get the boolean checked state of the a widget.
 
virtual void checked (bool value)
 Set the checked state of the widget.
 
EGT_NODISCARD bool clip () const
 Return the clip state of the widget.
 
EGT_NODISCARD const Patterncolor (Palette::ColorId id) const
 Get a Widget color.
 
void color (Palette::ColorId id, const Pattern &color, Palette::GroupId group=Palette::GroupId::normal)
 Add a color to the widget's instance palette.
 
EGT_NODISCARD const Patterncolor (Palette::ColorId id, Palette::GroupId group) const
 Get a Widget color.
 
virtual EGT_NODISCARD Rect content_area () const
 Return the area that content is allowed to be positioned into.
 
void continue_drag (Event &event)
 Handle 'pointer_drag' and 'pointer_drag_stop' events.
 
virtual void damage ()
 Damage the box() of the widget and cause a redraw.
 
void detach ()
 Detach this widget from its parent.
 
void disable ()
 Set the disabled state to true.
 
void disable_toggle ()
 Toggle the disabled state.
 
EGT_NODISCARD bool disabled () const
 Return the disabled state of the widget.
 
void disabled (bool value)
 Set the disabled state.
 
DisplayPoint display_origin ()
 Get the display origin of the Widget.
 
virtual Point display_to_local (const DisplayPoint &p) const
 Convert a display point to a local point.
 
void draw_box (Painter &painter, Palette::ColorId bg, Palette::ColorId border) const
 Helper function to draw this widget's box using the appropriate theme.
 
void draw_circle (Painter &painter, Palette::ColorId bg, Palette::ColorId border) const
 Helper function to draw this widget's circle using the appropriate theme.
 
void enable ()
 Set the disabled state to false.
 
Theme::FillFlagsfill_flags ()
 Get a modifiable fill flags reference.
 
EGT_NODISCARD const Theme::FillFlagsfill_flags () const
 Get the fill flags.
 
void fill_flags (const Theme::FillFlags &flags)
 Set the fill flags.
 
EGT_NODISCARD bool focus () const
 Get the current focus state.
 
void focus (bool value)
 Set the focus state.
 
EGT_NODISCARD const Fontfont () const
 Get the widget Font.
 
void font (const Font &font)
 Set the widget Font.
 
EGT_NODISCARD bool frame () const
 Return the frame state of the widget.
 
EGT_NODISCARD bool grab_mouse () const
 Return the grab_mouse state of the widget.
 
void grab_mouse (bool value)
 Set the grab_mouse state.
 
EGT_NODISCARD Palette::GroupId group () const
 Get the current Palette::GroupId depending on the widget's state.
 
virtual void handle (Event &event)
 Handle an event.
 
bool has_font () const
 Check whether the widget has a custom Font.
 
EGT_NODISCARD bool has_palette () const
 Check whether the widget has a custom palette.
 
EGT_NODISCARD DefaultDim height () const
 Height of the widget's box().
 
void height (DefaultDim h)
 Change the height.
 
EGT_NODISCARD bool hit (const DisplayPoint &point) const
 Returns true if the DisplayPoint is within the widget box.
 
EGT_NODISCARD DefaultDim horizontal_ratio () const
 Get the horizontal ratio relative to parent.
 
void horizontal_ratio (DefaultDim horizontal)
 Set the horizontal ratio relative to parent.
 
EGT_NODISCARD bool in_layout () const
 Indicate if the Widget is computing the layout or not.
 
virtual void layout ()
 Perform layout of the Widget.
 
DisplayPoint local_to_display (const Point &p) const
 Convert a local point to a display point.
 
EGT_NODISCARD DefaultDim margin () const
 Get the margin width.
 
void margin (DefaultDim margin)
 Set the margin width.
 
virtual EGT_NODISCARD Size min_size_hint () const
 Get a minimum size hint for the Widget.
 
void min_size_hint (const Size &size)
 Set the minimum size hint for the Widget.
 
EGT_NODISCARD size_t moat () const
 Get the sum of the margin(), padding(), and border() around the content of the widget.
 
void move_to_center ()
 Move the widget to the center of its parent.
 
void move_to_center (const Point &point)
 Move the widget to the specified center point.
 
EGT_NODISCARD bool no_layout () const
 Return the no_layout state of the widget.
 
void no_layout (bool value)
 Set the no_layout state.
 
Widgetoperator= (const Widget &)=delete
 
Widgetoperator= (Widget &&) noexcept=default
 
EGT_NODISCARD DefaultDim padding () const
 Return the padding width.
 
void padding (DefaultDim padding)
 Set the padding width.
 
EGT_NODISCARD const Palettepalette () const
 Get the widget palette.
 
void palette (const Palette &palette)
 Set the widget instance Palette.
 
Widgetparent ()
 Get a pointer to the parent Widget, or nullptr if none exists.
 
EGT_NODISCARD const Widgetparent () const
 Get a pointer to the parent Widget, or nullptr if none exists.
 
EGT_NODISCARD bool plane_window () const
 Return the plane_window state of the widget.
 
EGT_NODISCARD const Pointpoint () const
 Get the origin of the widget's box().
 
virtual void post_deserialize (Serializer::Properties &props)
 Resume deserializing of the widget after its children have been deserialized.
 
void ratio (DefaultDim horizontal, DefaultDim vertical)
 Set the size ratio relative to parent.
 
void ratio (DefaultDim ratio)
 Set the size ratio relative to parent.
 
EGT_NODISCARD bool readonly () const
 Get the readonly state of the widget.
 
void readonly (bool value)
 Set the readonly state of the widget.
 
void readonly_toggle ()
 Toggle the readonly state.
 
void reset_background (Palette::GroupId group=Palette::GroupId::normal)
 Remove an image background from the widget's box.
 
void reset_font ()
 Reset the widget's Font.
 
void reset_palette ()
 Clear the widget instance palette.
 
void resize_by_ratio (DefaultDim hratio, DefaultDim vratio)
 Scale the current size of the Widget given the ratio.
 
void resize_by_ratio (DefaultDim ratio)
 Scale the current size of the Widget given the ratio.
 
void scale (float scale)
 Set the scale of the widget.
 
EGT_NODISCARD const Sizesize () const
 Get the size of the widget's box().
 
EGT_NODISCARD const Themetheme () const
 Get the Widget Theme.
 
EGT_NODISCARD Point to_parent (const Point &r) const
 Convert a point with a local origin to a parent origin.
 
EGT_NODISCARD Rect to_parent (const Rect &r) const
 Convert a point in a rect a local origin to a parent origin.
 
virtual EGT_NODISCARD std::string type () const
 Returns a string representation of the type of this widget.
 
EGT_NODISCARD bool user_drag () const
 
void user_drag (bool value)
 
EGT_NODISCARD const Rectuser_requested_box () const
 Get the box corresponding to the user requested one, not the actual one.
 
EGT_NODISCARD bool user_track_drag () const
 
void user_track_drag (bool value)
 
EGT_NODISCARD DefaultDim vertical_ratio () const
 Get the vertical ratio relative to parent.
 
void vertical_ratio (DefaultDim vertical)
 Set the vertical ratio relative to parent.
 
EGT_NODISCARD bool visible () const
 Get the visible state of the widget.
 
void visible (bool value)
 Set the visible state.
 
void visible_toggle ()
 Toggle the visibility state.
 
EGT_NODISCARD WidgetId widgetid () const
 Get the unique id of the widget.
 
EGT_NODISCARD DefaultDim width () const
 Width of the widget's box().
 
void width (DefaultDim w)
 Change the width.
 
EGT_NODISCARD DefaultDim x () const
 X coordinate of the widget's box().
 
void x (DefaultDim x)
 Set the X coordinate of the box.
 
EGT_NODISCARD DefaultDim xratio () const
 Get the X position ratio relative to parent.
 
void xratio (DefaultDim xratio)
 Set the X position ratio relative to parent.
 
EGT_NODISCARD DefaultDim y () const
 Y coordinate of the widget's box().
 
void y (DefaultDim y)
 Set the Y coordinate of the box.
 
EGT_NODISCARD DefaultDim yratio () const
 Get the Y position ratio relative to parent.
 
void yratio (DefaultDim yratio)
 Set the Y position ratio relative to parent.
 
- 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.
 
Objectoperator= (const Object &)=delete
 
Objectoperator= (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.
 
- Public Attributes inherited from Widget
Signal on_checked_changed
 Event signal.
 
Signal on_gain_focus
 Invoked when the widget gains focus.
 
Signal on_lost_focus
 Invoked when the widget loses focus.
 
Signal on_show
 Invoked when a widget is shown.
 
Signal on_hide
 Invoked when a widget is hidden.
 

Protected Member Functions

 VideoWindow (Serializer::Properties &props, bool is_derived)
 
- Protected Member Functions inherited from Window
 Window (Serializer::Properties &props, bool is_derived)
 
void create_impl (const Rect &rect, PixelFormat format_hint, WindowHint hint)
 Select and allocate the backend implementation for the window.
 
void main_window ()
 Set this window as the main window.
 
- Protected Member Functions inherited from Frame
 Frame (Serializer::Properties &props, bool is_derived) noexcept
 
- Protected Member Functions inherited from Widget
 Widget (Serializer::Properties &props, bool is_derived) noexcept
 
bool accept_drag () const
 Tell the start_drag() method whether the widget accepts 'pointer_drag*' events.
 
void add_component (Widget &widget)
 Add a component.
 
void add_damage (const Rect &rect)
 Add damage to the damage array.
 
void begin_draw (Widget *parent)
 Call the begin_draw() method of the parent.
 
EGT_NODISCARD detail::Range< SubordinatesArray > & children ()
 Return the array of child widgets.
 
EGT_NODISCARD const detail::Range< SubordinatesArray > & children () const
 Return the array of child widgets.
 
EGT_NODISCARD bool component () const
 Get the component status.
 
void component (bool value)
 Set the component flag.
 
EGT_NODISCARD detail::Range< SubordinatesArray > & components ()
 Return the array of components widgets.
 
EGT_NODISCARD const detail::Range< SubordinatesArray > & components () const
 Return the array of components widgets.
 
virtual void damage_from_subordinate (const Rect &rect)
 Special variation of damage() that is to be called explicitly by subordinate widgets.
 
void deserialize_leaf (Serializer::Properties &props)
 Deserialize widget properties that require to call overridden methods.
 
Widgetfind_screen ()
 Starting from this Widget, find the Widget that has a Screen.
 
EGT_NODISCARD const Widgetfind_screen () const
 Starting from this Widget, find the Widget that has a Screen.
 
Widget::Flagsflags ()
 Get a modifiable ref of the flags.
 
EGT_NODISCARD const Widget::Flagsflags () const
 Get a const ref of the flags.
 
virtual bool internal_drag () const
 
virtual bool internal_track_drag () const
 
EGT_NODISCARD Rect local_box () const
 Get the local box which is the same size as box(), but with the origin zeroed.
 
EGT_NODISCARD bool parent_in_layout ()
 Indicate if our parent is computing the layout.
 
void parent_layout ()
 Call our parent to do a layout.
 
virtual Point point_from_subordinate (const Widget &subordinate) const
 
EGT_NODISCARD detail::Range< SubordinatesArray > & range_from_widget (const Widget &widget)
 Return either components() or children() depending on widget.component()
 
EGT_NODISCARD const detail::Range< SubordinatesArray > & range_from_widget (const Widget &widget) const
 Return either components() or children() depending on widget.component()
 
void remove_component (Widget *widget)
 Remove a component.
 
virtual void set_parent (Widget *parent)
 Set this widget's parent.
 
void special_child_draw (Painter &painter, Widget *widget)
 Special draw function that can be invoked when drawing each child.
 
EGT_NODISCARD ChildDrawCallback special_child_draw_callback () const
 Get the special child draw callback.
 
void special_child_draw_callback (ChildDrawCallback func)
 Set the special child draw callback.
 
EGT_NODISCARD ChildDrawCallback special_child_draw_callback (Widget *parent) const
 Get the child draw callback of the parent.
 
void start_drag (Event &event)
 Handle 'pointer_drag_start' events and decide whether they are caught by this widget.
 
virtual Point to_panel (const Point &p)
 Convert a local point to the coordinate system of the current panel.
 
virtual EGT_NODISCARD Point to_subordinate (const Point &p) const
 Convert a point with an origin of the current widget to subordinate origin.
 
EGT_NODISCARD Rect to_subordinate (Rect rect) const
 
bool track_drag () const
 Tell the continue_drag() method whether the widget tracks 'pointer_drag*' events once they have crossed out the widget boundaries.
 
void update_subordinates_ranges ()
 Update the 'm_children' and 'm_components' members.
 
size_t zorder (const Widget *widget) const
 Get the zorder of the widget.
 
void zorder (const Widget *widget, size_t rank)
 Set the zorder of the widget.
 
void zorder_bottom (const Widget *widget)
 Move the specified widget zorder to the bottom of the current list of widgets with the same parent.
 
void zorder_down (const Widget *widget)
 Move the specified widget zorder down relative to other widgets with the same parent.
 
void zorder_top (const Widget *widget)
 Move the specified widget zorder to the top of the current list of widgets with the same parent.
 
void zorder_up (const Widget *widget)
 Move the specified widget zorder up relative to other widgets with the same parent.
 

Protected Attributes

std::string m_uri
 media file
 
- Protected Attributes inherited from Window
float m_hscale {1.0}
 Horizontal scale value.
 
float m_vscale {1.0}
 Vertical scale value.
 
- Protected Attributes inherited from Widget
Rect m_box
 Bounding box.
 
detail::Range< SubordinatesArraym_children
 Array of child widgets in the order they were added.
 
detail::Range< SubordinatesArraym_components
 Array of component widgets in the order they were added.
 
SubordinatesArray::iterator m_components_begin
 Iterator for the beginning of components which are positionned after children in the subordinates array.
 
Screen::DamageArray m_damage
 The damage array for this widget.
 
bool m_in_draw {false}
 Status for whether this widget is currently drawing.
 
bool m_in_layout {false}
 Status for whether this widget is currently performing layout.
 
Size m_min_size
 Minimum size of the widget when not an empty value.
 
Widgetm_parent {nullptr}
 Pointer to this widget's parent.
 
ChildDrawCallback m_special_child_draw_callback
 Used internally for calling the special child draw function.
 
SubordinatesArray m_subordinates
 Array of subordinates widgets split in child widgets and component widgets.
 
Rect m_user_requested_box
 Keep track of the box requested by the user.
 
WidgetId m_widgetid {0}
 Unique ID of this widget.
 
- Protected Attributes inherited from Object
detail::CopyOnWriteAllocate< CallbackArraym_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.
 

Friends

class detail::GstAppSinkImpl
 
class detail::GstDecoderImpl
 

Additional Inherited Members

- Public Types inherited from Widget
enum class  Flag : uint32_t {
  plane_window = detail::bit(0) , window = detail::bit(1) , frame = detail::bit(2) , disabled = detail::bit(3) ,
  readonly = detail::bit(4) , active = detail::bit(5) , invisible = detail::bit(6) , grab_mouse = detail::bit(7) ,
  no_clip = detail::bit(8) , no_layout = detail::bit(9) , no_autoresize = detail::bit(10) , checked = detail::bit(11) ,
  component = detail::bit(12) , user_drag = detail::bit(13) , user_track_drag = detail::bit(14)
}
 Common flags used for various widget properties. More...
 
using Flags = egt::Flags< Widget::Flag >
 Widget flags.
 
using WalkCallback = std::function< bool(Widget *widget, int level)>
 Callback definition used by walk().
 
using WidgetId = uint64_t
 Type used to identify a unique Widget ID.
 
- 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.
 
- Static Public Attributes inherited from Window
static const PixelFormat DEFAULT_FORMAT
 Default pixel format used for Window.
 
- Protected Types inherited from Widget
using ChildDrawCallback = std::function< void(Painter &painter, Widget *widget)>
 Helper type that defines the special draw child callback.
 
using SubordinatesArray = std::list< std::shared_ptr< Widget > >
 Helper type for an array of subordinate widgets.
 
- Protected Types inherited from Object
using CallbackArray = std::vector< CallbackMeta >
 Helper type for an array of callbacks.
 

Detailed Description

A VideoWindow is a widget to decode video and render it to a screen.

It has a bounding rectangle, format and WindowHint. These properties can be manipulated to create a video window either as a basic window or an overlay plane.

The video decoding is done through gstreamer media framework.

Constructor & Destructor Documentation

◆ VideoWindow() [1/6]

VideoWindow ( const Rect rect = {},
PixelFormat  format = PixelFormat::xrgb8888,
WindowHint  hint = WindowHint::overlay 
)
explicit

Create a video window to decode video and render it to a screen.

Parameters
[in]rectInitial rectangle of the widget.
[in]formatPixel format of window or a overlay plane.
[in]hintUsed for configuring window backends.
Note
Only WindowHint::heo_overlay can use yuyv, nv21 and yuv420 pixel formats.

◆ VideoWindow() [2/6]

VideoWindow ( const Rect rect,
const std::string &  uri,
PixelFormat  format = PixelFormat::xrgb8888,
WindowHint  hint = WindowHint::overlay 
)

Create a video window to decode video and render it to a screen.

Parameters
[in]rectInitial rectangle of the widget.
[in]uriMedia file
[in]formatPixel format of window or a overlay plane.
[in]hintUsed for configuring window backends.
Note
Only WindowHint::heo_overlay can use yuyv, nv21 and yuv420 pixel formats.

◆ VideoWindow() [3/6]

VideoWindow ( Serializer::Properties props)
inline

Construct a video window.

Parameters
[in]propslist of widget argument and its properties.

◆ VideoWindow() [4/6]

VideoWindow ( Serializer::Properties props,
bool  is_derived 
)
protected

◆ VideoWindow() [5/6]

VideoWindow ( const VideoWindow )
delete

◆ VideoWindow() [6/6]

VideoWindow ( VideoWindow &&  )
noexcept

◆ ~VideoWindow()

~VideoWindow ( )
overridenoexcept

Member Function Documentation

◆ do_draw()

void do_draw ( )
inlineoverridevirtual

Perform the actual drawing.

Allocate the Painter and call draw() on each child.

Reimplemented from Window.

◆ draw()

void draw ( Painter painter,
const Rect rect 
)
overridevirtual

Draw the widget.

To change how a widget is drawn, this function can be overloaded and changed in a derived class, or it can be changed dynamically with the Theme.

To optimize drawing, a Widget may use the Rect parameter to limit what needs to be redrawn, which may be smaller than the widget's box(), but will never be outside the widget's box().

Painter will always be supplied in a default state to this function, so there is no need to do any cleanup or state saving inside this draw() function.

Warning
Normally this should not be called directly and instead the EventLoop will call this function with an already established Painter when the Widget needs to be drawn.
See also
Color, Palette, and Theme and Drawing
Parameters
[in]painterInstance of the Painter for the Screen.
[in]rectThe rectangle to draw.

Reimplemented from Widget.

◆ duration()

EGT_NODISCARD int64_t duration ( ) const

Get the total duration of the video.

Returns
Time duration in nanoseconds.

◆ gst_custom_pipeline()

void gst_custom_pipeline ( const std::string &  pipeline_desc)

◆ has_audio()

EGT_NODISCARD bool has_audio ( ) const

check for audio is supported.

check is done based on sound device and audio track present in media file.

Returns
true if supported and false if not supported.

◆ loopback() [1/2]

EGT_NODISCARD bool loopback ( ) const

Get loop-back state.

Returns
true/false based on loop-back state

◆ loopback() [2/2]

void loopback ( bool  enable)

Enable/disable continues loop-back mode of the video being played.

by default this is disabled.

Parameters
enableenable/disable loop-back mode.

◆ media() [1/2]

EGT_NODISCARD std::string media ( ) const
inline

get the media file used of video playback.

Returns
media file.

◆ media() [2/2]

bool media ( const std::string &  uri)

Initialize gstreamer pipeline for specified media file.

Parameters
uriMedia file
Returns
true on success

◆ operator=() [1/2]

VideoWindow & operator= ( const VideoWindow )
delete

◆ operator=() [2/2]

VideoWindow & operator= ( VideoWindow &&  )
noexcept

◆ pause()

bool pause ( )

Pause the video.

Returns
true on success

◆ play()

bool play ( )

Play the video.

Returns
true on success

◆ playing()

EGT_NODISCARD bool playing ( ) const

Check is video in play state.

Returns
true on success

◆ position()

EGT_NODISCARD int64_t position ( ) const

Get the current position of the video being played.

Returns
Time duration in nanoseconds.

◆ resize() [1/2]

void resize ( const Size size)
overridevirtual

Resize the widget.

Changes the width and height of the Widget.

Parameters
[in]sizeThe new size of the Widget.
Note
This will cause a redraw of the Widget.

Reimplemented from Widget.

◆ resize() [2/2]

void resize ( const Size size)
overridevirtual

Resize the widget.

Changes the width and height of the Widget.

Parameters
[in]sizeThe new size of the Widget.
Note
This will cause a redraw of the Widget.

Reimplemented from Widget.

◆ scale() [1/2]

void scale ( float  hscale,
float  vscale 
)
overridevirtual

Set the scale of the widget.

Parameters
[in]hscaleHorizontal scale, with 1.0 being 100%.
[in]vscaleVertical scale, with 1.0 being 100%.
Warning
This is experimental.

Reimplemented from Widget.

◆ scale() [2/2]

void scale ( float  hscale,
float  vscale 
)
overridevirtual

Set the scale of the widget.

Parameters
[in]hscaleHorizontal scale, with 1.0 being 100%.
[in]vscaleVertical scale, with 1.0 being 100%.
Warning
This is experimental.

Reimplemented from Widget.

◆ seek()

bool seek ( int64_t  pos)

Seek to a position.

The position is given by the position() function and the duration is given by the duration() method.

Parameters
posPosition in nanoseconds.
Returns
true on success

◆ serialize()

void serialize ( Serializer serializer) const
overridevirtual

Serialize the widget to the specified serializer.

Reimplemented from Frame.

◆ volume() [1/2]

EGT_NODISCARD int volume ( ) const

Get the volume value for the video being played.

Returns
Value in the range 0 - 100.

◆ volume() [2/2]

bool volume ( int  volume)

Adjust volume of the video being played.

Parameters
volumeValue in the range 0 - 100.
Returns
true on success

Friends And Related Symbol Documentation

◆ detail::GstAppSinkImpl

friend class detail::GstAppSinkImpl
friend

◆ detail::GstDecoderImpl

friend class detail::GstDecoderImpl
friend

Member Data Documentation

◆ m_uri

std::string m_uri
protected

media file

◆ on_eos

SignalW on_eos

Invoked on end of stream.

◆ on_error

SignalW<const std::string&> on_error

Invoked when an error occurs.

◆ on_position_changed

SignalW<int64_t> on_position_changed

Event signal.

Invoked when the position of the player changes.

◆ on_state_changed

SignalW on_state_changed

Invoked when the state of the player changes.