private void CheckSelf(cef_audio_handler_t *self)
 {
     if (_self != self)
     {
         throw ExceptionBuilder.InvalidSelfReference();
     }
 }
        private void on_audio_stream_started(cef_audio_handler_t *self, cef_browser_t *browser, int audio_stream_id, int channels, CefChannelLayout channel_layout, int sample_rate, int frames_per_buffer)
        {
            CheckSelf(self);

            var mBrowser = CefBrowser.FromNative(browser);

            OnAudioStreamStarted(mBrowser, audio_stream_id, channels, channel_layout, sample_rate, frames_per_buffer);
        }
        private void on_audio_stream_packet(cef_audio_handler_t *self, cef_browser_t *browser, int audio_stream_id, float **data, int frames, long pts)
        {
            CheckSelf(self);

            var mBrowser = CefBrowser.FromNative(browser);

            OnAudioStreamPacket(mBrowser, audio_stream_id, (IntPtr)data, frames, pts);
        }
        private void on_audio_stream_stopped(cef_audio_handler_t *self, cef_browser_t *browser, int audio_stream_id)
        {
            CheckSelf(self);

            var mBrowser = CefBrowser.FromNative(browser);

            OnAudioStreamStopped(mBrowser, audio_stream_id);
        }
        private void on_audio_stream_started(cef_audio_handler_t *self, cef_browser_t *browser, cef_audio_parameters_t * @params, int channels)
        {
            CheckSelf(self);

            var mBrowser = CefBrowser.FromNative(browser);

            OnAudioStreamStarted(mBrowser, new CefAudioParameters(@params), channels);
        }
 protected virtual void Dispose(bool disposing)
 {
     if (_self != null)
     {
         cef_audio_handler_t.Free(_self);
         _self = null;
     }
 }
        private void on_audio_stream_error(cef_audio_handler_t *self, cef_browser_t *browser, cef_string_t *message)
        {
            CheckSelf(self);

            var mBrowser = CefBrowser.FromNative(browser);
            var mMessage = cef_string_t.ToString(message);

            OnAudioStreamError(mBrowser, mMessage);
        }
Exemple #8
0
        public CefAudioHandler()
        {
            cef_audio_handler_t *self = this.NativeInstance;

            self->get_audio_parameters    = (void *)Marshal.GetFunctionPointerForDelegate(fnGetAudioParameters);
            self->on_audio_stream_started = (void *)Marshal.GetFunctionPointerForDelegate(fnOnAudioStreamStarted);
            self->on_audio_stream_packet  = (void *)Marshal.GetFunctionPointerForDelegate(fnOnAudioStreamPacket);
            self->on_audio_stream_stopped = (void *)Marshal.GetFunctionPointerForDelegate(fnOnAudioStreamStopped);
            self->on_audio_stream_error   = (void *)Marshal.GetFunctionPointerForDelegate(fnOnAudioStreamError);
        }
        private int get_audio_parameters(cef_audio_handler_t *self, cef_browser_t *browser, cef_audio_parameters_t * @params)
        {
            CheckSelf(self);

            var mBrowser = CefBrowser.FromNative(browser);

            var mResult = GetAudioParameters(mBrowser, new CefAudioParameters(@params));

            return(mResult ? 1 : 0);
        }
 private void add_ref(cef_audio_handler_t *self)
 {
     lock (SyncRoot)
     {
         var result = ++_refct;
         if (result == 1)
         {
             lock (_roots) { _roots.Add((IntPtr)_self, this); }
         }
     }
 }
 private int release(cef_audio_handler_t *self)
 {
     lock (SyncRoot)
     {
         var result = --_refct;
         if (result == 0)
         {
             lock (_roots) { _roots.Remove((IntPtr)_self); }
             return(1);
         }
         return(0);
     }
 }
