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