Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(568)

Side by Side Diff: media/base/sample_format.cc

Issue 148553003: Clean up histogram'd media enum max values. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix naming collision Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « media/base/sample_format.h ('k') | media/base/video_decoder_config.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 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/sample_format.h" 5 #include "media/base/sample_format.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 8
9 namespace media { 9 namespace media {
10 10
11 int SampleFormatToBytesPerChannel(SampleFormat sample_format) { 11 int SampleFormatToBytesPerChannel(SampleFormat sample_format) {
12 switch (sample_format) { 12 switch (sample_format) {
13 case kUnknownSampleFormat: 13 case kUnknownSampleFormat:
14 return 0; 14 return 0;
15 case kSampleFormatU8: 15 case kSampleFormatU8:
16 return 1; 16 return 1;
17 case kSampleFormatS16: 17 case kSampleFormatS16:
18 case kSampleFormatPlanarS16: 18 case kSampleFormatPlanarS16:
19 return 2; 19 return 2;
20 case kSampleFormatS32: 20 case kSampleFormatS32:
21 case kSampleFormatF32: 21 case kSampleFormatF32:
22 case kSampleFormatPlanarF32: 22 case kSampleFormatPlanarF32:
23 return 4; 23 return 4;
24 case kSampleFormatMax:
25 break;
26 } 24 }
27 25
28 NOTREACHED() << "Invalid sample format provided: " << sample_format; 26 NOTREACHED() << "Invalid sample format provided: " << sample_format;
29 return 0; 27 return 0;
30 } 28 }
31 29
32 const char* SampleFormatToString(SampleFormat sample_format) { 30 const char* SampleFormatToString(SampleFormat sample_format) {
33 switch(sample_format) { 31 switch(sample_format) {
34 case kUnknownSampleFormat: 32 case kUnknownSampleFormat:
35 return "Unknown sample format"; 33 return "Unknown sample format";
36 case kSampleFormatU8: 34 case kSampleFormatU8:
37 return "Unsigned 8-bit with bias of 128"; 35 return "Unsigned 8-bit with bias of 128";
38 case kSampleFormatS16: 36 case kSampleFormatS16:
39 return "Signed 16-bit"; 37 return "Signed 16-bit";
40 case kSampleFormatS32: 38 case kSampleFormatS32:
41 return "Signed 32-bit"; 39 return "Signed 32-bit";
42 case kSampleFormatF32: 40 case kSampleFormatF32:
43 return "Float 32-bit"; 41 return "Float 32-bit";
44 case kSampleFormatPlanarS16: 42 case kSampleFormatPlanarS16:
45 return "Signed 16-bit planar"; 43 return "Signed 16-bit planar";
46 case kSampleFormatPlanarF32: 44 case kSampleFormatPlanarF32:
47 return "Float 32-bit planar"; 45 return "Float 32-bit planar";
48 case kSampleFormatMax:
49 break;
50 } 46 }
51 NOTREACHED() << "Invalid sample format provided: " << sample_format; 47 NOTREACHED() << "Invalid sample format provided: " << sample_format;
52 return ""; 48 return "";
53 } 49 }
54 50
55 } // namespace media 51 } // namespace media
OLDNEW
« no previous file with comments | « media/base/sample_format.h ('k') | media/base/video_decoder_config.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698