Chromium Code Reviews| 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 #ifndef MEDIA_BASE_STREAM_PARSER_BUFFER_H_ | 5 #ifndef MEDIA_BASE_STREAM_PARSER_BUFFER_H_ |
| 6 #define MEDIA_BASE_STREAM_PARSER_BUFFER_H_ | 6 #define MEDIA_BASE_STREAM_PARSER_BUFFER_H_ |
| 7 | 7 |
| 8 #include "media/base/decoder_buffer.h" | 8 #include "media/base/decoder_buffer.h" |
| 9 #include "media/base/media_export.h" | 9 #include "media/base/media_export.h" |
| 10 | 10 |
| 11 namespace media { | 11 namespace media { |
| 12 | 12 |
| 13 class MEDIA_EXPORT StreamParserBuffer : public DecoderBuffer { | 13 class MEDIA_EXPORT StreamParserBuffer : public DecoderBuffer { |
| 14 public: | 14 public: |
| 15 // Value used to signal an invalid decoder config ID. | 15 // Value used to signal an invalid decoder config ID. |
| 16 enum { kInvalidConfigId = -1 }; | 16 enum { kInvalidConfigId = -1 }; |
| 17 | 17 |
| 18 enum Type { | |
|
xhwang
2014/01/29 08:04:50
Does it make sense to reuse DemuxerStream::Type? I
wolenetz
2014/02/05 02:49:53
tl;dr: Seems reasonable to me. I've made the chang
| |
| 19 kAudio, | |
| 20 kVideo, | |
| 21 kText | |
| 22 }; | |
|
xhwang
2014/01/29 08:04:50
FYI, we are moving from kCamelCase to UPPER_CASE s
wolenetz
2014/02/05 02:49:53
Cool. Thank you.
| |
| 23 | |
| 18 static scoped_refptr<StreamParserBuffer> CreateEOSBuffer(); | 24 static scoped_refptr<StreamParserBuffer> CreateEOSBuffer(); |
| 19 static scoped_refptr<StreamParserBuffer> CopyFrom( | 25 static scoped_refptr<StreamParserBuffer> CopyFrom( |
| 20 const uint8* data, int data_size, bool is_keyframe); | 26 const uint8* data, int data_size, bool is_keyframe, Type type); |
| 21 static scoped_refptr<StreamParserBuffer> CopyFrom( | 27 static scoped_refptr<StreamParserBuffer> CopyFrom( |
| 22 const uint8* data, int data_size, | 28 const uint8* data, int data_size, |
| 23 const uint8* side_data, int side_data_size, bool is_keyframe); | 29 const uint8* side_data, int side_data_size, bool is_keyframe, Type type); |
| 24 bool IsKeyframe() const { return is_keyframe_; } | 30 bool IsKeyframe() const { return is_keyframe_; } |
| 25 | 31 |
| 26 // Decode timestamp. If not explicitly set, or set to kNoTimestamp(), the | 32 // Decode timestamp. If not explicitly set, or set to kNoTimestamp(), the |
| 27 // value will be taken from the normal timestamp. | 33 // value will be taken from the normal timestamp. |
| 28 base::TimeDelta GetDecodeTimestamp() const; | 34 base::TimeDelta GetDecodeTimestamp() const; |
| 29 void SetDecodeTimestamp(const base::TimeDelta& timestamp); | 35 void SetDecodeTimestamp(const base::TimeDelta& timestamp); |
| 30 | 36 |
| 31 // Gets/sets the ID of the decoder config associated with this | 37 // Gets/sets the ID of the decoder config associated with this buffer. |
| 32 // buffer. | |
| 33 int GetConfigId() const; | 38 int GetConfigId() const; |
| 34 void SetConfigId(int config_id); | 39 void SetConfigId(int config_id); |
| 35 | 40 |
| 41 // Gets the parser's media type associated with this buffer. Value is | |
| 42 // meaningless for EOS buffers. | |
| 43 Type type() const { return type_; } | |
| 44 | |
| 45 // Gets/sets the parser's text track number associated with this buffer. Value | |
| 46 // is meaningless for EOS buffers or buffers whose type() is not |kText|. | |
| 47 int text_track_number() const { return text_track_number_; } | |
| 48 void set_text_track_number(int track_num) { text_track_number_ = track_num; } | |
| 49 | |
| 36 // Buffers to be exhausted before using the data in this DecoderBuffer. Used | 50 // Buffers to be exhausted before using the data in this DecoderBuffer. Used |
| 37 // to implement the Audio Splice Frame Algorithm per the MSE specification. | 51 // to implement the Audio Splice Frame Algorithm per the MSE specification. |
| 38 const std::vector<scoped_refptr<StreamParserBuffer> >& GetFadeOutPreroll() | 52 const std::vector<scoped_refptr<StreamParserBuffer> >& GetFadeOutPreroll() |
| 39 const; | 53 const; |
| 40 void SetFadeOutPreroll( | 54 void SetFadeOutPreroll( |
| 41 const std::vector<scoped_refptr<StreamParserBuffer> >& fade_out_preroll); | 55 const std::vector<scoped_refptr<StreamParserBuffer> >& fade_out_preroll); |
| 42 | 56 |
| 43 private: | 57 private: |
| 44 StreamParserBuffer(const uint8* data, int data_size, | 58 StreamParserBuffer(const uint8* data, int data_size, |
| 45 const uint8* side_data, int side_data_size, | 59 const uint8* side_data, int side_data_size, |
| 46 bool is_keyframe); | 60 bool is_keyframe, Type type); |
| 47 virtual ~StreamParserBuffer(); | 61 virtual ~StreamParserBuffer(); |
| 48 | 62 |
| 49 bool is_keyframe_; | 63 bool is_keyframe_; |
| 50 base::TimeDelta decode_timestamp_; | 64 base::TimeDelta decode_timestamp_; |
| 51 int config_id_; | 65 int config_id_; |
| 66 Type type_; | |
| 67 int text_track_number_; | |
|
xhwang
2014/01/29 08:04:50
document range of |text_track_number|, e.g. -1 is
wolenetz
2014/02/05 02:49:53
For the current WebM Tracks Parser, -1 is indeed i
| |
| 52 std::vector<scoped_refptr<StreamParserBuffer> > fade_out_preroll_; | 68 std::vector<scoped_refptr<StreamParserBuffer> > fade_out_preroll_; |
| 53 | 69 |
| 54 DISALLOW_COPY_AND_ASSIGN(StreamParserBuffer); | 70 DISALLOW_COPY_AND_ASSIGN(StreamParserBuffer); |
| 55 }; | 71 }; |
| 56 | 72 |
| 57 } // namespace media | 73 } // namespace media |
| 58 | 74 |
| 59 #endif // MEDIA_BASE_STREAM_PARSER_BUFFER_H_ | 75 #endif // MEDIA_BASE_STREAM_PARSER_BUFFER_H_ |
| OLD | NEW |