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

Side by Side Diff: media/base/stream_parser_buffer.h

Issue 149153002: MSE: Add StreamParser buffer remuxing utility and tests (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased, fixed comments from PS3, and prepped for TrackId unification work. Created 6 years, 10 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 | Annotate | Revision Log
OLDNEW
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/demuxer_stream.h"
9 #include "media/base/media_export.h" 10 #include "media/base/media_export.h"
11 #include "media/base/stream_parser.h"
10 12
11 namespace media { 13 namespace media {
12 14
13 class MEDIA_EXPORT StreamParserBuffer : public DecoderBuffer { 15 class MEDIA_EXPORT StreamParserBuffer : public DecoderBuffer {
14 public: 16 public:
15 // Value used to signal an invalid decoder config ID. 17 // Value used to signal an invalid decoder config ID.
16 enum { kInvalidConfigId = -1 }; 18 enum { kInvalidConfigId = -1 };
17 19
20 typedef DemuxerStream::Type Type;
21 typedef StreamParser::TrackId TrackId;
22
18 static scoped_refptr<StreamParserBuffer> CreateEOSBuffer(); 23 static scoped_refptr<StreamParserBuffer> CreateEOSBuffer();
19 static scoped_refptr<StreamParserBuffer> CopyFrom( 24 static scoped_refptr<StreamParserBuffer> CopyFrom(
20 const uint8* data, int data_size, bool is_keyframe); 25 const uint8* data, int data_size, bool is_keyframe, Type type,
26 TrackId track_id);
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,
30 TrackId track_id);
24 bool IsKeyframe() const { return is_keyframe_; } 31 bool IsKeyframe() const { return is_keyframe_; }
25 32
26 // Decode timestamp. If not explicitly set, or set to kNoTimestamp(), the 33 // Decode timestamp. If not explicitly set, or set to kNoTimestamp(), the
27 // value will be taken from the normal timestamp. 34 // value will be taken from the normal timestamp.
28 base::TimeDelta GetDecodeTimestamp() const; 35 base::TimeDelta GetDecodeTimestamp() const;
29 void SetDecodeTimestamp(const base::TimeDelta& timestamp); 36 void SetDecodeTimestamp(const base::TimeDelta& timestamp);
30 37
31 // Gets/sets the ID of the decoder config associated with this 38 // Gets/sets the ID of the decoder config associated with this buffer.
32 // buffer.
33 int GetConfigId() const; 39 int GetConfigId() const;
34 void SetConfigId(int config_id); 40 void SetConfigId(int config_id);
35 41
42 // Gets the parser's media type associated with this buffer. Value is
43 // meaningless for EOS buffers.
44 Type type() const { return type_; }
45
46 // Gets the parser's track ID associated with this buffer. Value is
47 // meaningless for EOS buffers.
48 TrackId track_id() const { return track_id_; }
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,
61 TrackId track_id);
47 virtual ~StreamParserBuffer(); 62 virtual ~StreamParserBuffer();
48 63
49 bool is_keyframe_; 64 bool is_keyframe_;
50 base::TimeDelta decode_timestamp_; 65 base::TimeDelta decode_timestamp_;
51 int config_id_; 66 int config_id_;
67 Type type_;
68 TrackId track_id_;
69
52 std::vector<scoped_refptr<StreamParserBuffer> > fade_out_preroll_; 70 std::vector<scoped_refptr<StreamParserBuffer> > fade_out_preroll_;
53 71
54 DISALLOW_COPY_AND_ASSIGN(StreamParserBuffer); 72 DISALLOW_COPY_AND_ASSIGN(StreamParserBuffer);
55 }; 73 };
56 74
57 } // namespace media 75 } // namespace media
58 76
59 #endif // MEDIA_BASE_STREAM_PARSER_BUFFER_H_ 77 #endif // MEDIA_BASE_STREAM_PARSER_BUFFER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698