LCOV - code coverage report
Current view: top level - media/server/gstplayer/include - IGstGenericPlayerPrivate.h (source / functions) Coverage Total Hit
Test: coverage.info Lines: 100.0 % 2 2
Test Date: 2026-07-02 10:31:16 Functions: 100.0 % 2 2

            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_SERVER_I_GST_GENERIC_PLAYER_PRIVATE_H_
      21              : #define FIREBOLT_RIALTO_SERVER_I_GST_GENERIC_PLAYER_PRIVATE_H_
      22              : 
      23              : #include "IMediaPipeline.h"
      24              : 
      25              : #include <gst/app/gstappsrc.h>
      26              : #include <gst/gst.h>
      27              : #include <memory>
      28              : #include <string>
      29              : #include <vector>
      30              : 
      31              : namespace firebolt::rialto::server
      32              : {
      33              : class IGstGenericPlayerPrivate
      34              : {
      35              : public:
      36          506 :     IGstGenericPlayerPrivate() = default;
      37          506 :     virtual ~IGstGenericPlayerPrivate() = default;
      38              : 
      39              :     IGstGenericPlayerPrivate(const IGstGenericPlayerPrivate &) = delete;
      40              :     IGstGenericPlayerPrivate &operator=(const IGstGenericPlayerPrivate &) = delete;
      41              :     IGstGenericPlayerPrivate(IGstGenericPlayerPrivate &&) = delete;
      42              :     IGstGenericPlayerPrivate &operator=(IGstGenericPlayerPrivate &&) = delete;
      43              : 
      44              :     /**
      45              :      * @brief Schedules need media data task. Called by the worker thread.
      46              :      */
      47              :     virtual void scheduleNeedMediaData(GstAppSrc *src) = 0;
      48              : 
      49              :     /**
      50              :      * @brief Schedules enough data task. Called by the worker thread.
      51              :      */
      52              :     virtual void scheduleEnoughData(GstAppSrc *src) = 0;
      53              : 
      54              :     /**
      55              :      * @brief Schedules audio underflow task. Called by the worker thread.
      56              :      */
      57              :     virtual void scheduleAudioUnderflow() = 0;
      58              : 
      59              :     /**
      60              :      * @brief Schedules video underflow task. Called by the worker thread.
      61              :      */
      62              :     virtual void scheduleVideoUnderflow() = 0;
      63              : 
      64              :     /**
      65              :      * @brief Schedules first video frame received task. Called by the worker thread.
      66              :      */
      67              :     virtual void scheduleFirstVideoFrameReceived() = 0;
      68              : 
      69              :     /**
      70              :      * @brief Schedules all sources attached task. Called by the worker thread.
      71              :      */
      72              :     virtual void scheduleAllSourcesAttached() = 0;
      73              : 
      74              :     /**
      75              :      * @brief Sets video sink rectangle. Called by the worker thread.
      76              :      *
      77              :      * @retval true on success.
      78              :      */
      79              :     virtual bool setVideoSinkRectangle() = 0;
      80              : 
      81              :     /**
      82              :      * @brief Sets immediate output. Called by the worker thread.
      83              :      *
      84              :      * @retval true on success.
      85              :      */
      86              :     virtual bool setImmediateOutput() = 0;
      87              : 
      88              :     /**
      89              :      * @brief Sets the low latency property. Called by the worker thread.
      90              :      *
      91              :      * @retval true on success.
      92              :      */
      93              :     virtual bool setLowLatency() = 0;
      94              : 
      95              :     /**
      96              :      * @brief Sets the sync property. Called by the worker thread.
      97              :      *
      98              :      * @retval true on success.
      99              :      */
     100              :     virtual bool setSync() = 0;
     101              : 
     102              :     /**
     103              :      * @brief Sets the sync off property. Called by the worker thread.
     104              :      *
     105              :      * @retval true on success.
     106              :      */
     107              :     virtual bool setSyncOff() = 0;
     108              : 
     109              :     /**
     110              :      * @brief Sets the stream sync mode property. Called by the worker thread.
     111              :      *
     112              :      * @retval true on success.
     113              :      */
     114              :     virtual bool setStreamSyncMode(const MediaSourceType &type) = 0;
     115              : 
     116              :     /**
     117              :      * @brief Sets frame rendering. Called by the worker thread.
     118              :      *
     119              :      * @retval true on success.
     120              :      */
     121              :     virtual bool setRenderFrame() = 0;
     122              : 
     123              :     /**
     124              :      * @brief Sets buffering limit. Called by the worker thread.
     125              :      *
     126              :      * @retval true on success.
     127              :      */
     128              :     virtual bool setBufferingLimit() = 0;
     129              : 
     130              :     /**
     131              :      * @brief Sets use buffering. Called by the worker thread.
     132              :      *
     133              :      * @retval true on success.
     134              :      */
     135              :     virtual bool setUseBuffering() = 0;
     136              : 
     137              :     /**
     138              :      * @brief Sets Show Video Window property. Called by the worker thread.
     139              :      *
     140              :      * @retval true on success.
     141              :      */
     142              :     virtual bool setShowVideoWindow() = 0;
     143              : 
     144              :     /**
     145              :      * @brief Sends NeedMediaData notification. Called by the worker thread.
     146              :      */
     147              :     virtual void notifyNeedMediaData(const MediaSourceType mediaSource) = 0;
     148              : 
     149              :     /**
     150              :      * @brief Sends NeedMediaData notification with a delay. Called by the worker thread.
     151              :      */
     152              :     virtual void notifyNeedMediaDataWithDelay(const MediaSourceType mediaSource) = 0;
     153              : 
     154              :     /**
     155              :      * @brief Constructs a new buffer with data from media segment. Does not perform decryption.
     156              :      *        Called by the worker thread.
     157              :      */
     158              :     virtual GstBuffer *createBuffer(const IMediaPipeline::MediaSegment &mediaSegment) const = 0;
     159              : 
     160              :     virtual void attachData(const firebolt::rialto::MediaSourceType mediaType) = 0;
     161              : 
     162              :     /**
     163              :      * @brief Checks the new audio mediaSegment metadata and updates the caps accordingly.
     164              :      */
     165              :     virtual void updateAudioCaps(int32_t rate, int32_t channels, const std::shared_ptr<CodecData> &codecData) = 0;
     166              : 
     167              :     /**
     168              :      * @brief Checks the new video mediaSegment metadata and updates the caps accordingly.
     169              :      */
     170              :     virtual void updateVideoCaps(int32_t width, int32_t height, Fraction frameRate,
     171              :                                  const std::shared_ptr<CodecData> &codecData) = 0;
     172              : 
     173              :     /**
     174              :      * @brief Adds clipping meta to the audio buffer.
     175              :      *
     176              :      * @param buffer the buffer to add the clipping meta to
     177              :      * @param clippingStart the start of the clipping
     178              :      * @param clippingEnd the end of the clipping
     179              :      */
     180              :     virtual void addAudioClippingToBuffer(GstBuffer *buffer, uint64_t clippingStart, uint64_t clippingEnd) const = 0;
     181              : 
     182              :     /**
     183              :      * @brief Changes pipeline state.
     184              :      *
     185              :      * @param[in] newState    : The desired state.
     186              :      *
     187              :      * @retval state change status
     188              :      */
     189              :     virtual GstStateChangeReturn changePipelineState(GstState newState) = 0;
     190              : 
     191              :     /**
     192              :      * @brief Gets the current position of the element
     193              :      *
     194              :      * @param[in] element : The GstElement to check.
     195              :      *
     196              :      * @retval position of the element; -1 in case of failure
     197              :      */
     198              :     virtual int64_t getPosition(GstElement *element) = 0;
     199              : 
     200              :     /**
     201              :      * @brief Starts position reporting and check audio underflow. Called by the worker thread.
     202              :      */
     203              :     virtual void startPositionReportingAndCheckAudioUnderflowTimer() = 0;
     204              : 
     205              :     /**
     206              :      * @brief Stops position reporting and check audio underflow. Called by the worker thread.
     207              :      */
     208              :     virtual void stopPositionReportingAndCheckAudioUnderflowTimer() = 0;
     209              : 
     210              :     /**
     211              :      * @brief Starts notify playback info timer. Called by the worker thread.
     212              :      */
     213              :     virtual void startNotifyPlaybackInfoTimer() = 0;
     214              : 
     215              :     /**
     216              :      * @brief Stops notify playback info timer. Called by the worker thread.
     217              :      */
     218              :     virtual void stopNotifyPlaybackInfoTimer() = 0;
     219              : 
     220              :     /**
     221              :      * @brief Starts subtitle clock resync. Called by the worker thread.
     222              :      */
     223              :     virtual void startSubtitleClockResyncTimer() = 0;
     224              : 
     225              :     /**
     226              :      * @brief Stops subtitle clock resync. Called by the worker thread.
     227              :      */
     228              :     virtual void stopSubtitleClockResyncTimer() = 0;
     229              : 
     230              :     /**
     231              :      * @brief Stops worker thread. Called by the worker thread.
     232              :      */
     233              :     virtual void stopWorkerThread() = 0;
     234              : 
     235              :     /**
     236              :      * @brief Restores playback after underflow. Called by the worker thread.
     237              :      *
     238              :      * @param[in] underflowFlag    : The audio or video underflow flag to be cleared.
     239              :      */
     240              :     virtual void cancelUnderflow(firebolt::rialto::MediaSourceType mediaSource) = 0;
     241              : 
     242              :     /**
     243              :      * @brief Sets pending playback rate after reaching PLAYING state
     244              :      *
     245              :      */
     246              :     virtual void setPendingPlaybackRate() = 0;
     247              : 
     248              :     /**
     249              :      * @brief Updates Playback Group in PlayerContext.
     250              :      */
     251              :     virtual void updatePlaybackGroup(GstElement *typefind, const GstCaps *caps) = 0;
     252              : 
     253              :     /**
     254              :      * @brief Notification that a new child element has been added to the autovideosink.
     255              :      *        Stores the child video sink in the player context.
     256              :      *
     257              :      * @param[in] object    : Element added to the autovideosink.
     258              :      */
     259              :     virtual void addAutoVideoSinkChild(GObject *object) = 0;
     260              : 
     261              :     /**
     262              :      * @brief Notification that a new child element has been added to the autoaudiosink.
     263              :      *        Stores the child audio sink in the player context.
     264              :      *
     265              :      * @param[in] object    : Element added to the autoaudiosink.
     266              :      */
     267              :     virtual void addAutoAudioSinkChild(GObject *object) = 0;
     268              : 
     269              :     /**
     270              :      * @brief Notification that a child element has been removed from the autovideosink.
     271              :      *        Removes the child video sink in the player context if it has been stored.
     272              :      *
     273              :      * @param[in] object    : Element removed from the autovideosink.
     274              :      */
     275              :     virtual void removeAutoVideoSinkChild(GObject *object) = 0;
     276              : 
     277              :     /**
     278              :      * @brief Notification that a child element has been removed from the autoaudiosink.
     279              :      *        Removes the child audio sink in the player context if it has been stored.
     280              :      *
     281              :      * @param[in] object    : Element removed from the autoaudiosink.
     282              :      */
     283              :     virtual void removeAutoAudioSinkChild(GObject *object) = 0;
     284              : 
     285              :     /**
     286              :      * @brief Gets the sink element for source type.
     287              :      *
     288              :      * @param[in] mediaSourceType : the source type to obtain the sink for
     289              :      *
     290              :      * @retval The sink, NULL if not found. Please call getObjectUnref() if it's non-null
     291              :      */
     292              :     virtual GstElement *getSink(const MediaSourceType &mediaSourceType) const = 0;
     293              : 
     294              :     /**
     295              :      * @brief Pushes GstSample if playback position has changed or new segment needs to be sent.
     296              :      *
     297              :      * @param[in] source          : The Gst Source element, that should receive new sample
     298              :      * @param[in] typeStr         : The media source type string
     299              :      */
     300              :     virtual void pushSampleIfRequired(GstElement *source, const std::string &typeStr) = 0;
     301              : 
     302              :     /**
     303              :      * @brief Reattaches source (or switches it)
     304              :      *
     305              :      * @param[in] source          : The new media source
     306              :      *
     307              :      * @retval True on success
     308              :      */
     309              :     virtual bool reattachSource(const std::unique_ptr<IMediaPipeline::MediaSource> &source) = 0;
     310              : 
     311              :     /**
     312              :      * @brief Checks if the player has a source of the given type.
     313              :      *
     314              :      * @param[in] mediaSourceType : The source type to check
     315              :      *
     316              :      * @retval True if the player has a source of the given type, false otherwise
     317              :      */
     318              :     virtual bool hasSourceType(const MediaSourceType &mediaSourceType) const = 0;
     319              : 
     320              :     /**
     321              :      * @brief Sets source state flushed
     322              :      *
     323              :      * @param[in] mediaSourceType : the source type that has been flushed
     324              :      */
     325              :     virtual void setSourceFlushed(const MediaSourceType &mediaSourceType) = 0;
     326              : 
     327              :     /**
     328              :      * @brief Sends PlaybackInfo notification. Called by the worker thread.
     329              :      */
     330              :     virtual void notifyPlaybackInfo() = 0;
     331              : };
     332              : } // namespace firebolt::rialto::server
     333              : 
     334              : #endif // FIREBOLT_RIALTO_SERVER_I_GST_GENERIC_PLAYER_PRIVATE_H_
        

Generated by: LCOV version 2.0-1