| 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 #ifndef MEDIA_FILTERS_DECODER_STREAM_TRAITS_H_ | 5 #ifndef MEDIA_FILTERS_DECODER_STREAM_TRAITS_H_ |
| 6 #define MEDIA_FILTERS_DECODER_STREAM_TRAITS_H_ | 6 #define MEDIA_FILTERS_DECODER_STREAM_TRAITS_H_ |
| 7 | 7 |
| 8 #include "media/base/cdm_context.h" | |
| 9 #include "media/base/demuxer_stream.h" | 8 #include "media/base/demuxer_stream.h" |
| 10 #include "media/base/pipeline_status.h" | 9 #include "media/base/pipeline_status.h" |
| 11 | 10 |
| 12 namespace media { | 11 namespace media { |
| 13 | 12 |
| 14 class AudioBuffer; | 13 class AudioBuffer; |
| 15 class AudioDecoder; | 14 class AudioDecoder; |
| 16 class DecryptingAudioDecoder; | 15 class DecryptingAudioDecoder; |
| 17 class DecryptingVideoDecoder; | 16 class DecryptingVideoDecoder; |
| 18 class DemuxerStream; | 17 class DemuxerStream; |
| 19 class VideoDecoder; | 18 class VideoDecoder; |
| 20 class VideoFrame; | 19 class VideoFrame; |
| 21 | 20 |
| 22 template <DemuxerStream::Type StreamType> | 21 template <DemuxerStream::Type StreamType> |
| 23 struct DecoderStreamTraits {}; | 22 struct DecoderStreamTraits {}; |
| 24 | 23 |
| 25 template <> | 24 template <> |
| 26 struct DecoderStreamTraits<DemuxerStream::AUDIO> { | 25 struct DecoderStreamTraits<DemuxerStream::AUDIO> { |
| 27 typedef AudioBuffer OutputType; | 26 typedef AudioBuffer OutputType; |
| 28 typedef AudioDecoder DecoderType; | 27 typedef AudioDecoder DecoderType; |
| 29 typedef DecryptingAudioDecoder DecryptingDecoderType; | 28 typedef DecryptingAudioDecoder DecryptingDecoderType; |
| 30 typedef base::Callback<void(bool success)> InitCB; | 29 typedef base::Callback<void(bool success)> InitCB; |
| 31 typedef base::Callback<void(const scoped_refptr<OutputType>&)> OutputCB; | 30 typedef base::Callback<void(const scoped_refptr<OutputType>&)> OutputCB; |
| 32 | 31 |
| 33 static std::string ToString(); | 32 static std::string ToString(); |
| 34 static void InitializeDecoder(DecoderType* decoder, | 33 static void InitializeDecoder(DecoderType* decoder, |
| 35 DemuxerStream* stream, | 34 DemuxerStream* stream, |
| 36 const SetCdmReadyCB& set_cdm_ready_cb, | |
| 37 const InitCB& init_cb, | 35 const InitCB& init_cb, |
| 38 const OutputCB& output_cb); | 36 const OutputCB& output_cb); |
| 39 static bool NeedsBitstreamConversion(DecoderType* decoder) { return false; } | 37 static bool NeedsBitstreamConversion(DecoderType* decoder) { return false; } |
| 40 static void ReportStatistics(const StatisticsCB& statistics_cb, | 38 static void ReportStatistics(const StatisticsCB& statistics_cb, |
| 41 int bytes_decoded); | 39 int bytes_decoded); |
| 42 static scoped_refptr<OutputType> CreateEOSOutput(); | 40 static scoped_refptr<OutputType> CreateEOSOutput(); |
| 43 }; | 41 }; |
| 44 | 42 |
| 45 template <> | 43 template <> |
| 46 struct DecoderStreamTraits<DemuxerStream::VIDEO> { | 44 struct DecoderStreamTraits<DemuxerStream::VIDEO> { |
| 47 typedef VideoFrame OutputType; | 45 typedef VideoFrame OutputType; |
| 48 typedef VideoDecoder DecoderType; | 46 typedef VideoDecoder DecoderType; |
| 49 typedef DecryptingVideoDecoder DecryptingDecoderType; | 47 typedef DecryptingVideoDecoder DecryptingDecoderType; |
| 50 typedef base::Callback<void(bool success)> InitCB; | 48 typedef base::Callback<void(bool success)> InitCB; |
| 51 typedef base::Callback<void(const scoped_refptr<OutputType>&)> OutputCB; | 49 typedef base::Callback<void(const scoped_refptr<OutputType>&)> OutputCB; |
| 52 | 50 |
| 53 static std::string ToString(); | 51 static std::string ToString(); |
| 54 static void InitializeDecoder(DecoderType* decoder, | 52 static void InitializeDecoder(DecoderType* decoder, |
| 55 DemuxerStream* stream, | 53 DemuxerStream* stream, |
| 56 const SetCdmReadyCB& set_cdm_ready_cb, | |
| 57 const InitCB& init_cb, | 54 const InitCB& init_cb, |
| 58 const OutputCB& output_cb); | 55 const OutputCB& output_cb); |
| 59 static bool NeedsBitstreamConversion(DecoderType* decoder); | 56 static bool NeedsBitstreamConversion(DecoderType* decoder); |
| 60 static void ReportStatistics(const StatisticsCB& statistics_cb, | 57 static void ReportStatistics(const StatisticsCB& statistics_cb, |
| 61 int bytes_decoded); | 58 int bytes_decoded); |
| 62 static scoped_refptr<OutputType> CreateEOSOutput(); | 59 static scoped_refptr<OutputType> CreateEOSOutput(); |
| 63 }; | 60 }; |
| 64 | 61 |
| 65 } // namespace media | 62 } // namespace media |
| 66 | 63 |
| 67 #endif // MEDIA_FILTERS_DECODER_STREAM_TRAITS_H_ | 64 #endif // MEDIA_FILTERS_DECODER_STREAM_TRAITS_H_ |
| OLD | NEW |