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