Roll src/third_party/WebKit 05e9c31:d6595eb (svn 198725:198727)
[chromium-blink-merge.git] / media / filters / decoder_stream_traits.h
blob8caf2df193beedf03ef96009956211f7aff35ef0
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
3 // found in the LICENSE file.
5 #ifndef MEDIA_FILTERS_DECODER_STREAM_TRAITS_H_
6 #define MEDIA_FILTERS_DECODER_STREAM_TRAITS_H_
8 #include "media/base/demuxer_stream.h"
9 #include "media/base/pipeline_status.h"
11 namespace media {
13 class AudioBuffer;
14 class AudioDecoder;
15 class DecryptingAudioDecoder;
16 class DecryptingVideoDecoder;
17 class DemuxerStream;
18 class VideoDecoder;
19 class VideoFrame;
21 template <DemuxerStream::Type StreamType>
22 struct DecoderStreamTraits {};
24 template <>
25 struct DecoderStreamTraits<DemuxerStream::AUDIO> {
26 typedef AudioBuffer OutputType;
27 typedef AudioDecoder DecoderType;
28 typedef DecryptingAudioDecoder DecryptingDecoderType;
29 typedef base::Callback<void(bool success)> InitCB;
30 typedef base::Callback<void(const scoped_refptr<OutputType>&)> OutputCB;
32 static std::string ToString();
33 static void InitializeDecoder(DecoderType* decoder,
34 DemuxerStream* stream,
35 const InitCB& init_cb,
36 const OutputCB& output_cb);
37 static bool NeedsBitstreamConversion(DecoderType* decoder) { return false; }
38 static void ReportStatistics(const StatisticsCB& statistics_cb,
39 int bytes_decoded);
40 static scoped_refptr<OutputType> CreateEOSOutput();
43 template <>
44 struct DecoderStreamTraits<DemuxerStream::VIDEO> {
45 typedef VideoFrame OutputType;
46 typedef VideoDecoder DecoderType;
47 typedef DecryptingVideoDecoder DecryptingDecoderType;
48 typedef base::Callback<void(bool success)> InitCB;
49 typedef base::Callback<void(const scoped_refptr<OutputType>&)> OutputCB;
51 static std::string ToString();
52 static void InitializeDecoder(DecoderType* decoder,
53 DemuxerStream* stream,
54 const InitCB& init_cb,
55 const OutputCB& output_cb);
56 static bool NeedsBitstreamConversion(DecoderType* decoder);
57 static void ReportStatistics(const StatisticsCB& statistics_cb,
58 int bytes_decoded);
59 static scoped_refptr<OutputType> CreateEOSOutput();
62 } // namespace media
64 #endif // MEDIA_FILTERS_DECODER_STREAM_TRAITS_H_