LCOV - code coverage report
Current view: top level - nnstreamer-2.4.2/gst/datarepo - gstdatarepo.c (source / functions) Coverage Total Hit
Test: nnstreamer 2.4.2-0 nnstreamer/nnstreamer.git#5d55fc62547faa02e861af5ef93cc1c89800934a Lines: 67.9 % 28 19
Test Date: 2024-09-25 09:08:39 Functions: 75.0 % 4 3

            Line data    Source code
       1              : /* SPDX-License-Identifier: LGPL-2.1-only */
       2              : /**
       3              :  * Copyright (C) 2022 Samsung Electronics Co., Ltd.
       4              :  *
       5              :  * @file        gstdatarepo.c
       6              :  * @date        31 January 2023
       7              :  * @brief       Register datarepo plugins
       8              :  * @see         https://github.com/nnstreamer/nnstreamer
       9              :  * @author      Hyunil Park <hyunil46.park@samsung.com>
      10              :  * @bug         No known bugs except for NYI items
      11              :  */
      12              : 
      13              : #include "gstdatarepo.h"
      14              : #include "gstdatareposrc.h"
      15              : #include "gstdatareposink.h"
      16              : 
      17              : /**
      18              :  * @brief Get data type from caps.
      19              :  */
      20              : GstDataRepoDataType
      21           70 : gst_data_repo_get_data_type_from_caps (const GstCaps * caps)
      22              : {
      23              :   const gchar *name;
      24              : 
      25           70 :   g_return_val_if_fail (GST_IS_CAPS (caps), GST_DATA_REPO_DATA_UNKNOWN);
      26              : 
      27           70 :   name = gst_structure_get_name (gst_caps_get_structure (caps, 0));
      28           70 :   g_return_val_if_fail (name != NULL, GST_DATA_REPO_DATA_UNKNOWN);
      29              : 
      30           70 :   if (g_ascii_strcasecmp (name, "other/tensors") == 0) {
      31           56 :     return GST_DATA_REPO_DATA_TENSOR;
      32           14 :   } else if (g_ascii_strcasecmp (name, "video/x-raw") == 0) {
      33            3 :     return GST_DATA_REPO_DATA_VIDEO;
      34           11 :   } else if (g_ascii_strcasecmp (name, "audio/x-raw") == 0) {
      35            6 :     return GST_DATA_REPO_DATA_AUDIO;
      36            5 :   } else if (g_ascii_strcasecmp (name, "text/x-raw") == 0) {
      37            0 :     return GST_DATA_REPO_DATA_TEXT;
      38            5 :   } else if (g_ascii_strcasecmp (name, "application/octet-stream") == 0) {
      39            0 :     return GST_DATA_REPO_DATA_OCTET;
      40            5 :   } else if (g_ascii_strcasecmp (name, "image/png") == 0
      41            0 :       || g_ascii_strcasecmp (name, "image/jpeg") == 0
      42            0 :       || g_ascii_strcasecmp (name, "image/tiff") == 0
      43            0 :       || g_ascii_strcasecmp (name, "image/gif") == 0) {
      44            5 :     return GST_DATA_REPO_DATA_IMAGE;
      45              :   }
      46              : 
      47            0 :   GST_ERROR ("Could not get a data type from caps.");
      48            0 :   return GST_DATA_REPO_DATA_UNKNOWN;
      49              : }
      50              : 
      51              : /**
      52              :  * @brief The entry point of the Gstreamer datarepo plugin
      53              :  */
      54              : static gboolean
      55           23 : plugin_init (GstPlugin * plugin)
      56              : {
      57           23 :   if (!gst_element_register (plugin, "datareposrc", GST_RANK_NONE,
      58              :           GST_TYPE_DATA_REPO_SRC))
      59            0 :     return FALSE;
      60              : 
      61           23 :   if (!gst_element_register (plugin, "datareposink", GST_RANK_NONE,
      62              :           GST_TYPE_DATA_REPO_SINK))
      63            0 :     return FALSE;
      64              : 
      65           23 :   return TRUE;
      66              : }
      67              : 
      68              : #ifndef PACKAGE
      69              : #define PACKAGE "NNStreamer MLOps Data Repository Plugins"
      70              : #endif
      71              : 
      72           23 : GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
      73              :     GST_VERSION_MINOR,
      74              :     datarepo,
      75              :     "NNStreamer MLOps Data Repository plugin library",
      76              :     plugin_init, VERSION, "LGPL", PACKAGE,
      77              :     "https://github.com/nnstreamer/nnstreamer")
        

Generated by: LCOV version 2.0-1