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 AudioDecoderConfig DecoderConfigType
;
29 typedef DecryptingAudioDecoder DecryptingDecoderType
;
30 typedef base::Callback
<void(bool success
)> StreamInitCB
;
32 static std::string
ToString();
33 static void Initialize(DecoderType
* decoder
,
34 const DecoderConfigType
& config
,
36 const PipelineStatusCB
& status_cb
);
37 static bool FinishInitialization(const StreamInitCB
& init_cb
,
39 DemuxerStream
* stream
);
40 static void ReportStatistics(const StatisticsCB
& statistics_cb
,
42 static DecoderConfigType
GetDecoderConfig(DemuxerStream
& stream
);
46 struct DecoderStreamTraits
<DemuxerStream::VIDEO
> {
47 typedef VideoFrame OutputType
;
48 typedef VideoDecoder DecoderType
;
49 typedef VideoDecoderConfig DecoderConfigType
;
50 typedef DecryptingVideoDecoder DecryptingDecoderType
;
51 typedef base::Callback
<void(bool success
)> StreamInitCB
;
53 static std::string
ToString();
54 static void Initialize(DecoderType
* decoder
,
55 const DecoderConfigType
& config
,
57 const PipelineStatusCB
& status_cb
);
58 static bool FinishInitialization(const StreamInitCB
& init_cb
,
60 DemuxerStream
* stream
);
61 static void ReportStatistics(const StatisticsCB
& statistics_cb
,
63 static DecoderConfigType
GetDecoderConfig(DemuxerStream
& stream
);
68 #endif // MEDIA_FILTERS_DECODER_STREAM_TRAITS_H_