Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef MEDIA_BASE_ENCODED_BITSTREAM_BUFFER_H_ | |
| 6 #define MEDIA_BASE_ENCODED_BITSTREAM_BUFFER_H_ | |
| 7 | |
| 8 #include <ostream> | |
| 9 | |
| 10 #include "base/memory/ref_counted.h" | |
| 11 #include "base/memory/scoped_ptr.h" | |
| 12 #include "base/shared_memory.h" | |
| 13 #include "base/time.h" | |
| 14 #include "media/base/media_export.h" | |
| 15 #include "media/video/video_encode_types.h" | |
| 16 | |
| 17 namespace media { | |
| 18 | |
| 19 // Class to represent read-only encoded video bitstream buffers encapsulating | |
| 20 // both the bitstream data and the metadata from the encoding context into | |
| 21 // single object. Class implements reference counting mechanism so that | |
| 22 // instances can be passed between threads (and possibly to multiple clients) | |
| 23 // conveniently without requiring deep copies and lifetime of each object is | |
| 24 // tied to scoped_refptrs held by the clients for the duration of the required | |
| 25 // processing. | |
| 26 // | |
| 27 // As long as constantness of the buffer is respected by the clients class is | |
| 28 // also thread safe. | |
| 29 class MEDIA_EXPORT EncodedBitstreamBuffer : | |
| 30 public base::RefCountedThreadSafe<EncodedBitstreamBuffer> { | |
| 31 public: | |
| 32 // Constructor that maps the shared memory with the given size to the current | |
| 33 // process and associates the given metadata with the buffer. | |
| 34 EncodedBitstreamBuffer(base::SharedMemoryHandle handle, | |
| 35 size_t size, | |
| 36 const media::BufferEncodingMetadata& metadata); | |
| 37 | |
| 38 // Accessors for properties. | |
| 39 const uint8* buffer() const; | |
| 40 size_t size() const; | |
| 41 media::BufferEncodingMetadata metadata() const; | |
|
Ami GONE FROM CHROMIUM
2013/03/19 18:01:49
Am I missing something or could this return a cons
vmr
2013/03/20 12:09:14
It could. I returned by value to make 100 % sure s
| |
| 42 | |
| 43 std::string ToDebugString() const; | |
| 44 | |
| 45 protected: | |
| 46 virtual ~EncodedBitstreamBuffer(); | |
| 47 friend class base::RefCountedThreadSafe<EncodedBitstreamBuffer>; | |
| 48 | |
| 49 private: | |
| 50 scoped_ptr<base::SharedMemory> shm_; | |
| 51 size_t size_; | |
| 52 media::BufferEncodingMetadata metadata_; | |
| 53 | |
| 54 DISALLOW_COPY_AND_ASSIGN(EncodedBitstreamBuffer); | |
| 55 }; | |
| 56 | |
| 57 } // namespace media | |
| 58 | |
| 59 #endif // MEDIA_BASE_ENCODED_BITSTREAM_BUFFER_H_ | |
| 60 | |
| OLD | NEW |