Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2100)

Unified Diff: ppapi/thunk/ppb_audio_buffer_thunk.cc

Issue 156863005: [PPAPI][MediaStream] Rename AudioFrame to AudioBuffer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@frame_to_buffer
Patch Set: Update Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ppapi/thunk/ppb_audio_buffer_api.h ('k') | ppapi/thunk/ppb_audio_frame_api.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ppapi/thunk/ppb_audio_buffer_thunk.cc
diff --git a/ppapi/thunk/ppb_audio_buffer_thunk.cc b/ppapi/thunk/ppb_audio_buffer_thunk.cc
new file mode 100644
index 0000000000000000000000000000000000000000..d87d5b0780a6a9d51936b8b0cd23a6ed80c81734
--- /dev/null
+++ b/ppapi/thunk/ppb_audio_buffer_thunk.cc
@@ -0,0 +1,108 @@
+// Copyright 2014 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.
+
+// From ppb_audio_buffer.idl modified Thu Feb 6 15:31:48 2014.
+
+#include "ppapi/c/pp_errors.h"
+#include "ppapi/c/ppb_audio_buffer.h"
+#include "ppapi/shared_impl/tracked_callback.h"
+#include "ppapi/thunk/enter.h"
+#include "ppapi/thunk/ppapi_thunk_export.h"
+#include "ppapi/thunk/ppb_audio_buffer_api.h"
+
+namespace ppapi {
+namespace thunk {
+
+namespace {
+
+PP_Bool IsAudioBuffer(PP_Resource resource) {
+ VLOG(4) << "PPB_AudioBuffer::IsAudioBuffer()";
+ EnterResource<PPB_AudioBuffer_API> enter(resource, false);
+ return PP_FromBool(enter.succeeded());
+}
+
+PP_TimeDelta GetTimestamp(PP_Resource buffer) {
+ VLOG(4) << "PPB_AudioBuffer::GetTimestamp()";
+ EnterResource<PPB_AudioBuffer_API> enter(buffer, true);
+ if (enter.failed())
+ return 0.0;
+ return enter.object()->GetTimestamp();
+}
+
+void SetTimestamp(PP_Resource buffer, PP_TimeDelta timestamp) {
+ VLOG(4) << "PPB_AudioBuffer::SetTimestamp()";
+ EnterResource<PPB_AudioBuffer_API> enter(buffer, true);
+ if (enter.failed())
+ return;
+ enter.object()->SetTimestamp(timestamp);
+}
+
+PP_AudioBuffer_SampleRate GetSampleRate(PP_Resource buffer) {
+ VLOG(4) << "PPB_AudioBuffer::GetSampleRate()";
+ EnterResource<PPB_AudioBuffer_API> enter(buffer, true);
+ if (enter.failed())
+ return PP_AUDIOBUFFER_SAMPLERATE_UNKNOWN;
+ return enter.object()->GetSampleRate();
+}
+
+PP_AudioBuffer_SampleSize GetSampleSize(PP_Resource buffer) {
+ VLOG(4) << "PPB_AudioBuffer::GetSampleSize()";
+ EnterResource<PPB_AudioBuffer_API> enter(buffer, true);
+ if (enter.failed())
+ return PP_AUDIOBUFFER_SAMPLESIZE_UNKNOWN;
+ return enter.object()->GetSampleSize();
+}
+
+uint32_t GetNumberOfChannels(PP_Resource buffer) {
+ VLOG(4) << "PPB_AudioBuffer::GetNumberOfChannels()";
+ EnterResource<PPB_AudioBuffer_API> enter(buffer, true);
+ if (enter.failed())
+ return 0;
+ return enter.object()->GetNumberOfChannels();
+}
+
+uint32_t GetNumberOfSamples(PP_Resource buffer) {
+ VLOG(4) << "PPB_AudioBuffer::GetNumberOfSamples()";
+ EnterResource<PPB_AudioBuffer_API> enter(buffer, true);
+ if (enter.failed())
+ return 0;
+ return enter.object()->GetNumberOfSamples();
+}
+
+void* GetDataBuffer(PP_Resource buffer) {
+ VLOG(4) << "PPB_AudioBuffer::GetDataBuffer()";
+ EnterResource<PPB_AudioBuffer_API> enter(buffer, true);
+ if (enter.failed())
+ return NULL;
+ return enter.object()->GetDataBuffer();
+}
+
+uint32_t GetDataBufferSize(PP_Resource buffer) {
+ VLOG(4) << "PPB_AudioBuffer::GetDataBufferSize()";
+ EnterResource<PPB_AudioBuffer_API> enter(buffer, true);
+ if (enter.failed())
+ return 0;
+ return enter.object()->GetDataBufferSize();
+}
+
+const PPB_AudioBuffer_0_1 g_ppb_audiobuffer_thunk_0_1 = {
+ &IsAudioBuffer,
+ &GetTimestamp,
+ &SetTimestamp,
+ &GetSampleRate,
+ &GetSampleSize,
+ &GetNumberOfChannels,
+ &GetNumberOfSamples,
+ &GetDataBuffer,
+ &GetDataBufferSize
+};
+
+} // namespace
+
+PPAPI_THUNK_EXPORT const PPB_AudioBuffer_0_1* GetPPB_AudioBuffer_0_1_Thunk() {
+ return &g_ppb_audiobuffer_thunk_0_1;
+}
+
+} // namespace thunk
+} // namespace ppapi
« no previous file with comments | « ppapi/thunk/ppb_audio_buffer_api.h ('k') | ppapi/thunk/ppb_audio_frame_api.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698