Upstream version 7.36.149.0
[platform/framework/web/crosswalk.git] / src / media / filters / decoder_stream_traits.h
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.
4
5 #ifndef MEDIA_FILTERS_DECODER_STREAM_TRAITS_H_
6 #define MEDIA_FILTERS_DECODER_STREAM_TRAITS_H_
7
8 #include "media/base/demuxer_stream.h"
9 #include "media/base/pipeline_status.h"
10
11 namespace media {
12
13 class AudioBuffer;
14 class AudioDecoder;
15 class DecryptingAudioDecoder;
16 class DecryptingVideoDecoder;
17 class DemuxerStream;
18 class VideoDecoder;
19 class VideoFrame;
20
21 template <DemuxerStream::Type StreamType>
22 struct DecoderStreamTraits {};
23
24 template <>
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;
31
32   static std::string ToString();
33   static void Initialize(DecoderType* decoder,
34                          const DecoderConfigType& config,
35                          bool low_delay,
36                          const PipelineStatusCB& status_cb);
37   static bool FinishInitialization(const StreamInitCB& init_cb,
38                                    DecoderType* decoder,
39                                    DemuxerStream* stream);
40   static void ReportStatistics(const StatisticsCB& statistics_cb,
41                                int bytes_decoded);
42   static DecoderConfigType GetDecoderConfig(DemuxerStream& stream);
43 };
44
45 template <>
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;
52
53   static std::string ToString();
54   static void Initialize(DecoderType* decoder,
55                          const DecoderConfigType& config,
56                          bool low_delay,
57                          const PipelineStatusCB& status_cb);
58   static bool FinishInitialization(const StreamInitCB& init_cb,
59                                    DecoderType* decoder,
60                                    DemuxerStream* stream);
61   static void ReportStatistics(const StatisticsCB& statistics_cb,
62                                int bytes_decoded);
63   static DecoderConfigType GetDecoderConfig(DemuxerStream& stream);
64 };
65
66 }  // namespace media
67
68 #endif  // MEDIA_FILTERS_DECODER_STREAM_TRAITS_H_