1 /*
2  * Copyright (C) 2023 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef STREAM_PARSER_H
17 #define STREAM_PARSER_H
18 
19 #include <cstdint>
20 
21 namespace OHOS {
22 namespace Media {
23 namespace Plugins {
24 class StreamParser {
25 public:
26     explicit StreamParser() = default;
27     virtual ~StreamParser() = default;
28     virtual void ParseExtraData(const uint8_t *sample, int32_t size,
29                                 uint8_t **extraDataBuf, int32_t *extraDataSize) = 0;
30     virtual bool ConvertExtraDataToAnnexb(uint8_t *extraData, int32_t extraDataSize) = 0;
31     virtual void ConvertPacketToAnnexb(uint8_t **hvccPacket, int32_t &hvccPacketSize, uint8_t *sideData,
32         size_t sideDataSize, bool isExtradata) = 0;
33     virtual void ParseAnnexbExtraData(const uint8_t *sample, int32_t size) = 0;
34     virtual void ResetXPSSendStatus();
35     virtual bool IsHdrVivid() = 0;
36     virtual bool IsSyncFrame(const uint8_t *sample, int32_t size) = 0;
37     virtual bool GetColorRange() = 0;
38     virtual uint8_t GetColorPrimaries() = 0;
39     virtual uint8_t GetColorTransfer() = 0;
40     virtual uint8_t GetColorMatrixCoeff() = 0;
41     virtual uint8_t GetProfileIdc() = 0;
42     virtual uint8_t GetLevelIdc() = 0;
43     virtual uint32_t GetChromaLocation() = 0;
44     virtual uint32_t GetPicWidInLumaSamples() = 0;
45     virtual uint32_t GetPicHetInLumaSamples() = 0;
46 };
47 } // Plugins
48 } // Media
49 } // OHOS
50 #endif // STREAM_PARSER_H