OLD | NEW |
---|---|
(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_AUDIO_DECODER_FACTORY_H_ | |
6 #define MEDIA_FILTERS_AUDIO_DECODER_FACTORY_H_ | |
7 | |
8 #include <list> | |
9 | |
10 #include "base/callback.h" | |
11 #include "base/memory/ref_counted.h" | |
12 #include "base/memory/weak_ptr.h" | |
13 #include "media/base/audio_decoder.h" | |
14 #include "media/base/decryptor.h" | |
15 #include "media/base/demuxer_stream.h" | |
16 | |
17 namespace base { | |
18 class MessageLoopProxy; | |
19 } | |
20 | |
21 namespace media { | |
22 | |
23 class DecoderBuffer; | |
24 class DecryptingDemuxerStream; | |
25 class Decryptor; | |
26 | |
27 // AudioDecoderFactory (creates if necessary and) initializes the proper | |
28 // AudioDecoder for a given DemuxerStream. If the given DemuxerStream is | |
29 // encrypted, a DecryptingDemuxerStream may also be created. | |
30 class MEDIA_EXPORT AudioDecoderFactory { | |
ddorwin
2012/12/11 05:13:34
It's odd for a factory to have state. This factory
xhwang
2012/12/12 23:43:28
It's not factory anymore.
| |
31 public: | |
32 typedef std::list<scoped_refptr<AudioDecoder> > AudioDecoderList; | |
33 | |
34 // Indicates completion of AudioDecoder initialization. | |
35 // | |
36 // First parameter: The initialized AudioDecoder. If it's set to NULL, then | |
37 // AudioDecoder initialization failed. | |
scherkus (not reviewing)
2012/12/11 20:52:15
nit: this style of indentation is a waste of valua
xhwang
2012/12/12 23:43:28
Done.
| |
38 // Second parameter: The initialized DecryptingDemuxerStream. If it's not | |
39 // NULL, then a DecryptingDemuxerStream is created and | |
40 // initialized to do decryption for the initialized | |
41 // AudioDecoder. | |
42 typedef base::Callback< | |
43 void(const scoped_refptr<AudioDecoder>&, | |
44 const scoped_refptr<DecryptingDemuxerStream>&)> InitDoneCB; | |
ddorwin
2012/12/11 05:13:34
Should the callback be DecoderCreatedCB?
xhwang
2012/12/12 23:43:28
Changed to DecoderSlectedCB.
xhwang
2012/12/12 23:43:28
Done.
| |
45 | |
46 // If |request_decryptor_notification_cb| is null, no decryptor will be | |
47 // available to perform decryption. | |
ddorwin
2012/12/11 05:13:34
I don't understand? The factory will not support d
xhwang
2012/12/11 19:43:04
When --enable-encrypted-media is not set, we don't
ddorwin
2012/12/12 00:30:25
Why not use an explicit control (Boolean)? It does
xhwang
2012/12/12 23:43:28
Yep, will keep what I have here.
| |
48 AudioDecoderFactory( | |
49 const scoped_refptr<base::MessageLoopProxy>& message_loop, | |
ddorwin
2012/12/12 00:30:25
Is there a method/pattern to who parameters are pa
xhwang
2012/12/12 23:43:28
Not sure, keep the code as is unless anybody objec
| |
50 const AudioDecoderList& precreated_decoders, | |
ddorwin
2012/12/11 05:13:34
"precreated" is an odd term.
xhwang
2012/12/11 19:43:04
How about "default", to match "AddDefaultDecodersT
ddorwin
2012/12/12 00:30:25
Sounds better, BUT not all are default. When we do
| |
51 const RequestDecryptorNotificationCB& request_decryptor_notification_cb); | |
52 ~AudioDecoderFactory(); | |
53 | |
54 void InitAudioDecoder(const scoped_refptr<DemuxerStream>& stream, | |
ddorwin
2012/12/11 05:13:34
Is this Init or Create?
xhwang
2012/12/11 19:43:04
Well, this is tricky. The accurate name should be
ddorwin
2012/12/12 00:30:25
Select? Get? Obtain?
On a related note, Factories
xhwang
2012/12/12 23:43:28
Renamed to Select. Class name renamed also.
| |
55 const StatisticsCB& statistics_cb, | |
56 const InitDoneCB& init_done_cb); | |
57 | |
58 private: | |
59 void DecryptingAudioDecoderInitDone(PipelineStatus status); | |
60 void DecryptingDemuxerStreamInitDone(PipelineStatus status); | |
61 void InitializeNextPrecreatedDecoder(); | |
62 void PrecreatedDecoderInitDone(PipelineStatus status); | |
63 | |
64 scoped_refptr<base::MessageLoopProxy> message_loop_; | |
65 AudioDecoderList precreated_decoders_; | |
66 RequestDecryptorNotificationCB request_decryptor_notification_cb_; | |
67 | |
68 scoped_refptr<DemuxerStream> input_stream_; | |
69 StatisticsCB statistics_cb_; | |
70 InitDoneCB init_done_cb_; | |
71 | |
72 scoped_refptr<AudioDecoder> audio_decoder_; | |
73 scoped_refptr<DecryptingDemuxerStream> decrypted_stream_; | |
74 | |
75 base::WeakPtrFactory<AudioDecoderFactory> weak_ptr_factory_; | |
76 base::WeakPtr<AudioDecoderFactory> weak_this_; | |
77 | |
78 DISALLOW_COPY_AND_ASSIGN(AudioDecoderFactory); | |
79 }; | |
80 | |
81 } // namespace media | |
82 | |
83 #endif // MEDIA_FILTERS_AUDIO_DECODER_FACTORY_H_ | |
OLD | NEW |