Delete unused downloads page asset.
[chromium-blink-merge.git] / media / base / sample_format.cc
blob464fc1b6f578e0f4187f40365d18f4ef8922a20b
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
3 // found in the LICENSE file.
5 #include "media/base/sample_format.h"
7 #include "base/logging.h"
9 namespace media {
11 int SampleFormatToBytesPerChannel(SampleFormat sample_format) {
12 switch (sample_format) {
13 case kUnknownSampleFormat:
14 return 0;
15 case kSampleFormatU8:
16 return 1;
17 case kSampleFormatS16:
18 case kSampleFormatPlanarS16:
19 return 2;
20 case kSampleFormatS32:
21 case kSampleFormatF32:
22 case kSampleFormatPlanarF32:
23 case kSampleFormatPlanarS32:
24 return 4;
27 NOTREACHED() << "Invalid sample format provided: " << sample_format;
28 return 0;
31 const char* SampleFormatToString(SampleFormat sample_format) {
32 switch(sample_format) {
33 case kUnknownSampleFormat:
34 return "Unknown sample format";
35 case kSampleFormatU8:
36 return "Unsigned 8-bit with bias of 128";
37 case kSampleFormatS16:
38 return "Signed 16-bit";
39 case kSampleFormatS32:
40 return "Signed 32-bit";
41 case kSampleFormatF32:
42 return "Float 32-bit";
43 case kSampleFormatPlanarS16:
44 return "Signed 16-bit planar";
45 case kSampleFormatPlanarF32:
46 return "Float 32-bit planar";
47 case kSampleFormatPlanarS32:
48 return "Signed 32-bit planar";
50 NOTREACHED() << "Invalid sample format provided: " << sample_format;
51 return "";
54 } // namespace media