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 #ifndef MEDIA_CAST_VIDEO_SENDER_VIDEO_ENCODER_H_ | 5 #ifndef MEDIA_CAST_SENDER_VIDEO_ENCODER_H_ |
6 #define MEDIA_CAST_VIDEO_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 // All these functions are called from the main cast thread. | 20 // All these functions are called from the main cast thread. |
21 class VideoEncoder { | 21 class VideoEncoder { |
22 public: | 22 public: |
23 typedef base::Callback<void(scoped_ptr<transport::EncodedFrame>)> | 23 typedef base::Callback<void(scoped_ptr<EncodedFrame>)> |
24 FrameEncodedCallback; | 24 FrameEncodedCallback; |
25 | 25 |
26 virtual ~VideoEncoder() {} | 26 virtual ~VideoEncoder() {} |
27 | 27 |
28 // The video_frame must be valid until the closure callback is called. | 28 // The video_frame must be valid until the closure callback is called. |
29 // The closure callback is called from the video encoder thread as soon as | 29 // The closure callback is called from the video encoder thread as soon as |
30 // the encoder is done with the frame; it does not mean that the encoded frame | 30 // the encoder is done with the frame; it does not mean that the encoded frame |
31 // has been sent out. | 31 // has been sent out. |
32 // Once the encoded frame is ready the frame_encoded_callback is called. | 32 // Once the encoded frame is ready the frame_encoded_callback is called. |
33 virtual bool EncodeVideoFrame( | 33 virtual bool EncodeVideoFrame( |
34 const scoped_refptr<media::VideoFrame>& video_frame, | 34 const scoped_refptr<media::VideoFrame>& video_frame, |
35 const base::TimeTicks& capture_time, | 35 const base::TimeTicks& capture_time, |
36 const FrameEncodedCallback& frame_encoded_callback) = 0; | 36 const FrameEncodedCallback& frame_encoded_callback) = 0; |
37 | 37 |
38 // Inform the encoder about the new target bit rate. | 38 // Inform the encoder about the new target bit rate. |
39 virtual void SetBitRate(int new_bit_rate) = 0; | 39 virtual void SetBitRate(int new_bit_rate) = 0; |
40 | 40 |
41 // Inform the encoder to encode the next frame as a key frame. | 41 // Inform the encoder to encode the next frame as a key frame. |
42 virtual void GenerateKeyFrame() = 0; | 42 virtual void GenerateKeyFrame() = 0; |
43 | 43 |
44 // Inform the encoder to only reference frames older or equal to frame_id; | 44 // Inform the encoder to only reference frames older or equal to frame_id; |
45 virtual void LatestFrameIdToReference(uint32 frame_id) = 0; | 45 virtual void LatestFrameIdToReference(uint32 frame_id) = 0; |
46 }; | 46 }; |
47 | 47 |
48 } // namespace cast | 48 } // namespace cast |
49 } // namespace media | 49 } // namespace media |
50 | 50 |
51 #endif // MEDIA_CAST_VIDEO_SENDER_VIDEO_ENCODER_H_ | 51 #endif // MEDIA_CAST_SENDER_VIDEO_ENCODER_H_ |
OLD | NEW |