1 /**
2  * Copyright (C) 2022 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef VIDEO_RTPPAYLOAD_DECODER_NODE_H_INCLUDED
18 #define VIDEO_RTPPAYLOAD_DECODER_NODE_H_INCLUDED
19 
20 #include <ImsMediaDefine.h>
21 #include <BaseNode.h>
22 
23 class VideoRtpPayloadDecoderNode : public BaseNode
24 {
25 public:
26     VideoRtpPayloadDecoderNode(BaseSessionCallback* callback = nullptr);
27     virtual ~VideoRtpPayloadDecoderNode();
28     virtual kBaseNodeId GetNodeId();
29     virtual ImsMediaResult Start();
30     virtual void Stop();
31     virtual bool IsRunTime();
32     virtual bool IsSourceNode();
33     virtual void SetConfig(void* config);
34     virtual bool IsSameConfig(void* config);
35     virtual void OnDataFromFrontNode(ImsMediaSubType subtype, uint8_t* pData, uint32_t nDataSize,
36             uint32_t nTimeStamp, bool bMark, uint32_t nSeqNum,
37             ImsMediaSubType nDataType = MEDIASUBTYPE_UNDEFINED, uint32_t arrivalTime = 0);
38 
39 private:
40     void DecodeAvc(ImsMediaSubType subtype, uint8_t* pData, uint32_t nDataSize, uint32_t nTimeStamp,
41             bool bMark, uint32_t nSeqNum, uint32_t arrivalTime);
42     void DecodeHevc(ImsMediaSubType subtype, uint8_t* pData, uint32_t nDataSize,
43             uint32_t nTimeStamp, bool bMark, uint32_t nSeqNum, uint32_t arrivalTime);
44 
45     uint32_t mCodecType;
46     uint32_t mPayloadMode;
47     uint8_t* mBuffer;
48     uint8_t mSbitfirstByte;
49 };
50 
51 #endif  // VIDEO_RTPPAYLOAD_DECODER_NODE_H_INCLUDED
52