Debian Codegraph @

src/videofilters/h26x/h265-nal-packer.h

raw symbols SCIP
1 /*
2 * Copyright (c) 2010-2022 Belledonne Communications SARL.
3 *
4 * This file is part of mediastreamer2
5 * (see https://gitlab.linphone.org/BC/public/mediastreamer2).
6 *
7 * This program is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU Affero General Public License as
9 * published by the Free Software Foundation, either version 3 of the
10 * License, or (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU Affero General Public License for more details.
16 *
17 * You should have received a copy of the GNU Affero General Public License
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19 */
20
21 #pragma once
22
23 #include "h265-utils.h"
24
25 #include "nal-packer.h"
26
27 namespace mediastreamer {
28
29 class H265NalPacker : public NalPacker {
30 public:
31 H265NalPacker(size_t maxPayloadSize)
32 : NalPacker(new NaluAggregator(maxPayloadSize), new NaluSpliter(maxPayloadSize), maxPayloadSize) {
33 }
34
35 private:
36 class NaluAggregator : public NaluAggregatorInterface {
37 public:
38 using NaluAggregatorInterface::NaluAggregatorInterface;
39 ~NaluAggregator();
40
41 mblk_t *feed(mblk_t *nalu) override;
42 bool isAggregating() const override {
43 return _ap != nullptr;
44 }
45 void reset() override;
46 mblk_t *completeAggregation() override;
47
48 private:
49 void placeFirstNalu(mblk_t *nalu);
50 void aggregate(mblk_t *nalu);
51
52 size_t _size = 0;
53 H265NaluHeader _apHeader;
54 mblk_t *_ap = nullptr;
55 };
56
57 class NaluSpliter : public NaluSpliterInterface {
58 public:
59 using NaluSpliterInterface::NaluSpliterInterface;
60 void feed(mblk_t *nalu) override;
61
62 private:
63 mblk_t *
64 makeFu(const H265NaluHeader &naluHeader, const H265FuHeader &fuHeader, const uint8_t *payload, size_t length);
65 };
66 };
67
68 } // namespace mediastreamer