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

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: Move DVD to filters/ and rebase. 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
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 DecryptingVideoDecoder(const MessageLoopFactoryCB& message_loop_factory_cb,
ddorwin 2012/09/28 17:36:40 // Blah. // |decryptor| must to outlive this insta
xhwang 2012/09/30 19:58:51 Done.
35 Decryptor* decryptor);
36
37 // VideoDecoder implementation.
38 virtual void Initialize(const scoped_refptr<DemuxerStream>& stream,
39 const PipelineStatusCB& status_cb,
40 const StatisticsCB& statistics_cb) OVERRIDE;
41 virtual void Read(const ReadCB& read_cb) OVERRIDE;
42 virtual void Reset(const base::Closure& closure) OVERRIDE;
43 virtual void Stop(const base::Closure& closure) OVERRIDE;
44
45 protected:
46 virtual ~DecryptingVideoDecoder();
47
48 private:
49 enum DecoderState {
50 kUninitialized,
51 kNormal,
52 kDecodeFinished
53 };
54
55 // Callback for Decryptor::InitializeVideoDecoder().
56 void OnDecoderInitialized(bool success);
57
58 // Carries out the buffer reading operation scheduled by Read().
59 void DoRead(const ReadCB& read_cb);
60
61 void ReadFromDemuxerStream();
62
63 // Callback for DemuxerStream::Read().
64 void DecryptAndDecodeBuffer(DemuxerStream::Status status,
65 const scoped_refptr<DecoderBuffer>& buffer);
66
67 // Carries out the buffer decrypting/decoding operation scheduled by
68 // DecryptAndDecodeBuffer().
69 void DoDecryptAndDecodeBuffer(DemuxerStream::Status status,
70 const scoped_refptr<DecoderBuffer>& buffer);
71
72 // Callback for Decryptor::DecryptAndDecodeVideo().
73 void DeliverFrame(int buffer_size,
ddorwin 2012/09/28 17:36:40 The previous Decryptor callback started with "On".
xhwang 2012/09/30 19:58:51 We use both in media code. I use On* for callbacks
74 Decryptor::Status status,
75 const scoped_refptr<VideoFrame>& frame);
76
77 // Carries out the frame delivery operation scheduled by DeliverFrame().
78 void DoDeliverFrame(int buffer_size,
79 Decryptor::Status status,
80 const scoped_refptr<VideoFrame>& frame);
81
82 // Reset decoder and call |reset_cb_|.
83 void DoReset();
84
85 // Free decoder resources and call |stop_cb_|.
86 void DoStop();
87
88 // This is !is_null() iff Initialize() hasn't been called.
89 MessageLoopFactoryCB message_loop_factory_cb_;
90
91 scoped_refptr<base::MessageLoopProxy> message_loop_;
92 DecoderState state_;
93 PipelineStatusCB status_cb_;
94 StatisticsCB statistics_cb_;
95 ReadCB read_cb_;
96 base::Closure reset_cb_;
97 base::Closure stop_cb_;
98
99 // Pointer to the demuxer stream that will feed us compressed buffers.
100 scoped_refptr<DemuxerStream> demuxer_stream_;
101
102 // Pointer to a Decryptor that can decrypt and decode encrypted video buffers.
ddorwin 2012/09/28 17:36:40 This comment will need to be updated when you addr
xhwang 2012/09/30 19:58:51 Removed.
103 Decryptor* const decryptor_;
104
105 DISALLOW_COPY_AND_ASSIGN(DecryptingVideoDecoder);
106 };
107
108 } // namespace media
109
110 #endif // MEDIA_FILTERS_DECRYPTING_VIDEO_DECODER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698