OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright 2012 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 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 | 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 | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 16 matching lines...) Loading... |
27 namespace rtc { | 27 namespace rtc { |
28 class Thread; | 28 class Thread; |
29 } | 29 } |
30 | 30 |
31 namespace webrtc { | 31 namespace webrtc { |
32 | 32 |
33 // This interface is called by DtmfSender to talk to the actual audio channel | 33 // This interface is called by DtmfSender to talk to the actual audio channel |
34 // to send DTMF. | 34 // to send DTMF. |
35 class DtmfProviderInterface { | 35 class DtmfProviderInterface { |
36 public: | 36 public: |
37 // Returns true if the audio track with given id (|track_id|) is capable | 37 // Returns true if the audio sender is capable of sending DTMF. Otherwise |
38 // of sending DTMF. Otherwise returns false. | 38 // returns false. |
39 virtual bool CanInsertDtmf(const std::string& track_id) = 0; | 39 virtual bool CanInsertDtmf() = 0; |
40 // Sends DTMF |code| via the audio track with given id (|track_id|). | 40 // Sends DTMF |code|. |
41 // The |duration| indicates the length of the DTMF tone in ms. | 41 // The |duration| indicates the length of the DTMF tone in ms. |
42 // Returns true on success and false on failure. | 42 // Returns true on success and false on failure. |
43 virtual bool InsertDtmf(const std::string& track_id, | 43 virtual bool InsertDtmf(int code, int duration) = 0; |
44 int code, int duration) = 0; | |
45 // Returns a |sigslot::signal0<>| signal. The signal should fire before | 44 // Returns a |sigslot::signal0<>| signal. The signal should fire before |
46 // the provider is destroyed. | 45 // the provider is destroyed. |
47 virtual sigslot::signal0<>* GetOnDestroyedSignal() = 0; | 46 virtual sigslot::signal0<>* GetOnDestroyedSignal() = 0; |
48 | 47 |
49 protected: | 48 protected: |
50 virtual ~DtmfProviderInterface() {} | 49 virtual ~DtmfProviderInterface() {} |
51 }; | 50 }; |
52 | 51 |
53 class DtmfSender | 52 class DtmfSender |
54 : public DtmfSenderInterface, | 53 : public DtmfSenderInterface, |
55 public sigslot::has_slots<>, | 54 public sigslot::has_slots<>, |
56 public rtc::MessageHandler { | 55 public rtc::MessageHandler { |
57 public: | 56 public: |
| 57 // |track| is only there for backwards compatibility, since there's a track |
| 58 // accessor method. |
58 static rtc::scoped_refptr<DtmfSender> Create( | 59 static rtc::scoped_refptr<DtmfSender> Create( |
59 AudioTrackInterface* track, | 60 AudioTrackInterface* track, |
60 rtc::Thread* signaling_thread, | 61 rtc::Thread* signaling_thread, |
61 DtmfProviderInterface* provider); | 62 DtmfProviderInterface* provider); |
62 | 63 |
63 // Implements DtmfSenderInterface. | 64 // Implements DtmfSenderInterface. |
64 void RegisterObserver(DtmfSenderObserverInterface* observer) override; | 65 void RegisterObserver(DtmfSenderObserverInterface* observer) override; |
65 void UnregisterObserver() override; | 66 void UnregisterObserver() override; |
66 bool CanInsertDtmf() override; | 67 bool CanInsertDtmf() override; |
67 bool InsertDtmf(const std::string& tones, | 68 bool InsertDtmf(const std::string& tones, |
(...skipping 46 matching lines...) Loading... |
114 PROXY_CONSTMETHOD0(int, duration) | 115 PROXY_CONSTMETHOD0(int, duration) |
115 PROXY_CONSTMETHOD0(int, inter_tone_gap) | 116 PROXY_CONSTMETHOD0(int, inter_tone_gap) |
116 END_PROXY_MAP() | 117 END_PROXY_MAP() |
117 | 118 |
118 // Get DTMF code from the DTMF event character. | 119 // Get DTMF code from the DTMF event character. |
119 bool GetDtmfCode(char tone, int* code); | 120 bool GetDtmfCode(char tone, int* code); |
120 | 121 |
121 } // namespace webrtc | 122 } // namespace webrtc |
122 | 123 |
123 #endif // WEBRTC_PC_DTMFSENDER_H_ | 124 #endif // WEBRTC_PC_DTMFSENDER_H_ |
OLD | NEW |