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