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_buffer.h"
9 #include "media/base/audio_decoder.h"
10 #include "media/base/audio_decoder_config.h"
11 #include "media/base/video_decoder.h"
12 #include "media/base/video_decoder_config.h"
13 #include "media/base/video_frame.h"
17 std::string DecoderStreamTraits
<DemuxerStream::AUDIO
>::ToString() {
21 void DecoderStreamTraits
<DemuxerStream::AUDIO
>::Initialize(
23 const DecoderConfigType
& config
,
25 const PipelineStatusCB
& status_cb
,
26 const OutputCB
& output_cb
) {
27 decoder
->Initialize(config
, status_cb
, output_cb
);
30 void DecoderStreamTraits
<DemuxerStream::AUDIO
>::ReportStatistics(
31 const StatisticsCB
& statistics_cb
,
33 PipelineStatistics statistics
;
34 statistics
.audio_bytes_decoded
= bytes_decoded
;
35 statistics_cb
.Run(statistics
);
38 DecoderStreamTraits
<DemuxerStream::AUDIO
>::DecoderConfigType
39 DecoderStreamTraits
<DemuxerStream::AUDIO
>::GetDecoderConfig(
40 DemuxerStream
& stream
) {
41 return stream
.audio_decoder_config();
44 scoped_refptr
<DecoderStreamTraits
<DemuxerStream::AUDIO
>::OutputType
>
45 DecoderStreamTraits
<DemuxerStream::AUDIO
>::CreateEOSOutput() {
46 return OutputType::CreateEOSBuffer();
49 std::string DecoderStreamTraits
<DemuxerStream::VIDEO
>::ToString() {
53 void DecoderStreamTraits
<DemuxerStream::VIDEO
>::Initialize(
55 const DecoderConfigType
& config
,
57 const PipelineStatusCB
& status_cb
,
58 const OutputCB
& output_cb
) {
59 decoder
->Initialize(config
, low_delay
, status_cb
, output_cb
);
62 bool DecoderStreamTraits
<DemuxerStream::VIDEO
>::NeedsBitstreamConversion(
63 DecoderType
* decoder
) {
64 return decoder
->NeedsBitstreamConversion();
67 void DecoderStreamTraits
<DemuxerStream::VIDEO
>::ReportStatistics(
68 const StatisticsCB
& statistics_cb
,
70 PipelineStatistics statistics
;
71 statistics
.video_bytes_decoded
= bytes_decoded
;
72 statistics_cb
.Run(statistics
);
75 DecoderStreamTraits
<DemuxerStream::VIDEO
>::DecoderConfigType
76 DecoderStreamTraits
<DemuxerStream::VIDEO
>::GetDecoderConfig(
77 DemuxerStream
& stream
) {
78 return stream
.video_decoder_config();
81 scoped_refptr
<DecoderStreamTraits
<DemuxerStream::VIDEO
>::OutputType
>
82 DecoderStreamTraits
<DemuxerStream::VIDEO
>::CreateEOSOutput() {
83 return OutputType::CreateEOSFrame();