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

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

Issue 14348007: Reland: Remove reference counting from media::VideoDecoder and friends. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fixes Created 7 years, 8 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_VIDEO_DECODER_SELECTOR_H_ 5 #ifndef MEDIA_FILTERS_VIDEO_DECODER_SELECTOR_H_
6 #define MEDIA_FILTERS_VIDEO_DECODER_SELECTOR_H_ 6 #define MEDIA_FILTERS_VIDEO_DECODER_SELECTOR_H_
7 7
8 #include <list>
9
10 #include "base/callback.h" 8 #include "base/callback.h"
11 #include "base/memory/ref_counted.h" 9 #include "base/memory/ref_counted.h"
10 #include "base/memory/scoped_vector.h"
12 #include "base/memory/weak_ptr.h" 11 #include "base/memory/weak_ptr.h"
13 #include "media/base/decryptor.h" 12 #include "media/base/decryptor.h"
14 #include "media/base/demuxer_stream.h" 13 #include "media/base/demuxer_stream.h"
15 #include "media/base/video_decoder.h" 14 #include "media/base/video_decoder.h"
16 15
17 namespace base { 16 namespace base {
18 class MessageLoopProxy; 17 class MessageLoopProxy;
19 } 18 }
20 19
21 namespace media { 20 namespace media {
22 21
23 class DecoderBuffer; 22 class DecoderBuffer;
24 class DecryptingDemuxerStream; 23 class DecryptingDemuxerStream;
25 class Decryptor; 24 class Decryptor;
26 25
27 // VideoDecoderSelector (creates if necessary and) initializes the proper 26 // VideoDecoderSelector (creates if necessary and) initializes the proper
28 // VideoDecoder for a given DemuxerStream. If the given DemuxerStream is 27 // VideoDecoder for a given DemuxerStream. If the given DemuxerStream is
29 // encrypted, a DecryptingDemuxerStream may also be created. 28 // encrypted, a DecryptingDemuxerStream may also be created.
30 class MEDIA_EXPORT VideoDecoderSelector { 29 class MEDIA_EXPORT VideoDecoderSelector {
31 public: 30 public:
32 typedef std::list<scoped_refptr<VideoDecoder> > VideoDecoderList;
33
34 // Indicates completion of VideoDecoder selection. 31 // Indicates completion of VideoDecoder selection.
35 // - First parameter: The initialized VideoDecoder. If it's set to NULL, then 32 // - First parameter: The initialized VideoDecoder. If it's set to NULL, then
36 // VideoDecoder initialization failed. 33 // VideoDecoder initialization failed.
37 // - Second parameter: The initialized DecryptingDemuxerStream. If it's not 34 // - Second parameter: The initialized DecryptingDemuxerStream. If it's not
38 // NULL, then a DecryptingDemuxerStream is created and initialized to do 35 // NULL, then a DecryptingDemuxerStream is created and initialized to do
39 // decryption for the initialized VideoDecoder. 36 // decryption for the initialized VideoDecoder.
40 // Note: The caller owns selected VideoDecoder and DecryptingDemuxerStream. 37 // Note: The caller owns selected VideoDecoder and DecryptingDemuxerStream.
41 // The caller should call DecryptingDemuxerStream::Reset() before 38 // The caller should call DecryptingDemuxerStream::Reset() before
42 // calling VideoDecoder::Reset() to release any pending decryption or read. 39 // calling VideoDecoder::Reset() to release any pending decryption or read.
43 typedef base::Callback< 40 typedef base::Callback<
44 void(const scoped_refptr<VideoDecoder>&, 41 void(scoped_ptr<VideoDecoder>,
45 const scoped_refptr<DecryptingDemuxerStream>&)> SelectDecoderCB; 42 const scoped_refptr<DecryptingDemuxerStream>&)> SelectDecoderCB;
46 43
44 // |decoders| contains the VideoDecoders to use when initializing.
45 //
47 // |set_decryptor_ready_cb| is optional. If |set_decryptor_ready_cb| is null, 46 // |set_decryptor_ready_cb| is optional. If |set_decryptor_ready_cb| is null,
48 // no decryptor will be available to perform decryption. 47 // no decryptor will be available to perform decryption.
49 VideoDecoderSelector( 48 VideoDecoderSelector(
50 const scoped_refptr<base::MessageLoopProxy>& message_loop, 49 const scoped_refptr<base::MessageLoopProxy>& message_loop,
51 const VideoDecoderList& decoders, 50 ScopedVector<VideoDecoder> decoders,
52 const SetDecryptorReadyCB& set_decryptor_ready_cb); 51 const SetDecryptorReadyCB& set_decryptor_ready_cb);
53 ~VideoDecoderSelector(); 52 ~VideoDecoderSelector();
54 53
55 // Initializes and selects an VideoDecoder that can decode the |stream|. 54 // Initializes and selects an VideoDecoder that can decode the |stream|.
56 // Selected VideoDecoder (and DecryptingDemuxerStream) is returned via 55 // Selected VideoDecoder (and DecryptingDemuxerStream) is returned via
57 // the |select_decoder_cb|. 56 // the |select_decoder_cb|.
58 void SelectVideoDecoder(const scoped_refptr<DemuxerStream>& stream, 57 void SelectVideoDecoder(const scoped_refptr<DemuxerStream>& stream,
59 const StatisticsCB& statistics_cb, 58 const StatisticsCB& statistics_cb,
60 const SelectDecoderCB& select_decoder_cb); 59 const SelectDecoderCB& select_decoder_cb);
61 60
62 private: 61 private:
63 void DecryptingVideoDecoderInitDone(PipelineStatus status); 62 void DecryptingVideoDecoderInitDone(PipelineStatus status);
64 void DecryptingDemuxerStreamInitDone(PipelineStatus status); 63 void DecryptingDemuxerStreamInitDone(PipelineStatus status);
65 void InitializeNextDecoder(); 64 void InitializeDecoder(ScopedVector<VideoDecoder>::iterator iter);
66 void DecoderInitDone(PipelineStatus status); 65 void DecoderInitDone(ScopedVector<VideoDecoder>::iterator iter,
66 PipelineStatus status);
67 67
68 scoped_refptr<base::MessageLoopProxy> message_loop_; 68 scoped_refptr<base::MessageLoopProxy> message_loop_;
69 VideoDecoderList decoders_; 69 ScopedVector<VideoDecoder> decoders_;
70 SetDecryptorReadyCB set_decryptor_ready_cb_; 70 SetDecryptorReadyCB set_decryptor_ready_cb_;
71 71
72 scoped_refptr<DemuxerStream> input_stream_; 72 scoped_refptr<DemuxerStream> input_stream_;
73 StatisticsCB statistics_cb_; 73 StatisticsCB statistics_cb_;
74 SelectDecoderCB select_decoder_cb_; 74 SelectDecoderCB select_decoder_cb_;
75 75
76 scoped_refptr<VideoDecoder> video_decoder_; 76 scoped_ptr<VideoDecoder> video_decoder_;
77 scoped_refptr<DecryptingDemuxerStream> decrypted_stream_; 77 scoped_refptr<DecryptingDemuxerStream> decrypted_stream_;
78 78
79 base::WeakPtrFactory<VideoDecoderSelector> weak_ptr_factory_; 79 base::WeakPtrFactory<VideoDecoderSelector> weak_ptr_factory_;
80 80
81 DISALLOW_IMPLICIT_CONSTRUCTORS(VideoDecoderSelector); 81 DISALLOW_IMPLICIT_CONSTRUCTORS(VideoDecoderSelector);
82 }; 82 };
83 83
84 } // namespace media 84 } // namespace media
85 85
86 #endif // MEDIA_FILTERS_VIDEO_DECODER_SELECTOR_H_ 86 #endif // MEDIA_FILTERS_VIDEO_DECODER_SELECTOR_H_
OLDNEW
« no previous file with comments | « media/filters/pipeline_integration_test_base.cc ('k') | media/filters/video_decoder_selector.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698