Ginga  0.13.6.1771-df200
The iTV middleware.
aux-ginga.h File Reference
#include "ginga.h"
#include <config.h>
#include "aux-glib.h"
#include <math.h>
#include <stdlib.h>
#include <gdk/gdk.h>
#include <gst/app/gstappsink.h>
#include <gst/gst.h>
#include <gst/video/video.h>
#include <algorithm>
#include <list>
#include <map>
#include <set>
#include <string>
#include <vector>
Include dependency graph for aux-ginga.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  UserData
 

Macros

#define GINGA_PRAGMA_DIAG   PRAGMA_DIAG
 
#define GINGA_PRAGMA_DIAG_PUSH   PRAGMA_DIAG_PUSH
 
#define GINGA_PRAGMA_DIAG_POP   PRAGMA_DIAG_POP
 
#define GINGA_PRAGMA_DIAG_IGNORE   PRAGMA_DIAG_IGNORE
 
#define GINGA_PRAGMA_DIAG_WARNING   PRAGMA_DIAG_WARNING
 
#define GINGA_NAMESPACE_BEGIN   namespace ginga {/*}*/
 
#define GINGA_NAMESPACE_END   /*{*/}
 
#define unused(...)   G_GNUC_UNUSED __VA_ARGS__
 
#define cast(a, b)   (dynamic_cast<a>((b)))
 
#define instanceof(a, b)   (cast (a,(b)) != nullptr)
 
#define tryinsert(a, b, fn)
 
#define MAP_GET_IMPL(m, a, b)
 
#define MAP_SET_IMPL(m, a, b)
 
#define GINGA_STRFUNC   (__ginga_strfunc (G_STRFUNC)).c_str ()
 
#define __ginga_log(fn, fmt, ...)   fn ("%s: " fmt, GINGA_STRFUNC, ## __VA_ARGS__)
 
#define TRACE(fmt, ...)   __ginga_log (g_debug, fmt, ## __VA_ARGS__)
 
#define WARNING(fmt, ...)   __ginga_log (g_warning, fmt, ## __VA_ARGS__)
 
#define ERROR(fmt, ...)   __ginga_log (g_error, fmt, ## __VA_ARGS__)
 
#define CRITICAL(fmt, ...)   __ginga_log (g_critical, fmt, ## __VA_ARGS__)
 
#define ERROR_NOT_IMPLEMENTED(fmt, ...)   ERROR ("not implemented: " fmt, ## __VA_ARGS__)
 
#define GINGA_TIME_NONE   GST_CLOCK_TIME_NONE
 
#define GINGA_TIME_IS_VALID(t)   GST_CLOCK_TIME_IS_VALID ((t))
 
#define GINGA_STIME_NONE   GST_CLOCK_STIME_NONE
 
#define GINGA_STIME_IS_VALID(t)   GST_CLOCK_STIME_IS_VALID ((t))
 
#define GINGA_SECOND   GST_SECOND
 
#define GINGA_MSECOND   GST_MSECOND
 
#define GINGA_USECOND   GST_USECOND
 
#define GINGA_NSECOND   GST_NSECOND
 
#define GINGA_TIME_AS_SECONDS(t)   GST_TIME_AS_SECONDS ((t))
 
#define GINGA_TIME_AS_MSECONDS(t)   GST_TIME_AS_MSECONDS ((t))
 
#define GINGA_TIME_AS_USECONDS(t)   GST_TIME_AS_USECONDS ((t))
 
#define GINGA_TIME_AS_NSECONDS(t)   GST_TIME_AS_NSECONDS ((t))
 
#define GINGA_TIME_DIFF(s, e)   GST_CLOCK_DIFF ((s), (e))
 
#define GINGA_TIME_FORMAT   GST_TIME_FORMAT
 
#define GINGA_TIME_ARGS(t)   GST_TIME_ARGS ((t))
 
#define GINGA_STIME_FORMAT   GST_STIME_FORMAT
 
#define GINGA_STIME_ARGS(t)   GST_STIME_ARGS ((t))
 
#define xstrcaseeq(s1, s2)   (xstrcasecmp ((s1), (s2)) == 0)
 

Typedefs

typedef GdkRGBA Color
 
typedef GdkRectangle Rect
 
typedef GstClockTime Time
 
typedef void(* UserDataCleanFunc) (void *)
 

Functions

string __ginga_strfunc (const string &)
 Parses G_STRFUNC string to generate a log prefix. More...
 
