| OLD | NEW |
| (Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CHROME_BROWSER_MEDIA_ROUTER_MEDIA_REMOTING_PROVIDER_IMPL_H_ |
| 6 #define CHROME_BROWSER_MEDIA_ROUTER_MEDIA_REMOTING_PROVIDER_IMPL_H_ |
| 7 |
| 8 #include "base/callback.h" |
| 9 #include "media/mojo/interfaces/remoter.mojom.h" |
| 10 |
| 11 namespace media_router { |
| 12 |
| 13 // Interface for a provider of remote media services. |
| 14 class MediaRemotingProvider { |
| 15 public: |
| 16 // Returns the remote's capabilities if remote services are |
| 17 // available. Otherwise, nullptr. |
| 18 virtual const media::mojom::RemoteCapabilities* |
| 19 GetRemoteCapabilities() const = 0; |
| 20 |
| 21 // Requests that remote media services be started, returning true if |
| 22 // successful. |audio_pipe| and |video_pipe| are handles to data pipes for |
| 23 // consuming buffer data whenever SendBufferToRemote() is |
| 24 // called. |message_callback| is run to dispatch messages received from the |
| 25 // remote to the local implementation. |
| 26 using RemoteMessageCallback = base::Callback<void(mojo::Array<uint8_t>)>; |
| 27 virtual bool StartMediaServices( |
| 28 mojo::ScopedDataPipeConsumerHandle audio_pipe, |
| 29 mojo::ScopedDataPipeConsumerHandle video_pipe, |
| 30 const RemoteMessageCallback& message_callback) = 0; |
| 31 |
| 32 // Stops media remoting services. The data pipes provided in the call to |
| 33 // StartMediaServices() are closed. If |error_reason| is non-empty, it |
| 34 // contains a human-readable error message. |
| 35 virtual void StopMediaServices(const mojo::String& error_reason) = 0; |
| 36 |
| 37 // Sends a |message| or |buffer| to the remote. Messages are passed to the |
| 38 // MediaRemotingProvider for transmission over the third-party messaging |
| 39 // channel, which must be encrypted and reliable. Buffers are passed to the |
| 40 // bitstream transport implementation. |
| 41 virtual void SendMessageToRemote(mojo::Array<uint8_t> message) = 0; |
| 42 virtual void SendBufferToRemote(uint32_t pipe_id, |
| 43 media::mojom::DecoderBufferPtr buffer) = 0; |
| 44 |
| 45 protected: |
| 46 MediaRemotingProvider() {} |
| 47 virtual ~MediaRemotingProvider() {} |
| 48 |
| 49 private: |
| 50 DISALLOW_COPY_AND_ASSIGN(MediaRemotingProvider); |
| 51 }; |
| 52 |
| 53 } // namespace media_router |
| 54 |
| 55 #endif // CHROME_BROWSER_MEDIA_ROUTER_MEDIA_REMOTING_PROVIDER_IMPL_H_ |
| OLD | NEW |