LCOV - code coverage report
Current view: top level - source - RialtoGSteamerPlugin.cpp (source / functions) Coverage Total Hit
Test: coverage.info Lines: 81.8 % 22 18
Test Date: 2025-06-24 14:11:58 Functions: 50.0 % 2 1

            Line data    Source code
       1              : /*
       2              :  * Copyright (C) 2022 Sky UK
       3              :  *
       4              :  * This library is free software; you can redistribute it and/or
       5              :  * modify it under the terms of the GNU Lesser General Public
       6              :  * License as published by the Free Software Foundation;
       7              :  * version 2.1 of the License.
       8              :  *
       9              :  * This library is distributed in the hope that it will be useful,
      10              :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      11              :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
      12              :  * Lesser General Public License for more details.
      13              :  *
      14              :  * You should have received a copy of the GNU Lesser General Public
      15              :  * License along with this library; if not, write to the Free Software
      16              :  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
      17              :  */
      18              : 
      19              : #include "GstreamerCatLog.h"
      20              : #include "RialtoGStreamerMSEAudioSink.h"
      21              : #include "RialtoGStreamerMSESubtitleSink.h"
      22              : #include "RialtoGStreamerMSEVideoSink.h"
      23              : #include "RialtoGStreamerWebAudioSink.h"
      24              : #include <cstring>
      25              : #include <limits>
      26              : 
      27            1 : static gboolean rialto_mse_sinks_init(GstPlugin *plugin)
      28              : {
      29            1 :     init_gst_debug_category();
      30              : 
      31            1 :     const char kSrcRev[] = SRCREV;
      32            1 :     const char kTags[] = TAGS;
      33              : 
      34              :     if (std::strlen(kSrcRev) > 0)
      35              :     {
      36              :         if (std::strlen(kTags) > 0)
      37              :         {
      38              :             GST_INFO("Release Tag(s): %s (Commit ID: %s)", kTags, kSrcRev);
      39              :         }
      40              :         else
      41              :         {
      42            1 :             GST_INFO("Release Tag(s): No Release Tags! (Commit ID: %s)", kSrcRev);
      43              :         }
      44              :     }
      45              :     else
      46              :     {
      47              :         GST_WARNING("Failed to get git commit ID!");
      48              :     }
      49              : 
      50            1 :     const char *socketPathStr = getenv("RIALTO_SOCKET_PATH");
      51            1 :     guint sinkRank = socketPathStr ? std::numeric_limits<int>::max() : 0;
      52              : 
      53            1 :     const char *sinkRankStr = getenv("RIALTO_SINKS_RANK");
      54            1 :     if (sinkRankStr)
      55              :     {
      56              :         char *end;
      57            1 :         unsigned long val = strtoul(sinkRankStr, &end, 10);
      58            1 :         if (*end != '\0' || errno == ERANGE)
      59            0 :             GST_WARNING("Failed to parse 'RIALTO_SINKS_RANK' env variable - '%s'", sinkRankStr);
      60              :         else
      61            1 :             sinkRank = val;
      62              :     }
      63              : 
      64            1 :     if (sinkRank == 0)
      65              :     {
      66            0 :         GST_INFO("sinkRank has a value of 0");
      67            0 :         return true;
      68              :     }
      69              : 
      70            1 :     GST_INFO("Registering plugins with rank %u", sinkRank);
      71              : 
      72            1 :     return gst_element_register(plugin, "rialtomsevideosink", sinkRank, RIALTO_TYPE_MSE_VIDEO_SINK) &&
      73            1 :            gst_element_register(plugin, "rialtomseaudiosink", sinkRank, RIALTO_TYPE_MSE_AUDIO_SINK) &&
      74            3 :            gst_element_register(plugin, "rialtomsesubtitlesink", sinkRank, RIALTO_TYPE_MSE_SUBTITLE_SINK) &&
      75            2 :            gst_element_register(plugin, "rialtowebaudiosink", sinkRank, RIALTO_TYPE_WEB_AUDIO_SINK);
      76              : }
      77              : 
      78            0 : GST_PLUGIN_DEFINE(GST_VERSION_MAJOR, GST_VERSION_MINOR, rialtosinks, "Sinks which communicate with RialtoServer",
      79              :                   rialto_mse_sinks_init, "1.0", "LGPL", PACKAGE, "http://gstreamer.net/")
        

Generated by: LCOV version 2.0-1