OLD | NEW |
| (Empty) |
1 /* | |
2 * libjingle | |
3 * Copyright 2010 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 /* | |
29 * A collection of functions and types for serializing and | |
30 * deserializing Jingle session messages related to media. | |
31 * Specificially, the <notify> and <view> messages. They are not yet | |
32 * standardized, but their current documentation can be found at: | |
33 * goto/jinglemuc | |
34 */ | |
35 | |
36 #ifndef WEBRTC_LIBJINGLE_SESSION_MEDIA_MEDIAMESSAGES_H_ | |
37 #define WEBRTC_LIBJINGLE_SESSION_MEDIA_MEDIAMESSAGES_H_ | |
38 | |
39 #include <string> | |
40 #include <vector> | |
41 | |
42 #include "talk/media/base/mediachannel.h" // For RtpHeaderExtension | |
43 #include "talk/media/base/streamparams.h" | |
44 #include "webrtc/base/basictypes.h" | |
45 #include "webrtc/libjingle/session/parsing.h" | |
46 #include "webrtc/p2p/base/sessiondescription.h" | |
47 | |
48 namespace cricket { | |
49 | |
50 // If the parent element (usually <jingle>) is a jingle view. | |
51 bool IsJingleViewRequest(const buzz::XmlElement* action_elem); | |
52 | |
53 // Parses a view request from the parent element (usually | |
54 // <jingle>). If it fails, it returns false and fills an error | |
55 // message. | |
56 bool ParseJingleViewRequest(const buzz::XmlElement* action_elem, | |
57 ViewRequest* view_request, | |
58 ParseError* error); | |
59 | |
60 // Serializes a view request to XML. If it fails, returns false and | |
61 // fills in an error message. | |
62 bool WriteJingleViewRequest(const std::string& content_name, | |
63 const ViewRequest& view, | |
64 XmlElements* elems, | |
65 WriteError* error); | |
66 | |
67 // TODO(pthatcher): Get rid of legacy source notify and replace with | |
68 // description-info as soon as reflector is capable of sending it. | |
69 bool IsSourcesNotify(const buzz::XmlElement* action_elem); | |
70 | |
71 // If the given elem has <streams>. | |
72 bool HasJingleStreams(const buzz::XmlElement* desc_elem); | |
73 | |
74 // Parses streams from a jingle <description>. If it fails, returns | |
75 // false and fills an error message. | |
76 bool ParseJingleStreams(const buzz::XmlElement* desc_elem, | |
77 std::vector<StreamParams>* streams, | |
78 ParseError* error); | |
79 | |
80 // Write a <streams> element to the parent_elem. | |
81 void WriteJingleStreams(const std::vector<StreamParams>& streams, | |
82 buzz::XmlElement* parent_elem); | |
83 | |
84 // Parses rtp header extensions from a jingle <description>. If it | |
85 // fails, returns false and fills an error message. | |
86 bool ParseJingleRtpHeaderExtensions( | |
87 const buzz::XmlElement* desc_elem, | |
88 std::vector<RtpHeaderExtension>* hdrexts, | |
89 ParseError* error); | |
90 | |
91 // Writes <rtp-hdrext> elements to the parent_elem. | |
92 void WriteJingleRtpHeaderExtensions( | |
93 const std::vector<RtpHeaderExtension>& hdrexts, | |
94 buzz::XmlElement* parent_elem); | |
95 | |
96 } // namespace cricket | |
97 | |
98 #endif // WEBRTC_LIBJINGLE_SESSION_MEDIA_MEDIAMESSAGES_H_ | |
OLD | NEW |