| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #ifndef MEDIA_CAST_SENDER_VIDEO_ENCODER_H_ | 5 #ifndef MEDIA_CAST_SENDER_VIDEO_ENCODER_H_ |
| 6 #define MEDIA_CAST_SENDER_VIDEO_ENCODER_H_ | 6 #define MEDIA_CAST_SENDER_VIDEO_ENCODER_H_ |
| 7 | 7 |
| 8 #include "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| 11 #include "base/memory/weak_ptr.h" | 11 #include "base/memory/weak_ptr.h" |
| 12 #include "base/time/time.h" | 12 #include "base/time/time.h" |
| 13 #include "media/base/video_frame.h" | 13 #include "media/base/video_frame.h" |
| 14 #include "media/cast/cast_config.h" | 14 #include "media/cast/cast_config.h" |
| 15 #include "media/cast/cast_environment.h" | 15 #include "media/cast/cast_environment.h" |
| 16 | 16 |
| 17 namespace media { | 17 namespace media { |
| 18 namespace cast { | 18 namespace cast { |
| 19 | 19 |
| 20 class VideoFrameFactory; | 20 class VideoFrameFactory; |
| 21 | 21 |
| 22 // All these functions are called from the main cast thread. | 22 // All these functions are called from the main cast thread. |
| 23 class VideoEncoder { | 23 class VideoEncoder { |
| 24 public: | 24 public: |
| 25 typedef base::Callback<void(scoped_ptr<EncodedFrame>)> FrameEncodedCallback; | 25 typedef base::Callback<void(scoped_ptr<EncodedFrame>)> FrameEncodedCallback; |
| 26 | 26 |
| 27 virtual ~VideoEncoder() {} | 27 virtual ~VideoEncoder() {} |
| 28 | 28 |
| 29 // Returns true if the size of video frames passed in successive calls to |
| 30 // EncodedVideoFrame() can vary. |
| 31 virtual bool CanEncodeVariedFrameSizes() const = 0; |
| 32 |
| 29 // If true is returned, the Encoder has accepted the request and will process | 33 // If true is returned, the Encoder has accepted the request and will process |
| 30 // it asynchronously, running |frame_encoded_callback| on the MAIN | 34 // it asynchronously, running |frame_encoded_callback| on the MAIN |
| 31 // CastEnvironment thread with the result. If false is returned, nothing | 35 // CastEnvironment thread with the result. If false is returned, nothing |
| 32 // happens and the callback will not be run. | 36 // happens and the callback will not be run. |
| 33 virtual bool EncodeVideoFrame( | 37 virtual bool EncodeVideoFrame( |
| 34 const scoped_refptr<media::VideoFrame>& video_frame, | 38 const scoped_refptr<media::VideoFrame>& video_frame, |
| 35 const base::TimeTicks& reference_time, | 39 const base::TimeTicks& reference_time, |
| 36 const FrameEncodedCallback& frame_encoded_callback) = 0; | 40 const FrameEncodedCallback& frame_encoded_callback) = 0; |
| 37 | 41 |
| 38 // Inform the encoder about the new target bit rate. | 42 // Inform the encoder about the new target bit rate. |
| (...skipping 16 matching lines...) Expand all Loading... |
| 55 // network congestion, it is necessary to flush out of the encoder all | 59 // network congestion, it is necessary to flush out of the encoder all |
| 56 // submitted frames so that eventually new frames may be encoded. Like | 60 // submitted frames so that eventually new frames may be encoded. Like |
| 57 // EncodeVideoFrame(), the encoder will process this request asynchronously. | 61 // EncodeVideoFrame(), the encoder will process this request asynchronously. |
| 58 virtual void EmitFrames(); | 62 virtual void EmitFrames(); |
| 59 }; | 63 }; |
| 60 | 64 |
| 61 } // namespace cast | 65 } // namespace cast |
| 62 } // namespace media | 66 } // namespace media |
| 63 | 67 |
| 64 #endif // MEDIA_CAST_SENDER_VIDEO_ENCODER_H_ | 68 #endif // MEDIA_CAST_SENDER_VIDEO_ENCODER_H_ |
| OLD | NEW |