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

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

Issue 395703002: Fold {Audio|Video}Decoder::Stop() into the dtor. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase only Created 6 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
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/weak_ptr.h" 9 #include "base/memory/weak_ptr.h"
10 #include "media/base/decryptor.h" 10 #include "media/base/decryptor.h"
(...skipping 21 matching lines...) Expand all
32 virtual ~DecryptingVideoDecoder(); 32 virtual ~DecryptingVideoDecoder();
33 33
34 // VideoDecoder implementation. 34 // VideoDecoder implementation.
35 virtual void Initialize(const VideoDecoderConfig& config, 35 virtual void Initialize(const VideoDecoderConfig& config,
36 bool low_delay, 36 bool low_delay,
37 const PipelineStatusCB& status_cb, 37 const PipelineStatusCB& status_cb,
38 const OutputCB& output_cb) OVERRIDE; 38 const OutputCB& output_cb) OVERRIDE;
39 virtual void Decode(const scoped_refptr<DecoderBuffer>& buffer, 39 virtual void Decode(const scoped_refptr<DecoderBuffer>& buffer,
40 const DecodeCB& decode_cb) OVERRIDE; 40 const DecodeCB& decode_cb) OVERRIDE;
41 virtual void Reset(const base::Closure& closure) OVERRIDE; 41 virtual void Reset(const base::Closure& closure) OVERRIDE;
42 virtual void Stop() OVERRIDE;
43 42
44 private: 43 private:
45 // For a detailed state diagram please see this link: http://goo.gl/8jAok 44 // For a detailed state diagram please see this link: http://goo.gl/8jAok
46 // TODO(xhwang): Add a ASCII state diagram in this file after this class 45 // TODO(xhwang): Add a ASCII state diagram in this file after this class
47 // stabilizes. 46 // stabilizes.
48 enum State { 47 enum State {
49 kUninitialized = 0, 48 kUninitialized = 0,
50 kDecryptorRequested, 49 kDecryptorRequested,
51 kPendingDecoderInit, 50 kPendingDecoderInit,
52 kIdle, 51 kIdle,
53 kPendingDecode, 52 kPendingDecode,
54 kWaitingForKey, 53 kWaitingForKey,
55 kDecodeFinished, 54 kDecodeFinished,
56 kStopped,
57 kError 55 kError
58 }; 56 };
59 57
60 // Callback for DecryptorHost::RequestDecryptor(). 58 // Callback for DecryptorHost::RequestDecryptor().
61 void SetDecryptor(Decryptor* decryptor); 59 void SetDecryptor(Decryptor* decryptor);
62 60
63 // Callback for Decryptor::InitializeVideoDecoder() during initialization. 61 // Callback for Decryptor::InitializeVideoDecoder() during initialization.
64 void FinishInitialization(bool success); 62 void FinishInitialization(bool success);
65 63
66 void DecodePendingBuffer(); 64 void DecodePendingBuffer();
67 65
68 // Callback for Decryptor::DecryptAndDecodeVideo(). 66 // Callback for Decryptor::DecryptAndDecodeVideo().
69 void DeliverFrame(int buffer_size, 67 void DeliverFrame(int buffer_size,
70 Decryptor::Status status, 68 Decryptor::Status status,
71 const scoped_refptr<VideoFrame>& frame); 69 const scoped_refptr<VideoFrame>& frame);
72 70
73 // Callback for the |decryptor_| to notify this object that a new key has been 71 // Callback for the |decryptor_| to notify this object that a new key has been
74 // added. 72 // added.
75 void OnKeyAdded(); 73 void OnKeyAdded();
76 74
77 // Reset decoder and call |reset_cb_|. 75 // Reset decoder and call |reset_cb_|.
78 void DoReset(); 76 void DoReset();
79 77
80 // Free decoder resources and call |stop_cb_|.
81 void DoStop();
82
83 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; 78 scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
84 79
85 State state_; 80 State state_;
86 81
87 PipelineStatusCB init_cb_; 82 PipelineStatusCB init_cb_;
88 OutputCB output_cb_; 83 OutputCB output_cb_;
89 DecodeCB decode_cb_; 84 DecodeCB decode_cb_;
90 base::Closure reset_cb_; 85 base::Closure reset_cb_;
91 86
92 VideoDecoderConfig config_; 87 VideoDecoderConfig config_;
(...skipping 20 matching lines...) Expand all
113 // NOTE: Weak pointers must be invalidated before all other member variables. 108 // NOTE: Weak pointers must be invalidated before all other member variables.
114 base::WeakPtrFactory<DecryptingVideoDecoder> weak_factory_; 109 base::WeakPtrFactory<DecryptingVideoDecoder> weak_factory_;
115 base::WeakPtr<DecryptingVideoDecoder> weak_this_; 110 base::WeakPtr<DecryptingVideoDecoder> weak_this_;
116 111
117 DISALLOW_COPY_AND_ASSIGN(DecryptingVideoDecoder); 112 DISALLOW_COPY_AND_ASSIGN(DecryptingVideoDecoder);
118 }; 113 };
119 114
120 } // namespace media 115 } // namespace media
121 116
122 #endif // MEDIA_FILTERS_DECRYPTING_VIDEO_DECODER_H_ 117 #endif // MEDIA_FILTERS_DECRYPTING_VIDEO_DECODER_H_
OLDNEW
« no previous file with comments | « media/filters/decrypting_audio_decoder_unittest.cc ('k') | media/filters/decrypting_video_decoder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698