bool try_parse_bool (const string &, bool *)
 Parses boolean string. More...
 
bool parse_bool (const string &)
 
bool try_parse_color (const string &, Color *)
 Parses color string. More...
 
Color parse_color (const string &)
 
bool try_parse_list (const string &, char, size_t, size_t, list< string > *)
 Parses list of string items. More...
 
list< string > parse_list (const string &, char, size_t, size_t)
 
bool try_parse_time (const string &, Time *)
 
Time parse_time (const string &)
 
int parse_percent (const string &, int, int, int)
 Parses number or percent string to an integer. More...
 
guint8 parse_pixel (const string &)
 Parses pixel string to an integer. More...
 
bool _xstrtod (const string &, double *)
 Converts string to a floating-point number. More...
 
bool _xstrtoll (const string &, gint64 *, guint)
 Converts string to a 64-bit integer. More...
 
bool _xstrtoull (const string &, guint64 *, guint)
 Converts string to an unsigned 64-bit integer. More...
 
double xstrtod (const string &)
 
gint xstrtoint (const string &, guint8)
 
gint8 xstrtoint8 (const string &, guint8)
 
gint64 xstrtoint64 (const string &, guint8)
 
guint xstrtouint (const string &, guint8)
 
guint8 xstrtouint8 (const string &, guint8)
 
guint64 xstrtouint64 (const string &, guint8)
 
bool xstrispercent (const string &)
 Checks if string is a percent value. More...
 
double xstrtodorpercent (const string &, bool *)
 Converts number or percent string to floating-point number. More...
 
int xstrcasecmp (const string &, const string &)
 Compares two strings ignoring case. More...
 
bool xstrhasprefix (const string &, const string &)
 Tests string prefix. More...
 
bool xstrhassuffix (const string &, const string &)
 Tests string suffix. More...
 
int G_GNUC_PRINTF (2, 3) xstrassign(string &
 
int const char string G_GNUC_PRINTF (1, 2) xstrbuild(const char *
 
int const char string string xstrstrip (string)
 Removes leading and trailing whitespace from string. More...
 
list< string > xstrsplit (const string &, char)
 Splits strings according to separator. More...
 
string xpathbasename (string)
 Returns the basename of path. More...
 
string xpathdirname (string)
 Returns the dirname of path. More...
 
bool xpathisabs (const string &)
 Checks if path is absolute. More...
 
bool xpathisuri (const string &)
 Checks if path is an URI. More...
 
string xpathmakeabs (string)
 Makes path absolute. More...
 
string xpathbuild (const string &, const string &)
 Builds a path from the given components. More...
 
string xpathbuildabs (const string &, const string &)
 Builds an absolute path from the given components. More...
 

Macro Definition Documentation

#define __ginga_log (   fn,
  fmt,
  ... 
)    fn ("%s: " fmt, GINGA_STRFUNC, ## __VA_ARGS__)
#define CRITICAL (   fmt,
  ... 
)    __ginga_log (g_critical, fmt, ## __VA_ARGS__)
#define ERROR_NOT_IMPLEMENTED (   fmt,
  ... 
)    ERROR ("not implemented: " fmt, ## __VA_ARGS__)
#define GINGA_MSECOND   GST_MSECOND
#define GINGA_NAMESPACE_BEGIN   namespace ginga {/*}*/
#define GINGA_NSECOND   GST_NSECOND
#define GINGA_PRAGMA_DIAG   PRAGMA_DIAG
#define GINGA_PRAGMA_DIAG_IGNORE   PRAGMA_DIAG_IGNORE
#define GINGA_PRAGMA_DIAG_POP   PRAGMA_DIAG_POP
#define GINGA_PRAGMA_DIAG_PUSH   PRAGMA_DIAG_PUSH
#define GINGA_PRAGMA_DIAG_WARNING   PRAGMA_DIAG_WARNING
#define GINGA_SECOND   GST_SECOND
#define GINGA_STIME_ARGS (   t)    GST_STIME_ARGS ((t))
#define GINGA_STIME_FORMAT   GST_STIME_FORMAT
#define GINGA_STIME_IS_VALID (   t)    GST_CLOCK_STIME_IS_VALID ((t))
#define GINGA_STIME_NONE   GST_CLOCK_STIME_NONE
#define GINGA_STRFUNC   (__ginga_strfunc (G_STRFUNC)).c_str ()
#define GINGA_TIME_ARGS (   t)    GST_TIME_ARGS ((t))
#define GINGA_TIME_AS_MSECONDS (   t)    GST_TIME_AS_MSECONDS ((t))
#define GINGA_TIME_AS_NSECONDS (   t)    GST_TIME_AS_NSECONDS ((t))
#define GINGA_TIME_AS_SECONDS (   t)    GST_TIME_AS_SECONDS ((t))
#define GINGA_TIME_AS_USECONDS (   t)    GST_TIME_AS_USECONDS ((t))
#define GINGA_TIME_DIFF (   s,
 
)    GST_CLOCK_DIFF ((s), (e))
#define GINGA_TIME_FORMAT   GST_TIME_FORMAT
#define GINGA_TIME_IS_VALID (   t)    GST_CLOCK_TIME_IS_VALID ((t))
#define GINGA_USECOND   GST_USECOND
#define MAP_GET_IMPL (   m,
  a,
 
)
Value:
G_STMT_START \
{ \
auto it = (m).find ((a)); \
if (it == (m).end ()) \
return false; \
tryset ((b), it->second); \
return true; \
} \
G_STMT_END \
#define tryset(p, x)
Definition: aux-glib.h:30

