Skip to main content

SimaaiGstErrors.h File

Structured error/warning helpers for SiMa's GStreamer plugins. More...

Included Headers

#include <gst/gst.h> #include <cstdarg> #include <cstdint> #include <cstdio> #include <sstream> #include <string> #include <vector>

Classes Index

structSimaaiGstErrorContext

Bag of diagnostic fields used to build SiMa GStreamer error/warning messages. More...

Functions Index

const char *simaai_gst_safe (const char *s)

Returns s if non-null, or the empty string if null. Convenience for printf-style sites. More...

voidsimaai_gst_append_kv (std::ostringstream &ss, const char *key, const char *value)

Append ‘key='value`(space-prefixed if not the first entry) whenvalue` is non-empty. More...

voidsimaai_gst_append_kv_required (std::ostringstream &ss, const char *key, const char *value)

Append ‘key='value`always, substituting empty string whenvalue` is null. More...

voidsimaai_gst_append_kv_int (std::ostringstream &ss, const char *key, std::int64_t value)

Append key=<value> (unquoted, integer). More...

std::stringsimaai_gst_format_context (const SimaaiGstErrorContext &ctx)

Format an entire SimaaiGstErrorContext as a single key-value line. More...

std::stringsimaai_gst_format_detail (const SimaaiGstErrorContext &ctx, const char *detail)

Format ctx and append a ‘detail=`...'field ifdetail` is non-empty. More...

std::stringsimaai_gst_vformat (const char *fmt, va_list ap)

vsnprintf-into-string helper used by the *detailf formatters; returns empty on null/empty fmt. More...

std::stringsimaai_gst_format_detailf (const SimaaiGstErrorContext &ctx, const char *fmt,...)

printf-style variant of simaai_gst_format_detail. More...

Macro Definitions Index

#defineSIMAAI_GST_FATAL(self, domain, code, summary, detail)   ...

Post a fatal error on the GStreamer bus and log it via GST_ERROR_OBJECT. More...

#defineSIMAAI_GST_WARN(self, summary, detail)   ...

Log a non-fatal warning via GST_WARNING_OBJECT, optionally with a detail suffix. More...

Description

Structured error/warning helpers for SiMa's GStreamer plugins.

Provides a SimaaiGstErrorContext struct gathering the diagnostic fields plugins carry around (plugin/node names, graph and frame ids, stream id, caps, dims, allocator, etc.) plus a small set of inline formatters that turn that context into a stable, key-value-formatted line. The SIMAAI_GST_FATAL and SIMAAI_GST_WARN macros are the standard call sites that route a formatted message into both the GStreamer logging subsystem and an element-level error message.

This header is consumed by SiMa's GStreamer plugin sources directly; framework code sees the resulting bus messages via GstBusWatch.h.

Functions

simaai_gst_append_kv()

void simaai_gst_append_kv (std::ostringstream & ss, const char * key, const char * value)
inline

Append ‘key='value`(space-prefixed if not the first entry) whenvalue` is non-empty.

Definition at line 62 of file SimaaiGstErrors.h.

simaai_gst_append_kv_int()

void simaai_gst_append_kv_int (std::ostringstream & ss, const char * key, std::int64_t value)
inline

Append key=<value> (unquoted, integer).

Definition at line 79 of file SimaaiGstErrors.h.

simaai_gst_append_kv_required()

void simaai_gst_append_kv_required (std::ostringstream & ss, const char * key, const char * value)
inline

Append ‘key='value`always, substituting empty string whenvalue` is null.

Definition at line 71 of file SimaaiGstErrors.h.

simaai_gst_format_context()

std::string simaai_gst_format_context (const SimaaiGstErrorContext & ctx)
inline

Format an entire SimaaiGstErrorContext as a single key-value line.

Returns

Space-separated ‘key='value`(orkey=N`) pairs; null/empty values are skipped.

Definition at line 89 of file SimaaiGstErrors.h.

simaai_gst_format_detail()

std::string simaai_gst_format_detail (const SimaaiGstErrorContext & ctx, const char * detail)
inline

Format ctx and append a ‘detail=`...'field ifdetail` is non-empty.

Parameters
ctx

Diagnostic context to format.

detail

Free-form detail string (may be null/empty).

Definition at line 123 of file SimaaiGstErrors.h.

simaai_gst_format_detailf()

std::string simaai_gst_format_detailf (const SimaaiGstErrorContext & ctx, const char * fmt, ...)
inline

printf-style variant of simaai_gst_format_detail.

Formats fmt and the variadic args into a detail string, then appends it to the formatted context line.

Definition at line 155 of file SimaaiGstErrors.h.

simaai_gst_safe()

const char * simaai_gst_safe (const char * s)
inline

Returns s if non-null, or the empty string if null. Convenience for printf-style sites.

Definition at line 57 of file SimaaiGstErrors.h.

simaai_gst_vformat()

std::string simaai_gst_vformat (const char * fmt, va_list ap)
inline

vsnprintf-into-string helper used by the *detailf formatters; returns empty on null/empty fmt.

Definition at line 135 of file SimaaiGstErrors.h.

Macro Definitions

SIMAAI_GST_FATAL

#define SIMAAI_GST_FATAL(self, domain, code, summary, detail)   ...

Post a fatal error on the GStreamer bus and log it via GST_ERROR_OBJECT.

Value
do { \ GST_ERROR_OBJECT((self), "%s", (summary)); \ gst_element_message_full(GST_ELEMENT(self), GST_MESSAGE_ERROR, (domain), (code), \ g_strdup(summary), g_strdup((detail) ? (detail) : ""), __FILE__, \ G_STRFUNC, __LINE__); \ } while (0)
Parameters
self

GstElement-like pointer the message is attributed to.

domain

GError domain for the message.

code

GError code within domain.

summary

Short, user-facing summary string.

detail

Detail string (may be empty); attached as the message's debug field.

Definition at line 172 of file SimaaiGstErrors.h.

SIMAAI_GST_WARN

#define SIMAAI_GST_WARN(self, summary, detail)   ...

Log a non-fatal warning via GST_WARNING_OBJECT, optionally with a detail suffix.

Value
do { \ if ((detail) && *(detail)) { \ GST_WARNING_OBJECT((self), "%s | %s", (summary), (detail)); \ } else { \ GST_WARNING_OBJECT((self), "%s", (summary)); \ } \ } while (0)
Parameters
self

GstElement-like pointer the warning is attributed to.

summary

Short summary string.

detail

Detail string; if non-empty it's appended after a | separator.

Definition at line 186 of file SimaaiGstErrors.h.


Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.9.8.