Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(7)

Side by Side Diff: content/renderer/media/rtc_video_decoder.h

Issue 7193001: Move rtc_video_decoder* from media/filter/ to content/renderer/media/. (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: '' Created 9 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 MEDIA_FILTERS_RTC_VIDEO_DECODER_H_ 5 #ifndef CONTENT_RENDERER_MEDIA_RTC_VIDEO_DECODER_H_
6 #define MEDIA_FILTERS_RTC_VIDEO_DECODER_H_ 6 #define CONTENT_RENDERER_MEDIA_RTC_VIDEO_DECODER_H_
7 7
8 #include <deque> 8 #include <deque>
9 #include <string> 9 #include <string>
10 10
11 #include "base/gtest_prod_util.h" 11 #include "base/gtest_prod_util.h"
12 #include "base/time.h" 12 #include "base/time.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/filters/decoder_base.h" 15 #include "media/filters/decoder_base.h"
16 16
17 // TODO(ronghuawu) ExternalRenderer should be defined in WebRtc 17 // TODO(ronghuawu) ExternalRenderer should be defined in WebRtc
18 class ExternalRenderer { 18 class ExternalRenderer {
scherkus (not reviewing) 2011/06/24 21:33:39 can you move this into a separate .h file?
19 public: 19 public:
20 virtual int FrameSizeChange(unsigned int width, 20 virtual int FrameSizeChange(unsigned int width,
21 unsigned int height, 21 unsigned int height,
22 unsigned int number_of_streams) = 0; 22 unsigned int number_of_streams) = 0;
23 virtual int DeliverFrame(unsigned char* buffer, int buffer_size) = 0; 23 virtual int DeliverFrame(unsigned char* buffer, int buffer_size) = 0;
24 24
25 protected: 25 protected:
26 virtual ~ExternalRenderer() {} 26 virtual ~ExternalRenderer() {}
27 }; 27 };
28 28
29 namespace media { 29 class RTCVideoDecoder : public media::VideoDecoder,
scherkus (not reviewing) 2011/06/24 21:33:39 nit: use initializer list format class RTCVideoDe
Ronghua 2011/06/27 22:34:51 Done.
30
31 class RTCVideoDecoder : public VideoDecoder,
32 public ExternalRenderer { 30 public ExternalRenderer {
33 public: 31 public:
34 RTCVideoDecoder(MessageLoop* message_loop, const std::string& url); 32 RTCVideoDecoder(MessageLoop* message_loop, const std::string& url);
35 virtual ~RTCVideoDecoder(); 33 virtual ~RTCVideoDecoder();
36 34
37 // Filter implementation. 35 // Filter implementation.
38 virtual void Play(FilterCallback* callback); 36 virtual void Play(media::FilterCallback* callback);
39 virtual void Seek(base::TimeDelta time, const FilterStatusCB& cb); 37 virtual void Seek(base::TimeDelta time, const media::FilterStatusCB& cb);
40 virtual void Pause(FilterCallback* callback); 38 virtual void Pause(media::FilterCallback* callback);
41 virtual void Stop(FilterCallback* callback); 39 virtual void Stop(media::FilterCallback* callback);
42 40
43 // Decoder implementation. 41 // Decoder implementation.
44 virtual void Initialize(DemuxerStream* demuxer_stream, 42 virtual void Initialize(media::DemuxerStream* demuxer_stream,
45 FilterCallback* filter_callback, 43 media::FilterCallback* filter_callback,
46 StatisticsCallback* stat_callback); 44 media::StatisticsCallback* stat_callback);
47 virtual const MediaFormat& media_format(); 45 virtual const media::MediaFormat& media_format();
48 virtual void ProduceVideoFrame(scoped_refptr<VideoFrame> video_frame); 46 virtual void ProduceVideoFrame(scoped_refptr<media::VideoFrame> video_frame);
49 virtual bool ProvidesBuffer(); 47 virtual bool ProvidesBuffer();
50 48
51 // ExternalRenderer implementation 49 // ExternalRenderer implementation
52 virtual int FrameSizeChange(unsigned int width, 50 virtual int FrameSizeChange(unsigned int width,
53 unsigned int height, 51 unsigned int height,
54 unsigned int number_of_streams); 52 unsigned int number_of_streams);
55 53
56 virtual int DeliverFrame(unsigned char* buffer, 54 virtual int DeliverFrame(unsigned char* buffer,
57 int buffer_size); 55 int buffer_size);
58 56
59 // TODO(ronghuawu): maybe move this function to a
60 // base class (RawVideoDecoder) so that the camera preview may share this.
61 static bool IsUrlSupported(const std::string& url);
62
63 private: 57 private:
64 friend class RTCVideoDecoderTest; 58 friend class RTCVideoDecoderTest;
65 FRIEND_TEST_ALL_PREFIXES(RTCVideoDecoderTest, Initialize_Successful); 59 FRIEND_TEST_ALL_PREFIXES(RTCVideoDecoderTest, Initialize_Successful);
66 FRIEND_TEST_ALL_PREFIXES(RTCVideoDecoderTest, DoSeek); 60 FRIEND_TEST_ALL_PREFIXES(RTCVideoDecoderTest, DoSeek);
67 FRIEND_TEST_ALL_PREFIXES(RTCVideoDecoderTest, DoDeliverFrame); 61 FRIEND_TEST_ALL_PREFIXES(RTCVideoDecoderTest, DoDeliverFrame);
68 FRIEND_TEST_ALL_PREFIXES(RTCVideoDecoderTest, DoFrameSizeChange); 62 FRIEND_TEST_ALL_PREFIXES(RTCVideoDecoderTest, DoFrameSizeChange);
69 63
70 enum DecoderState { 64 enum DecoderState {
71 kUnInitialized, 65 kUnInitialized,
72 kNormal, 66 kNormal,
73 kSeeking, 67 kSeeking,
74 kPaused, 68 kPaused,
75 kStopped 69 kStopped
76 }; 70 };
77 71
78 MessageLoop* message_loop_; 72 MessageLoop* message_loop_;
79 size_t width_; 73 size_t width_;
80 size_t height_; 74 size_t height_;
81 std::string url_; 75 std::string url_;
82 DecoderState state_; 76 DecoderState state_;
83 MediaFormat media_format_; 77 media::MediaFormat media_format_;
84 std::deque<scoped_refptr<VideoFrame> > frame_queue_available_; 78 std::deque<scoped_refptr<media::VideoFrame> > frame_queue_available_;
85 // Used for accessing frame queue from another thread. 79 // Used for accessing frame queue from another thread.
86 base::Lock lock_; 80 base::Lock lock_;
87 81
88 DISALLOW_COPY_AND_ASSIGN(RTCVideoDecoder); 82 DISALLOW_COPY_AND_ASSIGN(RTCVideoDecoder);
89 }; 83 };
90 84
91 } // namespace media 85 #endif // CONTENT_RENDERER_MEDIA_RTC_VIDEO_DECODER_H_
92 86
93 #endif // MEDIA_FILTERS_RTC_VIDEO_DECODER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698