Ginga  0.13.6.1771-df200
The iTV middleware.
PlayerHTML Class Reference

A player class for HTML. More...

#include <PlayerHTML.h>

Inheritance diagram for PlayerHTML:
Collaboration diagram for PlayerHTML:

Public Types

enum  PlayerState { SLEEPING = 1, OCCURRING, PAUSED }
 
enum  PlayerProperty {
  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_HEIGHT, PROP_HORZ_ALIGN,
  PROP_LEFT, PROP_LOCATION, PROP_MUTE, PROP_RIGHT,
  PROP_SIZE, PROP_TOP, PROP_TRANSPARENCY, PROP_TREBLE,
  PROP_VERT_ALIGN, PROP_VISIBLE, PROP_VOLUME, PROP_WIDTH,
  PROP_Z_INDEX
}
 

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
 
PlayerState getState ()
 
bool isFocused ()
 
Time getTime ()
 
void incTime (Time)
 
Time getDuration ()
 
void setDuration (Time)
 
bool getEOS ()
 
void setEOS (bool)
 
void getZ (int *, int *)
 
void setZ (int, int)
 
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)
 

Static Public Member Functions

static string getCurrentFocus ()
 
static void setCurrentFocus (const string &)
 
static PlayerProperty getPlayerProperty (const string &, string *)
 
static PlayercreatePlayer (Formatter *, const string &, const string &, const string &)
 

Protected Member Functions

virtual bool doSetProperty (PlayerProperty, const string &, const string &)
 

Protected Attributes

Formatter_formatter
 
bool _opengl
 
string _id
 
string _uri
 
PlayerState _state
 
Time _time
 
bool _eos
 
cairo_surface_t * _surface
 
guint _gltexture
 
bool _dirty
 
PlayerAnimator_animator
 
map< string, string > _properties
 
struct {
   bool   debug
 
   string   focusIndex
 
   Rect   rect
 
   int   z
 
   int   zorder
 
   guint8   alpha
 
   Color   bgColor
 
   bool   visible
 
