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"
15 class DecryptingAudioDecoder
;
16 class DecryptingVideoDecoder
;
21 template <DemuxerStream::Type StreamType
>
22 struct DecoderStreamTraits
{};
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
,
40 static scoped_refptr
<OutputType
> CreateEOSOutput();
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
,
59 static scoped_refptr
<OutputType
> CreateEOSOutput();
64 #endif // MEDIA_FILTERS_DECODER_STREAM_TRAITS_H_