| 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 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 // discontinuities for playback. Note: A NULL pointer can be returned when data | 33 // discontinuities for playback. Note: A NULL pointer can be returned when data |
| 34 // is not available (e.g., bad/missing packet). | 34 // is not available (e.g., bad/missing packet). |
| 35 typedef base::Callback<void(scoped_ptr<AudioBus> audio_bus, | 35 typedef base::Callback<void(scoped_ptr<AudioBus> audio_bus, |
| 36 const base::TimeTicks& playout_time, | 36 const base::TimeTicks& playout_time, |
| 37 bool is_continuous)> AudioFrameDecodedCallback; | 37 bool is_continuous)> AudioFrameDecodedCallback; |
| 38 // TODO(miu): |video_frame| includes a timestamp, so use that instead. | 38 // TODO(miu): |video_frame| includes a timestamp, so use that instead. |
| 39 typedef base::Callback<void(const scoped_refptr<media::VideoFrame>& video_frame, | 39 typedef base::Callback<void(const scoped_refptr<media::VideoFrame>& video_frame, |
| 40 const base::TimeTicks& playout_time, | 40 const base::TimeTicks& playout_time, |
| 41 bool is_continuous)> VideoFrameDecodedCallback; | 41 bool is_continuous)> VideoFrameDecodedCallback; |
| 42 | 42 |
| 43 // The following callbacks deliver still-encoded audio/video frame data, along | 43 // The following callback delivers encoded frame data and metadata. The client |
| 44 // with the frame's corresponding play-out time. The client should examine the | 44 // should examine the |frame_id| field to determine whether any frames have been |
| 45 // EncodedXXXFrame::frame_id field to determine whether any frames have been | |
| 46 // dropped (i.e., frame_id should be incrementing by one each time). Note: A | 45 // dropped (i.e., frame_id should be incrementing by one each time). Note: A |
| 47 // NULL pointer can be returned on error. | 46 // NULL pointer can be returned on error. |
| 48 typedef base::Callback<void(scoped_ptr<transport::EncodedAudioFrame>, | 47 typedef base::Callback<void(scoped_ptr<transport::EncodedFrame>)> |
| 49 const base::TimeTicks&)> AudioFrameEncodedCallback; | 48 FrameEncodedCallback; |
| 50 typedef base::Callback<void(scoped_ptr<transport::EncodedVideoFrame>, | |
| 51 const base::TimeTicks&)> VideoFrameEncodedCallback; | |
| 52 | 49 |
| 53 // This Class is thread safe. | 50 // This Class is thread safe. |
| 54 class FrameReceiver : public base::RefCountedThreadSafe<FrameReceiver> { | 51 class FrameReceiver : public base::RefCountedThreadSafe<FrameReceiver> { |
| 55 public: | 52 public: |
| 56 virtual void GetRawAudioFrame(const AudioFrameDecodedCallback& callback) = 0; | 53 virtual void GetRawAudioFrame(const AudioFrameDecodedCallback& callback) = 0; |
| 57 | 54 |
| 58 virtual void GetCodedAudioFrame( | 55 virtual void GetCodedAudioFrame(const FrameEncodedCallback& callback) = 0; |
| 59 const AudioFrameEncodedCallback& callback) = 0; | |
| 60 | 56 |
| 61 virtual void GetRawVideoFrame(const VideoFrameDecodedCallback& callback) = 0; | 57 virtual void GetRawVideoFrame(const VideoFrameDecodedCallback& callback) = 0; |
| 62 | 58 |
| 63 virtual void GetEncodedVideoFrame( | 59 virtual void GetEncodedVideoFrame(const FrameEncodedCallback& callback) = 0; |
| 64 const VideoFrameEncodedCallback& callback) = 0; | |
| 65 | 60 |
| 66 protected: | 61 protected: |
| 67 virtual ~FrameReceiver() {} | 62 virtual ~FrameReceiver() {} |
| 68 | 63 |
| 69 private: | 64 private: |
| 70 friend class base::RefCountedThreadSafe<FrameReceiver>; | 65 friend class base::RefCountedThreadSafe<FrameReceiver>; |
| 71 }; | 66 }; |
| 72 | 67 |
| 73 // This Class is thread safe. | 68 // This Class is thread safe. |
| 74 class CastReceiver { | 69 class CastReceiver { |
| (...skipping 13 matching lines...) Expand all Loading... |
| 88 // Polling interface to get audio and video frames from the CastReceiver. | 83 // Polling interface to get audio and video frames from the CastReceiver. |
| 89 virtual scoped_refptr<FrameReceiver> frame_receiver() = 0; | 84 virtual scoped_refptr<FrameReceiver> frame_receiver() = 0; |
| 90 | 85 |
| 91 virtual ~CastReceiver() {} | 86 virtual ~CastReceiver() {} |
| 92 }; | 87 }; |
| 93 | 88 |
| 94 } // namespace cast | 89 } // namespace cast |
| 95 } // namespace media | 90 } // namespace media |
| 96 | 91 |
| 97 #endif // MEDIA_CAST_CAST_RECEIVER_H_ | 92 #endif // MEDIA_CAST_CAST_RECEIVER_H_ |
| OLD | NEW |