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

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

Issue 14348007: Reland: Remove reference counting from media::VideoDecoder and friends. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fixes Created 7 years, 8 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/base/video_renderer.h ('k') | media/filters/decrypting_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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_DECRYPTING_VIDEO_DECODER_H_ 5 #ifndef MEDIA_FILTERS_DECRYPTING_VIDEO_DECODER_H_
6 #define MEDIA_FILTERS_DECRYPTING_VIDEO_DECODER_H_ 6 #define MEDIA_FILTERS_DECRYPTING_VIDEO_DECODER_H_
7 7
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/memory/ref_counted.h" 9 #include "base/memory/weak_ptr.h"
10 #include "media/base/decryptor.h" 10 #include "media/base/decryptor.h"
11 #include "media/base/demuxer_stream.h" 11 #include "media/base/demuxer_stream.h"
12 #include "media/base/video_decoder.h" 12 #include "media/base/video_decoder.h"
13 13
14 namespace base { 14 namespace base {
15 class MessageLoopProxy; 15 class MessageLoopProxy;
16 } 16 }
17 17
18 namespace media { 18 namespace media {
19 19
20 class DecoderBuffer; 20 class DecoderBuffer;
21 class Decryptor; 21 class Decryptor;
22 22
23 // Decryptor-based VideoDecoder implementation that can decrypt and decode 23 // Decryptor-based VideoDecoder implementation that can decrypt and decode
24 // encrypted video buffers and return decrypted and decompressed video frames. 24 // encrypted video buffers and return decrypted and decompressed video frames.
25 // All public APIs and callbacks are trampolined to the |message_loop_| so 25 // All public APIs and callbacks are trampolined to the |message_loop_| so
26 // that no locks are required for thread safety. 26 // that no locks are required for thread safety.
27 // 27 //
28 // TODO(xhwang): For now, DecryptingVideoDecoder relies on the decryptor to do 28 // TODO(xhwang): For now, DecryptingVideoDecoder relies on the decryptor to do
29 // both decryption and video decoding. Add the path to use the decryptor for 29 // both decryption and video decoding. Add the path to use the decryptor for
30 // decryption only and use other VideoDecoder implementations within 30 // decryption only and use other VideoDecoder implementations within
31 // DecryptingVideoDecoder for video decoding. 31 // DecryptingVideoDecoder for video decoding.
32 class MEDIA_EXPORT DecryptingVideoDecoder : public VideoDecoder { 32 class MEDIA_EXPORT DecryptingVideoDecoder : public VideoDecoder {
33 public: 33 public:
34 DecryptingVideoDecoder( 34 DecryptingVideoDecoder(
35 const scoped_refptr<base::MessageLoopProxy>& message_loop, 35 const scoped_refptr<base::MessageLoopProxy>& message_loop,
36 const SetDecryptorReadyCB& set_decryptor_ready_cb); 36 const SetDecryptorReadyCB& set_decryptor_ready_cb);
37 virtual ~DecryptingVideoDecoder();
37 38
38 // VideoDecoder implementation. 39 // VideoDecoder implementation.
39 virtual void Initialize(const scoped_refptr<DemuxerStream>& stream, 40 virtual void Initialize(const scoped_refptr<DemuxerStream>& stream,
40 const PipelineStatusCB& status_cb, 41 const PipelineStatusCB& status_cb,
41 const StatisticsCB& statistics_cb) OVERRIDE; 42 const StatisticsCB& statistics_cb) OVERRIDE;
42 virtual void Read(const ReadCB& read_cb) OVERRIDE; 43 virtual void Read(const ReadCB& read_cb) OVERRIDE;
43 virtual void Reset(const base::Closure& closure) OVERRIDE; 44 virtual void Reset(const base::Closure& closure) OVERRIDE;
44 virtual void Stop(const base::Closure& closure) OVERRIDE; 45 virtual void Stop(const base::Closure& closure) OVERRIDE;
45 46
46 protected:
47 virtual ~DecryptingVideoDecoder();
48
49 private: 47 private:
50 // For a detailed state diagram please see this link: http://goo.gl/8jAok 48 // For a detailed state diagram please see this link: http://goo.gl/8jAok
51 // TODO(xhwang): Add a ASCII state diagram in this file after this class 49 // TODO(xhwang): Add a ASCII state diagram in this file after this class
52 // stabilizes. 50 // stabilizes.
53 enum State { 51 enum State {
54 kUninitialized = 0, 52 kUninitialized = 0,
55 kDecryptorRequested, 53 kDecryptorRequested,
56 kPendingDecoderInit, 54 kPendingDecoderInit,
57 kIdle, 55 kIdle,
58 kPendingConfigChange, 56 kPendingConfigChange,
(...skipping 30 matching lines...) Expand all
89 // added. 87 // added.
90 void OnKeyAdded(); 88 void OnKeyAdded();
91 89
92 // Reset decoder and call |reset_cb_|. 90 // Reset decoder and call |reset_cb_|.
93 void DoReset(); 91 void DoReset();
94 92
95 // Free decoder resources and call |stop_cb_|. 93 // Free decoder resources and call |stop_cb_|.
96 void DoStop(); 94 void DoStop();
97 95
98 scoped_refptr<base::MessageLoopProxy> message_loop_; 96 scoped_refptr<base::MessageLoopProxy> message_loop_;
97 base::WeakPtrFactory<DecryptingVideoDecoder> weak_factory_;
98 base::WeakPtr<DecryptingVideoDecoder> weak_this_;
99 99
100 State state_; 100 State state_;
101 101
102 PipelineStatusCB init_cb_; 102 PipelineStatusCB init_cb_;
103 StatisticsCB statistics_cb_; 103 StatisticsCB statistics_cb_;
104 ReadCB read_cb_; 104 ReadCB read_cb_;
105 base::Closure reset_cb_; 105 base::Closure reset_cb_;
106 106
107 // Pointer to the demuxer stream that will feed us compressed buffers. 107 // Pointer to the demuxer stream that will feed us compressed buffers.
108 scoped_refptr<DemuxerStream> demuxer_stream_; 108 scoped_refptr<DemuxerStream> demuxer_stream_;
(...skipping 16 matching lines...) Expand all
125 // A unique ID to trace Decryptor::DecryptAndDecodeVideo() call and the 125 // A unique ID to trace Decryptor::DecryptAndDecodeVideo() call and the
126 // matching DecryptCB call (in DoDeliverFrame()). 126 // matching DecryptCB call (in DoDeliverFrame()).
127 uint32 trace_id_; 127 uint32 trace_id_;
128 128
129 DISALLOW_COPY_AND_ASSIGN(DecryptingVideoDecoder); 129 DISALLOW_COPY_AND_ASSIGN(DecryptingVideoDecoder);
130 }; 130 };
131 131
132 } // namespace media 132 } // namespace media
133 133
134 #endif // MEDIA_FILTERS_DECRYPTING_VIDEO_DECODER_H_ 134 #endif // MEDIA_FILTERS_DECRYPTING_VIDEO_DECODER_H_
OLDNEW
« no previous file with comments | « media/base/video_renderer.h ('k') | media/filters/decrypting_video_decoder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698