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
3// found in the LICENSE file.
4
5#ifndef CONTENT_RENDERER_MEDIA_RTC_VIDEO_DECODER_BRIDGE_TV_H_
6#define CONTENT_RENDERER_MEDIA_RTC_VIDEO_DECODER_BRIDGE_TV_H_
7
8#include "base/basictypes.h"
9#include "base/compiler_specific.h"
10#include "content/common/content_export.h"
11#include "third_party/webrtc/modules/video_coding/codecs/interface/video_codec_interface.h"
12#include "ui/gfx/size.h"
13
14namespace content {
15
16class MediaStreamDependencyFactory;
17class RTCVideoDecoderFactoryTv;
18
19// An object shared between WebMediaPlayerAndroid and WebRTC Video Engine.
20// Note that this class provides the first remote stream.
21class CONTENT_EXPORT RTCVideoDecoderBridgeTv
22    : NON_EXPORTED_BASE(public webrtc::VideoDecoder) {
23 public:
24  explicit RTCVideoDecoderBridgeTv(RTCVideoDecoderFactoryTv* factory);
25  virtual ~RTCVideoDecoderBridgeTv();
26
27  // webrtc::VideoDecoder implementation.
28  virtual int32_t InitDecode(const webrtc::VideoCodec* codec_settings,
29                             int32_t number_of_cores) OVERRIDE;
30  virtual int32_t Decode(
31      const webrtc::EncodedImage& input_image,
32      bool missing_frames,
33      const webrtc::RTPFragmentationHeader* fragmentation,
34      const webrtc::CodecSpecificInfo* codec_specific_info,
35      int64_t render_time_ms) OVERRIDE;
36  virtual int32_t RegisterDecodeCompleteCallback(
37      webrtc::DecodedImageCallback* callback) OVERRIDE;
38  virtual int32_t Release() OVERRIDE;
39  virtual int32_t Reset() OVERRIDE;
40
41 private:
42  // The factory outlives this object, so weak pointer is fine.
43  RTCVideoDecoderFactoryTv* factory_;
44
45  gfx::Size size_;
46  bool is_initialized_;
47  bool first_frame_;
48  int64_t timestamp_offset_millis_;
49
50  DISALLOW_COPY_AND_ASSIGN(RTCVideoDecoderBridgeTv);
51};
52
53}  // namespace content
54
55#endif  // CONTENT_RENDERER_MEDIA_RTC_VIDEO_DECODER_BRIDGE_TV_H_
56