| 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/demuxer_stream.h" | 8 #include "media/base/demuxer_stream.h" |
| 9 #include "media/base/pipeline_status.h" | 9 #include "media/base/pipeline_status.h" |
| 10 | 10 |
| 11 namespace media { | 11 namespace media { |
| 12 | 12 |
| 13 class AudioBuffer; | 13 class AudioBuffer; |
| 14 class AudioDecoder; | 14 class AudioDecoder; |
| 15 class DecryptingAudioDecoder; | 15 class DecryptingAudioDecoder; |
| 16 class DecryptingVideoDecoder; | 16 class DecryptingVideoDecoder; |
| 17 class DemuxerStream; | 17 class DemuxerStream; |
| 18 class VideoDecoder; | 18 class VideoDecoder; |
| 19 class VideoFrame; | 19 class VideoFrame; |
| 20 | 20 |
| 21 template <DemuxerStream::Type StreamType> | 21 template <DemuxerStream::Type StreamType> |
| 22 struct DecoderStreamTraits {}; | 22 struct DecoderStreamTraits {}; |
| 23 | 23 |
| 24 template <> | 24 template <> |
| 25 struct DecoderStreamTraits<DemuxerStream::AUDIO> { | 25 struct DecoderStreamTraits<DemuxerStream::AUDIO> { |
| 26 typedef AudioBuffer OutputType; | 26 typedef AudioBuffer OutputType; |
| 27 typedef AudioDecoder DecoderType; | 27 typedef AudioDecoder DecoderType; |
| 28 typedef AudioDecoderConfig DecoderConfigType; |
| 28 typedef DecryptingAudioDecoder DecryptingDecoderType; | 29 typedef DecryptingAudioDecoder DecryptingDecoderType; |
| 29 typedef base::Callback<void(bool success)> StreamInitCB; | 30 typedef base::Callback<void(bool success)> StreamInitCB; |
| 31 |
| 32 static bool FinishInitialization(const StreamInitCB& init_cb, |
| 33 DecoderType* decoder, |
| 34 DemuxerStream* stream); |
| 35 static void ReportStatistics(const StatisticsCB& statistics_cb, |
| 36 int bytes_decoded); |
| 37 static DecoderConfigType GetDecoderConfig(DemuxerStream& stream); |
| 30 }; | 38 }; |
| 31 | 39 |
| 32 template <> | 40 template <> |
| 33 struct DecoderStreamTraits<DemuxerStream::VIDEO> { | 41 struct DecoderStreamTraits<DemuxerStream::VIDEO> { |
| 34 typedef VideoFrame OutputType; | 42 typedef VideoFrame OutputType; |
| 35 typedef VideoDecoder DecoderType; | 43 typedef VideoDecoder DecoderType; |
| 44 typedef VideoDecoderConfig DecoderConfigType; |
| 36 typedef DecryptingVideoDecoder DecryptingDecoderType; | 45 typedef DecryptingVideoDecoder DecryptingDecoderType; |
| 37 typedef base::Callback<void(bool success, bool has_alpha)> StreamInitCB; | 46 typedef base::Callback<void(bool success, bool has_alpha)> StreamInitCB; |
| 38 | 47 |
| 39 static bool FinishInitialization(const StreamInitCB& init_cb, | 48 static bool FinishInitialization(const StreamInitCB& init_cb, |
| 40 DecoderType* decoder, | 49 DecoderType* decoder, |
| 41 DemuxerStream* stream); | 50 DemuxerStream* stream); |
| 42 static void ReportStatistics(const StatisticsCB& statistics_cb, | 51 static void ReportStatistics(const StatisticsCB& statistics_cb, |
| 43 int bytes_decoded); | 52 int bytes_decoded); |
| 53 static DecoderConfigType GetDecoderConfig(DemuxerStream& stream); |
| 44 }; | 54 }; |
| 45 | 55 |
| 46 } // namespace media | 56 } // namespace media |
| 47 | 57 |
| 48 #endif // MEDIA_FILTERS_DECODER_STREAM_TRAITS_H_ | 58 #endif // MEDIA_FILTERS_DECODER_STREAM_TRAITS_H_ |
| OLD | NEW |