LCOV - code coverage report
Current view: top level - media/common/include - MediaFrameWriterV1.h (source / functions) Coverage Total Hit
Test: coverage.info Lines: 0.0 % 1 0
Test Date: 2025-03-21 11:02:39 Functions: 0.0 % 1 0

            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 2022 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              : #ifndef FIREBOLT_RIALTO_COMMON_MEDIA_FRAME_WRITERV1_H_
      21              : #define FIREBOLT_RIALTO_COMMON_MEDIA_FRAME_WRITERV1_H_
      22              : 
      23              : #include "ByteWriter.h"
      24              : #include "IMediaFrameWriter.h"
      25              : #include <memory>
      26              : #include <vector>
      27              : 
      28              : namespace firebolt::rialto::common
      29              : {
      30              : /**
      31              :  * @brief The definition of the MediaFrameWriterV1.
      32              :  */
      33              : class MediaFrameWriterV1 : public IMediaFrameWriter
      34              : {
      35              : public:
      36              :     /**
      37              :      * @brief The constructor.
      38              :      *
      39              :      * @param[in] shmBuffer     : The shared buffer pointer.
      40              :      * @param[in] shmInfo       : The information for populating the shared memory.
      41              :      */
      42              :     MediaFrameWriterV1(uint8_t *shmBuffer, const std::shared_ptr<MediaPlayerShmInfo> &shminfo);
      43              : 
      44              :     /**
      45              :      * @brief Virtual destructor.
      46              :      */
      47              :     virtual ~MediaFrameWriterV1() {}
      48              : 
      49              :     /**
      50              :      * @brief Write the frame data.
      51              :      *
      52              :      * @param[in] data  : Media Segment data.
      53              :      *
      54              :      * @retval true on success.
      55              :      */
      56              :     AddSegmentStatus writeFrame(const std::unique_ptr<IMediaPipeline::MediaSegment> &data) override;
      57              : 
      58              :     /**
      59              :      * @brief Gets number of written frames
      60              :      *
      61              :      * @retval number of written frames
      62              :      */
      63            0 :     uint32_t getNumFrames() override { return m_numFrames; }
      64              : 
      65              :     /**
      66              :      * @brief The version of metadata this object shall write.
      67              :      */
      68              :     static const uint32_t m_kMetadataVersion = 1U;
      69              : 
      70              :     /**
      71              :      * @brief The size of the encryption metadata set if the frame is encrypted.
      72              :      */
      73              :     static const uint32_t m_kEncryptionMetadataSizeBytes = 32U;
      74              : 
      75              : private:
      76              :     /**
      77              :      * @brief Pointer to the shared memory buffer.
      78              :      */
      79              :     uint8_t *m_shmBuffer;
      80              : 
      81              :     /**
      82              :      * @brief The maximum amout of media data that can be written.
      83              :      */
      84              :     const uint32_t m_kMaxMediaBytes;
      85              : 
      86              :     /**
      87              :      * @brief The maximum amout of metadata the shared buffer can hold.
      88              :      */
      89              :     const uint32_t m_kMaxMetadataBytes;
      90              : 
      91              :     /**
      92              :      * @brief The amount of metadata bytes written to the shared buffer.
      93              :      */
      94              :     uint32_t m_metadataBytesWritten;
      95              : 
      96              :     /**
      97              :      * @brief The amount of media bytes written to the shared buffer.
      98              :      */
      99              :     uint32_t m_mediaBytesWritten;
     100              : 
     101              :     /**
     102              :      * @brief The offset of the shared memory to write the data.
     103              :      */
     104              :     uint32_t m_mediaDataOffset;
     105              : 
     106              :     /**
     107              :      * @brief The offset of the shared memory to write the metadata.
     108              :      */
     109              :     uint32_t m_metadataOffset;
     110              : 
     111              :     /**
     112              :      * @brief ByteWriter object.
     113              :      */
     114              :     ByteWriter m_bytewriter;
     115              : 
     116              :     uint32_t m_numFrames = 0;
     117              : 
     118              :     /**
     119              :      * @brief Write the generic frame meta data.
     120              :      *
     121              :      * @param[in] data  : Media Segment data.
     122              :      *
     123              :      * @retval true on success.
     124              :      */
     125              :     bool writeMetaDataGeneric(const std::unique_ptr<IMediaPipeline::MediaSegment> &data);
     126              : 
     127              :     /**
     128              :      * @brief Write the generic frame meta data.
     129              :      *
     130              :      * @param[in] data  : Media Segment data.
     131              :      *
     132              :      * @retval true on success.
     133              :      */
     134              :     bool writeMetaDataTypeSpecific(const std::unique_ptr<IMediaPipeline::MediaSegment> &data);
     135              : 
     136              :     /**
     137              :      * @brief Write the sample data.
     138              :      *
     139              :      * @param[in] data  : Media Segment data.
     140              :      *
     141              :      * @retval true on success.
     142              :      */
     143              :     bool writeData(const std::unique_ptr<IMediaPipeline::MediaSegment> &data);
     144              : };
     145              : }; // namespace firebolt::rialto::common
     146              : 
     147              : #endif // FIREBOLT_RIALTO_COMMON_MEDIA_FRAME_WRITERV1_H_
        

Generated by: LCOV version 2.0-1