Ginga  0.13.6.2086-83aa
The iTV middleware.
PlayerHTML Class Reference

A player class for HTML. More...

#include <PlayerHTML.h>

Inheritance diagram for PlayerHTML:
Collaboration diagram for PlayerHTML:

Public Member Functions

 PlayerHTML (const string &location)
 Default constructor for PlayerHTML. More...
 
virtual ~PlayerHTML ()
 Default destructor for PlayerHTML. More...
 
virtual bool play () override
 Start the presentation. More...
 
virtual void stop () override
 Stop the presentation. More...
 
virtual void handleKeyEvent (SDL_EventType type, SDL_Keycode key) override
 Process keyboard input events. More...
 
virtual void handleTickEvent (Time, Time, int) override
 
- Public Member Functions inherited from Player
 Player (Formatter *, Media *)
 
State getState ()
 
void getZ (int *, int *)
 
bool isFocused ()
 
Time getTime ()
 
void incTime (Time)
 
Time getDuration ()
 
void setDuration (Time)
 
bool getEOS ()
 
void setEOS (bool)
 
virtual void start ()
 
virtual void pause ()
 
virtual void resume ()
 
virtual string getProperty (const string &)
 
virtual void setProperty (const string &, const string &)
 
void resetProperties ()
 
void resetProperties (set< string > *)
 
void schedulePropertyAnimation (const string &, const string &, const string &, Time)
 
virtual void reload ()
 
virtual void redraw (cairo_t *)
 
virtual void sendKeyEvent (const string &, bool)
 
virtual void sendPresentationEvent (const string &, const string &)
 

Private Member Functions

bool displayJobCallback (DisplayJob *job, SDL_Renderer *renderer)
 Defines the job actions to be executed by the renderer. More...
 
void mouseInputCallback (SDL_EventType type, int x, int y)
 Process mouse input events. More...
 
int getPlayerKey (SDL_Keycode key)
 Translate a SDL key code to a CEF key code. More...
 

Static Private Member Functions

static bool displayJobCallbackWrapper (DisplayJob *job, SDL_Renderer *renderer, void *self)
 Defines mutex methods. More...
 

Private Attributes

CefRefPtr< GingaCefHandler_handler
 Keep the active handler instance, needed to create a new client instance.
 
CefRefPtr< GingaCefClient_client
 Keep the active client instance, needed to create a new browser instance.
 
CefRefPtr< CefBrowser > _browser
 Keep the active browser instance.
 
bool _isPlaying
 Keep execution player status.
 

Additional Inherited Members

- Public Types inherited from Player
enum  State { SLEEPING = 1, OCCURRING, PAUSED }
 
enum  Property {
  PROP_UNKNOWN = 0, PROP_BACKGROUND, PROP_BALANCE, PROP_BASS,
  PROP_BOTTOM, PROP_BOUNDS, PROP_DEBUG, PROP_DURATION,
  PROP_EXPLICIT_DUR, PROP_FOCUS_INDEX, PROP_FONT_BG_COLOR, PROP_FONT_COLOR,
  PROP_FONT_FAMILY, PROP_FONT_SIZE, PROP_FONT_STYLE, PROP_FONT_VARIANT,
  PROP_FONT_WEIGHT, PROP_FREEZE, PROP_FREQ, PROP_HEIGHT,
  PROP_HORZ_ALIGN, PROP_LEFT, PROP_LOCATION, PROP_MUTE,
  PROP_RIGHT, PROP_SIZE, PROP_SPEED, PROP_TIME,
  PROP_TOP, PROP_TRANSPARENCY, PROP_TREBLE, PROP_TYPE,
  PROP_URI, PROP_VERT_ALIGN, PROP_VISIBLE, PROP_VOLUME,
  PROP_WAVE, PROP_WIDTH, PROP_Z_INDEX, PROP_Z_ORDER
}
 
- Static Public Member Functions inherited from Player
static string getCurrentFocus ()
 
static void setCurrentFocus (const string &)
 
static Property getPlayerProperty (const string &, string *)
 
static PlayercreatePlayer (Formatter *, Media *, const string &, const string &type="")
 
