Changeset 224887 in webkit
- Timestamp:
- Nov 15, 2017 11:06:53 AM (6 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r224882 r224887 1 2017-11-15 Jer Noble <jer.noble@apple.com> 2 3 Add a compile-time-checked string literal initializer for FourCC. 4 https://bugs.webkit.org/show_bug.cgi?id=179706 5 6 Reviewed by Alex Christensen. 7 8 Add a contexpr constructor for FourCC that takes a string literal and static_asserts that it 9 is exactly 4 chars long. Use this string literal constructor everywhere instead of multi- 10 character literals. 11 12 * platform/graphics/FourCC.h: 13 (WebCore::FourCC::FourCC): 14 * platform/graphics/iso/ISOBox.cpp: 15 (WebCore::ISOBox::parse): 16 * platform/graphics/iso/ISOOriginalFormatBox.h: 17 (WebCore::ISOOriginalFormatBox::boxTypeName): 18 * platform/graphics/iso/ISOProtectionSchemeInfoBox.h: 19 (WebCore::ISOProtectionSchemeInfoBox::boxTypeName): 20 * platform/graphics/iso/ISOSchemeInformationBox.h: 21 (WebCore::ISOSchemeInformationBox::boxTypeName): 22 * platform/graphics/iso/ISOSchemeTypeBox.h: 23 (WebCore::ISOSchemeTypeBox::boxTypeName): 24 * platform/graphics/iso/ISOTrackEncryptionBox.h: 25 (WebCore::ISOTrackEncryptionBox::boxTypeName): 26 * platform/graphics/iso/ISOVTTCue.h: 27 (WebCore::ISOWebVTTCue::boxTypeName): 28 1 29 2017-11-15 Adrian Perez de Castro <aperez@igalia.com> 2 30 -
trunk/Source/WebCore/platform/graphics/FourCC.h
r224707 r224887 33 33 WEBCORE_EXPORT FourCC(uint32_t value) : value(value) { } 34 34 35 template<std::size_t N> 36 constexpr FourCC(const char (&data)[N]) 37 { 38 static_assert((N - 1) == 4, "FourCC literals must be exactly 4 characters long"); 39 value = data[0] << 24 | data[1] << 16 | data[2] << 8 | data[3]; 40 } 41 35 42 String toString() const; 36 43 WEBCORE_EXPORT static std::optional<FourCC> fromString(const String&); -
trunk/Source/WebCore/platform/graphics/iso/ISOBox.cpp
r224707 r224887 76 76 return false; 77 77 78 if (m_boxType .value == 'uuid') {78 if (m_boxType == "uuid") { 79 79 struct ExtendedType { 80 80 uint8_t value[16]; -
trunk/Source/WebCore/platform/graphics/iso/ISOOriginalFormatBox.h
r224707 r224887 32 32 class ISOOriginalFormatBox : public ISOBox { 33 33 public: 34 static FourCC boxTypeName() { return 'frma'; }34 static FourCC boxTypeName() { return "frma"; } 35 35 36 36 FourCC dataFormat() const { return m_dataFormat; } -
trunk/Source/WebCore/platform/graphics/iso/ISOProtectionSchemeInfoBox.h
r224707 r224887 35 35 class ISOProtectionSchemeInfoBox : public ISOFullBox { 36 36 public: 37 static FourCC boxTypeName() { return 'sinf'; }37 static FourCC boxTypeName() { return "sinf"; } 38 38 39 39 const ISOSchemeTypeBox* schemeTypeBox() const { return m_schemeTypeBox.get(); } -
trunk/Source/WebCore/platform/graphics/iso/ISOSchemeInformationBox.h
r224707 r224887 32 32 class ISOSchemeInformationBox : public ISOBox { 33 33 public: 34 static FourCC boxTypeName() { return 'schi'; }34 static FourCC boxTypeName() { return "schi"; } 35 35 36 36 const ISOBox* schemeSpecificData() const { return m_schemeSpecificData.get(); } -
trunk/Source/WebCore/platform/graphics/iso/ISOSchemeTypeBox.h
r224707 r224887 32 32 class ISOSchemeTypeBox : public ISOFullBox { 33 33 public: 34 static FourCC boxTypeName() { return 'schm'; }34 static FourCC boxTypeName() { return "schm"; } 35 35 36 36 FourCC schemeType() const { return m_schemeType; } -
trunk/Source/WebCore/platform/graphics/iso/ISOTrackEncryptionBox.h
r224707 r224887 32 32 class ISOTrackEncryptionBox : public ISOFullBox { 33 33 public: 34 static FourCC boxTypeName() { return 'tenc'; }34 static FourCC boxTypeName() { return "tenc"; } 35 35 36 36 std::optional<int8_t> defaultCryptByteBlock() const { return m_defaultCryptByteBlock; } -
trunk/Source/WebCore/platform/graphics/iso/ISOVTTCue.cpp
r224707 r224887 74 74 }; 75 75 76 static FourCC vttIdBoxType() { return 'iden'; }77 static FourCC vttSettingsBoxType() { return 'sttg'; }78 static FourCC vttPayloadBoxType() { return 'payl'; }79 static FourCC vttCurrentTimeBoxType() { return 'ctim'; }80 static FourCC vttCueSourceIDBoxType() { return 'vsid'; }76 static FourCC vttIdBoxType() { return "iden"; } 77 static FourCC vttSettingsBoxType() { return "sttg"; } 78 static FourCC vttPayloadBoxType() { return "payl"; } 79 static FourCC vttCurrentTimeBoxType() { return "ctim"; } 80 static FourCC vttCueSourceIDBoxType() { return "vsid"; } 81 81 82 82 ISOWebVTTCue::ISOWebVTTCue(const MediaTime& presentationTime, const MediaTime& duration) -
trunk/Source/WebCore/platform/graphics/iso/ISOVTTCue.h
r224707 r224887 43 43 ISOWebVTTCue(const MediaTime& presentationTime, const MediaTime& duration); 44 44 45 static FourCC boxTypeName() { return 'vtcc'; }45 static FourCC boxTypeName() { return "vtcc"; } 46 46 47 47 const MediaTime& presentationTime() const { return m_presentationTime; }
Note: See TracChangeset
for help on using the changeset viewer.