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

Side by Side Diff: webrtc/examples/unityplugin/unity_plugin_apis.h

Issue 2823783002: An example of Unity native plugin of webrtc for Windows OS (Closed)
Patch Set: Sync to head Created 3 years, 7 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 unified diff | Download patch
OLDNEW
(Empty)
1 /*
2 * Copyright (c) 2017 The WebRTC project authors. All Rights Reserved.
3 *
4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
10
11 // This file provides an example of unity native plugin APIs.
12
13 #ifndef WEBRTC_EXAMPLES_UNITYPLUGIN_UNITY_PLUGIN_APIS_H_
14 #define WEBRTC_EXAMPLES_UNITYPLUGIN_UNITY_PLUGIN_APIS_H_
15
16 #include <stdint.h>
17
18 // Defintions of callback functions.
19 typedef void (*VIDEOFRAMEREADY_CALLBACK)(uint8_t* buffer,
20 uint32_t width,
21 uint32_t height,
22 uint32_t stride);
23 typedef void (*LOCALDATACHANNELREADY_CALLBACK)();
24 typedef void (*DATAFROMEDATECHANNELREADY_CALLBACK)(const char* msg);
25 typedef void (*FAILURE_CALLBACK)(const char* msg);
26 typedef void (*LOCALSDPREADYTOSEND_CALLBACK)(const char* msg);
27 typedef void (*ICECANDIDATEREADYTOSEND_CALLBACK)(const char* msg);
28 typedef void (*AUDIOBUSREADY_CALLBACK)(const void* audio_data,
29 int bits_per_sample,
30 int sample_rate,
31 int number_of_channels,
32 int number_of_frames);
33
34 #define WEBRTC_PLUGIN_API __declspec(dllexport)
35 extern "C" {
36 // Create a peerconnection and return a unique peer connection id.
37 WEBRTC_PLUGIN_API int CreatePeerConnection();
38 // Close a peerconnection.
39 WEBRTC_PLUGIN_API bool ClosePeerConnection(int peer_connection_id);
40 // Add a audio stream. If audio_only is true, the stream only has an audio
41 // track and no video track.
42 WEBRTC_PLUGIN_API bool AddStream(int peer_connection_id, bool audio_only);
43 // Add a data channel to peer connection.
44 WEBRTC_PLUGIN_API bool AddDataChannel(int peer_connection_id);
45 // Create a peer connection offer.
46 WEBRTC_PLUGIN_API bool CreateOffer(int peer_connection_id);
47 // Create a peer connection answer.
48 WEBRTC_PLUGIN_API bool CreateAnswer(int peer_connection_id);
49 // Send data through data channel.
50 WEBRTC_PLUGIN_API bool SendDataViaDataChannel(int peer_connection_id,
51 const char* data);
52 // Set audio control. If is_mute=true, no audio will playout. If is_record=true,
53 // AUDIOBUSREADY_CALLBACK will be called every 10 ms.
54 WEBRTC_PLUGIN_API bool SetAudioControl(int peer_connection_id,
55 bool is_mute,
56 bool is_record);
57
58 // Register callback functions.
59 WEBRTC_PLUGIN_API bool RegisterOnVideoFramReady(
60 int peer_connection_id,
61 VIDEOFRAMEREADY_CALLBACK callback);
62 WEBRTC_PLUGIN_API bool RegisterOnLocalDataChannelReady(
63 int peer_connection_id,
64 LOCALDATACHANNELREADY_CALLBACK callback);
65 WEBRTC_PLUGIN_API bool RegisterOnDataFromDataChannelReady(
66 int peer_connection_id,
67 DATAFROMEDATECHANNELREADY_CALLBACK callback);
68 WEBRTC_PLUGIN_API bool RegisterOnFailure(int peer_connection_id,
69 FAILURE_CALLBACK callback);
70 WEBRTC_PLUGIN_API bool RegisterOnAudioBusReady(int peer_connection_id,
71 AUDIOBUSREADY_CALLBACK callback);
72 WEBRTC_PLUGIN_API bool RegisterOnLocalSdpReadytoSend(
73 int peer_connection_id,
74 LOCALSDPREADYTOSEND_CALLBACK callback);
75 WEBRTC_PLUGIN_API bool RegisterOnIceCandiateReadytoSend(
76 int peer_connection_id,
77 ICECANDIDATEREADYTOSEND_CALLBACK callback);
78 WEBRTC_PLUGIN_API int ReceivedSdp(int peer_connection_id, const char* sdp);
79 WEBRTC_PLUGIN_API bool ReceivedIceCandidate(int peer_connection_id,
80 const char* ice_candidate);
81 }
82
83 #endif // WEBRTC_EXAMPLES_UNITYPLUGIN_UNITY_PLUGIN_APIS_H_
OLDNEW
« no previous file with comments | « webrtc/examples/unityplugin/simple_peer_connection.cc ('k') | webrtc/examples/unityplugin/unity_plugin_apis.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698