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_CODECS_VP8_VP8_ENCODER_H_ | 5 #ifndef MEDIA_CAST_SENDER_CODECS_VP8_VP8_ENCODER_H_ |
6 #define MEDIA_CAST_VIDEO_SENDER_CODECS_VP8_VP8_ENCODER_H_ | 6 #define MEDIA_CAST_SENDER_CODECS_VP8_VP8_ENCODER_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/threading/thread_checker.h" | 10 #include "base/threading/thread_checker.h" |
11 #include "base/time/time.h" | 11 #include "base/time/time.h" |
12 #include "media/cast/cast_config.h" | 12 #include "media/cast/cast_config.h" |
13 #include "media/cast/video_sender/software_video_encoder.h" | 13 #include "media/cast/sender/software_video_encoder.h" |
14 #include "third_party/libvpx/source/libvpx/vpx/vpx_encoder.h" | 14 #include "third_party/libvpx/source/libvpx/vpx/vpx_encoder.h" |
15 | 15 |
16 namespace media { | 16 namespace media { |
17 class VideoFrame; | 17 class VideoFrame; |
18 } | 18 } |
19 | 19 |
20 // VPX forward declaration. | 20 // VPX forward declaration. |
21 typedef struct vpx_codec_ctx vpx_enc_ctx_t; | 21 typedef struct vpx_codec_ctx vpx_enc_ctx_t; |
22 | 22 |
23 namespace media { | 23 namespace media { |
24 namespace cast { | 24 namespace cast { |
25 | 25 |
26 const int kNumberOfVp8VideoBuffers = 3; | 26 const int kNumberOfVp8VideoBuffers = 3; |
27 | 27 |
28 class Vp8Encoder : public SoftwareVideoEncoder { | 28 class Vp8Encoder : public SoftwareVideoEncoder { |
29 public: | 29 public: |
30 Vp8Encoder(const VideoSenderConfig& video_config, int max_unacked_frames); | 30 Vp8Encoder(const VideoSenderConfig& video_config, int max_unacked_frames); |
31 | 31 |
32 virtual ~Vp8Encoder(); | 32 virtual ~Vp8Encoder(); |
33 | 33 |
34 // Initialize the encoder before Encode() can be called. This method | 34 // Initialize the encoder before Encode() can be called. This method |
35 // must be called on the thread that Encode() is called. | 35 // must be called on the thread that Encode() is called. |
36 virtual void Initialize() OVERRIDE; | 36 virtual void Initialize() OVERRIDE; |
37 | 37 |
38 // Encode a raw image (as a part of a video stream). | 38 // Encode a raw image (as a part of a video stream). |
39 virtual bool Encode(const scoped_refptr<media::VideoFrame>& video_frame, | 39 virtual bool Encode(const scoped_refptr<media::VideoFrame>& video_frame, |
40 transport::EncodedFrame* encoded_image) OVERRIDE; | 40 EncodedFrame* encoded_image) OVERRIDE; |
41 | 41 |
42 // Update the encoder with a new target bit rate. | 42 // Update the encoder with a new target bit rate. |
43 virtual void UpdateRates(uint32 new_bitrate) OVERRIDE; | 43 virtual void UpdateRates(uint32 new_bitrate) OVERRIDE; |
44 | 44 |
45 // Set the next frame to be a key frame. | 45 // Set the next frame to be a key frame. |
46 virtual void GenerateKeyFrame() OVERRIDE; | 46 virtual void GenerateKeyFrame() OVERRIDE; |
47 | 47 |
48 virtual void LatestFrameIdToReference(uint32 frame_id) OVERRIDE; | 48 virtual void LatestFrameIdToReference(uint32 frame_id) OVERRIDE; |
49 | 49 |
50 private: | 50 private: |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 | 93 |
94 // This is bound to the thread where Initialize() is called. | 94 // This is bound to the thread where Initialize() is called. |
95 base::ThreadChecker thread_checker_; | 95 base::ThreadChecker thread_checker_; |
96 | 96 |
97 DISALLOW_COPY_AND_ASSIGN(Vp8Encoder); | 97 DISALLOW_COPY_AND_ASSIGN(Vp8Encoder); |
98 }; | 98 }; |
99 | 99 |
100 } // namespace cast | 100 } // namespace cast |
101 } // namespace media | 101 } // namespace media |
102 | 102 |
103 #endif // MEDIA_CAST_VIDEO_SENDER_CODECS_VP8_VP8_ENCODER_H_ | 103 #endif // MEDIA_CAST_SENDER_CODECS_VP8_VP8_ENCODER_H_ |
OLD | NEW |