Line data Source code
1 : /*
2 : * If not stated otherwise in this file or this component's LICENSE file the
3 : * following copyright and licenses apply:
4 : *
5 : * Copyright 2022 Sky UK
6 : *
7 : * Licensed under the Apache License, Version 2.0 (the "License");
8 : * you may not use this file except in compliance with the License.
9 : * You may obtain a copy of the License at
10 : *
11 : * http://www.apache.org/licenses/LICENSE-2.0
12 : *
13 : * Unless required by applicable law or agreed to in writing, software
14 : * distributed under the License is distributed on an "AS IS" BASIS,
15 : * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 : * See the License for the specific language governing permissions and
17 : * limitations under the License.
18 : */
19 :
20 : #include "Logger.h"
21 : #include "OpenCDMSession.h"
22 : #include <opencdm/open_cdm_adapter.h>
23 :
24 : namespace
25 : {
26 : const Logger kLog{"open_cdm_adapter"};
27 : } // namespace
28 :
29 2 : OpenCDMError opencdm_gstreamer_session_decrypt_ex(struct OpenCDMSession *session, GstBuffer *buffer,
30 : GstBuffer *subSample, const uint32_t subSampleCount, GstBuffer *IV,
31 : GstBuffer *keyID, uint32_t initWithLast15, GstCaps *caps)
32 : {
33 2 : if (nullptr == session)
34 : {
35 1 : kLog << error << "Failed to decrypt - session is NULL";
36 1 : return ERROR_FAIL;
37 : }
38 1 : session->addProtectionMeta(buffer, subSample, subSampleCount, IV, keyID, initWithLast15);
39 1 : return ERROR_NONE;
40 : }
41 :
42 2 : OpenCDMError opencdm_gstreamer_session_decrypt(struct OpenCDMSession *session, GstBuffer *buffer, GstBuffer *subSample,
43 : const uint32_t subSampleCount, GstBuffer *IV, GstBuffer *keyID,
44 : uint32_t initWithLast15)
45 : {
46 2 : return opencdm_gstreamer_session_decrypt_ex(session, buffer, subSample, subSampleCount, IV, keyID, initWithLast15,
47 2 : nullptr);
48 : }
49 :
50 3 : OpenCDMError opencdm_gstreamer_session_decrypt_buffer(struct OpenCDMSession *session, GstBuffer *buffer, GstCaps *caps)
51 : {
52 3 : if (nullptr == session)
53 : {
54 1 : kLog << error << "Failed to decrypt - session is NULL";
55 1 : return ERROR_FAIL;
56 : }
57 :
58 2 : if (!session->addProtectionMeta(buffer))
59 : {
60 1 : kLog << error << "Failed to decrypt - could not append protection meta";
61 1 : return ERROR_FAIL;
62 : }
63 :
64 1 : return ERROR_NONE;
65 : }
66 :
67 1 : OpenCDMError opencdm_gstreamer_transform_caps(GstCaps **caps)
68 : {
69 1 : return ERROR_NONE;
70 : }
|