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
   52
   53
   54
   55
   56
   57
   58
   59
   60
   61
   62
   63
   64
   65
   66
   67
   68
   69
   70
   71
   72
   73
   74
   75
   76
   77
   78
   79
   80
   81
   82
   83
   84
   85
   86
   87
   88
   89

media / cast / openscreen / remoting_message_factories.h [blame]

// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef MEDIA_CAST_OPENSCREEN_REMOTING_MESSAGE_FACTORIES_H_
#define MEDIA_CAST_OPENSCREEN_REMOTING_MESSAGE_FACTORIES_H_

#include <memory>

#include "base/time/time.h"
#include "media/base/buffering_state.h"
#include "media/base/pipeline_status.h"
#include "third_party/openscreen/src/cast/streaming/public/rpc_messenger.h"

namespace gfx {
class Size;
}  // namespace gfx

namespace media {
class AudioDecoderConfig;
class VideoDecoderConfig;
}  // namespace media

namespace openscreen {
namespace cast {
class RpcMessage;
}  // namespace cast
}  // namespace openscreen

namespace media::cast {

// Each of these methods creates an RpcMessage type representing the operation
// called out in the name. They are intended to be used by a media::Renderer to
// communicate using the Cast Mirroring protocol.
//
// Note that these utilities do NOT set the handle for the created messages, and
// the caller is instead expected to set this.
std::unique_ptr<openscreen::cast::RpcMessage> CreateMessageForError();

std::unique_ptr<openscreen::cast::RpcMessage> CreateMessageForMediaEnded();

std::unique_ptr<openscreen::cast::RpcMessage> CreateMessageForStatisticsUpdate(
    const media::PipelineStatistics& stats);

std::unique_ptr<openscreen::cast::RpcMessage>
CreateMessageForBufferingStateChange(media::BufferingState state);

std::unique_ptr<openscreen::cast::RpcMessage> CreateMessageForAudioConfigChange(
    const media::AudioDecoderConfig& config);

std::unique_ptr<openscreen::cast::RpcMessage> CreateMessageForVideoConfigChange(
    const media::VideoDecoderConfig& config);

std::unique_ptr<openscreen::cast::RpcMessage>
CreateMessageForVideoNaturalSizeChange(const gfx::Size& size);

std::unique_ptr<openscreen::cast::RpcMessage>
CreateMessageForVideoOpacityChange(bool opaque);

std::unique_ptr<openscreen::cast::RpcMessage> CreateMessageForMediaTimeUpdate(
    base::TimeDelta media_time);

std::unique_ptr<openscreen::cast::RpcMessage>
CreateMessageForInitializationComplete(bool has_succeeded);

std::unique_ptr<openscreen::cast::RpcMessage> CreateMessageForFlushComplete();

std::unique_ptr<openscreen::cast::RpcMessage>
CreateMessageForAcquireRendererDone(
    openscreen::cast::RpcMessenger::Handle receiver_renderer_handle);

std::unique_ptr<openscreen::cast::RpcMessage>
CreateMessageForDemuxerStreamInitialize(
    openscreen::cast::RpcMessenger::Handle local_handle);

std::unique_ptr<openscreen::cast::RpcMessage>
CreateMessageForDemuxerStreamReadUntil(
    openscreen::cast::RpcMessenger::Handle local_handle,
    uint32_t buffers_requested);

std::unique_ptr<openscreen::cast::RpcMessage>
CreateMessageForDemuxerStreamEnableBitstreamConverter();

std::unique_ptr<openscreen::cast::RpcMessage>
CreateMessageForDemuxerStreamError();

}  // namespace media::cast

#endif  // MEDIA_CAST_OPENSCREEN_REMOTING_MESSAGE_FACTORIES_H_