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 #include "media/filters/decoder_stream_traits.h"
7 #include "base/logging.h"
8 #include "media/base/audio_decoder.h"
9 #include "media/base/audio_decoder_config.h"
10 #include "media/base/video_decoder.h"
11 #include "media/base/video_decoder_config.h"
15 std::string DecoderStreamTraits
<DemuxerStream::AUDIO
>::ToString() {
19 void DecoderStreamTraits
<DemuxerStream::AUDIO
>::Initialize(
21 const DecoderConfigType
& config
,
23 const PipelineStatusCB
& status_cb
) {
24 decoder
->Initialize(config
, status_cb
);
27 bool DecoderStreamTraits
<DemuxerStream::AUDIO
>::FinishInitialization(
28 const StreamInitCB
& init_cb
,
30 DemuxerStream
* stream
) {
40 void DecoderStreamTraits
<DemuxerStream::AUDIO
>::ReportStatistics(
41 const StatisticsCB
& statistics_cb
,
43 PipelineStatistics statistics
;
44 statistics
.audio_bytes_decoded
= bytes_decoded
;
45 statistics_cb
.Run(statistics
);
48 DecoderStreamTraits
<DemuxerStream::AUDIO
>::DecoderConfigType
49 DecoderStreamTraits
<DemuxerStream::AUDIO
>::GetDecoderConfig(
50 DemuxerStream
& stream
) {
51 return stream
.audio_decoder_config();
54 std::string DecoderStreamTraits
<DemuxerStream::VIDEO
>::ToString() {
58 void DecoderStreamTraits
<DemuxerStream::VIDEO
>::Initialize(
60 const DecoderConfigType
& config
,
62 const PipelineStatusCB
& status_cb
) {
63 decoder
->Initialize(config
, low_delay
, status_cb
);
66 bool DecoderStreamTraits
<DemuxerStream::VIDEO
>::FinishInitialization(
67 const StreamInitCB
& init_cb
,
69 DemuxerStream
* stream
) {
75 if (decoder
->NeedsBitstreamConversion())
76 stream
->EnableBitstreamConverter();
81 void DecoderStreamTraits
<DemuxerStream::VIDEO
>::ReportStatistics(
82 const StatisticsCB
& statistics_cb
,
84 PipelineStatistics statistics
;
85 statistics
.video_bytes_decoded
= bytes_decoded
;
86 statistics_cb
.Run(statistics
);
89 DecoderStreamTraits
<DemuxerStream::VIDEO
>::DecoderConfigType
90 DecoderStreamTraits
<DemuxerStream::VIDEO
>::GetDecoderConfig(
91 DemuxerStream
& stream
) {
92 return stream
.video_decoder_config();