LCOV - code coverage report
Current view: top level - source - RialtoGStreamerEMEProtectionMetadata.cpp (source / functions) Coverage Total Hit
Test: coverage.info Lines: 100.0 % 24 24
Test Date: 2025-07-07 09:31:15 Functions: 100.0 % 5 5

            Line data    Source code
       1              : /*
       2              :  * If not stated otherwise in this file or this component's LICENSE file the
       3              :  * following copyright and licenses apply:
       4              :  *
       5              :  * Copyright 2024 Sky UK
       6              :  *
       7              :  * Licensed under the Apache License, Version 2.0 (the "License");
       8              :  * you may not use this file except in compliance with the License.
       9              :  * You may obtain a copy of the License at
      10              :  *
      11              :  * http://www.apache.org/licenses/LICENSE-2.0
      12              :  *
      13              :  * Unless required by applicable law or agreed to in writing, software
      14              :  * distributed under the License is distributed on an "AS IS" BASIS,
      15              :  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
      16              :  * See the License for the specific language governing permissions and
      17              :  * limitations under the License.
      18              :  */
      19              : 
      20              : #include "RialtoGStreamerEMEProtectionMetadata.h"
      21              : #include <gst/gstconfig.h>
      22              : 
      23              : // NOLINTNEXTLINE(build/function_format)
      24            5 : static gboolean rialto_eme_protection_metadata_init(GstMeta *meta, gpointer params, GstBuffer *buffer)
      25              : {
      26              :     // NOLINTNEXTLINE(readability/casting)
      27            5 :     GstRialtoProtectionMetadata *emeta = reinterpret_cast<GstRialtoProtectionMetadata *>(meta);
      28              : 
      29            5 :     emeta->info = NULL;
      30              : 
      31            5 :     return TRUE;
      32              : }
      33              : 
      34              : // NOLINTNEXTLINE(build/function_format)
      35            5 : static gboolean rialto_eme_protection_metadata_free(GstMeta *meta, GstBuffer *buffer)
      36              : {
      37              :     // NOLINTNEXTLINE(readability/casting)
      38            5 :     GstRialtoProtectionMetadata *emeta = reinterpret_cast<GstRialtoProtectionMetadata *>(meta);
      39              : 
      40            5 :     if (emeta->info)
      41              :     {
      42            5 :         gst_structure_free(emeta->info);
      43            5 :         emeta->info = nullptr;
      44              :     }
      45              : 
      46            5 :     return TRUE;
      47              : }
      48              : 
      49              : // NOLINTNEXTLINE(build/function_format)
      50            9 : GST_EXPORT GType rialto_eme_protection_metadata_get_type()
      51              : {
      52              :     static GType g_type{0};
      53              :     static const gchar *api_tags[] = {"rialto", "protection", NULL};
      54              : 
      55            9 :     if (g_once_init_enter(&g_type))
      56              :     {
      57            1 :         GType _type = gst_meta_api_type_register("GstRialtoProtectionMetadataAPI", api_tags);
      58            1 :         g_once_init_leave(&g_type, _type);
      59              :     }
      60            9 :     return g_type;
      61              : }
      62              : 
      63              : // NOLINTNEXTLINE(build/function_format)
      64            5 : const GstMetaInfo *rialto_mse_protection_metadata_get_info()
      65              : {
      66              :     static const GstMetaInfo *metainfo = NULL;
      67            5 :     if (g_once_init_enter(&metainfo))
      68              :     {
      69              :         const GstMetaInfo *gstMeta =
      70            1 :             gst_meta_register(GST_RIALTO_PROTECTION_METADATA_GET_TYPE, "GstRialtoProtectionMetadata",
      71              :                               sizeof(GstRialtoProtectionMetadata),
      72              :                               (GstMetaInitFunction)rialto_eme_protection_metadata_init,
      73              :                               (GstMetaFreeFunction)rialto_eme_protection_metadata_free, (GstMetaTransformFunction)NULL);
      74              : 
      75            1 :         g_once_init_leave(&metainfo, gstMeta);
      76              :     }
      77            5 :     return metainfo;
      78              : }
      79              : 
      80              : // NOLINTNEXTLINE(build/function_format)
      81            5 : GstRialtoProtectionMetadata *rialto_mse_add_protection_metadata(GstBuffer *gstBuffer, GstStructure *info)
      82              : {
      83              :     GstRialtoProtectionMetadata *metadata = reinterpret_cast<GstRialtoProtectionMetadata *>(
      84            5 :         gst_buffer_add_meta(gstBuffer, GST_RIALTO_PROTECTION_METADATA_INFO, NULL));
      85            5 :     metadata->info = info;
      86            5 :     return metadata;
      87              : }
        

Generated by: LCOV version 2.0-1