1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 2 /* vim:set ts=2 sw=2 sts=2 tw=80 et cindent: */ 3 /* This Source Code Form is subject to the terms of the Mozilla Public 4 * License, v. 2.0. If a copy of the MPL was not distributed with this 5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 6 7 #ifndef nsMediaSniffer_h 8 #define nsMediaSniffer_h 9 10 #include "nsIContentSniffer.h" 11 #include "mozilla/Attributes.h" 12 13 // ed905ba3-c656-480e-934e-6bc35bd36aff 14 #define NS_MEDIA_SNIFFER_CID \ 15 { \ 16 0x3fdd6c28, 0x5b87, 0x4e3e, { \ 17 0x8b, 0x57, 0x8e, 0x83, 0xc2, 0x3c, 0x1a, 0x6d \ 18 } \ 19 } 20 21 #define NS_MEDIA_SNIFFER_CONTRACTID "@mozilla.org/media/sniffer;1" 22 23 #define PATTERN_ENTRY(mask, pattern, contentType) \ 24 { \ 25 (const uint8_t*)mask, (const uint8_t*)pattern, sizeof(mask) - 1, \ 26 contentType \ 27 } 28 29 struct nsMediaSnifferEntry { 30 const uint8_t* mMask; 31 const uint8_t* mPattern; 32 const uint32_t mLength; 33 const char* mContentType; 34 }; 35 36 class nsMediaSniffer final : public nsIContentSniffer { 37 public: 38 NS_DECL_ISUPPORTS 39 NS_DECL_NSICONTENTSNIFFER 40 41 private: 42 ~nsMediaSniffer() = default; 43 44 static nsMediaSnifferEntry sSnifferEntries[]; 45 }; 46 47 #endif 48