LCOV - code coverage report
Current view: top level - nnstreamer-2.4.2/ext/nnstreamer/tensor_converter - tensor_converter_util.c (source / functions) Coverage Total Hit
Test: nnstreamer 2.4.2-0 nnstreamer/nnstreamer#eca68b8d050408568af95d831a8eef62aaee7784 Lines: 77.8 % 18 14
Test Date: 2025-03-13 05:38:21 Functions: 100.0 % 1 1

            Line data    Source code
       1              : /* SPDX-License-Identifier: LGPL-2.1-only */
       2              : /**
       3              : * @file        tensor_converter_util.h
       4              : * @date        26 May 2021
       5              : * @brief       Utility functions for NNStreamer tensor-converter subplugins.
       6              : * @see         https://github.com/nnstreamer/nnstreamer
       7              : * @author      MyungJoo Ham <myungjoo.ham@samsung.com>
       8              : * @bug         No known bugs except for NYI items
       9              : */
      10              : 
      11              : #include <glib.h>
      12              : #include <gst/gst.h>
      13              : #include <nnstreamer_log.h>
      14              : #include <nnstreamer_plugin_api.h>
      15              : #include "tensor_converter_util.h"
      16              : 
      17              : /** @brief tensor converter plugin's NNStreamerExternalConverter callback */
      18              : gboolean
      19           57 : tcu_get_out_config (const GstCaps * in_cap, GstTensorsConfig * config)
      20              : {
      21              :   GstStructure *structure;
      22           57 :   g_return_val_if_fail (config != NULL, FALSE);
      23           57 :   gst_tensors_config_init (config);
      24           57 :   g_return_val_if_fail (in_cap != NULL, FALSE);
      25              : 
      26           57 :   structure = gst_caps_get_structure (in_cap, 0);
      27           57 :   g_return_val_if_fail (structure != NULL, FALSE);
      28              : 
      29              :   /* All tensor info should be updated later in chain function. */
      30           57 :   config->info.info[0].type = _NNS_UINT8;
      31           57 :   config->info.num_tensors = 1;
      32           57 :   if (gst_tensor_parse_dimension ("1:1:1:1",
      33           57 :           config->info.info[0].dimension) == 0) {
      34            0 :     ml_loge ("Failed to set initial dimension for subplugin");
      35            0 :     return FALSE;
      36              :   }
      37              : 
      38           57 :   if (gst_structure_has_field (structure, "framerate")) {
      39           57 :     gst_structure_get_fraction (structure, "framerate", &config->rate_n,
      40           57 :         &config->rate_d);
      41              :   } else {
      42              :     /* cannot get the framerate */
      43            0 :     config->rate_n = 0;
      44            0 :     config->rate_d = 1;
      45              :   }
      46           57 :   return TRUE;
      47              : }
        

Generated by: LCOV version 2.0-1