Report errors from ChromiumEnv::GetChildren in Posix.
[chromium-blink-merge.git] / media / cast / cast_receiver.h
blob9faf94c4ed3fab160a93af9dfc3e3b1d5ba9d8da
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
3 // found in the LICENSE file.
4 //
5 // This is the main interface for the cast receiver. All configuration are done
6 // at creation.
8 #ifndef MEDIA_CAST_CAST_RECEIVER_H_
9 #define MEDIA_CAST_CAST_RECEIVER_H_
11 #include "base/basictypes.h"
12 #include "base/callback.h"
13 #include "base/memory/ref_counted.h"
14 #include "base/memory/scoped_ptr.h"
15 #include "base/time/time.h"
16 #include "media/cast/cast_config.h"
17 #include "media/cast/cast_environment.h"
19 namespace media {
20 namespace cast {
21 // Callback in which the raw audio frame and play-out time will be returned
22 // once decoding is complete.
23 typedef base::Callback<void(scoped_ptr<PcmAudioFrame>, const base::TimeTicks&)>
24 AudioFrameDecodedCallback;
26 // Callback in which the encoded audio frame and play-out time will be returned.
27 typedef base::Callback<void(scoped_ptr<EncodedAudioFrame>,
28 const base::TimeTicks&)> AudioFrameEncodedCallback;
30 // Callback in which the raw frame and render time will be returned once
31 // decoding is complete.
32 typedef base::Callback<void(scoped_ptr<I420VideoFrame>, const base::TimeTicks&)>
33 VideoFrameDecodedCallback;
35 // Callback in which the encoded video frame and render time will be returned.
36 typedef base::Callback<void(scoped_ptr<EncodedVideoFrame>,
37 const base::TimeTicks&)> VideoFrameEncodedCallback;
39 // This Class is thread safe.
40 class FrameReceiver : public base::RefCountedThreadSafe<FrameReceiver> {
41 public:
42 virtual void GetRawAudioFrame(int number_of_10ms_blocks,
43 int desired_frequency,
44 const AudioFrameDecodedCallback& callback) = 0;
46 virtual void GetCodedAudioFrame(
47 const AudioFrameEncodedCallback& callback) = 0;
49 virtual void GetRawVideoFrame(const VideoFrameDecodedCallback& callback) = 0;
51 virtual void GetEncodedVideoFrame(
52 const VideoFrameEncodedCallback& callback) = 0;
54 protected:
55 virtual ~FrameReceiver() {}
57 private:
58 friend class base::RefCountedThreadSafe<FrameReceiver>;
61 // This Class is thread safe.
62 class CastReceiver {
63 public:
64 static CastReceiver* CreateCastReceiver(
65 scoped_refptr<CastEnvironment> cast_environment,
66 const AudioReceiverConfig& audio_config,
67 const VideoReceiverConfig& video_config,
68 PacketSender* const packet_sender);
70 // All received RTP and RTCP packets for the call should be inserted to this
71 // PacketReceiver.
72 virtual scoped_refptr<PacketReceiver> packet_receiver() = 0;
74 // Polling interface to get audio and video frames from the CastReceiver.
75 virtual scoped_refptr<FrameReceiver> frame_receiver() = 0;
77 virtual ~CastReceiver() {}
80 } // namespace cast
81 } // namespace media
83 #endif // MEDIA_CAST_CAST_RECEIVER_H_