Ensure callback objects held by the Indexed DB
[chromium-blink-merge.git] / media / base / sample_format.cc
bloba4791cd6861ef5dbb86f0edfe0fa7ce2f0459383
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 return 4;
24 case kSampleFormatMax:
25 break;
28 NOTREACHED() << "Invalid sample format provided: " << sample_format;
29 return 0;
32 const char* SampleFormatToString(SampleFormat sample_format) {
33 switch(sample_format) {
34 case kUnknownSampleFormat:
35 return "Unknown sample format";
36 case kSampleFormatU8:
37 return "Unsigned 8-bit with bias of 128";
38 case kSampleFormatS16:
39 return "Signed 16-bit";
40 case kSampleFormatS32:
41 return "Signed 32-bit";
42 case kSampleFormatF32:
43 return "Float 32-bit";
44 case kSampleFormatPlanarS16:
45 return "Signed 16-bit planar";
46 case kSampleFormatPlanarF32:
47 return "Float 32-bit planar";
48 case kSampleFormatMax:
49 break;
51 NOTREACHED() << "Invalid sample format provided: " << sample_format;
52 return "";
55 } // namespace media