summaryrefslogtreecommitdiffstats
path: root/media/base/sample_format.h
diff options
context:
space:
mode:
authorjrummell@chromium.org <jrummell@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-06-12 21:42:10 +0000
committerjrummell@chromium.org <jrummell@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-06-12 21:42:10 +0000
commitd1d4595ae1cee37c14b800b3cde15a2798129a39 (patch)
treeef639b5099bf86c60eccbe1fff0eb257b506fdd3 /media/base/sample_format.h
parentcadd30fea95dbec58c69078b959789be93917c37 (diff)
downloadchromium_src-d1d4595ae1cee37c14b800b3cde15a2798129a39.zip
chromium_src-d1d4595ae1cee37c14b800b3cde15a2798129a39.tar.gz
chromium_src-d1d4595ae1cee37c14b800b3cde15a2798129a39.tar.bz2
Expose SampleFormat -> bytes per frame calculations.
First part of converting audio streams to reduce copying the data. BUG=248989 Review URL: https://chromiumcodereview.appspot.com/16404013 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@205937 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'media/base/sample_format.h')
-rw-r--r--media/base/sample_format.h34
1 files changed, 34 insertions, 0 deletions
diff --git a/media/base/sample_format.h b/media/base/sample_format.h
new file mode 100644
index 0000000..bcaa5b2
--- /dev/null
+++ b/media/base/sample_format.h
@@ -0,0 +1,34 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef MEDIA_BASE_SAMPLE_FORMAT_H
+#define MEDIA_BASE_SAMPLE_FORMAT_H
+
+#include "media/base/media_export.h"
+
+namespace media {
+
+enum SampleFormat {
+ // These values are histogrammed over time; do not change their ordinal
+ // values. When deleting a sample format replace it with a dummy value; when
+ // adding a sample format, do so at the bottom before kSampleFormatMax.
+ kUnknownSampleFormat = 0,
+ kSampleFormatU8, // Unsigned 8-bit w/ bias of 128.
+ kSampleFormatS16, // Signed 16-bit.
+ kSampleFormatS32, // Signed 32-bit.
+ kSampleFormatF32, // Float 32-bit.
+ kSampleFormatPlanarS16, // Signed 16-bit planar.
+ kSampleFormatPlanarF32, // Float 32-bit planar.
+
+ // Must always be last!
+ kSampleFormatMax
+};
+
+// Returns the number of bytes used per channel for the specified
+// |sample_format|.
+MEDIA_EXPORT int SampleFormatToBytesPerChannel(SampleFormat sample_format);
+
+} // namespace media
+
+#endif // MEDIA_BASE_SAMPLE_FORMAT_H