Referenced by NclBind::getParameter(), and Event::getParameter().

#define MAP_SET_IMPL (   m,
  a,
 
)
Value:
G_STMT_START \
{ \
auto it = (m).find ((a)); \
(m)[(a)] = (b); \
return it == (m).end (); \
} \
G_STMT_END

Referenced by NclBind::setParameter(), and Event::setParameter().

#define tryinsert (   a,
  b,
  fn 
)
Value:
(std::count ((b).begin (), (b).end (), (a)) == 0) \
? ((b).fn (a), true) : false

Referenced by Object::addAlias(), Composition::addChild(), NclContext::addLink(), and Context::addPort().

#define unused (   ...)    G_GNUC_UNUSED __VA_ARGS__
#define WARNING (   fmt,
  ... 
)    __ginga_log (g_warning, fmt, ## __VA_ARGS__)
#define xstrcaseeq (   s1,
  s2 
)    (xstrcasecmp ((s1), (s2)) == 0)

Typedef Documentation

typedef GdkRGBA Color
typedef GdkRectangle Rect
typedef GstClockTime Time
typedef void(* UserDataCleanFunc) (void *)

Function Documentation

string __ginga_strfunc ( const string &  strfunc)

Parses G_STRFUNC string to generate a log prefix.

Parameters
strfuncString generated by G_STRFUNC macro.
Returns
Log prefix.

References g_assert().

bool _xstrtod ( const string &  s,
double *  dp 
)

Converts string to a floating-point number.

Parameters
sNumber string.
dpVariable to store the resulting floating-point number.
Returns
True if successful, or false otherwise.

References c_str, and tryset.

Referenced by xstrtod().

bool _xstrtoll ( const string &  s,
gint64 *  ip,
guint  base 
)

Converts string to a 64-bit integer.

Parameters
sNumber string.
ipVariable to store the resulting integer.
baseThe base to be used in the conversion.
Returns
True if successful, or false otherwise.

References c_str, and tryset.

bool _xstrtoull ( const string &  s,
guint64 *  ip,
guint  base 
)

Converts string to an unsigned 64-bit integer.

Parameters
sNumber string.
ipVariable to store the resulting unsigned integer.
baseThe base to be used in the conversion.
Returns
True if successful, or false otherwise.

References c_str, and tryset.

int G_GNUC_PRINTF ( ,
 
)
int const char string G_GNUC_PRINTF ( ,
 
) const
bool parse_bool ( const string &  )
Color parse_color ( const string &  )
list<string> parse_list ( const string &  ,
char  ,
size_t  ,
size_t   
)

References ERROR, try_parse_list(), and unlikely.

Referenced by PlayerAnimator::schedule().

int parse_percent ( const string &  s,
int  base,
int  min,
int  max 
)

Parses number or percent string to an integer.

Parameters
sNumber or percent string.
baseBase value used to convert percent to integer.
minMinimum resulting integer.
maxMaximum resulting integer.
Returns
The resulting integer.

References xstrtodorpercent().

Referenced by PlayerAnimator::doSchedule(), Player::doSetProperty(), parse_pixel(), ParserXercesC::parseRegion(), and ParserState::pushRegion().

guint8 parse_pixel ( const string &  s)

Parses pixel string to an integer.

