RDK Documentation (Open Sourced RDK Components)
mediaprocessor.h
Go to the documentation of this file.
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 2019 RDK Management
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 /**
21 * @file mediaprocessor.h
22 * @brief Header file for base class of media container processor
23 */
24 
25 #ifndef __MEDIA_PROCESSOR_H__
26 #define __MEDIA_PROCESSOR_H__
27 
28 #include <stddef.h>
29 
30 /**
31  * @enum _PlayMode
32  * @brief Defines the parameters required for Recording Playback
33  */
34 typedef enum _PlayMode
35 {
36  PlayMode_normal, /**< Playing a recording in normal mode */
37  PlayMode_retimestamp_IPB, /**< Playing with I-Frame, P-Frame and B-Frame */
38  PlayMode_retimestamp_IandP, /**< Playing with I-Frame and P-Frame */
39  PlayMode_retimestamp_Ionly, /**< Playing a recording with I-Frame only */
40  PlayMode_reverse_GOP, /**< Playing a recording with rewind mode */
41 } PlayMode;
42 
43 /**
44  * @class MediaProcessor
45  * @brief Base Class for Media Container Processor
46  */
48 {
49 public:
50  /**
51  * @brief MediaProcessor constructor
52  */
54  {
55 
56  }
57 
58  /**
59  * @brief MediaProcessor destructor
60  */
61  virtual ~MediaProcessor()
62  {
63 
64  }
65 
66  MediaProcessor(const MediaProcessor&) = delete;
67  MediaProcessor& operator=(const MediaProcessor&) = delete;
68 
69  /**
70  * @fn sendSegment
71  *
72  * @param[in] segment - fragment buffer pointer
73  * @param[in] size - fragment buffer size
74  * @param[in] position - position of fragment
75  * @param[in] duration - duration of fragment
76  * @param[in] discontinuous - true if discontinuous fragment
77  * @param[out] ptsError - flag indicates if any PTS error occurred
78  * @return true if fragment was sent, false otherwise
79  */
80  virtual bool sendSegment( char *segment, size_t& size, double position, double duration, bool discontinuous, bool &ptsError) = 0;
81 
82  /**
83  * @brief Set playback rate
84  *
85  * @param[in] rate - playback rate
86  * @param[in] mode - playback mode
87  * @return void
88  */
89  virtual void setRate(double rate, PlayMode mode) = 0;
90 
91  /**
92  * @brief Enable or disable throttle
93  *
94  * @param[in] enable - throttle enable/disable
95  * @return void
96  */
97  virtual void setThrottleEnable(bool enable) = 0;
98 
99  /**
100  * @brief Set frame rate for trickmode
101  *
102  * @param[in] frameRate - rate per second
103  * @return void
104  */
105  virtual void setFrameRateForTM (int frameRate) = 0;
106 
107  /**
108  * @brief Abort all operations
109  *
110  * @return void
111  */
112  virtual void abort() = 0;
113 
114  /**
115  * @brief Reset all variables
116  *
117  * @return void
118  */
119  virtual void reset() = 0;
120 
121  /**
122  * @fn Change Muxed Audio Track
123  * @param[in] AudioTrackIndex
124  */
125  virtual void ChangeMuxedAudioTrack(unsigned char index){};
126 
127  /**
128  * @brief Function to set the group-ID
129  * @param[in] string - id
130  */
131  virtual void SetAudioGroupId(std::string& id){};
132 
133  /**
134  * @brief Function to set a offsetflag. if the value is fasle, no need to apply offset while doing pts restamping
135  * @param[in] bool - true/false
136  */
137  virtual void setApplyOffsetFlag(bool enable){};
138 };
139 #endif /* __MEDIA_PROCESSOR_H__ */
MediaProcessor::SetAudioGroupId
virtual void SetAudioGroupId(std::string &id)
Function to set the group-ID.
Definition: mediaprocessor.h:131
_PlayMode
_PlayMode
Defines the parameters required for Recording Playback.
Definition: mediaprocessor.h:34
MediaProcessor::sendSegment
virtual bool sendSegment(char *segment, size_t &size, double position, double duration, bool discontinuous, bool &ptsError)=0
PlayMode_retimestamp_IandP
@ PlayMode_retimestamp_IandP
Definition: mediaprocessor.h:38
PlayMode_normal
@ PlayMode_normal
Definition: mediaprocessor.h:36
PlayMode_retimestamp_IPB
@ PlayMode_retimestamp_IPB
Definition: mediaprocessor.h:37
MediaProcessor::setRate
virtual void setRate(double rate, PlayMode mode)=0
Set playback rate.
MediaProcessor::~MediaProcessor
virtual ~MediaProcessor()
MediaProcessor destructor.
Definition: mediaprocessor.h:61
PlayMode_retimestamp_Ionly
@ PlayMode_retimestamp_Ionly
Definition: mediaprocessor.h:39
MediaProcessor::setFrameRateForTM
virtual void setFrameRateForTM(int frameRate)=0
Set frame rate for trickmode.
MediaProcessor
Base Class for Media Container Processor.
Definition: mediaprocessor.h:47
MediaProcessor::setThrottleEnable
virtual void setThrottleEnable(bool enable)=0
Enable or disable throttle.
MediaProcessor::setApplyOffsetFlag
virtual void setApplyOffsetFlag(bool enable)
Function to set a offsetflag. if the value is fasle, no need to apply offset while doing pts restampi...
Definition: mediaprocessor.h:137
PlayMode_reverse_GOP
@ PlayMode_reverse_GOP
Definition: mediaprocessor.h:40
MediaProcessor::abort
virtual void abort()=0
Abort all operations.
MediaProcessor::MediaProcessor
MediaProcessor()
MediaProcessor constructor.
Definition: mediaprocessor.h:53
MediaProcessor::reset
virtual void reset()=0
Reset all variables.