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

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

Issue 12263013: media: Add support for playback of VP8 Alpha video streams (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: addressing comments on patchset 2 Created 7 years, 9 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_DECODER_BUFFER_H_ 5 #ifndef MEDIA_BASE_DECODER_BUFFER_H_
6 #define MEDIA_BASE_DECODER_BUFFER_H_ 6 #define MEDIA_BASE_DECODER_BUFFER_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/memory/aligned_memory.h" 10 #include "base/memory/aligned_memory.h"
(...skipping 29 matching lines...) Expand all
40 }; 40 };
41 41
42 // Allocates buffer with |size| >= 0. Buffer will be padded and aligned 42 // Allocates buffer with |size| >= 0. Buffer will be padded and aligned
43 // as necessary. 43 // as necessary.
44 explicit DecoderBuffer(int size); 44 explicit DecoderBuffer(int size);
45 45
46 // Create a DecoderBuffer whose |data_| is copied from |data|. Buffer will be 46 // Create a DecoderBuffer whose |data_| is copied from |data|. Buffer will be
47 // padded and aligned as necessary. |data| must not be NULL and |size| >= 0. 47 // padded and aligned as necessary. |data| must not be NULL and |size| >= 0.
48 static scoped_refptr<DecoderBuffer> CopyFrom(const uint8* data, int size); 48 static scoped_refptr<DecoderBuffer> CopyFrom(const uint8* data, int size);
49 49
50 // Create a DecoderBuffer whose |data_| is copied from |data| and |side_data_|
51 // is copied from |side_data|. Buffers will be padded and aligned as necessary
52 // |data| must not be NULL and |size| >= 0.
53 static scoped_refptr<DecoderBuffer> CopyFrom(const uint8* data, int size,
54 const uint8* side_data,
55 int side_data_size);
Tom Finegan 2013/02/25 22:56:06 Align per http://google-styleguide.googlecode.com/
vignesh 2013/02/25 23:33:14 deceived by eclipse as it bolds the type. :) Done
56
50 // Create a DecoderBuffer indicating we've reached end of stream. 57 // Create a DecoderBuffer indicating we've reached end of stream.
51 // 58 //
52 // Calling any method other than IsEndOfStream() on the resulting buffer 59 // Calling any method other than IsEndOfStream() on the resulting buffer
53 // is disallowed. 60 // is disallowed.
54 static scoped_refptr<DecoderBuffer> CreateEOSBuffer(); 61 static scoped_refptr<DecoderBuffer> CreateEOSBuffer();
55 62
56 base::TimeDelta GetTimestamp() const; 63 base::TimeDelta GetTimestamp() const;
57 void SetTimestamp(const base::TimeDelta& timestamp); 64 void SetTimestamp(const base::TimeDelta& timestamp);
58 65
59 base::TimeDelta GetDuration() const; 66 base::TimeDelta GetDuration() const;
60 void SetDuration(const base::TimeDelta& duration); 67 void SetDuration(const base::TimeDelta& duration);
61 68
62 const uint8* GetData() const; 69 const uint8* GetData() const;
63 uint8* GetWritableData() const; 70 uint8* GetWritableData() const;
64 71
65 int GetDataSize() const; 72 int GetDataSize() const;
66 73
74 const uint8* GetSideData() const;
75 int GetSideDataSize() const;
76
67 const DecryptConfig* GetDecryptConfig() const; 77 const DecryptConfig* GetDecryptConfig() const;
68 void SetDecryptConfig(scoped_ptr<DecryptConfig> decrypt_config); 78 void SetDecryptConfig(scoped_ptr<DecryptConfig> decrypt_config);
69 79
70 // If there's no data in this buffer, it represents end of stream. 80 // If there's no data in this buffer, it represents end of stream.
71 bool IsEndOfStream() const; 81 bool IsEndOfStream() const;
72 82
73 // Returns a human-readable string describing |*this|. 83 // Returns a human-readable string describing |*this|.
74 std::string AsHumanReadableString(); 84 std::string AsHumanReadableString();
75 85
76 protected: 86 protected:
77 friend class base::RefCountedThreadSafe<DecoderBuffer>; 87 friend class base::RefCountedThreadSafe<DecoderBuffer>;
78 88
79 // Allocates a buffer of size |size| >= 0 and copies |data| into it. Buffer 89 // Allocates a buffer of size |size| >= 0 and copies |data| into it. Buffer
80 // will be padded and aligned as necessary. If |data| is NULL then |data_| is 90 // will be padded and aligned as necessary. If |data| is NULL then |data_| is
81 // set to NULL and |buffer_size_| to 0. 91 // set to NULL and |buffer_size_| to 0.
82 DecoderBuffer(const uint8* data, int size); 92 DecoderBuffer(const uint8* data, int size);
93 DecoderBuffer(const uint8* data, int size, const uint8* side_data,
94 int side_data_size);
Tom Finegan 2013/02/25 22:56:06 data and size on same line, side_data and side_dat
vignesh 2013/02/25 23:33:14 Done.
83 virtual ~DecoderBuffer(); 95 virtual ~DecoderBuffer();
84 96
85 private: 97 private:
86 base::TimeDelta timestamp_; 98 base::TimeDelta timestamp_;
87 base::TimeDelta duration_; 99 base::TimeDelta duration_;
88 100
89 int size_; 101 int size_;
90 scoped_ptr<uint8, base::ScopedPtrAlignedFree> data_; 102 scoped_ptr<uint8, base::ScopedPtrAlignedFree> data_;
103 int side_data_size_;
104 scoped_ptr<uint8, base::ScopedPtrAlignedFree> side_data_;
91 scoped_ptr<DecryptConfig> decrypt_config_; 105 scoped_ptr<DecryptConfig> decrypt_config_;
92 106
93 // Constructor helper method for memory allocations. 107 // Constructor helper method for memory allocations.
94 void Initialize(); 108 void Initialize();
95 109
96 DISALLOW_COPY_AND_ASSIGN(DecoderBuffer); 110 DISALLOW_COPY_AND_ASSIGN(DecoderBuffer);
97 }; 111 };
98 112
99 } // namespace media 113 } // namespace media
100 114
101 #endif // MEDIA_BASE_DECODER_BUFFER_H_ 115 #endif // MEDIA_BASE_DECODER_BUFFER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698