Parameters
sPixel string.
Returns
The resulting integer.

References parse_percent().

Referenced by Player::doSetProperty().

bool try_parse_bool ( const string &  s,
bool *  result 
)

Parses boolean string.

Parameters
sBoolean string.
resultVariable to store the resulting boolean.
Returns
True if successful, or false otherwise.

References tryset, and xstrcaseeq.

Referenced by parser_syntax_parse_bool().

bool try_parse_color ( const string &  s,
Color result 
)

Parses color string.

Parameters
sColor string.
resultVariable to store the resulting color.
Returns
True if successful, or false otherwise.

References tryset.

Referenced by PlayerText::doSetProperty().

bool try_parse_list ( const string &  s,
char  sep,
size_t  min,
size_t  max,
list< string > *  result 
)

Parses list of string items.

Parameters
sList string.
sepSeparator.
minMinimum number of items.
maxMaximum number of items.
resultVariable to store the resulting items.
Returns
True if successful, or false otherwise.

References n, xstrsplit(), and xstrstrip().

Referenced by Player::doSetProperty(), and parse_list().

bool try_parse_time ( const string &  s,
Time result 
)

Parses time string ("Ns" or "NN:NN:NN").

Parameters
sTime string.
resultVariable to store the resulting time.
Returns
True if successful, or false otherwise.

References g_free(), GINGA_SECOND, and tryset.

string xpathbasename ( string  )

Returns the basename of path.

References g_free().

Referenced by Player::redrawDebuggingInfo().

string xpathbuild ( const string &  ,
const string &   
)

Builds a path from the given components.

References g_free().

Referenced by xpathbuildabs().

string xpathbuildabs ( const string &  ,
const string &   
)

Builds an absolute path from the given components.

References xpathbuild(), and xpathmakeabs().

Referenced by ncl_push_media(), ParserXercesC::parse1(), ParserXercesC::parseImportBase(), ParserXercesC::parseMedia(), and ParserState::pushMedia().

string xpathdirname ( string  )
bool xpathisabs ( const string &  )
bool xpathisuri ( const string &  )

Checks if path is an URI.

References g_free().

Referenced by ncl_push_media(), ParserXercesC::parse1(), ParserXercesC::parseMedia(), and ParserState::pushMedia().

string xpathmakeabs ( string  )

Makes path absolute.

References g_free(), and xpathisabs().

Referenced by ParserXercesC::parse0(), and xpathbuildabs().

int xstrcasecmp ( const string &  s1,
const string &  s2 
)

Compares two strings ignoring case.

Parameters
s1First string.
s2Second string.
Returns
-1, 0, or 1
bool xstrhasprefix ( const string &  s,
const string &  prefix 
)

Tests string prefix.

Parameters
sString.
prefixPrefix.
Returns
True if successful, or false otherwise.

Referenced by Player::createPlayer(), parser_syntax_reserved_role_table_index(), and Media::sendKeyEvent().

bool xstrhassuffix ( const string &  s,
const string &  suffix 
)

Tests string suffix.

Parameters
sString.
suffixSuffix.
Returns
True if successful, or false otherwise.
bool xstrispercent ( const string &  s)

Checks if string is a percent value.

Parameters
sValue string.
Returns
True if successful, or false otherwise.
list<string> xstrsplit ( const string &  s,
char  sep 
)

Splits strings according to separator.

Parameters
sString.
sepSeparator.
Returns
The resulting vector.

Referenced by try_parse_list().

int const char string string xstrstrip ( string  )

Removes leading and trailing whitespace from string.

References g_free().

Referenced by Parser::parseBuffer(), Parser::parseFile(), and try_parse_list().

double xstrtod ( const string &  )

References _xstrtod(), and g_assert().

double xstrtodorpercent ( const string &  s,
bool *  perc 
)

Converts number or percent string to floating-point number.

Parameters
sNumber or percent string.
percVariable to store whether the converted value is a number or percent value.
Returns
The resulting number.

References tryset.

Referenced by PlayerVideo::doSetProperty(), and parse_percent().

gint xstrtoint ( const string &  ,
guint8   
)
gint64 xstrtoint64 ( const string &  ,
guint8   
)
gint8 xstrtoint8 ( const string &  ,
guint8   
)
guint xstrtouint ( const string &  ,
guint8   
)
guint64 xstrtouint64 ( const string &  ,
guint8   
)
guint8 xstrtouint8 ( const string &  ,
guint8   
)