Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(392)

Side by Side Diff: media/filters/decoder_stream_traits.cc

Issue 1143223007: media: Reland "Simplify {Audio|Video}Decoder initialization callback." (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « media/filters/decoder_stream_traits.h ('k') | media/filters/decrypting_audio_decoder.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "media/filters/decoder_stream_traits.h" 5 #include "media/filters/decoder_stream_traits.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "media/base/audio_buffer.h" 8 #include "media/base/audio_buffer.h"
9 #include "media/base/audio_decoder.h" 9 #include "media/base/audio_decoder.h"
10 #include "media/base/audio_decoder_config.h" 10 #include "media/base/audio_decoder_config.h"
11 #include "media/base/video_decoder.h" 11 #include "media/base/video_decoder.h"
12 #include "media/base/video_decoder_config.h" 12 #include "media/base/video_decoder_config.h"
13 #include "media/base/video_frame.h" 13 #include "media/base/video_frame.h"
14 14
15 namespace media { 15 namespace media {
16 16
17 std::string DecoderStreamTraits<DemuxerStream::AUDIO>::ToString() { 17 std::string DecoderStreamTraits<DemuxerStream::AUDIO>::ToString() {
18 return "audio"; 18 return "audio";
19 } 19 }
20 20
21 void DecoderStreamTraits<DemuxerStream::AUDIO>::InitializeDecoder( 21 void DecoderStreamTraits<DemuxerStream::AUDIO>::InitializeDecoder(
22 DecoderType* decoder, 22 DecoderType* decoder,
23 DemuxerStream* stream, 23 DemuxerStream* stream,
24 const PipelineStatusCB& status_cb, 24 const InitCB& init_cb,
25 const OutputCB& output_cb) { 25 const OutputCB& output_cb) {
26 DCHECK(stream->audio_decoder_config().IsValidConfig()); 26 DCHECK(stream->audio_decoder_config().IsValidConfig());
27 decoder->Initialize(stream->audio_decoder_config(), status_cb, output_cb); 27 decoder->Initialize(stream->audio_decoder_config(), init_cb, output_cb);
28 } 28 }
29 29
30 void DecoderStreamTraits<DemuxerStream::AUDIO>::ReportStatistics( 30 void DecoderStreamTraits<DemuxerStream::AUDIO>::ReportStatistics(
31 const StatisticsCB& statistics_cb, 31 const StatisticsCB& statistics_cb,
32 int bytes_decoded) { 32 int bytes_decoded) {
33 PipelineStatistics statistics; 33 PipelineStatistics statistics;
34 statistics.audio_bytes_decoded = bytes_decoded; 34 statistics.audio_bytes_decoded = bytes_decoded;
35 statistics_cb.Run(statistics); 35 statistics_cb.Run(statistics);
36 } 36 }
37 37
38 scoped_refptr<DecoderStreamTraits<DemuxerStream::AUDIO>::OutputType> 38 scoped_refptr<DecoderStreamTraits<DemuxerStream::AUDIO>::OutputType>
39 DecoderStreamTraits<DemuxerStream::AUDIO>::CreateEOSOutput() { 39 DecoderStreamTraits<DemuxerStream::AUDIO>::CreateEOSOutput() {
40 return OutputType::CreateEOSBuffer(); 40 return OutputType::CreateEOSBuffer();
41 } 41 }
42 42
43 std::string DecoderStreamTraits<DemuxerStream::VIDEO>::ToString() { 43 std::string DecoderStreamTraits<DemuxerStream::VIDEO>::ToString() {
44 return "video"; 44 return "video";
45 } 45 }
46 46
47 void DecoderStreamTraits<DemuxerStream::VIDEO>::InitializeDecoder( 47 void DecoderStreamTraits<DemuxerStream::VIDEO>::InitializeDecoder(
48 DecoderType* decoder, 48 DecoderType* decoder,
49 DemuxerStream* stream, 49 DemuxerStream* stream,
50 const PipelineStatusCB& status_cb, 50 const InitCB& init_cb,
51 const OutputCB& output_cb) { 51 const OutputCB& output_cb) {
52 DCHECK(stream->video_decoder_config().IsValidConfig()); 52 DCHECK(stream->video_decoder_config().IsValidConfig());
53 decoder->Initialize(stream->video_decoder_config(), 53 decoder->Initialize(stream->video_decoder_config(),
54 stream->liveness() == DemuxerStream::LIVENESS_LIVE, 54 stream->liveness() == DemuxerStream::LIVENESS_LIVE,
55 status_cb, output_cb); 55 init_cb, output_cb);
56 } 56 }
57 57
58 bool DecoderStreamTraits<DemuxerStream::VIDEO>::NeedsBitstreamConversion( 58 bool DecoderStreamTraits<DemuxerStream::VIDEO>::NeedsBitstreamConversion(
59 DecoderType* decoder) { 59 DecoderType* decoder) {
60 return decoder->NeedsBitstreamConversion(); 60 return decoder->NeedsBitstreamConversion();
61 } 61 }
62 62
63 void DecoderStreamTraits<DemuxerStream::VIDEO>::ReportStatistics( 63 void DecoderStreamTraits<DemuxerStream::VIDEO>::ReportStatistics(
64 const StatisticsCB& statistics_cb, 64 const StatisticsCB& statistics_cb,
65 int bytes_decoded) { 65 int bytes_decoded) {
66 PipelineStatistics statistics; 66 PipelineStatistics statistics;
67 statistics.video_bytes_decoded = bytes_decoded; 67 statistics.video_bytes_decoded = bytes_decoded;
68 statistics_cb.Run(statistics); 68 statistics_cb.Run(statistics);
69 } 69 }
70 70
71 scoped_refptr<DecoderStreamTraits<DemuxerStream::VIDEO>::OutputType> 71 scoped_refptr<DecoderStreamTraits<DemuxerStream::VIDEO>::OutputType>
72 DecoderStreamTraits<DemuxerStream::VIDEO>::CreateEOSOutput() { 72 DecoderStreamTraits<DemuxerStream::VIDEO>::CreateEOSOutput() {
73 return OutputType::CreateEOSFrame(); 73 return OutputType::CreateEOSFrame();
74 } 74 }
75 75
76 } // namespace media 76 } // namespace media
OLDNEW
« no previous file with comments | « media/filters/decoder_stream_traits.h ('k') | media/filters/decrypting_audio_decoder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698