| 1 | /* GStreamer ClearKey common encryption decryptor |
| 2 | * |
| 3 | * Copyright (C) 2013 YouView TV Ltd. <alex.ashley@youview.com> |
| 4 | * Copyright (C) 2016 Metrological |
| 5 | * Copyright (C) 2016 Igalia S.L |
| 6 | * |
| 7 | * This library is free software; you can redistribute it and/or |
| 8 | * modify it under the terms of the GNU Library General Public |
| 9 | * License as published by the Free Software Foundation; either |
| 10 | * version 2 of the License, or (at your option) any later version. |
| 11 | * |
| 12 | * This library 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 GNU |
| 15 | * Library General Public License for more details. |
| 16 | * |
| 17 | * You should have received a copy of the GNU Library General Public |
| 18 | * License along with this library; if not, write to the |
| 19 | * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, |
| 20 | * Boston, MA 02110-1301, USA. |
| 21 | */ |
| 22 | |
| 23 | #pragma once |
| 24 | |
| 25 | #if ENABLE(ENCRYPTED_MEDIA) && USE(GSTREAMER) |
| 26 | |
| 27 | #include <CDMInstance.h> |
| 28 | #include <gst/base/gstbasetransform.h> |
| 29 | #include <gst/gst.h> |
| 30 | #include <wtf/RefPtr.h> |
| 31 | |
| 32 | G_BEGIN_DECLS |
| 33 | |
| 34 | #define WEBKIT_TYPE_MEDIA_CENC_DECRYPT (webkit_media_common_encryption_decrypt_get_type()) |
| 35 | #define WEBKIT_MEDIA_CENC_DECRYPT(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), WEBKIT_TYPE_MEDIA_CENC_DECRYPT, WebKitMediaCommonEncryptionDecrypt)) |
| 36 | #define WEBKIT_MEDIA_CENC_DECRYPT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), WEBKIT_TYPE_MEDIA_CENC_DECRYPT, WebKitMediaCommonEncryptionDecryptClass)) |
| 37 | #define WEBKIT_MEDIA_CENC_DECRYPT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), WEBKIT_TYPE_MEDIA_CENC_DECRYPT, WebKitMediaCommonEncryptionDecryptClass)) |
| 38 | |
| 39 | #define WEBKIT_IS_MEDIA_CENC_DECRYPT(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), WEBKIT_TYPE_MEDIA_CENC_DECRYPT)) |
| 40 | #define WEBKIT_IS_MEDIA_CENC_DECRYPT_CLASS(obj) (G_TYPE_CHECK_CLASS_TYPE((klass), WEBKIT_TYPE_MEDIA_CENC_DECRYPT)) |
| 41 | |
| 42 | typedef struct _WebKitMediaCommonEncryptionDecrypt WebKitMediaCommonEncryptionDecrypt; |
| 43 | typedef struct _WebKitMediaCommonEncryptionDecryptClass WebKitMediaCommonEncryptionDecryptClass; |
| 44 | typedef struct _WebKitMediaCommonEncryptionDecryptPrivate WebKitMediaCommonEncryptionDecryptPrivate; |
| 45 | |
| 46 | GType webkit_media_common_encryption_decrypt_get_type(void); |
| 47 | |
| 48 | struct _WebKitMediaCommonEncryptionDecrypt { |
| 49 | GstBaseTransform parent; |
| 50 | |
| 51 | WebKitMediaCommonEncryptionDecryptPrivate* priv; |
| 52 | }; |
| 53 | |
| 54 | struct _WebKitMediaCommonEncryptionDecryptClass { |
| 55 | GstBaseTransformClass parentClass; |
| 56 | |
| 57 | const char* protectionSystemId; |
| 58 | bool (*handleKeyResponse)(WebKitMediaCommonEncryptionDecrypt*, RefPtr<WebCore::CDMInstance>); |
| 59 | bool (*decrypt)(WebKitMediaCommonEncryptionDecrypt*, GstBuffer* ivBuffer, GstBuffer* keyIDBuffer, GstBuffer* buffer, unsigned subSamplesCount, GstBuffer* subSamplesBuffer); |
| 60 | }; |
| 61 | |
| 62 | G_END_DECLS |
| 63 | |
| 64 | #endif // ENABLE(ENCRYPTED_MEDIA) && USE(GSTREAMER) |
| 65 | |