OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 CONTENT_RENDERER_MEDIA_CAPTURE_VIDEO_DECODER_H_ | 5 #ifndef CONTENT_RENDERER_MEDIA_CAPTURE_VIDEO_DECODER_H_ |
6 #define CONTENT_RENDERER_MEDIA_CAPTURE_VIDEO_DECODER_H_ | 6 #define CONTENT_RENDERER_MEDIA_CAPTURE_VIDEO_DECODER_H_ |
7 | 7 |
8 #include <deque> | 8 #include <queue> |
9 | 9 |
10 #include "base/time.h" | 10 #include "base/time.h" |
11 #include "content/common/content_export.h" | 11 #include "content/common/content_export.h" |
12 #include "media/base/demuxer_stream.h" | 12 #include "media/base/demuxer_stream.h" |
13 #include "media/base/filters.h" | 13 #include "media/base/filters.h" |
14 #include "media/base/video_frame.h" | 14 #include "media/base/video_frame.h" |
15 #include "media/video/capture/video_capture.h" | 15 #include "media/video/capture/video_capture.h" |
16 | 16 |
17 namespace base { | 17 namespace base { |
18 class MessageLoopProxy; | 18 class MessageLoopProxy; |
(...skipping 11 matching lines...) Expand all Loading... | |
30 media::VideoCaptureSessionId video_stream_id, | 30 media::VideoCaptureSessionId video_stream_id, |
31 VideoCaptureImplManager* vc_manager, | 31 VideoCaptureImplManager* vc_manager, |
32 const media::VideoCapture::VideoCaptureCapability& capability); | 32 const media::VideoCapture::VideoCaptureCapability& capability); |
33 virtual ~CaptureVideoDecoder(); | 33 virtual ~CaptureVideoDecoder(); |
34 | 34 |
35 // Filter implementation. | 35 // Filter implementation. |
36 virtual void Play(const base::Closure& callback) OVERRIDE; | 36 virtual void Play(const base::Closure& callback) OVERRIDE; |
37 virtual void Seek(base::TimeDelta time, | 37 virtual void Seek(base::TimeDelta time, |
38 const media::FilterStatusCB& cb) OVERRIDE; | 38 const media::FilterStatusCB& cb) OVERRIDE; |
39 virtual void Pause(const base::Closure& callback) OVERRIDE; | 39 virtual void Pause(const base::Closure& callback) OVERRIDE; |
40 virtual void Flush(const base::Closure& callback) OVERRIDE; | |
40 virtual void Stop(const base::Closure& callback) OVERRIDE; | 41 virtual void Stop(const base::Closure& callback) OVERRIDE; |
41 | 42 |
42 // Decoder implementation. | 43 // Decoder implementation. |
43 virtual void Initialize( | 44 virtual void Initialize( |
44 media::DemuxerStream* demuxer_stream, | 45 media::DemuxerStream* demuxer_stream, |
45 const base::Closure& filter_callback, | 46 const base::Closure& filter_callback, |
46 const media::StatisticsCallback& stat_callback) OVERRIDE; | 47 const media::StatisticsCallback& stat_callback) OVERRIDE; |
47 virtual void Read(const ReadCB& callback) OVERRIDE; | 48 virtual void Read(const ReadCB& callback) OVERRIDE; |
48 virtual const gfx::Size& natural_size() OVERRIDE; | 49 virtual const gfx::Size& natural_size() OVERRIDE; |
49 | 50 |
(...skipping 17 matching lines...) Expand all Loading... | |
67 kUnInitialized, | 68 kUnInitialized, |
68 kNormal, | 69 kNormal, |
69 kStopped, | 70 kStopped, |
70 kPaused | 71 kPaused |
71 }; | 72 }; |
72 | 73 |
73 void PlayOnDecoderThread(const base::Closure& callback); | 74 void PlayOnDecoderThread(const base::Closure& callback); |
74 void SeekOnDecoderThread(base::TimeDelta time, | 75 void SeekOnDecoderThread(base::TimeDelta time, |
75 const media::FilterStatusCB& cb); | 76 const media::FilterStatusCB& cb); |
76 void PauseOnDecoderThread(const base::Closure& callback); | 77 void PauseOnDecoderThread(const base::Closure& callback); |
78 void FlushOnDecoderThread(const base::Closure& callback); | |
77 void StopOnDecoderThread(const base::Closure& callback); | 79 void StopOnDecoderThread(const base::Closure& callback); |
78 | 80 |
79 void InitializeOnDecoderThread( | 81 void InitializeOnDecoderThread( |
80 media::DemuxerStream* demuxer_stream, | 82 media::DemuxerStream* demuxer_stream, |
81 const base::Closure& filter_callback, | 83 const base::Closure& filter_callback, |
82 const media::StatisticsCallback& stat_callback); | 84 const media::StatisticsCallback& stat_callback); |
83 void ReadOnDecoderThread(const ReadCB& callback); | 85 void ReadOnDecoderThread(const ReadCB& callback); |
84 | 86 |
85 void OnStoppedOnDecoderThread(media::VideoCapture* capture); | 87 void OnStoppedOnDecoderThread(media::VideoCapture* capture); |
86 void OnBufferReadyOnDecoderThread( | 88 void OnBufferReadyOnDecoderThread( |
87 media::VideoCapture* capture, | 89 media::VideoCapture* capture, |
88 scoped_refptr<media::VideoCapture::VideoFrameBuffer> buf); | 90 scoped_refptr<media::VideoCapture::VideoFrameBuffer> buf); |
89 void OnDeviceInfoReceivedOnDecoderThread( | 91 void OnDeviceInfoReceivedOnDecoderThread( |
90 media::VideoCapture* capture, | 92 media::VideoCapture* capture, |
91 const media::VideoCaptureParams& device_info); | 93 const media::VideoCaptureParams& device_info); |
92 | 94 |
93 // Delivers the frame to |read_cb_| and resets the callback. | 95 // Helper. |
94 void DeliverFrame(const scoped_refptr<media::VideoFrame>& video_frame); | 96 void DeliverBlackFrame(const ReadCB& read_cb); |
95 | 97 |
96 scoped_refptr<base::MessageLoopProxy> message_loop_proxy_; | 98 scoped_refptr<base::MessageLoopProxy> message_loop_proxy_; |
97 scoped_refptr<VideoCaptureImplManager> vc_manager_; | 99 scoped_refptr<VideoCaptureImplManager> vc_manager_; |
98 media::VideoCapture::VideoCaptureCapability capability_; | 100 media::VideoCapture::VideoCaptureCapability capability_; |
99 gfx::Size natural_size_; | 101 gfx::Size natural_size_; |
100 DecoderState state_; | 102 DecoderState state_; |
101 ReadCB read_cb_; | 103 std::queue<ReadCB> read_cbs_; |
scherkus (not reviewing)
2011/11/16 01:12:36
take a look at the definition of VideoDecoder::Rea
wjia(left Chromium)
2011/11/16 05:25:54
That sounds scary since single buffer scheme seria
acolwell GONE FROM CHROMIUM
2011/11/16 18:49:21
It does not serialize pipeline operations. Decodin
| |
102 base::Closure pending_stop_cb_; | 104 base::Closure pending_stop_cb_; |
103 media::StatisticsCallback statistics_callback_; | 105 media::StatisticsCallback statistics_callback_; |
104 | 106 |
105 media::VideoCaptureSessionId video_stream_id_; | 107 media::VideoCaptureSessionId video_stream_id_; |
106 media::VideoCapture* capture_engine_; | 108 media::VideoCapture* capture_engine_; |
107 base::Time start_time_; | 109 base::Time start_time_; |
108 | 110 |
109 DISALLOW_COPY_AND_ASSIGN(CaptureVideoDecoder); | 111 DISALLOW_COPY_AND_ASSIGN(CaptureVideoDecoder); |
110 }; | 112 }; |
111 | 113 |
112 #endif // CONTENT_RENDERER_MEDIA_CAPTURE_VIDEO_DECODER_H_ | 114 #endif // CONTENT_RENDERER_MEDIA_CAPTURE_VIDEO_DECODER_H_ |
OLD | NEW |