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

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

Issue 10969028: Add video decoding methods in Decryptor and add DecryptingVideoDecoder. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: reorder methods in the unittest Created 8 years, 2 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/crypto/aes_decryptor.cc ('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
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef MEDIA_FILTERS_DECRYPTING_VIDEO_DECODER_H_
6 #define MEDIA_FILTERS_DECRYPTING_VIDEO_DECODER_H_
7
8 #include "base/callback.h"
9 #include "base/memory/ref_counted.h"
10 #include "media/base/decryptor.h"
11 #include "media/base/demuxer_stream.h"
12 #include "media/base/video_decoder.h"
13
14 namespace base {
15 class MessageLoopProxy;
16 }
17
18 namespace media {
19
20 class DecoderBuffer;
21 class Decryptor;
22
23 // Decryptor-based VideoDecoder implementation that can decrypt and decode
24 // encrypted video buffers and return decrypted and decompressed video frames.
25 //
26 // TODO(xhwang): For now, DecryptingVideoDecoder relies on the decryptor to do
27 // both decryption and video decoding. Add the path to use the decryptor for
28 // decryption only and use other VideoDecoder implementations within
29 // DecryptingVideoDecoder for video decoding.
30 class MEDIA_EXPORT DecryptingVideoDecoder : public VideoDecoder {
31 public:
32 typedef base::Callback<
33 scoped_refptr<base::MessageLoopProxy>()> MessageLoopFactoryCB;
34 // |message_loop_factory_cb| provides message loop that the decryption
35 // operations run on.
36 // |decryptor| performs real decrypting operations.
37 // Note that |decryptor| must outlive this instance.
38 DecryptingVideoDecoder(const MessageLoopFactoryCB& message_loop_factory_cb,
39 Decryptor* decryptor);
40
41 // VideoDecoder implementation.
42 virtual void Initialize(const scoped_refptr<DemuxerStream>& stream,
43 const PipelineStatusCB& status_cb,
44 const StatisticsCB& statistics_cb) OVERRIDE;
45 virtual void Read(const ReadCB& read_cb) OVERRIDE;
46 virtual void Reset(const base::Closure& closure) OVERRIDE;
47 virtual void Stop(const base::Closure& closure) OVERRIDE;
48
49 protected:
50 virtual ~DecryptingVideoDecoder();
51
52 private:
53 enum DecoderState {
54 kUninitialized,
55 kNormal,
56 kDecodeFinished
57 };
58
59 // Carries out the initialization operation scheduled by Initialize().
60 void DoInitialize(const scoped_refptr<DemuxerStream>& stream,
61 const PipelineStatusCB& status_cb,
62 const StatisticsCB& statistics_cb);
63
64 // Callback for Decryptor::InitializeVideoDecoder().
65 void FinishInitialization(bool success);
66
67 // Carries out the initialization finishing operation scheduled by
68 // FinishInitialization().
69 void DoFinishInitialization(bool success);
70
71 // Carries out the buffer reading operation scheduled by Read().
72 void DoRead(const ReadCB& read_cb);
73
74 void ReadFromDemuxerStream();
75
76 // Callback for DemuxerStream::Read().
77 void DecryptAndDecodeBuffer(DemuxerStream::Status status,
78 const scoped_refptr<DecoderBuffer>& buffer);
79
80 // Carries out the buffer decrypting/decoding operation scheduled by
81 // DecryptAndDecodeBuffer().
82 void DoDecryptAndDecodeBuffer(DemuxerStream::Status status,
83 const scoped_refptr<DecoderBuffer>& buffer);
84
85 // Callback for Decryptor::DecryptAndDecodeVideo().
86 void DeliverFrame(int buffer_size,
87 Decryptor::Status status,
88 const scoped_refptr<VideoFrame>& frame);
89
90 // Carries out the frame delivery operation scheduled by DeliverFrame().
91 void DoDeliverFrame(int buffer_size,
92 Decryptor::Status status,
93 const scoped_refptr<VideoFrame>& frame);
94
95 // Reset decoder and call |reset_cb_|.
96 void DoReset();
97
98 // Free decoder resources and call |stop_cb_|.
99 void DoStop();
100
101 // This is !is_null() iff Initialize() hasn't been called.
102 MessageLoopFactoryCB message_loop_factory_cb_;
103
104 scoped_refptr<base::MessageLoopProxy> message_loop_;
105 DecoderState state_;
106 PipelineStatusCB init_cb_;
107 StatisticsCB statistics_cb_;
108 ReadCB read_cb_;
109 base::Closure reset_cb_;
110 base::Closure stop_cb_;
111
112 // Pointer to the demuxer stream that will feed us compressed buffers.
113 scoped_refptr<DemuxerStream> demuxer_stream_;
114
115 Decryptor* const decryptor_;
116
117 DISALLOW_COPY_AND_ASSIGN(DecryptingVideoDecoder);
118 };
119
120 } // namespace media
121
122 #endif // MEDIA_FILTERS_DECRYPTING_VIDEO_DECODER_H_
OLDNEW
« no previous file with comments | « media/crypto/aes_decryptor.cc ('k') | media/filters/decrypting_video_decoder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698