- Protected Member Functions inherited from Player
virtual bool doSetProperty (Property, const string &, const string &)
 
- Protected Attributes inherited from Player
Formatter_formatter
 
Media_media
 
string _id
 
State _state
 
Time _time
 
bool _eos
 
cairo_surface_t * _surface
 
bool _opengl
 
guint _gltexture
 
bool _dirty
 
PlayerAnimator_animator
 
list< int > _crop
 
map< string, string > _properties
 
struct {
   Color   bgColor
 
   Rect   rect
 
   Time   duration
 
   bool   debug
 
   bool   visible
 
   guint8   alpha
 
   int   z
 
   int   zorder
 
   string   focusIndex
 
   string   type
 
   string   uri
 
_prop
 

Detailed Description

A player class for HTML.

This class is responsible to present HTML pages. The player use the Chromium Embedded Framework (CEF) together with SDL to render the result in the screen.

Constructor & Destructor Documentation

◆ PlayerHTML()

GINGA_NAMESPACE_BEGIN PlayerHTML::PlayerHTML ( const string &  location)
explicit

Default constructor for PlayerHTML.

Parameters
locationAn URI for the HTML file.
Returns
Nothing.

◆ ~PlayerHTML()

PlayerHTML::~PlayerHTML ( )
virtual

Default destructor for PlayerHTML.

Returns
Nothing.

Member Function Documentation

◆ displayJobCallback()

bool PlayerHTML::displayJobCallback ( DisplayJob *  job,
SDL_Renderer *  renderer 
)
private

Defines the job actions to be executed by the renderer.

Parameters
jobThe job data.
rendererThe renderer.
Returns
false if the job could be removed from the execution list and true otherwise.
See also
displayJobCallbackWrapper(), play() and stop().

This method create a new browser and load the page to be render in the screen. In case the browser already exist, just process the browser events and update the screen. Return false only when stop() is called.

◆ displayJobCallbackWrapper()

bool PlayerHTML::displayJobCallbackWrapper ( DisplayJob *  job,
SDL_Renderer *  renderer,
void *  self 
)
staticprivate

Defines mutex methods.

This MACRO is defined in src/ginga.h. Defines the job actions to be executed by the renderer.

Parameters
jobThe job data.
rendererThe renderer.
selfThe object instance.
Returns
false if the job could be removed from the execution list and true otherwise.
See also
displayJobCallback() and play().

Actually, this is just a wrapper to displayJobCallback().

◆ getPlayerKey()

int PlayerHTML::getPlayerKey ( SDL_Keycode  key)
private

Translate a SDL key code to a CEF key code.

Parameters
keyA SDL key code.
Returns
A CEF key code.

◆ handleKeyEvent()

void PlayerHTML::handleKeyEvent ( SDL_EventType  type,
SDL_Keycode  key 
)
overridevirtual

Process keyboard input events.

Parameters
typeA SDL event type (SDL_KEYDOWN or SDL_KEYUP).
keyA SDL key code.
Returns
Nothing.
See also
getPlayerKey().

This method translate the key code captured by SDL in the event to the CEF code style and forward the events to the active browser.

◆ mouseInputCallback()

void PlayerHTML::mouseInputCallback ( SDL_EventType  type,
int  x,
int  y 
)
private

Process mouse input events.

Parameters
typeA SDL event type (SDL_MOUSEBUTTONDOWN or SDL_MOUSEBUTTONUP)
xThe X coordinate, relative to window.
yThe Y coordinate, relative to window.
Returns
Nothing.

This method forward the events captured by SDL to the active browser.

◆ play()

bool PlayerHTML::play ( )
overridevirtual

Start the presentation.

Returns
Nothing.
See also
displayJobCallbackWrapper() and displayJobCallback().

This method adds a new display job to start the presentation.

◆ stop()

void PlayerHTML::stop ( )
overridevirtual

Stop the presentation.

Returns
Nothing.
See also
displayJobCallbackWrapper() and displayJobCallback().

This method stop the presentation by finishing the display job and cleaning the screen.

Reimplemented from Player.


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