summaryrefslogtreecommitdiffstats
path: root/include/media/nbaio/SourceAudioBufferProvider.h
diff options
context:
space:
mode:
authorGlenn Kasten <gkasten@google.com>2012-08-29 11:10:32 -0700
committerGlenn Kasten <gkasten@google.com>2012-08-30 10:53:37 -0700
commitfc7992bd8220824f1404c0c54ac516d9e28b58c2 (patch)
tree972da8ca10068930ebb465a72c76be69a0ca6a79 /include/media/nbaio/SourceAudioBufferProvider.h
parent6db33a9272da8f011be1c51675220b81655fd470 (diff)
downloadframeworks_av-fc7992bd8220824f1404c0c54ac516d9e28b58c2.zip
frameworks_av-fc7992bd8220824f1404c0c54ac516d9e28b58c2.tar.gz
frameworks_av-fc7992bd8220824f1404c0c54ac516d9e28b58c2.tar.bz2
Move libnbaio out of AudioFlinger
libnbaio is now a separate shared library from AudioFlinger, rather than a static library used only by AudioFlinger. AudioBufferProvider interface is now also independent of AudioFlinger, moved to include/media/ Change-Id: I9bb62ffbc38d42a38b0af76e66da5e9ab1e0e21b
Diffstat (limited to 'include/media/nbaio/SourceAudioBufferProvider.h')
-rw-r--r--include/media/nbaio/SourceAudioBufferProvider.h52
1 files changed, 52 insertions, 0 deletions
diff --git a/include/media/nbaio/SourceAudioBufferProvider.h b/include/media/nbaio/SourceAudioBufferProvider.h
new file mode 100644
index 0000000..c08331b
--- /dev/null
+++ b/include/media/nbaio/SourceAudioBufferProvider.h
@@ -0,0 +1,52 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// Implementation of AudioBufferProvider that wraps an NBAIO_Source
+
+#ifndef ANDROID_SOURCE_AUDIO_BUFFER_PROVIDER_H
+#define ANDROID_SOURCE_AUDIO_BUFFER_PROVIDER_H
+
+#include "NBAIO.h"
+#include <media/ExtendedAudioBufferProvider.h>
+
+namespace android {
+
+class SourceAudioBufferProvider : public ExtendedAudioBufferProvider {
+
+public:
+ SourceAudioBufferProvider(const sp<NBAIO_Source>& source);
+ virtual ~SourceAudioBufferProvider();
+
+ // AudioBufferProvider interface
+ virtual status_t getNextBuffer(Buffer *buffer, int64_t pts);
+ virtual void releaseBuffer(Buffer *buffer);
+
+ // ExtendedAudioBufferProvider interface
+ virtual size_t framesReady() const;
+
+private:
+ const sp<NBAIO_Source> mSource; // the wrapped source
+ /*const*/ size_t mFrameBitShift; // log2(frame size in bytes)
+ void* mAllocated; // pointer to base of allocated memory
+ size_t mSize; // size of mAllocated in frames
+ size_t mOffset; // frame offset within mAllocated of valid data
+ size_t mRemaining; // frame count within mAllocated of valid data
+ size_t mGetCount; // buffer.frameCount of the most recent getNextBuffer
+};
+
+} // namespace android
+
+#endif // ANDROID_SOURCE_AUDIO_BUFFER_PROVIDER_H