| 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/time/time.h" | 11 #include "base/time/time.h" |
| 12 #include "media/base/video_frame.h" | 12 #include "media/base/video_frame.h" |
| 13 #include "media/cast/cast_config.h" | 13 #include "media/cast/cast_config.h" |
| 14 #include "media/cast/cast_environment.h" | 14 #include "media/cast/cast_environment.h" |
| 15 #include "media/cast/sender/sender_encoded_frame.h" |
| 15 #include "media/cast/sender/video_frame_factory.h" | 16 #include "media/cast/sender/video_frame_factory.h" |
| 16 | 17 |
| 17 namespace media { | 18 namespace media { |
| 18 namespace cast { | 19 namespace cast { |
| 19 | 20 |
| 20 // All these functions are called from the main cast thread. | 21 // All these functions are called from the main cast thread. |
| 21 class VideoEncoder { | 22 class VideoEncoder { |
| 22 public: | 23 public: |
| 23 typedef base::Callback<void(scoped_ptr<EncodedFrame>)> FrameEncodedCallback; | 24 // Callback used to deliver an encoded frame on the Cast MAIN thread. |
| 25 using FrameEncodedCallback = |
| 26 base::Callback<void(scoped_ptr<SenderEncodedFrame>)>; |
| 24 | 27 |
| 25 // Creates a VideoEncoder instance from the given |video_config| and based on | 28 // Creates a VideoEncoder instance from the given |video_config| and based on |
| 26 // the current platform's hardware/library support; or null if no | 29 // the current platform's hardware/library support; or null if no |
| 27 // implementation will suffice. The instance will run |status_change_cb| at | 30 // implementation will suffice. The instance will run |status_change_cb| at |
| 28 // some point in the future to indicate initialization success/failure. | 31 // some point in the future to indicate initialization success/failure. |
| 29 // | 32 // |
| 30 // All VideoEncoder instances returned by this function support encoding | 33 // All VideoEncoder instances returned by this function support encoding |
| 31 // sequences of differently-size VideoFrames. | 34 // sequences of differently-size VideoFrames. |
| 32 // | 35 // |
| 33 // TODO(miu): Remove the CreateVEA callbacks. http://crbug.com/454029 | 36 // TODO(miu): Remove the CreateVEA callbacks. http://crbug.com/454029 |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 // network congestion, it is necessary to flush out of the encoder all | 72 // network congestion, it is necessary to flush out of the encoder all |
| 70 // submitted frames so that eventually new frames may be encoded. Like | 73 // submitted frames so that eventually new frames may be encoded. Like |
| 71 // EncodeVideoFrame(), the encoder will process this request asynchronously. | 74 // EncodeVideoFrame(), the encoder will process this request asynchronously. |
| 72 virtual void EmitFrames(); | 75 virtual void EmitFrames(); |
| 73 }; | 76 }; |
| 74 | 77 |
| 75 } // namespace cast | 78 } // namespace cast |
| 76 } // namespace media | 79 } // namespace media |
| 77 | 80 |
| 78 #endif // MEDIA_CAST_SENDER_VIDEO_ENCODER_H_ | 81 #endif // MEDIA_CAST_SENDER_VIDEO_ENCODER_H_ |
| OLD | NEW |