Exemple #12
0
        public CefAudioHandler()
        {
            cef_audio_handler_t *self = this.NativeInstance;

                        #if NET_LESS_5_0
            self->get_audio_parameters    = (void *)Marshal.GetFunctionPointerForDelegate(fnGetAudioParameters);
            self->on_audio_stream_started = (void *)Marshal.GetFunctionPointerForDelegate(fnOnAudioStreamStarted);
            self->on_audio_stream_packet  = (void *)Marshal.GetFunctionPointerForDelegate(fnOnAudioStreamPacket);
            self->on_audio_stream_stopped = (void *)Marshal.GetFunctionPointerForDelegate(fnOnAudioStreamStopped);
            self->on_audio_stream_error   = (void *)Marshal.GetFunctionPointerForDelegate(fnOnAudioStreamError);
                        #else
            self->get_audio_parameters    = (delegate * unmanaged[Stdcall] < cef_audio_handler_t *, cef_browser_t *, cef_audio_parameters_t *, int >) & GetAudioParametersImpl;
            self->on_audio_stream_started = (delegate * unmanaged[Stdcall] < cef_audio_handler_t *, cef_browser_t *, cef_audio_parameters_t *, int, void >) & OnAudioStreamStartedImpl;
            self->on_audio_stream_packet  = (delegate * unmanaged[Stdcall] < cef_audio_handler_t *, cef_browser_t *, float **, int, long, void >) & OnAudioStreamPacketImpl;
            self->on_audio_stream_stopped = (delegate * unmanaged[Stdcall] < cef_audio_handler_t *, cef_browser_t *, void >) & OnAudioStreamStoppedImpl;
            self->on_audio_stream_error   = (delegate * unmanaged[Stdcall] < cef_audio_handler_t *, cef_browser_t *, cef_string_t *, void >) & OnAudioStreamErrorImpl;
                        #endif
        }
        protected CefAudioHandler()
        {
            _self = cef_audio_handler_t.Alloc();

            _ds0 = new cef_audio_handler_t.add_ref_delegate(add_ref);
            _self->_base._add_ref = Marshal.GetFunctionPointerForDelegate(_ds0);
            _ds1 = new cef_audio_handler_t.release_delegate(release);
            _self->_base._release = Marshal.GetFunctionPointerForDelegate(_ds1);
            _ds2 = new cef_audio_handler_t.has_one_ref_delegate(has_one_ref);
            _self->_base._has_one_ref = Marshal.GetFunctionPointerForDelegate(_ds2);
            _ds3 = new cef_audio_handler_t.has_at_least_one_ref_delegate(has_at_least_one_ref);
            _self->_base._has_at_least_one_ref = Marshal.GetFunctionPointerForDelegate(_ds3);
            _ds4 = new cef_audio_handler_t.on_audio_stream_started_delegate(on_audio_stream_started);
            _self->_on_audio_stream_started = Marshal.GetFunctionPointerForDelegate(_ds4);
            _ds5 = new cef_audio_handler_t.on_audio_stream_packet_delegate(on_audio_stream_packet);
            _self->_on_audio_stream_packet = Marshal.GetFunctionPointerForDelegate(_ds5);
            _ds6 = new cef_audio_handler_t.on_audio_stream_stopped_delegate(on_audio_stream_stopped);
            _self->_on_audio_stream_stopped = Marshal.GetFunctionPointerForDelegate(_ds6);
        }
Exemple #14
0
 internal static void Free(cef_audio_handler_t *ptr)
 {
     Marshal.FreeHGlobal((IntPtr)ptr);
 }
Exemple #15
0
 public CefAudioHandler(cef_audio_handler_t *instance)
     : base((cef_base_ref_counted_t *)instance)
 {
 }
 private int has_at_least_one_ref(cef_audio_handler_t *self)
 {
     lock (SyncRoot) { return(_refct != 0 ? 1 : 0); }
 }
 private int has_one_ref(cef_audio_handler_t *self)
 {
     lock (SyncRoot) { return(_refct == 1 ? 1 : 0); }
 }