   Time   duration
 
_prop
 

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. More...
 
CefRefPtr< GingaCefClient_client
 Keep the active client instance, needed to create a new browser instance. More...
 
CefRefPtr< CefBrowser > _browser
 Keep the active browser instance. More...
 
bool _isPlaying
 Keep execution player status. More...
 

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.

Member Enumeration Documentation

enum Player::PlayerProperty
inherited
Enumerator
PROP_UNKNOWN 
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_HEIGHT 
PROP_HORZ_ALIGN 
PROP_LEFT 
PROP_LOCATION 
PROP_MUTE 
PROP_RIGHT 
PROP_SIZE 
PROP_TOP 
PROP_TRANSPARENCY 
PROP_TREBLE 
PROP_VERT_ALIGN 
PROP_VISIBLE 
PROP_VOLUME 
PROP_WIDTH 
PROP_Z_INDEX 
enum Player::PlayerState
inherited
Enumerator
SLEEPING 
OCCURRING 
PAUSED 

Constructor & Destructor Documentation

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

Default constructor for PlayerHTML.

Parameters
locationAn URI for the HTML file.
Returns
Nothing.

References _browser, _client, _handler, _isPlaying, and g_assert().

PlayerHTML::~PlayerHTML ( )
virtual

Default destructor for PlayerHTML.

Returns
Nothing.

Member Function Documentation

Player * Player::createPlayer ( Formatter formatter,
const string &  id,
const string &  uri,
const string &  mime 
)
staticinherited
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.

References _browser, _client, _handler, and _isPlaying.

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().

Referenced by play().

bool Player::doSetProperty ( PlayerProperty  ,
const string &  ,
const string &   
)
protectedvirtualinherited
string Player::getCurrentFocus ( )
staticinherited
Time Player::getDuration ( )
inherited

Referenced by Media::sendTickEvent().

bool Player::getEOS ( )
inherited
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.

Referenced by handleKeyEvent().

Player::PlayerProperty Player::getPlayerProperty ( const string &  name,
string *  defval 
)
staticinherited
string Player::getProperty ( const string &  name)
virtualinherited

Referenced by Media::sendKeyEvent().

Player::PlayerState Player::getState ( )
inherited

Referenced by Media::doStop().

Time Player::getTime ( )
inherited
void Player::getZ ( int *  z,
int *  zorder 
)
inherited

References tryset.

Referenced by Media::getZ().

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.

References _browser, and getPlayerKey().

virtual void PlayerHTML::handleTickEvent ( Time  ,
Time  ,
int   
)
inlineoverridevirtual
void Player::incTime ( Time  inc)
inherited

Referenced by Media::sendTickEvent().

bool Player::isFocused ( )
inherited
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.

References _browser.

void Player::pause ( )
virtualinherited

Reimplemented in PlayerLua, and PlayerVideo.

References g_assert(), and TRACE.

Referenced by PlayerVideo::pause().

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.

References _isPlaying, and displayJobCallbackWrapper().

void Player::redraw ( cairo_t *  cr)
virtualinherited

Reimplemented in PlayerLua, and PlayerVideo.

References GL::draw_quad(), and g_assert().

Referenced by PlayerVideo::redraw(), PlayerLua::redraw(), and Media::redraw().

void Player::reload ( )
virtualinherited

Reimplemented in PlayerText, PlayerImage, and PlayerSvg.

References TRACE.

Referenced by PlayerImage::reload(), PlayerSvg::reload(), and PlayerText::reload().

void Player::resetProperties ( )
inherited
void Player::resetProperties ( set< string > *  props)
inherited
void Player::resume ( )
virtualinherited

Reimplemented in PlayerLua, and PlayerVideo.

References g_assert(), and TRACE.

Referenced by PlayerVideo::resume().

void Player::schedulePropertyAnimation ( const string &  name,
const string &  from,
const string &  to,
Time  dur 
)
inherited

Referenced by Media::setProperty().

void Player::sendKeyEvent ( const string &  ,
bool   
)
virtualinherited

Reimplemented in PlayerLua.

References Player::_currentFocus.

Referenced by Media::sendKeyEvent().

void Player::setCurrentFocus ( const string &  index)
staticinherited

References TRACE.

Referenced by MediaSettings::setProperty().

void Player::setDuration ( Time  duration)
inherited
void Player::setEOS ( bool  eos)
inherited
void Player::setProperty ( const string &  name,
const string &  value 
)
virtualinherited
void Player::setZ ( int  z,
int  zorder 
)
inherited
void Player::start ( )
virtualinherited

Reimplemented in PlayerLua, and PlayerVideo.

References g_assert(), and TRACE.

Referenced by PlayerVideo::start(), PlayerLua::start(), and Media::startTransition().

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.

References _browser, _client, _handler, and _isPlaying.

Member Data Documentation

PlayerAnimator* Player::_animator
protectedinherited
CefRefPtr<CefBrowser> PlayerHTML::_browser
private

Keep the active browser instance.

Referenced by displayJobCallback(), handleKeyEvent(), mouseInputCallback(), PlayerHTML(), and stop().

CefRefPtr<GingaCefClient> PlayerHTML::_client
private

Keep the active client instance, needed to create a new browser instance.

Referenced by displayJobCallback(), PlayerHTML(), and stop().

bool Player::_dirty
protectedinherited
bool Player::_eos
protectedinherited
Formatter* Player::_formatter
protectedinherited
guint Player::_gltexture
protectedinherited
CefRefPtr<GingaCefHandler> PlayerHTML::_handler
private

Keep the active handler instance, needed to create a new client instance.

Referenced by displayJobCallback(), GingaCefClient::GetRenderHandler(), GingaCefClient::GingaCefClient(), PlayerHTML(), and stop().

string Player::_id
protectedinherited
bool PlayerHTML::_isPlaying
private

Keep execution player status.

Referenced by displayJobCallback(), play(), PlayerHTML(), and stop().

bool Player::_opengl
protectedinherited
struct { ... } Player::_prop
map<string, string> Player::_properties
protectedinherited
cairo_surface_t* Player::_surface
protectedinherited
Time Player::_time
protectedinherited
string Player::_uri
protectedinherited
guint8 Player::alpha
inherited
Color Player::bgColor
inherited
bool Player::debug
inherited
Time Player::duration
inherited
string Player::focusIndex
inherited
Rect Player::rect
inherited
bool Player::visible
inherited
int Player::z
inherited
int Player::zorder
inherited

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