• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2023-2025 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 enum VideoStreamType {
25     HEVC = 0,
26     VVC  = 1,
27 };
28 
29 class StreamParser {
30 public:
31     explicit StreamParser() = default;
32     virtual ~StreamParser() = default;
33     virtual void ParseExtraData(const uint8_t *sample, int32_t size,
34                                 uint8_t **extraDataBuf, int32_t *extraDataSize) = 0;
35     virtual bool ConvertExtraDataToAnnexb(uint8_t *extraData, int32_t extraDataSize) = 0;
36     virtual void ConvertPacketToAnnexb(uint8_t **hvccPacket, int32_t &hvccPacketSize, uint8_t *sideData,
37         size_t sideDataSize, bool isExtradata) = 0;
38     virtual void ParseAnnexbExtraData(const uint8_t *sample, int32_t size) = 0;
39     virtual void ResetXPSSendStatus();
40     virtual bool IsHdrVivid() = 0;
41     virtual bool IsSyncFrame(const uint8_t *sample, int32_t size) = 0;
42     virtual bool GetColorRange() = 0;
43     virtual uint8_t GetColorPrimaries() = 0;
44     virtual uint8_t GetColorTransfer() = 0;
45     virtual uint8_t GetColorMatrixCoeff() = 0;
46     virtual uint8_t GetProfileIdc() = 0;
47     virtual uint8_t GetLevelIdc() = 0;
48     virtual uint32_t GetChromaLocation() = 0;
49     virtual uint32_t GetPicWidInLumaSamples() = 0;
50     virtual uint32_t GetPicHetInLumaSamples() = 0;
51     virtual std::vector<uint8_t> GetLogInfo() = 0;
52     virtual uint32_t GetMaxReorderPic() = 0;
53 };
54 } // Plugins
55 } // Media
56 } // OHOS
57 #endif // STREAM_PARSER_H