| OLD | NEW | 
|---|
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 #include "media/base/container_names.h" | 5 #include "media/base/container_names.h" | 
| 6 | 6 | 
| 7 #include <stddef.h> | 7 #include <stddef.h> | 
| 8 | 8 | 
| 9 #include <cctype> | 9 #include <cctype> | 
| 10 #include <limits> | 10 #include <limits> | 
| (...skipping 1407 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1418 static const uint8_t kWtvSignature[] = {0xb7, 0xd8, 0x00, 0x20, 0x37, 0x49, | 1418 static const uint8_t kWtvSignature[] = {0xb7, 0xd8, 0x00, 0x20, 0x37, 0x49, | 
| 1419                                         0xda, 0x11, 0xa6, 0x4e, 0x00, 0x07, | 1419                                         0xda, 0x11, 0xa6, 0x4e, 0x00, 0x07, | 
| 1420                                         0xe9, 0x5e, 0xad, 0x8d}; | 1420                                         0xe9, 0x5e, 0xad, 0x8d}; | 
| 1421 | 1421 | 
| 1422 // Attempt to determine the container type from the buffer provided. This is | 1422 // Attempt to determine the container type from the buffer provided. This is | 
| 1423 // a simple pass, that uses the first 4 bytes of the buffer as an index to get | 1423 // a simple pass, that uses the first 4 bytes of the buffer as an index to get | 
| 1424 // a rough idea of the container format. | 1424 // a rough idea of the container format. | 
| 1425 static MediaContainerName LookupContainerByFirst4(const uint8_t* buffer, | 1425 static MediaContainerName LookupContainerByFirst4(const uint8_t* buffer, | 
| 1426                                                   int buffer_size) { | 1426                                                   int buffer_size) { | 
| 1427   // Minimum size that the code expects to exist without checking size. | 1427   // Minimum size that the code expects to exist without checking size. | 
| 1428   if (buffer_size < 12) | 1428   if (buffer_size < kMinimumContainerSize) | 
| 1429     return CONTAINER_UNKNOWN; | 1429     return CONTAINER_UNKNOWN; | 
| 1430 | 1430 | 
| 1431   uint32_t first4 = Read32(buffer); | 1431   uint32_t first4 = Read32(buffer); | 
| 1432   switch (first4) { | 1432   switch (first4) { | 
| 1433     case 0x1a45dfa3: | 1433     case 0x1a45dfa3: | 
| 1434       if (CheckWebm(buffer, buffer_size)) | 1434       if (CheckWebm(buffer, buffer_size)) | 
| 1435         return CONTAINER_WEBM; | 1435         return CONTAINER_WEBM; | 
| 1436       break; | 1436       break; | 
| 1437 | 1437 | 
| 1438     case 0x3026b275: | 1438     case 0x3026b275: | 
| (...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1664     if (CheckEac3(buffer + offset, buffer_size - offset)) | 1664     if (CheckEac3(buffer + offset, buffer_size - offset)) | 
| 1665       return CONTAINER_EAC3; | 1665       return CONTAINER_EAC3; | 
| 1666   } | 1666   } | 
| 1667 | 1667 | 
| 1668   return CONTAINER_UNKNOWN; | 1668   return CONTAINER_UNKNOWN; | 
| 1669 } | 1669 } | 
| 1670 | 1670 | 
| 1671 }  // namespace container_names | 1671 }  // namespace container_names | 
| 1672 | 1672 | 
| 1673 }  // namespace media | 1673 }  // namespace media | 
| OLD | NEW | 
|---|