OLD | NEW |
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 #include "media/ffmpeg/ffmpeg_common.h" | 5 #include "media/ffmpeg/ffmpeg_common.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/sha1.h" | 8 #include "base/sha1.h" |
9 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
10 #include "base/strings/string_split.h" | 10 #include "base/strings/string_split.h" |
(...skipping 726 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
737 return COLOR_SPACE_HD_REC709; | 737 return COLOR_SPACE_HD_REC709; |
738 case AVCOL_SPC_SMPTE170M: | 738 case AVCOL_SPC_SMPTE170M: |
739 case AVCOL_SPC_BT470BG: | 739 case AVCOL_SPC_BT470BG: |
740 return COLOR_SPACE_SD_REC601; | 740 return COLOR_SPACE_SD_REC601; |
741 default: | 741 default: |
742 DVLOG(1) << "Unknown AVColorSpace: " << color_space; | 742 DVLOG(1) << "Unknown AVColorSpace: " << color_space; |
743 } | 743 } |
744 return COLOR_SPACE_UNSPECIFIED; | 744 return COLOR_SPACE_UNSPECIFIED; |
745 } | 745 } |
746 | 746 |
| 747 std::string AVErrorToString(int errnum) { |
| 748 char errbuf[AV_ERROR_MAX_STRING_SIZE] = {0}; |
| 749 av_strerror(errnum, errbuf, AV_ERROR_MAX_STRING_SIZE); |
| 750 return std::string(errbuf); |
| 751 } |
| 752 |
747 int32_t HashCodecName(const char* codec_name) { | 753 int32_t HashCodecName(const char* codec_name) { |
748 // Use the first 32-bits from the SHA1 hash as the identifier. | 754 // Use the first 32-bits from the SHA1 hash as the identifier. |
749 int32_t hash; | 755 int32_t hash; |
750 memcpy(&hash, base::SHA1HashString(codec_name).substr(0, 4).c_str(), 4); | 756 memcpy(&hash, base::SHA1HashString(codec_name).substr(0, 4).c_str(), 4); |
751 return hash; | 757 return hash; |
752 } | 758 } |
753 | 759 |
754 } // namespace media | 760 } // namespace media |
OLD | NEW |