| OLD | NEW |
| 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 #include "media/filters/decoder_selector.h" | 5 #include "media/filters/decoder_selector.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/callback_helpers.h" | 10 #include "base/callback_helpers.h" |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 namespace media { | 28 namespace media { |
| 29 | 29 |
| 30 static bool HasValidStreamConfig(DemuxerStream* stream) { | 30 static bool HasValidStreamConfig(DemuxerStream* stream) { |
| 31 switch (stream->type()) { | 31 switch (stream->type()) { |
| 32 case DemuxerStream::AUDIO: | 32 case DemuxerStream::AUDIO: |
| 33 return stream->audio_decoder_config().IsValidConfig(); | 33 return stream->audio_decoder_config().IsValidConfig(); |
| 34 case DemuxerStream::VIDEO: | 34 case DemuxerStream::VIDEO: |
| 35 return stream->video_decoder_config().IsValidConfig(); | 35 return stream->video_decoder_config().IsValidConfig(); |
| 36 case DemuxerStream::UNKNOWN: | 36 case DemuxerStream::UNKNOWN: |
| 37 case DemuxerStream::TEXT: | 37 case DemuxerStream::TEXT: |
| 38 case DemuxerStream::URL: |
| 38 case DemuxerStream::NUM_TYPES: | 39 case DemuxerStream::NUM_TYPES: |
| 39 NOTREACHED(); | 40 NOTREACHED(); |
| 40 } | 41 } |
| 41 return false; | 42 return false; |
| 42 } | 43 } |
| 43 | 44 |
| 44 static bool IsStreamEncrypted(DemuxerStream* stream) { | 45 static bool IsStreamEncrypted(DemuxerStream* stream) { |
| 45 switch (stream->type()) { | 46 switch (stream->type()) { |
| 46 case DemuxerStream::AUDIO: | 47 case DemuxerStream::AUDIO: |
| 47 return stream->audio_decoder_config().is_encrypted(); | 48 return stream->audio_decoder_config().is_encrypted(); |
| 48 case DemuxerStream::VIDEO: | 49 case DemuxerStream::VIDEO: |
| 49 return stream->video_decoder_config().is_encrypted(); | 50 return stream->video_decoder_config().is_encrypted(); |
| 50 case DemuxerStream::UNKNOWN: | 51 case DemuxerStream::UNKNOWN: |
| 51 case DemuxerStream::TEXT: | 52 case DemuxerStream::TEXT: |
| 53 case DemuxerStream::URL: |
| 52 case DemuxerStream::NUM_TYPES: | 54 case DemuxerStream::NUM_TYPES: |
| 53 NOTREACHED(); | 55 NOTREACHED(); |
| 54 } | 56 } |
| 55 return false; | 57 return false; |
| 56 } | 58 } |
| 57 | 59 |
| 58 template <DemuxerStream::Type StreamType> | 60 template <DemuxerStream::Type StreamType> |
| 59 DecoderSelector<StreamType>::DecoderSelector( | 61 DecoderSelector<StreamType>::DecoderSelector( |
| 60 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner, | 62 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner, |
| 61 ScopedVector<Decoder> decoders, | 63 ScopedVector<Decoder> decoders, |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 237 | 239 |
| 238 // These forward declarations tell the compiler that we will use | 240 // These forward declarations tell the compiler that we will use |
| 239 // DecoderSelector with these arguments, allowing us to keep these definitions | 241 // DecoderSelector with these arguments, allowing us to keep these definitions |
| 240 // in our .cc without causing linker errors. This also means if anyone tries to | 242 // in our .cc without causing linker errors. This also means if anyone tries to |
| 241 // instantiate a DecoderSelector with anything but these two specializations | 243 // instantiate a DecoderSelector with anything but these two specializations |
| 242 // they'll most likely get linker errors. | 244 // they'll most likely get linker errors. |
| 243 template class DecoderSelector<DemuxerStream::AUDIO>; | 245 template class DecoderSelector<DemuxerStream::AUDIO>; |
| 244 template class DecoderSelector<DemuxerStream::VIDEO>; | 246 template class DecoderSelector<DemuxerStream::VIDEO>; |
| 245 | 247 |
| 246 } // namespace media | 248 } // namespace media |
| OLD | NEW |