~ubuntu-branches/debian/experimental/kopete/experimental

« back to all changes in this revision

Viewing changes to protocols/jabber/googletalk/libjingle/talk/session/phone/mediasessionclient.h

  • Committer: Package Import Robot
  • Author(s): Maximiliano Curia
  • Date: 2015-02-24 11:32:57 UTC
  • mfrom: (1.1.41 vivid)
  • Revision ID: package-import@ubuntu.com-20150224113257-gnupg4v7lzz18ij0
Tags: 4:14.12.2-1
* New upstream release (14.12.2).
* Bump Standards-Version to 3.9.6, no changes needed.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 * libjingle
3
 
 * Copyright 2004--2005, Google Inc.
4
 
 *
5
 
 * Redistribution and use in source and binary forms, with or without
6
 
 * modification, are permitted provided that the following conditions are met:
7
 
 *
8
 
 *  1. Redistributions of source code must retain the above copyright notice,
9
 
 *     this list of conditions and the following disclaimer.
10
 
 *  2. Redistributions in binary form must reproduce the above copyright notice,
11
 
 *     this list of conditions and the following disclaimer in the documentation
12
 
 *     and/or other materials provided with the distribution.
13
 
 *  3. The name of the author may not be used to endorse or promote products
14
 
 *     derived from this software without specific prior written permission.
15
 
 *
16
 
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
17
 
 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
18
 
 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
19
 
 * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
20
 
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
21
 
 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
22
 
 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
23
 
 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
24
 
 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
25
 
 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26
 
 */
27
 
 
28
 
#ifndef TALK_SESSION_PHONE_MEDIASESSIONCLIENT_H_
29
 
#define TALK_SESSION_PHONE_MEDIASESSIONCLIENT_H_
30
 
 
31
 
#include <string>
32
 
#include <vector>
33
 
#include <map>
34
 
#include <algorithm>
35
 
#include "talk/session/phone/call.h"
36
 
#include "talk/session/phone/channelmanager.h"
37
 
#include "talk/session/phone/cryptoparams.h"
38
 
#include "talk/session/phone/mediasession.h"
39
 
#include "talk/base/sigslot.h"
40
 
#include "talk/base/sigslotrepeater.h"
41
 
#include "talk/base/messagequeue.h"
42
 
#include "talk/base/thread.h"
43
 
#include "talk/p2p/base/sessionmanager.h"
44
 
#include "talk/p2p/base/session.h"
45
 
#include "talk/p2p/base/sessionclient.h"
46
 
#include "talk/p2p/base/sessiondescription.h"
47
 
 
48
 
namespace cricket {
49
 
 
50
 
class Call;
51
 
 
52
 
class MediaSessionClient : public SessionClient, public sigslot::has_slots<> {
53
 
 public:
54
 
  MediaSessionClient(const buzz::Jid& jid, SessionManager *manager);
55
 
  // Alternative constructor, allowing injection of media_engine
56
 
  // and device_manager.
57
 
  MediaSessionClient(const buzz::Jid& jid, SessionManager *manager,
58
 
                     MediaEngineInterface* media_engine,
59
 
                     DataEngineInterface* data_media_engine,
60
 
                     DeviceManagerInterface* device_manager);
61
 
  ~MediaSessionClient();
62
 
 
63
 
  const buzz::Jid &jid() const { return jid_; }
64
 
  SessionManager* session_manager() const { return session_manager_; }
65
 
  ChannelManager* channel_manager() const { return channel_manager_; }
66
 
 
67
 
  SecureMediaPolicy secure() const { return desc_factory_.secure(); }
68
 
  void set_secure(SecureMediaPolicy s) { desc_factory_.set_secure(s); }
69
 
 
70
 
  int GetCapabilities() { return channel_manager_->GetCapabilities(); }
71
 
 
72
 
  Call *CreateCall();
73
 
  void DestroyCall(Call *call);
74
 
 
75
 
  Call *GetFocus();
76
 
  void SetFocus(Call *call);
77
 
 
78
 
  void JoinCalls(Call *call_to_join, Call *call);
79
 
 
80
 
  bool GetAudioInputDevices(std::vector<std::string>* names) {
81
 
    return channel_manager_->GetAudioInputDevices(names);
82
 
  }
83
 
  bool GetAudioOutputDevices(std::vector<std::string>* names) {
84
 
    return channel_manager_->GetAudioOutputDevices(names);
85
 
  }
86
 
  bool GetVideoCaptureDevices(std::vector<std::string>* names) {
87
 
    return channel_manager_->GetVideoCaptureDevices(names);
88
 
  }
89
 
 
90
 
  bool SetAudioOptions(const std::string& in_name, const std::string& out_name,
91
 
                       int opts) {
92
 
    return channel_manager_->SetAudioOptions(in_name, out_name, opts);
93
 
  }
94
 
  bool SetOutputVolume(int level) {
95
 
    return channel_manager_->SetOutputVolume(level);
96
 
  }
97
 
  bool SetVideoOptions(const std::string& cam_device) {
98
 
    return channel_manager_->SetVideoOptions(cam_device);
99
 
  }
100
 
 
101
 
  SessionDescription* CreateOffer(const CallOptions& options) {
102
 
    return desc_factory_.CreateOffer(options, NULL);
103
 
  }
104
 
  SessionDescription* CreateAnswer(const SessionDescription* offer,
105
 
                                   const CallOptions& options) {
106
 
    return desc_factory_.CreateAnswer(offer, options, NULL);
107
 
  }
108
 
 
109
 
  sigslot::signal2<Call *, Call *> SignalFocus;
110
 
  sigslot::signal1<Call *> SignalCallCreate;
111
 
  sigslot::signal1<Call *> SignalCallDestroy;
112
 
  sigslot::repeater0<> SignalDevicesChange;
113
 
 
114
 
  virtual bool ParseContent(SignalingProtocol protocol,
115
 
                            const buzz::XmlElement* elem,
116
 
                            const ContentDescription** content,
117
 
                            ParseError* error);
118
 
  virtual bool IsWritable(SignalingProtocol protocol,
119
 
                          const ContentDescription* content);
120
 
  virtual bool WriteContent(SignalingProtocol protocol,
121
 
                            const ContentDescription* content,
122
 
                            buzz::XmlElement** elem,
123
 
                            WriteError* error);
124
 
 
125
 
 private:
126
 
  void Construct();
127
 
  void OnSessionCreate(Session *session, bool received_initiate);
128
 
  void OnSessionState(BaseSession *session, BaseSession::State state);
129
 
  void OnSessionDestroy(Session *session);
130
 
  Session *CreateSession(Call *call);
131
 
 
132
 
  buzz::Jid jid_;
133
 
  SessionManager* session_manager_;
134
 
  Call *focus_call_;
135
 
  ChannelManager *channel_manager_;
136
 
  MediaSessionDescriptionFactory desc_factory_;
137
 
  std::map<uint32, Call *> calls_;
138
 
  std::map<std::string, Call *> session_map_;
139
 
  friend class Call;
140
 
};
141
 
 
142
 
}  // namespace cricket
143
 
 
144
 
#endif  // TALK_SESSION_PHONE_MEDIASESSIONCLIENT_H_