OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 // | 4 // |
5 // This is the main interface for the cast receiver. All configuration are done | 5 // This is the main interface for the cast receiver. All configuration are done |
6 // at creation. | 6 // at creation. |
7 | 7 |
8 #ifndef MEDIA_CAST_CAST_RECEIVER_H_ | 8 #ifndef MEDIA_CAST_CAST_RECEIVER_H_ |
9 #define MEDIA_CAST_CAST_RECEIVER_H_ | 9 #define MEDIA_CAST_CAST_RECEIVER_H_ |
10 | 10 |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
12 #include "base/callback.h" | 12 #include "base/callback.h" |
13 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
14 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
15 #include "base/time/time.h" | 15 #include "base/time/time.h" |
16 #include "media/base/audio_bus.h" | 16 #include "media/base/audio_bus.h" |
17 #include "media/cast/cast_config.h" | 17 #include "media/cast/cast_config.h" |
18 #include "media/cast/cast_environment.h" | 18 #include "media/cast/cast_environment.h" |
| 19 #include "media/cast/net/cast_transport_sender.h" |
19 | 20 |
20 namespace media { | 21 namespace media { |
21 class VideoFrame; | 22 class VideoFrame; |
22 | 23 |
23 namespace cast { | 24 namespace cast { |
24 | 25 |
25 class PacketSender; | 26 class PacketSender; |
26 | 27 |
27 // The following callbacks are used to deliver decoded audio/video frame data, | 28 // The following callbacks are used to deliver decoded audio/video frame data, |
28 // the frame's corresponding play-out time, and a continuity flag. | 29 // the frame's corresponding play-out time, and a continuity flag. |
(...skipping 15 matching lines...) Expand all Loading... |
44 // NULL pointer can be returned on error. | 45 // NULL pointer can be returned on error. |
45 typedef base::Callback<void(scoped_ptr<EncodedFrame>)> | 46 typedef base::Callback<void(scoped_ptr<EncodedFrame>)> |
46 ReceiveEncodedFrameCallback; | 47 ReceiveEncodedFrameCallback; |
47 | 48 |
48 class CastReceiver { | 49 class CastReceiver { |
49 public: | 50 public: |
50 static scoped_ptr<CastReceiver> Create( | 51 static scoped_ptr<CastReceiver> Create( |
51 scoped_refptr<CastEnvironment> cast_environment, | 52 scoped_refptr<CastEnvironment> cast_environment, |
52 const FrameReceiverConfig& audio_config, | 53 const FrameReceiverConfig& audio_config, |
53 const FrameReceiverConfig& video_config, | 54 const FrameReceiverConfig& video_config, |
54 PacketSender* const packet_sender); | 55 CastTransportSender* const transport); |
55 | 56 |
56 // All received RTP and RTCP packets for the call should be sent to this | 57 // All received RTP and RTCP packets for the call should be sent to this |
57 // PacketReceiver. Can be called from any thread. | 58 // PacketReceiver. Can be called from any thread. |
58 // TODO(hubbe): Replace with: | 59 virtual void ReceivePacket(scoped_ptr<Packet> packet) = 0; |
59 // virtual void ReceivePacket(scoped_ptr<Packet> packet) = 0; | |
60 virtual PacketReceiverCallback packet_receiver() = 0; | |
61 | 60 |
62 // Polling interface to get audio and video frames from the CastReceiver. The | 61 // Polling interface to get audio and video frames from the CastReceiver. The |
63 // the RequestDecodedXXXXXFrame() methods utilize internal software-based | 62 // the RequestDecodedXXXXXFrame() methods utilize internal software-based |
64 // decoding, while the RequestEncodedXXXXXFrame() methods provides | 63 // decoding, while the RequestEncodedXXXXXFrame() methods provides |
65 // still-encoded frames for use with external/hardware decoders. | 64 // still-encoded frames for use with external/hardware decoders. |
66 // | 65 // |
67 // In all cases, the given |callback| is guaranteed to be run at some point in | 66 // In all cases, the given |callback| is guaranteed to be run at some point in |
68 // the future, except for those requests still enqueued at destruction time. | 67 // the future, except for those requests still enqueued at destruction time. |
69 // | 68 // |
70 // These methods should all be called on the CastEnvironment's MAIN thread. | 69 // These methods should all be called on the CastEnvironment's MAIN thread. |
71 virtual void RequestDecodedAudioFrame( | 70 virtual void RequestDecodedAudioFrame( |
72 const AudioFrameDecodedCallback& callback) = 0; | 71 const AudioFrameDecodedCallback& callback) = 0; |
73 virtual void RequestEncodedAudioFrame( | 72 virtual void RequestEncodedAudioFrame( |
74 const ReceiveEncodedFrameCallback& callback) = 0; | 73 const ReceiveEncodedFrameCallback& callback) = 0; |
75 virtual void RequestDecodedVideoFrame( | 74 virtual void RequestDecodedVideoFrame( |
76 const VideoFrameDecodedCallback& callback) = 0; | 75 const VideoFrameDecodedCallback& callback) = 0; |
77 virtual void RequestEncodedVideoFrame( | 76 virtual void RequestEncodedVideoFrame( |
78 const ReceiveEncodedFrameCallback& callback) = 0; | 77 const ReceiveEncodedFrameCallback& callback) = 0; |
79 | 78 |
80 virtual ~CastReceiver() {} | 79 virtual ~CastReceiver() {} |
81 }; | 80 }; |
82 | 81 |
83 } // namespace cast | 82 } // namespace cast |
84 } // namespace media | 83 } // namespace media |
85 | 84 |
86 #endif // MEDIA_CAST_CAST_RECEIVER_H_ | 85 #endif // MEDIA_CAST_CAST_RECEIVER_H_ |
OLD | NEW |