Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(317)

Side by Side Diff: content_decryption_module.h

Issue 1950163002: DO NO SUBMIT: Add CDM_EXPORT to fix tests under ubsan (Closed) Base URL: https://chromium.googlesource.com/chromium/cdm.git@master
Patch Set: now it passes Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CDM_CONTENT_DECRYPTION_MODULE_H_ 5 #ifndef CDM_CONTENT_DECRYPTION_MODULE_H_
6 #define CDM_CONTENT_DECRYPTION_MODULE_H_ 6 #define CDM_CONTENT_DECRYPTION_MODULE_H_
7 7
8 #if defined(_MSC_VER) 8 #if defined(_MSC_VER)
9 typedef unsigned char uint8_t; 9 typedef unsigned char uint8_t;
10 typedef unsigned int uint32_t; 10 typedef unsigned int uint32_t;
11 typedef int int32_t; 11 typedef int int32_t;
12 typedef __int64 int64_t; 12 typedef __int64 int64_t;
13 #else 13 #else
14 #include <stdint.h> 14 #include <stdint.h>
15 #endif 15 #endif
16 16
17 // Define CDM_EXPORT so that functionality implemented by the CDM module 17 // Define CDM_EXPORT so that functionality implemented by the CDM module
18 // can be exported to consumers. 18 // can be exported to consumers.
19 #if defined(WIN32) 19 #if defined(WIN32)
20 20
21 #if defined(CDM_IMPLEMENTATION) 21 #if defined(CDM_IMPLEMENTATION)
22 #define CDM_EXPORT __declspec(dllexport) 22 #define CDM_EXPORT __declspec(dllexport)
23 #else 23 #else
24 #define CDM_EXPORT __declspec(dllimport) 24 #define CDM_EXPORT __declspec(dllimport)
25 #endif // defined(CDM_IMPLEMENTATION) 25 #endif // defined(CDM_IMPLEMENTATION)
26 26
27 #else // defined(WIN32) 27 #else // defined(WIN32)
28 28
29 #if defined(CDM_IMPLEMENTATION) 29 #if defined(CDM_IMPLEMENTATION) || defined(UNDEFINED_SANITIZER)
30 #define CDM_EXPORT __attribute__((visibility("default"))) 30 #define CDM_EXPORT __attribute__((visibility("default")))
31 #else 31 #else
32 #define CDM_EXPORT 32 #define CDM_EXPORT
33 #endif 33 #endif
34 34
35 #endif // defined(WIN32) 35 #endif // defined(WIN32)
36 36
37 // The version number must be rolled when the exported functions are updated! 37 // The version number must be rolled when the exported functions are updated!
38 // If the CDM and the adapter use different versions of these functions, the 38 // If the CDM and the adapter use different versions of these functions, the
39 // adapter will fail to load or crash! 39 // adapter will fail to load or crash!
(...skipping 597 matching lines...) Expand 10 before | Expand all | Expand 10 after
637 ContentDecryptionModule_7() {} 637 ContentDecryptionModule_7() {}
638 virtual ~ContentDecryptionModule_7() {} 638 virtual ~ContentDecryptionModule_7() {}
639 }; 639 };
640 640
641 // ContentDecryptionModule interface that all CDMs need to implement. 641 // ContentDecryptionModule interface that all CDMs need to implement.
642 // The interface is versioned for backward compatibility. 642 // The interface is versioned for backward compatibility.
643 // Note: ContentDecryptionModule implementations must use the allocator 643 // Note: ContentDecryptionModule implementations must use the allocator
644 // provided in CreateCdmInstance() to allocate any Buffer that needs to 644 // provided in CreateCdmInstance() to allocate any Buffer that needs to
645 // be passed back to the caller. Implementations must call Buffer::Destroy() 645 // be passed back to the caller. Implementations must call Buffer::Destroy()
646 // when a Buffer is created that will never be returned to the caller. 646 // when a Buffer is created that will never be returned to the caller.
647 class ContentDecryptionModule_8 { 647 class CDM_EXPORT ContentDecryptionModule_8 {
648 public: 648 public:
649 static const int kVersion = 8; 649 static const int kVersion = 8;
650 typedef Host_8 Host; 650 typedef Host_8 Host;
651 651
652 // Initializes the CDM instance, providing information about permitted 652 // Initializes the CDM instance, providing information about permitted
653 // functionalities. 653 // functionalities.
654 // If |allow_distinctive_identifier| is false, messages from the CDM, 654 // If |allow_distinctive_identifier| is false, messages from the CDM,
655 // such as message events, must not contain a Distinctive Identifier, 655 // such as message events, must not contain a Distinctive Identifier,
656 // even in an encrypted form. 656 // even in an encrypted form.
657 // If |allow_persistent_state| is false, the CDM must not attempt to 657 // If |allow_persistent_state| is false, the CDM must not attempt to
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
822 virtual void Destroy() = 0; 822 virtual void Destroy() = 0;
823 823
824 protected: 824 protected:
825 ContentDecryptionModule_8() {} 825 ContentDecryptionModule_8() {}
826 virtual ~ContentDecryptionModule_8() {} 826 virtual ~ContentDecryptionModule_8() {}
827 }; 827 };
828 828
829 typedef ContentDecryptionModule_8 ContentDecryptionModule; 829 typedef ContentDecryptionModule_8 ContentDecryptionModule;
830 830
831 // Represents a buffer created by Allocator implementations. 831 // Represents a buffer created by Allocator implementations.
832 class Buffer { 832 class CDM_EXPORT Buffer {
833 public: 833 public:
834 // Destroys the buffer in the same context as it was created. 834 // Destroys the buffer in the same context as it was created.
835 virtual void Destroy() = 0; 835 virtual void Destroy() = 0;
836 836
837 virtual uint32_t Capacity() const = 0; 837 virtual uint32_t Capacity() const = 0;
838 virtual uint8_t* Data() = 0; 838 virtual uint8_t* Data() = 0;
839 virtual void SetSize(uint32_t size) = 0; 839 virtual void SetSize(uint32_t size) = 0;
840 virtual uint32_t Size() const = 0; 840 virtual uint32_t Size() const = 0;
841 841
842 protected: 842 protected:
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
978 // if a FileIO object cannot be obtained. Once a valid FileIO object is 978 // if a FileIO object cannot be obtained. Once a valid FileIO object is
979 // returned, |client| must be valid until FileIO::Close() is called. The 979 // returned, |client| must be valid until FileIO::Close() is called. The
980 // CDM can call this method multiple times to operate on different files. 980 // CDM can call this method multiple times to operate on different files.
981 virtual FileIO* CreateFileIO(FileIOClient* client) = 0; 981 virtual FileIO* CreateFileIO(FileIOClient* client) = 0;
982 982
983 protected: 983 protected:
984 Host_7() {} 984 Host_7() {}
985 virtual ~Host_7() {} 985 virtual ~Host_7() {}
986 }; 986 };
987 987
988 class Host_8 { 988 class CDM_EXPORT Host_8 {
989 public: 989 public:
990 static const int kVersion = 8; 990 static const int kVersion = 8;
991 991
992 // Returns a Buffer* containing non-zero members upon success, or NULL on 992 // Returns a Buffer* containing non-zero members upon success, or NULL on
993 // failure. The caller owns the Buffer* after this call. The buffer is not 993 // failure. The caller owns the Buffer* after this call. The buffer is not
994 // guaranteed to be zero initialized. The capacity of the allocated Buffer 994 // guaranteed to be zero initialized. The capacity of the allocated Buffer
995 // is guaranteed to be not less than |capacity|. 995 // is guaranteed to be not less than |capacity|.
996 virtual Buffer* Allocate(uint32_t capacity) = 0; 996 virtual Buffer* Allocate(uint32_t capacity) = 0;
997 997
998 // Requests the host to call ContentDecryptionModule::TimerFired() |delay_ms| 998 // Requests the host to call ContentDecryptionModule::TimerFired() |delay_ms|
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
1116 // returned, |client| must be valid until FileIO::Close() is called. The 1116 // returned, |client| must be valid until FileIO::Close() is called. The
1117 // CDM can call this method multiple times to operate on different files. 1117 // CDM can call this method multiple times to operate on different files.
1118 virtual FileIO* CreateFileIO(FileIOClient* client) = 0; 1118 virtual FileIO* CreateFileIO(FileIOClient* client) = 0;
1119 1119
1120 protected: 1120 protected:
1121 Host_8() {} 1121 Host_8() {}
1122 virtual ~Host_8() {} 1122 virtual ~Host_8() {}
1123 }; 1123 };
1124 1124
1125 // Represents a decrypted block that has not been decoded. 1125 // Represents a decrypted block that has not been decoded.
1126 class DecryptedBlock { 1126 class CDM_EXPORT DecryptedBlock {
1127 public: 1127 public:
1128 virtual void SetDecryptedBuffer(Buffer* buffer) = 0; 1128 virtual void SetDecryptedBuffer(Buffer* buffer) = 0;
1129 virtual Buffer* DecryptedBuffer() = 0; 1129 virtual Buffer* DecryptedBuffer() = 0;
1130 1130
1131 // TODO(tomfinegan): Figure out if timestamp is really needed. If it is not, 1131 // TODO(tomfinegan): Figure out if timestamp is really needed. If it is not,
1132 // we can just pass Buffer pointers around. 1132 // we can just pass Buffer pointers around.
1133 virtual void SetTimestamp(int64_t timestamp) = 0; 1133 virtual void SetTimestamp(int64_t timestamp) = 0;
1134 virtual int64_t Timestamp() const = 0; 1134 virtual int64_t Timestamp() const = 0;
1135 1135
1136 protected: 1136 protected:
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
1193 virtual AudioFormat Format() const = 0; 1193 virtual AudioFormat Format() const = 0;
1194 1194
1195 protected: 1195 protected:
1196 AudioFrames() {} 1196 AudioFrames() {}
1197 virtual ~AudioFrames() {} 1197 virtual ~AudioFrames() {}
1198 }; 1198 };
1199 1199
1200 } // namespace cdm 1200 } // namespace cdm
1201 1201
1202 #endif // CDM_CONTENT_DECRYPTION_MODULE_H_ 1202 #endif // CDM_CONTENT_DECRYPTION_MODULE_H_
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698