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

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

Issue 1666653002: media: Remove SetCdmReadyCB and CdmReadyCB (part 1). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase and fix compile errors Created 4 years, 10 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
« no previous file with comments | « media/filters/audio_decoder_unittest.cc ('k') | media/filters/decoder_selector.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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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_DECODER_SELECTOR_H_ 5 #ifndef MEDIA_FILTERS_DECODER_SELECTOR_H_
6 #define MEDIA_FILTERS_DECODER_SELECTOR_H_ 6 #define MEDIA_FILTERS_DECODER_SELECTOR_H_
7 7
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/memory/ref_counted.h" 10 #include "base/memory/ref_counted.h"
11 #include "base/memory/scoped_vector.h" 11 #include "base/memory/scoped_vector.h"
12 #include "base/memory/weak_ptr.h" 12 #include "base/memory/weak_ptr.h"
13 #include "build/build_config.h" 13 #include "build/build_config.h"
14 #include "media/base/cdm_context.h"
15 #include "media/base/demuxer_stream.h" 14 #include "media/base/demuxer_stream.h"
16 #include "media/base/pipeline_status.h" 15 #include "media/base/pipeline_status.h"
17 #include "media/filters/decoder_stream_traits.h" 16 #include "media/filters/decoder_stream_traits.h"
18 17
19 namespace base { 18 namespace base {
20 class SingleThreadTaskRunner; 19 class SingleThreadTaskRunner;
21 } 20 }
22 21
23 namespace media { 22 namespace media {
24 23
24 class CdmContext;
25 class DecoderBuffer; 25 class DecoderBuffer;
26 class DecryptingDemuxerStream; 26 class DecryptingDemuxerStream;
27 class MediaLog; 27 class MediaLog;
28 28
29 // DecoderSelector (creates if necessary and) initializes the proper 29 // DecoderSelector (creates if necessary and) initializes the proper
30 // Decoder for a given DemuxerStream. If the given DemuxerStream is 30 // Decoder for a given DemuxerStream. If the given DemuxerStream is
31 // encrypted, a DecryptingDemuxerStream may also be created. 31 // encrypted, a DecryptingDemuxerStream may also be created.
32 // The template parameter |StreamType| is the type of stream we will be 32 // The template parameter |StreamType| is the type of stream we will be
33 // selecting a decoder for. 33 // selecting a decoder for.
34 template<DemuxerStream::Type StreamType> 34 template<DemuxerStream::Type StreamType>
(...skipping 26 matching lines...) Expand all
61 // NULL and NULL immediately if it's pending. 61 // NULL and NULL immediately if it's pending.
62 ~DecoderSelector(); 62 ~DecoderSelector();
63 63
64 // Initializes and selects the first Decoder that can decode the |stream|. 64 // Initializes and selects the first Decoder that can decode the |stream|.
65 // The selected Decoder (and DecryptingDemuxerStream) is returned via 65 // The selected Decoder (and DecryptingDemuxerStream) is returned via
66 // the |select_decoder_cb|. 66 // the |select_decoder_cb|.
67 // Notes: 67 // Notes:
68 // 1. This must not be called again before |select_decoder_cb| is run. 68 // 1. This must not be called again before |select_decoder_cb| is run.
69 // 2. Decoders that fail to initialize will be deleted. Future calls will 69 // 2. Decoders that fail to initialize will be deleted. Future calls will
70 // select from the decoders following the decoder that was last returned. 70 // select from the decoders following the decoder that was last returned.
71 // 3. |set_cdm_ready_cb| is optional. If |set_cdm_ready_cb| is 71 // 3. |cdm_context| is optional. If |cdm_context| is
72 // null, no CDM will be available to perform decryption. 72 // null, no CDM will be available to perform decryption.
73 void SelectDecoder(DemuxerStream* stream, 73 void SelectDecoder(DemuxerStream* stream,
74 const SetCdmReadyCB& set_cdm_ready_cb, 74 CdmContext* cdm_context,
75 const SelectDecoderCB& select_decoder_cb, 75 const SelectDecoderCB& select_decoder_cb,
76 const typename Decoder::OutputCB& output_cb, 76 const typename Decoder::OutputCB& output_cb,
77 const base::Closure& waiting_for_decryption_key_cb); 77 const base::Closure& waiting_for_decryption_key_cb);
78 78
79 private: 79 private:
80 #if !defined(OS_ANDROID) 80 #if !defined(OS_ANDROID)
81 void InitializeDecryptingDecoder(); 81 void InitializeDecryptingDecoder();
82 void DecryptingDecoderInitDone(bool success); 82 void DecryptingDecoderInitDone(bool success);
83 #endif 83 #endif
84
85 // Requests that this object notifies when a CDM is ready through the
86 // |cdm_ready_cb| provided.
87 // TODO(xhwang): Remove after DecryptingDemuxerStream::Initialize() is fixed
88 // to take |cdm_context_| directly.
89 void SetCdmReadyCallback(const CdmReadyCB& cdm_ready_cb);
90
84 void InitializeDecryptingDemuxerStream(); 91 void InitializeDecryptingDemuxerStream();
85 void DecryptingDemuxerStreamInitDone(PipelineStatus status); 92 void DecryptingDemuxerStreamInitDone(PipelineStatus status);
86 void InitializeDecoder(); 93 void InitializeDecoder();
87 void DecoderInitDone(bool success); 94 void DecoderInitDone(bool success);
88 void ReturnNullDecoder(); 95 void ReturnNullDecoder();
89 96
90 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; 97 scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
91 ScopedVector<Decoder> decoders_; 98 ScopedVector<Decoder> decoders_;
92 scoped_refptr<MediaLog> media_log_; 99 scoped_refptr<MediaLog> media_log_;
93 100
94 DemuxerStream* input_stream_; 101 DemuxerStream* input_stream_;
95 SetCdmReadyCB set_cdm_ready_cb_; 102 CdmContext* cdm_context_;
96 SelectDecoderCB select_decoder_cb_; 103 SelectDecoderCB select_decoder_cb_;
97 typename Decoder::OutputCB output_cb_; 104 typename Decoder::OutputCB output_cb_;
98 base::Closure waiting_for_decryption_key_cb_; 105 base::Closure waiting_for_decryption_key_cb_;
99 106
100 scoped_ptr<Decoder> decoder_; 107 scoped_ptr<Decoder> decoder_;
101 scoped_ptr<DecryptingDemuxerStream> decrypted_stream_; 108 scoped_ptr<DecryptingDemuxerStream> decrypted_stream_;
102 109
103 // NOTE: Weak pointers must be invalidated before all other member variables. 110 // NOTE: Weak pointers must be invalidated before all other member variables.
104 base::WeakPtrFactory<DecoderSelector> weak_ptr_factory_; 111 base::WeakPtrFactory<DecoderSelector> weak_ptr_factory_;
105 112
106 DISALLOW_IMPLICIT_CONSTRUCTORS(DecoderSelector); 113 DISALLOW_IMPLICIT_CONSTRUCTORS(DecoderSelector);
107 }; 114 };
108 115
109 typedef DecoderSelector<DemuxerStream::VIDEO> VideoDecoderSelector; 116 typedef DecoderSelector<DemuxerStream::VIDEO> VideoDecoderSelector;
110 typedef DecoderSelector<DemuxerStream::AUDIO> AudioDecoderSelector; 117 typedef DecoderSelector<DemuxerStream::AUDIO> AudioDecoderSelector;
111 118
112 } // namespace media 119 } // namespace media
113 120
114 #endif // MEDIA_FILTERS_DECODER_SELECTOR_H_ 121 #endif // MEDIA_FILTERS_DECODER_SELECTOR_H_
OLDNEW
« no previous file with comments | « media/filters/audio_decoder_unittest.cc ('k') | media/filters/decoder_selector.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698