#ifndef MEDIA_CAST_VIDEO_SENDER_VIDEO_ENCODER_IMPL_H_
#define MEDIA_CAST_VIDEO_SENDER_VIDEO_ENCODER_IMPL_H_
#include "base/memory/scoped_ptr.h"
#include "media/cast/cast_config.h"
#include "media/cast/cast_environment.h"
#include "media/cast/video_sender/codecs/vp8/vp8_encoder.h"
#include "media/cast/video_sender/video_encoder.h"
namespace media {
class VideoFrame;
namespace cast {
class VideoEncoderImpl : public VideoEncoder {
public:
struct CodecDynamicConfig {
bool key_frame_requested;
uint32 latest_frame_id_to_reference;
int bit_rate;
};
typedef base::Callback<void(scoped_ptr<transport::EncodedVideoFrame>,
const base::TimeTicks&)> FrameEncodedCallback;
VideoEncoderImpl(scoped_refptr<CastEnvironment> cast_environment,
const VideoSenderConfig& video_config,
uint8 max_unacked_frames);
virtual ~VideoEncoderImpl();
virtual bool EncodeVideoFrame(
const scoped_refptr<media::VideoFrame>& video_frame,
const base::TimeTicks& capture_time,
const FrameEncodedCallback& frame_encoded_callback) OVERRIDE;
virtual void SetBitRate(int new_bit_rate) OVERRIDE;
virtual void SkipNextFrame(bool skip_next_frame) OVERRIDE;
virtual void GenerateKeyFrame() OVERRIDE;
virtual void LatestFrameIdToReference(uint32 frame_id) OVERRIDE;
virtual int NumberOfSkippedFrames() const OVERRIDE;
private:
const VideoSenderConfig video_config_;
scoped_refptr<CastEnvironment> cast_environment_;
CodecDynamicConfig dynamic_config_;
bool skip_next_frame_;
int skip_count_;
scoped_ptr<Vp8Encoder> vp8_encoder_;
DISALLOW_COPY_AND_ASSIGN(VideoEncoderImpl);
};
}
}
#endif