LCOV - code coverage report
Current view: top level - nnstreamer-2.4.2/gst/mqtt - mqttcommon.h (source / functions) Coverage Total Hit
Test: nnstreamer 2.4.2-0 nnstreamer/nnstreamer.git#5d55fc62547faa02e861af5ef93cc1c89800934a Lines: 100.0 % 2 2
Test Date: 2024-09-25 09:08:39 Functions: 100.0 % 1 1

            Line data    Source code
       1              : /* SPDX-License-Identifier: LGPL-2.1-only */
       2              : /**
       3              :  * Copyright (C) 2021 Wook Song <wook16.song@samsung.com>
       4              :  */
       5              : /**
       6              :  * @file    mqttcommon.h
       7              :  * @date    08 Mar 2021
       8              :  * @brief   Common macros and utility functions for GStreamer MQTT plugins
       9              :  * @see     https://github.com/nnstreamer/nnstreamer
      10              :  * @author  Wook Song <wook16.song@samsung.com>
      11              :  * @bug     No known bugs except for NYI items
      12              :  */
      13              : 
      14              : #ifndef __GST_MQTT_COMMON_H__
      15              : #define __GST_MQTT_COMMON_H__
      16              : #include <stdint.h>
      17              : 
      18              : #ifndef UNUSED
      19              : #define UNUSED(expr) do { (void)(expr); } while (0)
      20              : #endif /* UNUSED */
      21              : 
      22              : #ifndef GST_MQTT_PACKAGE
      23              : #define GST_MQTT_PACKAGE "GStreamer MQTT Plugins"
      24              : #endif /* GST_MQTT_PACKAGE */
      25              : 
      26              : #define GST_MQTT_ELEM_NAME_SINK "mqttsink"
      27              : #define GST_MQTT_ELEM_NAME_SRC "mqttsrc"
      28              : 
      29              : #define GST_MQTT_LEN_MSG_HDR          1024
      30              : #define GST_MQTT_MAX_LEN_GST_CAPS_STR 512
      31              : /**
      32              :  * @brief GST_BUFFER_MEM_MAX in gstreamer/gstbuffer.c is 16. To represent each
      33              :  *        size of the memory block that the GstBuffer contains, GST_MQTT_MAX_NUM_MEMS
      34              :  *        should be 16.
      35              :  */
      36              : #define GST_MQTT_MAX_NUM_MEMS   16
      37              : 
      38              : #define GST_US_TO_NS_MULTIPLIER 1000
      39              : 
      40              : #define DEFAULT_MQTT_CONN_TIMEOUT_SEC 5
      41              : 
      42              : /**
      43              :  * @brief Defined a custom data type, GstMQTTMessageHdr
      44              :  *
      45              :  * GstMQTTMessageHdr contains the information needed to parse the message data
      46              :  * at the subscriber side and is prepended to the original message data at the
      47              :  * publisher side.
      48              :  */
      49              : typedef struct _GstMQTTMessageHdr {
      50              :   union {
      51              :     struct {
      52              :       guint num_mems;
      53              :       gsize size_mems[GST_MQTT_MAX_NUM_MEMS];
      54              :       gint64 base_time_epoch;
      55              :       gint64 sent_time_epoch;
      56              :       GstClockTime duration;
      57              :       GstClockTime dts;
      58              :       GstClockTime pts;
      59              :       gchar gst_caps_str[GST_MQTT_MAX_LEN_GST_CAPS_STR];
      60              :     };
      61              :     guint8 _reserved_hdr[GST_MQTT_LEN_MSG_HDR];
      62              :   };
      63              : } GstMQTTMessageHdr;
      64              : 
      65              : typedef int64_t (*mqtt_get_unix_epoch)(uint32_t, char **, uint16_t *);
      66              : 
      67              : /**
      68              :  * @brief A wrapper function of g_get_real_time () to assign it to the function
      69              :  * pointer, mqtt_get_unix_epoch
      70              :  */
      71           32 : static inline int64_t default_mqtt_get_unix_epoch (uint32_t hnum, char **hnames,
      72              :     uint16_t *hports)
      73              : {
      74              :   UNUSED (hnum);
      75              :   UNUSED (hnames);
      76              :   UNUSED (hports);
      77           32 :   return g_get_real_time ();
      78              : }
      79              : 
      80              : #endif /* !__GST_MQTT_COMMON_H__ */
        

Generated by: LCOV version 2.0-1