OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/base/stream_parser_buffer.h" | 5 #include "media/base/stream_parser_buffer.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "media/base/buffers.h" | 8 #include "media/base/buffers.h" |
9 | 9 |
10 namespace media { | 10 namespace media { |
11 | 11 |
| 12 static bool HasNestedFadeOutPreroll( |
| 13 const std::vector<scoped_refptr<StreamParserBuffer> >& fade_out_preroll) { |
| 14 for (size_t i = 0; i < fade_out_preroll.size(); ++i) { |
| 15 if (!fade_out_preroll[i]->GetFadeOutPreroll().empty()) |
| 16 return true; |
| 17 } |
| 18 return false; |
| 19 } |
| 20 |
12 scoped_refptr<StreamParserBuffer> StreamParserBuffer::CreateEOSBuffer() { | 21 scoped_refptr<StreamParserBuffer> StreamParserBuffer::CreateEOSBuffer() { |
13 return make_scoped_refptr(new StreamParserBuffer(NULL, 0, NULL, 0, false)); | 22 return make_scoped_refptr(new StreamParserBuffer(NULL, 0, NULL, 0, false)); |
14 } | 23 } |
15 | 24 |
16 scoped_refptr<StreamParserBuffer> StreamParserBuffer::CopyFrom( | 25 scoped_refptr<StreamParserBuffer> StreamParserBuffer::CopyFrom( |
17 const uint8* data, int data_size, bool is_keyframe) { | 26 const uint8* data, int data_size, bool is_keyframe) { |
18 return make_scoped_refptr( | 27 return make_scoped_refptr( |
19 new StreamParserBuffer(data, data_size, NULL, 0, is_keyframe)); | 28 new StreamParserBuffer(data, data_size, NULL, 0, is_keyframe)); |
20 } | 29 } |
21 | 30 |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 } | 65 } |
57 | 66 |
58 int StreamParserBuffer::GetConfigId() const { | 67 int StreamParserBuffer::GetConfigId() const { |
59 return config_id_; | 68 return config_id_; |
60 } | 69 } |
61 | 70 |
62 void StreamParserBuffer::SetConfigId(int config_id) { | 71 void StreamParserBuffer::SetConfigId(int config_id) { |
63 config_id_ = config_id; | 72 config_id_ = config_id; |
64 } | 73 } |
65 | 74 |
| 75 const std::vector<scoped_refptr<StreamParserBuffer> >& |
| 76 StreamParserBuffer::GetFadeOutPreroll() const { |
| 77 return fade_out_preroll_; |
| 78 } |
| 79 |
| 80 void StreamParserBuffer::SetFadeOutPreroll( |
| 81 const std::vector<scoped_refptr<StreamParserBuffer> >& fade_out_preroll) { |
| 82 DCHECK(!HasNestedFadeOutPreroll(fade_out_preroll)); |
| 83 fade_out_preroll_ = fade_out_preroll; |
| 84 } |
| 85 |
66 } // namespace media | 86 } // namespace media |
OLD | NEW |