chromium/third_party/openscreen/src/cast/streaming/message_fields.h

// Copyright 2020 The Chromium Authors
// 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 <string_view>

#include "cast/streaming/public/constants.h"
#include "platform/base/error.h"

namespace openscreen::cast {

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

// Namespace for OFFER/ANSWER messages.
constexpr char kCastWebrtcNamespace[] =;
constexpr char kCastRemotingNamespace[] =;

// JSON message field values specific to the Sender Session.
constexpr char kMessageType[] =;

// List of OFFER message fields.
constexpr char kMessageTypeOffer[] =;
constexpr char kOfferMessageBody[] =;
constexpr char kSequenceNumber[] =;
constexpr char kCodecName[] =;

/// ANSWER message fields.
constexpr char kMessageTypeAnswer[] =;
constexpr char kAnswerMessageBody[] =;
constexpr char kResult[] =;
constexpr char kResultOk[] =;
constexpr char kResultError[] =;
constexpr char kErrorMessageBody[] =;
constexpr char kErrorCode[] =;
constexpr char kErrorDescription[] =;

// Other message fields.
constexpr char kRpcMessageBody[] =;
constexpr char kCapabilitiesMessageBody[] =;
constexpr char kStatusMessageBody[] =;

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

const char* CodecToString(VideoCodec codec);
ErrorOr<VideoCodec> StringToVideoCodec(std::string_view name);

}  // namespace openscreen::cast

#endif  // CAST_STREAMING_MESSAGE_FIELDS_H_