28 #define GINGA_PRAGMA_DIAG PRAGMA_DIAG 29 #define GINGA_PRAGMA_DIAG_PUSH PRAGMA_DIAG_PUSH 30 #define GINGA_PRAGMA_DIAG_POP PRAGMA_DIAG_POP 31 #define GINGA_PRAGMA_DIAG_IGNORE PRAGMA_DIAG_IGNORE 32 #define GINGA_PRAGMA_DIAG_WARNING PRAGMA_DIAG_WARNING 44 #include <gst/app/gstappsink.h> 46 #include <gst/video/video.h> 61 #define GINGA_NAMESPACE_BEGIN namespace ginga { 62 #define GINGA_NAMESPACE_END } 68 #define unused(...) G_GNUC_UNUSED __VA_ARGS__ 71 #define cast(a, b) (dynamic_cast<a>((b))) 72 #define instanceof(a, b) (cast (a,(b)) != nullptr) 74 #define tryinsert(a, b, fn) \ 75 (std::count ((b).begin (), (b).end (), (a)) == 0) \ 76 ? ((b).fn (a), true) : false 78 #define MAP_GET_IMPL(m, a, b) \ 81 auto it = (m).find ((a)); \ 82 if (it == (m).end ()) \ 84 tryset ((b), it->second); \ 89 #define MAP_SET_IMPL(m, a, b) \ 92 auto it = (m).find ((a)); \ 94 return it == (m).end (); \ 99 #define GINGA_STRFUNC (__ginga_strfunc (G_STRFUNC)).c_str () 101 #define __ginga_log(fn, fmt, ...)\ 102 fn ("%s: " fmt, GINGA_STRFUNC, ## __VA_ARGS__) 104 #define TRACE(fmt, ...) __ginga_log (g_debug, fmt, ## __VA_ARGS__) 105 #define WARNING(fmt, ...) __ginga_log (g_warning, fmt, ## __VA_ARGS__) 106 #define ERROR(fmt, ...) __ginga_log (g_error, fmt, ## __VA_ARGS__) 107 #define CRITICAL(fmt, ...) __ginga_log (g_critical, fmt, ## __VA_ARGS__) 109 #define ERROR_NOT_IMPLEMENTED(fmt, ...)\ 110 ERROR ("not implemented: " fmt, ## __VA_ARGS__) 118 #define GINGA_TIME_NONE GST_CLOCK_TIME_NONE 119 #define GINGA_TIME_IS_VALID(t) GST_CLOCK_TIME_IS_VALID ((t)) 120 #define GINGA_STIME_NONE GST_CLOCK_STIME_NONE 121 #define GINGA_STIME_IS_VALID(t) GST_CLOCK_STIME_IS_VALID ((t)) 122 #define GINGA_SECOND GST_SECOND 123 #define GINGA_MSECOND GST_MSECOND 124 #define GINGA_USECOND GST_USECOND 125 #define GINGA_NSECOND GST_NSECOND 126 #define GINGA_TIME_AS_SECONDS(t) GST_TIME_AS_SECONDS ((t)) 127 #define GINGA_TIME_AS_MSECONDS(t) GST_TIME_AS_MSECONDS ((t)) 128 #define GINGA_TIME_AS_USECONDS(t) GST_TIME_AS_USECONDS ((t)) 129 #define GINGA_TIME_AS_NSECONDS(t) GST_TIME_AS_NSECONDS ((t)) 130 #define GINGA_TIME_DIFF(s,e) GST_CLOCK_DIFF ((s), (e)) 131 #define GINGA_TIME_FORMAT GST_TIME_FORMAT 132 #define GINGA_TIME_ARGS(t) GST_TIME_ARGS ((t)) 133 #define GINGA_STIME_FORMAT GST_STIME_FORMAT 134 #define GINGA_STIME_ARGS(t) GST_STIME_ARGS ((t)) 143 bool try_parse_list (
const string &,
char,
size_t,
size_t, list<string> *);
144 list<string>
parse_list (
const string &,
char,
size_t,
size_t);
153 bool _xstrtod (
const string &,
double *);
154 bool _xstrtoll (
const string &, gint64 *, guint);
155 bool _xstrtoull (
const string &, guint64 *, guint);
156 double xstrtod (
const string &);
166 #define xstrcaseeq(s1, s2) (xstrcasecmp ((s1), (s2)) == 0) 172 list<
string>
xstrsplit (const
string &,
char);
180 string xpathbuild (const
string &, const
string &);
190 bool getData (
const string &,
void **);
193 map<string,pair<void *, void (*)(void *)>>
_udata;
197 using namespace ginga;
199 #endif // AUX_GINGA_H GdkRGBA Color
Definition: aux-ginga.h:113
#define GINGA_PRAGMA_DIAG_PUSH
Definition: aux-ginga.h:29
list< string > parse_list(const string &, char, size_t, size_t)
Definition: aux-ginga.cpp:186
#define GINGA_PRAGMA_DIAG_POP
Definition: aux-ginga.h:30
Color parse_color(const string &)
string __ginga_strfunc(const string &)
Parses G_STRFUNC string to generate a log prefix.
Definition: aux-ginga.cpp:32
gint64 xstrtoint64(const string &, guint8)
string xpathdirname(string)
Returns the dirname of path.
Definition: aux-ginga.cpp:516
bool parse_bool(const string &)
guint64 xstrtouint64(const string &, guint8)
bool try_parse_bool(const string &, bool *)
Parses boolean string.
Definition: aux-ginga.cpp:58
string xpathbuildabs(const string &, const string &)
Builds an absolute path from the given components.
Definition: aux-ginga.cpp:577
int parse_percent(const string &, int, int, int)
Parses number or percent string to an integer.
Definition: aux-ginga.cpp:203
bool xpathisabs(const string &)
Checks if path is absolute.
Definition: aux-ginga.cpp:528
bool xstrhassuffix(const string &, const string &)
Tests string suffix.
Definition: aux-ginga.cpp:411
guint8 parse_pixel(const string &)
Parses pixel string to an integer.
Definition: aux-ginga.cpp:227
int G_GNUC_PRINTF(2, 3) xstrassign(string &
#define GINGA_NAMESPACE_END
Definition: aux-ginga.h:62
string xstrbuild(const char *format,...)
Builds string from format.
Definition: aux-ginga.cpp:447
int const char string string xstrstrip(string)
Removes leading and trailing whitespace from string.
Definition: aux-ginga.cpp:470
guint8 xstrtouint8(const string &, guint8)
bool xpathisuri(const string &)
Checks if path is an URI.
Definition: aux-ginga.cpp:537
int xstrassign(string &s, const char *format,...)
Assigns format to string.
Definition: aux-ginga.cpp:423
#define GINGA_PRAGMA_DIAG_IGNORE
Definition: aux-ginga.h:31
gint xstrtoint(const string &, guint8)
Definition: aux-ginga.h:185
int xstrcasecmp(const string &, const string &)
Compares two strings ignoring case.
Definition: aux-ginga.cpp:387
#define GINGA_END_DECLS
Definition: ginga.h:26
double xstrtod(const string &)
Definition: aux-ginga.cpp:304
string xpathbasename(string)
Returns the basename of path.
Definition: aux-ginga.cpp:504
bool try_parse_time(const string &, Time *)
Definition: aux-ginga.cpp:134
bool try_parse_color(const string &, Color *)
Parses color string.
Definition: aux-ginga.cpp:83
Time parse_time(const string &)
#define GINGA_NAMESPACE_BEGIN
Definition: aux-ginga.h:61
#define GINGA_BEGIN_DECLS
Definition: ginga.h:25
bool _xstrtoull(const string &, guint64 *, guint)
Converts string to an unsigned 64-bit integer.
Definition: aux-ginga.cpp:287
void(* UserDataCleanFunc)(void *)
Definition: aux-ginga.h:184
gint8 xstrtoint8(const string &, guint8)
double xstrtodorpercent(const string &, bool *)
Converts number or percent string to floating-point number.
Definition: aux-ginga.cpp:364
guint xstrtouint(const string &, guint8)
bool try_parse_list(const string &, char, size_t, size_t, list< string > *)
Parses list of string items.
Definition: aux-ginga.cpp:107
map< string, pair< void *, void(*)(void *)> > _udata
Definition: aux-ginga.h:193
bool _xstrtod(const string &, double *)
Converts string to a floating-point number.
Definition: aux-ginga.cpp:241
bool _xstrtoll(const string &, gint64 *, guint)
Converts string to a 64-bit integer.
Definition: aux-ginga.cpp:264
bool xstrhasprefix(const string &, const string &)
Tests string prefix.
Definition: aux-ginga.cpp:399
GdkRectangle Rect
Definition: aux-ginga.h:114
string xpathbuild(const string &, const string &)
Builds a path from the given components.
Definition: aux-ginga.cpp:564
GstClockTime Time
Definition: aux-ginga.h:115
bool xstrispercent(const string &)
Checks if string is a percent value.
Definition: aux-ginga.cpp:343
list< string > xstrsplit(const string &, char)
Splits strings according to separator.
Definition: aux-ginga.cpp:485
string xpathmakeabs(string)
Makes path absolute.
Definition: aux-ginga.cpp:547