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

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

Issue 881603002: Adding an ALAC enum to AudioDecoderConfig (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix compilation error Created 5 years, 10 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/ffmpeg/ffmpeg_common.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 case kSampleFormatPlanarS32:
23 return 4; 24 return 4;
24 } 25 }
25 26
26 NOTREACHED() << "Invalid sample format provided: " << sample_format; 27 NOTREACHED() << "Invalid sample format provided: " << sample_format;
27 return 0; 28 return 0;
28 } 29 }
29 30
30 const char* SampleFormatToString(SampleFormat sample_format) { 31 const char* SampleFormatToString(SampleFormat sample_format) {
31 switch(sample_format) { 32 switch(sample_format) {
32 case kUnknownSampleFormat: 33 case kUnknownSampleFormat:
33 return "Unknown sample format"; 34 return "Unknown sample format";
34 case kSampleFormatU8: 35 case kSampleFormatU8:
35 return "Unsigned 8-bit with bias of 128"; 36 return "Unsigned 8-bit with bias of 128";
36 case kSampleFormatS16: 37 case kSampleFormatS16:
37 return "Signed 16-bit"; 38 return "Signed 16-bit";
38 case kSampleFormatS32: 39 case kSampleFormatS32:
39 return "Signed 32-bit"; 40 return "Signed 32-bit";
40 case kSampleFormatF32: 41 case kSampleFormatF32:
41 return "Float 32-bit"; 42 return "Float 32-bit";
42 case kSampleFormatPlanarS16: 43 case kSampleFormatPlanarS16:
43 return "Signed 16-bit planar"; 44 return "Signed 16-bit planar";
44 case kSampleFormatPlanarF32: 45 case kSampleFormatPlanarF32:
45 return "Float 32-bit planar"; 46 return "Float 32-bit planar";
47 case kSampleFormatPlanarS32:
48 return "Signed 32-bit planar";
46 } 49 }
47 NOTREACHED() << "Invalid sample format provided: " << sample_format; 50 NOTREACHED() << "Invalid sample format provided: " << sample_format;
48 return ""; 51 return "";
49 } 52 }
50 53
51 } // namespace media 54 } // namespace media
OLDNEW
« no previous file with comments | « media/base/sample_format.h ('k') | media/ffmpeg/ffmpeg_common.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698