aboutsummaryrefslogtreecommitdiff
path: root/cast/streaming/message_fields.h
blob: 890afb3e5e131da92db52791ee827ca1dccc2a28 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
// Copyright 2020 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef CAST_STREAMING_MESSAGE_FIELDS_H_
#define CAST_STREAMING_MESSAGE_FIELDS_H_

#include <string>

#include "absl/strings/string_view.h"
#include "cast/streaming/constants.h"

namespace openscreen {
namespace cast {

/// NOTE: Constants here are all taken from the Cast V2: Mirroring Control
/// Protocol specification.

// Namespace for OFFER/ANSWER messages.
constexpr char kCastWebrtcNamespace[] = "urn:x-cast:com.google.cast.webrtc";

// JSON message field values specific to the Sender Session.
constexpr char kMessageKeyType[] = "type";
constexpr char kMessageTypeOffer[] = "OFFER";
constexpr char kMessageTypeAnswer[] = "ANSWER";

// List of OFFER message fields.
constexpr char kOfferMessageBody[] = "offer";
constexpr char kKeyType[] = "type";
constexpr char kSequenceNumber[] = "seqNum";

/// ANSWER message fields.
constexpr char kAnswerMessageBody[] = "answer";
constexpr char kResult[] = "result";
constexpr char kResultOk[] = "ok";
constexpr char kResultError[] = "error";
constexpr char kErrorMessageBody[] = "error";
constexpr char kErrorCode[] = "code";
constexpr char kErrorDescription[] = "description";

// Conversion methods for codec message fields.
const char* CodecToString(AudioCodec codec);
AudioCodec StringToAudioCodec(absl::string_view name);

const char* CodecToString(VideoCodec codec);
VideoCodec StringToVideoCodec(absl::string_view name);

}  // namespace cast
}  // namespace openscreen

#endif  // CAST_STREAMING_MESSAGE_FIELDS_H_