Line data Source code
1 : /*
2 : * Copyright (C) 2022 Sky UK
3 : *
4 : * This library is free software; you can redistribute it and/or
5 : * modify it under the terms of the GNU Lesser General Public
6 : * License as published by the Free Software Foundation;
7 : * version 2.1 of the License.
8 : *
9 : * This library is distributed in the hope that it will be useful,
10 : * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 : * Lesser General Public License for more details.
13 : *
14 : * You should have received a copy of the GNU Lesser General Public
15 : * License along with this library; if not, write to the Free Software
16 : * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17 : */
18 :
19 : #pragma once
20 : #include <MediaCommon.h>
21 : #include <gst/gst.h>
22 : #include <gst/gstprotection.h>
23 :
24 : #include <stdint.h>
25 : #include <vector>
26 :
27 : struct BufferProtectionMetadata
28 : {
29 19 : BufferProtectionMetadata() : encrypted(false) {}
30 :
31 : bool encrypted{false};
32 : int mediaKeySessionId{-1};
33 : std::vector<uint8_t> iv;
34 : std::vector<uint8_t> kid;
35 : // vector of bytesOfClearData, bytesOfEncryptedData
36 : std::vector<std::pair<uint32_t, uint32_t>> subsamples;
37 : uint32_t initWithLast15{0};
38 :
39 : // Encryption scheme
40 : firebolt::rialto::CipherMode cipherMode{firebolt::rialto::CipherMode::UNKNOWN};
41 : uint32_t cryptBlocks{0};
42 : uint32_t skipBlocks{0};
43 : bool encryptionPatternSet{false};
44 : };
45 :
46 : void ProcessProtectionMetadata(GstBuffer *buffer, BufferProtectionMetadata &metadata);
|