| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 MEDIA_FORMATS_MP4_FOURCCS_H_ | 5 #ifndef MEDIA_FORMATS_MP4_FOURCCS_H_ |
| 6 #define MEDIA_FORMATS_MP4_FOURCCS_H_ | 6 #define MEDIA_FORMATS_MP4_FOURCCS_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "media/media_features.h" | 10 #include "media/media_features.h" |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 FOURCC_TKHD = 0x746b6864, | 94 FOURCC_TKHD = 0x746b6864, |
| 95 FOURCC_TRAF = 0x74726166, | 95 FOURCC_TRAF = 0x74726166, |
| 96 FOURCC_TRAK = 0x7472616b, | 96 FOURCC_TRAK = 0x7472616b, |
| 97 FOURCC_TREX = 0x74726578, | 97 FOURCC_TREX = 0x74726578, |
| 98 FOURCC_TRUN = 0x7472756e, | 98 FOURCC_TRUN = 0x7472756e, |
| 99 FOURCC_UDTA = 0x75647461, | 99 FOURCC_UDTA = 0x75647461, |
| 100 FOURCC_UUID = 0x75756964, | 100 FOURCC_UUID = 0x75756964, |
| 101 FOURCC_VIDE = 0x76696465, | 101 FOURCC_VIDE = 0x76696465, |
| 102 FOURCC_VMHD = 0x766d6864, | 102 FOURCC_VMHD = 0x766d6864, |
| 103 FOURCC_VP09 = 0x76703039, | 103 FOURCC_VP09 = 0x76703039, |
| 104 FOURCC_VPCC = 0x76706343, |
| 104 FOURCC_WIDE = 0x77696465, | 105 FOURCC_WIDE = 0x77696465, |
| 105 }; | 106 }; |
| 106 | 107 |
| 107 const inline std::string FourCCToString(FourCC fourcc) { | 108 const inline std::string FourCCToString(FourCC fourcc) { |
| 108 char buf[5]; | 109 char buf[5]; |
| 109 buf[0] = (fourcc >> 24) & 0xff; | 110 buf[0] = (fourcc >> 24) & 0xff; |
| 110 buf[1] = (fourcc >> 16) & 0xff; | 111 buf[1] = (fourcc >> 16) & 0xff; |
| 111 buf[2] = (fourcc >> 8) & 0xff; | 112 buf[2] = (fourcc >> 8) & 0xff; |
| 112 buf[3] = (fourcc) & 0xff; | 113 buf[3] = (fourcc) & 0xff; |
| 113 buf[4] = 0; | 114 buf[4] = 0; |
| 114 | 115 |
| 115 // Return hex itself if characters can not be printed. Any character within | 116 // Return hex itself if characters can not be printed. Any character within |
| 116 // the "C" locale is considered printable. | 117 // the "C" locale is considered printable. |
| 117 for (int i = 0; i < 4; ++i) { | 118 for (int i = 0; i < 4; ++i) { |
| 118 if (!(buf[i] > 0x1f && buf[i] < 0x7f)) { | 119 if (!(buf[i] > 0x1f && buf[i] < 0x7f)) { |
| 119 std::stringstream hex_string; | 120 std::stringstream hex_string; |
| 120 hex_string << "0x" << std::hex << fourcc; | 121 hex_string << "0x" << std::hex << fourcc; |
| 121 return hex_string.str(); | 122 return hex_string.str(); |
| 122 } | 123 } |
| 123 } | 124 } |
| 124 | 125 |
| 125 return std::string(buf); | 126 return std::string(buf); |
| 126 } | 127 } |
| 127 | 128 |
| 128 } // namespace mp4 | 129 } // namespace mp4 |
| 129 } // namespace media | 130 } // namespace media |
| 130 | 131 |
| 131 #endif // MEDIA_FORMATS_MP4_FOURCCS_H_ | 132 #endif // MEDIA_FORMATS_MP4_FOURCCS_H_ |
| OLD | NEW |