OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 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_FACTORY_TV_H_ |
| 6 #define CONTENT_RENDERER_MEDIA_RTC_VIDEO_DECODER_FACTORY_TV_H_ |
| 7 |
| 8 #include "base/basictypes.h" |
| 9 #include "base/compiler_specific.h" |
| 10 #include "base/message_loop.h" |
| 11 #include "content/common/content_export.h" |
| 12 #include "media/base/demuxer.h" |
| 13 #include "third_party/libjingle/source/talk/media/webrtc/webrtcvideodecoderfacto
ry.h" |
| 14 #include "ui/gfx/size.h" |
| 15 |
| 16 namespace webrtc { class VideoDecoder; } |
| 17 |
| 18 namespace content { |
| 19 |
| 20 class MediaStreamDependencyFactory; |
| 21 class RTCDemuxerStream; |
| 22 class RTCVideoDecoderBridgeTv; |
| 23 |
| 24 // A factory object generating |RTCVideoDecoderBridgeTv| objects. This object |
| 25 // also functions as a |media::Demuxer| object to receive encoded streams from |
| 26 // the |RTCVideoDecoderBridgeTv| object (which inherits from |
| 27 // |webrtc::VideoDecoder|). |
| 28 class CONTENT_EXPORT RTCVideoDecoderFactoryTv |
| 29 : NON_EXPORTED_BASE(public cricket::WebRtcVideoDecoderFactory), |
| 30 public media::Demuxer { |
| 31 public: |
| 32 RTCVideoDecoderFactoryTv(); |
| 33 virtual ~RTCVideoDecoderFactoryTv(); |
| 34 |
| 35 // cricket::WebRtcVideoDecoderFactory implementation. |
| 36 virtual webrtc::VideoDecoder* CreateVideoDecoder(webrtc::VideoCodecType type) |
| 37 OVERRIDE; |
| 38 virtual void DestroyVideoDecoder(webrtc::VideoDecoder* decoder) OVERRIDE; |
| 39 |
| 40 // Acquires and releases the demuxer functionality of this object. Only one |
| 41 // client object can access demuxer functionality at a time. No calls to |
| 42 // |media::Demuxer| implementations should be made without acquiring it first. |
| 43 bool AcquireDemuxer(); |
| 44 void ReleaseDemuxer(); |
| 45 |
| 46 // media::Demuxer implementation. |
| 47 virtual void Initialize(media::DemuxerHost* host, |
| 48 const media::PipelineStatusCB& cb) OVERRIDE; |
| 49 virtual media::DemuxerStream* GetStream(media::DemuxerStream::Type type) |
| 50 OVERRIDE; |
| 51 virtual base::TimeDelta GetStartTime() const OVERRIDE; |
| 52 |
| 53 // For RTCVideoDecoderBridgeTv to talk to RTCDemuxerStream. |
| 54 void InitializeStream(const gfx::Size& size); |
| 55 void QueueBuffer(scoped_refptr<media::DecoderBuffer> buffer, |
| 56 const base::Closure& done_cb, |
| 57 const gfx::Size& size); |
| 58 |
| 59 private: |
| 60 // All private variables are lock protected. |
| 61 base::Lock lock_; |
| 62 scoped_ptr<RTCVideoDecoderBridgeTv> decoder_; |
| 63 |
| 64 media::PipelineStatusCB init_cb_; |
| 65 scoped_ptr<RTCDemuxerStream> stream_; |
| 66 |
| 67 bool is_acquired_; |
| 68 |
| 69 DISALLOW_COPY_AND_ASSIGN(RTCVideoDecoderFactoryTv); |
| 70 }; |
| 71 |
| 72 } // namespace content |
| 73 |
| 74 #endif // CONTENT_RENDERER_MEDIA_RTC_VIDEO_DECODER_FACTORY_TV_H_ |
OLD | NEW |