• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright (c) 2022 The Chromium Embedded Framework Authors. All rights
2 // reserved. Use of this source code is governed by a BSD-style license that
3 // can be found in the LICENSE file.
4 //
5 // ---------------------------------------------------------------------------
6 //
7 // This file was generated by the CEF translator tool. If making changes by
8 // hand only do so within the body of existing method and function
9 // implementations. See the translator.README.txt file in the tools directory
10 // for more information.
11 //
12 // $hash=519a82bbea84ea39cadc72c55291e15cb2a74072$
13 //
14 
15 #include "libcef_dll/cpptoc/audio_handler_cpptoc.h"
16 #include "libcef_dll/ctocpp/browser_ctocpp.h"
17 #include "libcef_dll/shutdown_checker.h"
18 
19 namespace {
20 
21 // MEMBER FUNCTIONS - Body may be edited by hand.
22 
23 int CEF_CALLBACK
audio_handler_get_audio_parameters(struct _cef_audio_handler_t * self,struct _cef_browser_t * browser,cef_audio_parameters_t * params)24 audio_handler_get_audio_parameters(struct _cef_audio_handler_t* self,
25                                    struct _cef_browser_t* browser,
26                                    cef_audio_parameters_t* params) {
27   shutdown_checker::AssertNotShutdown();
28 
29   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
30 
31   DCHECK(self);
32   if (!self)
33     return 0;
34   // Verify param: browser; type: refptr_diff
35   DCHECK(browser);
36   if (!browser)
37     return 0;
38   // Verify param: params; type: simple_byref
39   DCHECK(params);
40   if (!params)
41     return 0;
42 
43   // Translate param: params; type: simple_byref
44   CefAudioParameters paramsVal = params ? *params : CefAudioParameters();
45 
46   // Execute
47   bool _retval = CefAudioHandlerCppToC::Get(self)->GetAudioParameters(
48       CefBrowserCToCpp::Wrap(browser), paramsVal);
49 
50   // Restore param: params; type: simple_byref
51   if (params)
52     *params = paramsVal;
53 
54   // Return type: bool
55   return _retval;
56 }
57 
58 void CEF_CALLBACK
audio_handler_on_audio_stream_started(struct _cef_audio_handler_t * self,struct _cef_browser_t * browser,const cef_audio_parameters_t * params,int channels)59 audio_handler_on_audio_stream_started(struct _cef_audio_handler_t* self,
60                                       struct _cef_browser_t* browser,
61                                       const cef_audio_parameters_t* params,
62                                       int channels) {
63   shutdown_checker::AssertNotShutdown();
64 
65   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
66 
67   DCHECK(self);
68   if (!self)
69     return;
70   // Verify param: browser; type: refptr_diff
71   DCHECK(browser);
72   if (!browser)
73     return;
74   // Verify param: params; type: simple_byref_const
75   DCHECK(params);
76   if (!params)
77     return;
78 
79   // Translate param: params; type: simple_byref_const
80   CefAudioParameters paramsVal = params ? *params : CefAudioParameters();
81 
82   // Execute
83   CefAudioHandlerCppToC::Get(self)->OnAudioStreamStarted(
84       CefBrowserCToCpp::Wrap(browser), paramsVal, channels);
85 }
86 
87 void CEF_CALLBACK
audio_handler_on_audio_stream_packet(struct _cef_audio_handler_t * self,struct _cef_browser_t * browser,const float ** data,int frames,int64 pts)88 audio_handler_on_audio_stream_packet(struct _cef_audio_handler_t* self,
89                                      struct _cef_browser_t* browser,
90                                      const float** data,
91                                      int frames,
92                                      int64 pts) {
93   shutdown_checker::AssertNotShutdown();
94 
95   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
96 
97   DCHECK(self);
98   if (!self)
99     return;
100   // Verify param: browser; type: refptr_diff
101   DCHECK(browser);
102   if (!browser)
103     return;
104   // Verify param: data; type: simple_byaddr
105   DCHECK(data);
106   if (!data)
107     return;
108 
109   // Execute
110   CefAudioHandlerCppToC::Get(self)->OnAudioStreamPacket(
111       CefBrowserCToCpp::Wrap(browser), data, frames, pts);
112 }
113 
114 void CEF_CALLBACK
audio_handler_on_audio_stream_stopped(struct _cef_audio_handler_t * self,struct _cef_browser_t * browser)115 audio_handler_on_audio_stream_stopped(struct _cef_audio_handler_t* self,
116                                       struct _cef_browser_t* browser) {
117   shutdown_checker::AssertNotShutdown();
118 
119   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
120 
121   DCHECK(self);
122   if (!self)
123     return;
124   // Verify param: browser; type: refptr_diff
125   DCHECK(browser);
126   if (!browser)
127     return;
128 
129   // Execute
130   CefAudioHandlerCppToC::Get(self)->OnAudioStreamStopped(
131       CefBrowserCToCpp::Wrap(browser));
132 }
133 
134 void CEF_CALLBACK
audio_handler_on_audio_stream_error(struct _cef_audio_handler_t * self,struct _cef_browser_t * browser,const cef_string_t * message)135 audio_handler_on_audio_stream_error(struct _cef_audio_handler_t* self,
136                                     struct _cef_browser_t* browser,
137                                     const cef_string_t* message) {
138   shutdown_checker::AssertNotShutdown();
139 
140   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
141 
142   DCHECK(self);
143   if (!self)
144     return;
145   // Verify param: browser; type: refptr_diff
146   DCHECK(browser);
147   if (!browser)
148     return;
149   // Verify param: message; type: string_byref_const
150   DCHECK(message);
151   if (!message)
152     return;
153 
154   // Execute
155   CefAudioHandlerCppToC::Get(self)->OnAudioStreamError(
156       CefBrowserCToCpp::Wrap(browser), CefString(message));
157 }
158 
159 }  // namespace
160 
161 // CONSTRUCTOR - Do not edit by hand.
162 
CefAudioHandlerCppToC()163 CefAudioHandlerCppToC::CefAudioHandlerCppToC() {
164   GetStruct()->get_audio_parameters = audio_handler_get_audio_parameters;
165   GetStruct()->on_audio_stream_started = audio_handler_on_audio_stream_started;
166   GetStruct()->on_audio_stream_packet = audio_handler_on_audio_stream_packet;
167   GetStruct()->on_audio_stream_stopped = audio_handler_on_audio_stream_stopped;
168   GetStruct()->on_audio_stream_error = audio_handler_on_audio_stream_error;
169 }
170 
171 // DESTRUCTOR - Do not edit by hand.
172 
~CefAudioHandlerCppToC()173 CefAudioHandlerCppToC::~CefAudioHandlerCppToC() {
174   shutdown_checker::AssertNotShutdown();
175 }
176 
177 template <>
178 CefRefPtr<CefAudioHandler> CefCppToCRefCounted<
179     CefAudioHandlerCppToC,
180     CefAudioHandler,
UnwrapDerived(CefWrapperType type,cef_audio_handler_t * s)181     cef_audio_handler_t>::UnwrapDerived(CefWrapperType type,
182                                         cef_audio_handler_t* s) {
183   NOTREACHED() << "Unexpected class type: " << type;
184   return nullptr;
185 }
186 
187 template <>
188 CefWrapperType CefCppToCRefCounted<CefAudioHandlerCppToC,
189                                    CefAudioHandler,
190                                    cef_audio_handler_t>::kWrapperType =
191     WT_AUDIO_HANDLER;
192