| 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 13 matching lines...) Expand all Loading... |
| 24 | 24 |
| 25 namespace transport { | 25 namespace transport { |
| 26 class PacketSender; | 26 class PacketSender; |
| 27 } | 27 } |
| 28 | 28 |
| 29 // The following callbacks are used to deliver decoded audio/video frame data, | 29 // The following callbacks are used to deliver decoded audio/video frame data, |
| 30 // the frame's corresponding play-out time, and a continuity flag. | 30 // the frame's corresponding play-out time, and a continuity flag. |
| 31 // |is_continuous| will be false to indicate the loss of data due to a loss of | 31 // |is_continuous| will be false to indicate the loss of data due to a loss of |
| 32 // frames (or decoding errors). This allows the client to take steps to smooth | 32 // frames (or decoding errors). This allows the client to take steps to smooth |
| 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 packet or when flushing callbacks during | 34 // is not available (e.g., bad/missing packet). |
| 35 // shutdown). | |
| 36 typedef base::Callback<void(scoped_ptr<AudioBus> audio_bus, | 35 typedef base::Callback<void(scoped_ptr<AudioBus> audio_bus, |
| 37 const base::TimeTicks& playout_time, | 36 const base::TimeTicks& playout_time, |
| 38 bool is_continuous)> AudioFrameDecodedCallback; | 37 bool is_continuous)> AudioFrameDecodedCallback; |
| 39 // TODO(miu): |video_frame| includes a timestamp, so use that instead. | 38 // TODO(miu): |video_frame| includes a timestamp, so use that instead. |
| 40 typedef base::Callback<void(const scoped_refptr<media::VideoFrame>& video_frame, | 39 typedef base::Callback<void(const scoped_refptr<media::VideoFrame>& video_frame, |
| 41 const base::TimeTicks& playout_time, | 40 const base::TimeTicks& playout_time, |
| 42 bool is_continuous)> VideoFrameDecodedCallback; | 41 bool is_continuous)> VideoFrameDecodedCallback; |
| 43 | 42 |
| 44 // The following callbacks deliver still-encoded audio/video frame data, along | 43 // The following callbacks deliver still-encoded audio/video frame data, along |
| 45 // with the frame's corresponding play-out time. The client should examine the | 44 // with the frame's corresponding play-out time. The client should examine the |
| 46 // EncodedXXXFrame::frame_id field to determine whether any frames have been | 45 // EncodedXXXFrame::frame_id field to determine whether any frames have been |
| 47 // dropped (i.e., frame_id should be incrementing by one each time). Note: A | 46 // dropped (i.e., frame_id should be incrementing by one each time). Note: A |
| 48 // NULL pointer can be returned on error/shutdown. | 47 // NULL pointer can be returned on error. |
| 49 typedef base::Callback<void(scoped_ptr<transport::EncodedAudioFrame>, | 48 typedef base::Callback<void(scoped_ptr<transport::EncodedAudioFrame>, |
| 50 const base::TimeTicks&)> AudioFrameEncodedCallback; | 49 const base::TimeTicks&)> AudioFrameEncodedCallback; |
| 51 typedef base::Callback<void(scoped_ptr<transport::EncodedVideoFrame>, | 50 typedef base::Callback<void(scoped_ptr<transport::EncodedVideoFrame>, |
| 52 const base::TimeTicks&)> VideoFrameEncodedCallback; | 51 const base::TimeTicks&)> VideoFrameEncodedCallback; |
| 53 | 52 |
| 54 // This Class is thread safe. | 53 // This Class is thread safe. |
| 55 class FrameReceiver : public base::RefCountedThreadSafe<FrameReceiver> { | 54 class FrameReceiver : public base::RefCountedThreadSafe<FrameReceiver> { |
| 56 public: | 55 public: |
| 57 virtual void GetRawAudioFrame(const AudioFrameDecodedCallback& callback) = 0; | 56 virtual void GetRawAudioFrame(const AudioFrameDecodedCallback& callback) = 0; |
| 58 | 57 |
| (...skipping 30 matching lines...) Expand all Loading... |
| 89 // Polling interface to get audio and video frames from the CastReceiver. | 88 // Polling interface to get audio and video frames from the CastReceiver. |
| 90 virtual scoped_refptr<FrameReceiver> frame_receiver() = 0; | 89 virtual scoped_refptr<FrameReceiver> frame_receiver() = 0; |
| 91 | 90 |
| 92 virtual ~CastReceiver() {} | 91 virtual ~CastReceiver() {} |
| 93 }; | 92 }; |
| 94 | 93 |
| 95 } // namespace cast | 94 } // namespace cast |
| 96 } // namespace media | 95 } // namespace media |
| 97 | 96 |
| 98 #endif // MEDIA_CAST_CAST_RECEIVER_H_ | 97 #endif // MEDIA_CAST_CAST_RECEIVER_H_ |
| OLD | NEW |