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