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

Side by Side Diff: media/filters/fake_video_decoder.h

Issue 16274005: Separate DemuxerStream and VideoDecoder. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix win64 Created 7 years, 5 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
« no previous file with comments | « media/filters/fake_demuxer_stream.cc ('k') | media/filters/fake_video_decoder.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 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 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_FAKE_VIDEO_DECODER_H_ 5 #ifndef MEDIA_FILTERS_FAKE_VIDEO_DECODER_H_
6 #define MEDIA_FILTERS_FAKE_VIDEO_DECODER_H_ 6 #define MEDIA_FILTERS_FAKE_VIDEO_DECODER_H_
7 7
8 #include <list> 8 #include <list>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
11 #include "base/callback.h" 11 #include "base/callback.h"
12 #include "base/callback_helpers.h" 12 #include "base/callback_helpers.h"
13 #include "base/memory/weak_ptr.h" 13 #include "base/memory/weak_ptr.h"
14 #include "media/base/callback_holder.h" 14 #include "media/base/callback_holder.h"
15 #include "media/base/decoder_buffer.h" 15 #include "media/base/decoder_buffer.h"
16 #include "media/base/demuxer_stream.h"
17 #include "media/base/media_export.h"
18 #include "media/base/pipeline_status.h" 16 #include "media/base/pipeline_status.h"
19 #include "media/base/video_decoder.h" 17 #include "media/base/video_decoder.h"
20 #include "media/base/video_decoder_config.h" 18 #include "media/base/video_decoder_config.h"
21 #include "media/base/video_frame.h" 19 #include "media/base/video_frame.h"
22 #include "ui/gfx/size.h" 20 #include "ui/gfx/size.h"
23 21
24 using base::ResetAndReturn; 22 using base::ResetAndReturn;
25 23
26 namespace base { 24 namespace base {
27 class MessageLoopProxy; 25 class MessageLoopProxy;
28 } 26 }
29 27
30 namespace media { 28 namespace media {
31 29
32 class MEDIA_EXPORT FakeVideoDecoder : public VideoDecoder { 30 class FakeVideoDecoder : public VideoDecoder {
33 public: 31 public:
34 // Constructs an object with a decoding delay of |decoding_delay| frames. 32 // Constructs an object with a decoding delay of |decoding_delay| frames.
35 explicit FakeVideoDecoder(int decoding_delay); 33 explicit FakeVideoDecoder(int decoding_delay);
36 virtual ~FakeVideoDecoder(); 34 virtual ~FakeVideoDecoder();
37 35
38 // VideoDecoder implementation. 36 // VideoDecoder implementation.
39 virtual void Initialize(DemuxerStream* stream, 37 virtual void Initialize(const VideoDecoderConfig& config,
40 const PipelineStatusCB& status_cb, 38 const PipelineStatusCB& status_cb,
41 const StatisticsCB& statistics_cb) OVERRIDE; 39 const StatisticsCB& statistics_cb) OVERRIDE;
42 virtual void Read(const ReadCB& read_cb) OVERRIDE; 40 virtual void Decode(const scoped_refptr<DecoderBuffer>& buffer,
41 const ReadCB& read_cb) OVERRIDE;
43 virtual void Reset(const base::Closure& closure) OVERRIDE; 42 virtual void Reset(const base::Closure& closure) OVERRIDE;
44 virtual void Stop(const base::Closure& closure) OVERRIDE; 43 virtual void Stop(const base::Closure& closure) OVERRIDE;
45 44
46 // Holds the next init/read/reset/stop callback from firing. 45 // Holds the next init/read/reset/stop callback from firing.
47 void HoldNextInit(); 46 void HoldNextInit();
48 void HoldNextRead(); 47 void HoldNextRead();
49 void HoldNextReset(); 48 void HoldNextReset();
50 void HoldNextStop(); 49 void HoldNextStop();
51 50
52 // Satisfies the pending init/read/reset/stop callback, which must be ready 51 // Satisfies the pending init/read/reset/stop callback, which must be ready
53 // to fire when these methods are called. 52 // to fire when these methods are called.
54 void SatisfyInit(); 53 void SatisfyInit();
55 void SatisfyRead(); 54 void SatisfyRead();
56 void SatisfyReset(); 55 void SatisfyReset();
57 void SatisfyStop(); 56 void SatisfyStop();
58 57
59 private: 58 private:
60 enum State { 59 enum State {
61 UNINITIALIZED, 60 UNINITIALIZED,
62 NORMAL 61 NORMAL
63 }; 62 };
64 63
65 void ReadFromDemuxerStream();
66
67 // Callback for DemuxerStream::Read().
68 void BufferReady(DemuxerStream::Status status,
69 const scoped_refptr<DecoderBuffer>& buffer);
70
71 void DoReset(); 64 void DoReset();
72 void DoStop(); 65 void DoStop();
73 66
74 scoped_refptr<base::MessageLoopProxy> message_loop_; 67 scoped_refptr<base::MessageLoopProxy> message_loop_;
75 base::WeakPtrFactory<FakeVideoDecoder> weak_factory_; 68 base::WeakPtrFactory<FakeVideoDecoder> weak_factory_;
76 base::WeakPtr<FakeVideoDecoder> weak_this_; 69 base::WeakPtr<FakeVideoDecoder> weak_this_;
77 70
78 const int decoding_delay_; 71 const int decoding_delay_;
79 72
80 State state_; 73 State state_;
81 74
82 StatisticsCB statistics_cb_; 75 StatisticsCB statistics_cb_;
83 76
84 CallbackHolder<PipelineStatusCB> init_cb_; 77 CallbackHolder<PipelineStatusCB> init_cb_;
85 CallbackHolder<ReadCB> read_cb_; 78 CallbackHolder<ReadCB> read_cb_;
86 CallbackHolder<base::Closure> reset_cb_; 79 CallbackHolder<base::Closure> reset_cb_;
87 CallbackHolder<base::Closure> stop_cb_; 80 CallbackHolder<base::Closure> stop_cb_;
88 81
89 // Pointer to the demuxer stream that will feed us compressed buffers.
90 DemuxerStream* demuxer_stream_;
91
92 VideoDecoderConfig current_config_; 82 VideoDecoderConfig current_config_;
93 83
94 std::list<scoped_refptr<VideoFrame> > decoded_frames_; 84 std::list<scoped_refptr<VideoFrame> > decoded_frames_;
95 85
96 DISALLOW_COPY_AND_ASSIGN(FakeVideoDecoder); 86 DISALLOW_COPY_AND_ASSIGN(FakeVideoDecoder);
97 }; 87 };
98 88
99 } // namespace media 89 } // namespace media
100 90
101 #endif // MEDIA_FILTERS_FAKE_VIDEO_DECODER_H_ 91 #endif // MEDIA_FILTERS_FAKE_VIDEO_DECODER_H_
OLDNEW
« no previous file with comments | « media/filters/fake_demuxer_stream.cc ('k') | media/filters/fake_video_decoder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698