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"
11 int SampleFormatToBytesPerChannel(SampleFormat sample_format
) {
12 switch (sample_format
) {
13 case kUnknownSampleFormat
:
17 case kSampleFormatS16
:
18 case kSampleFormatPlanarS16
:
20 case kSampleFormatS32
:
21 case kSampleFormatF32
:
22 case kSampleFormatPlanarF32
:
23 case kSampleFormatPlanarS32
:
27 NOTREACHED() << "Invalid sample format provided: " << sample_format
;
31 const char* SampleFormatToString(SampleFormat sample_format
) {
32 switch(sample_format
) {
33 case kUnknownSampleFormat
:
34 return "Unknown sample format";
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
;