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

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

Issue 12379011: Interfaces for encoded video sources (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Build fixes 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
OLDNEW
(Empty)
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
Ami GONE FROM CHROMIUM 2013/03/18 22:53:45 Drop the (c) (here and elsewhere) https://code.goo
Ville-Mikko Rautio 2013/03/19 16:45:43 Done.
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/time.h"
13 #include "media/base/media_export.h"
14 #include "media/video/video_encode_types.h"
15
16 namespace media {
17
18 // Class to represent encoded video bitstream buffers encapsulating both the
19 // bitstream data and the metadata from the encoding context into single object.
20 // Class implements reference counting mechanism so that instances can be passed
21 // between threads (and possibly to multiple clients) conveniently without
22 // requiring deep copies and lifetime of each object is tied to scoped_refptrs
23 // held by the clients for the duration of the required processing.
Ami GONE FROM CHROMIUM 2013/03/18 22:53:45 The sentence of l.20-23 sounds like PR for scoped_
Ville-Mikko Rautio 2013/03/19 16:45:43 I am still defending the use of reference counting
24 //
25 // As long as constantness of the buffer is respected by the clients class is
26 // also thread safe.
27 class MEDIA_EXPORT EncodedBitstreamBuffer :
28 public base::RefCountedThreadSafe<EncodedBitstreamBuffer> {
29 public:
30 // Constructor that copies |size| bytes of data from |buffer| into newly
31 // allocated buffer.
32 EncodedBitstreamBuffer(const uint8* buffer,
33 size_t size,
34 const media::BufferEncodingMetadata& metadata);
35 // TODO(vmr): SharedMemory handle in addition to (or instead of) copy
36 // constructor?
37
38 // Accessors for properties.
39 const uint8* buffer() const;
40 size_t size() const;
41 const base::Time timestamp() const;
Ami GONE FROM CHROMIUM 2013/03/18 22:53:45 For this and all the following accessors, why not
Ville-Mikko Rautio 2013/03/19 16:45:43 Done.
42 int temporal_layer_id() const;
43 bool is_key_frame() const;
44 bool is_altref_frame() const;
45 bool is_golden_frame() const;
46 bool is_droppable() const;
47 bool is_layer_sync() const;
48
49 protected:
50 virtual ~EncodedBitstreamBuffer();
51 friend class base::RefCountedThreadSafe<EncodedBitstreamBuffer>;
52
53 private:
54 scoped_ptr<uint8[]> buffer_;
55 size_t size_;
56 media::BufferEncodingMetadata metadata_;
57
58 DISALLOW_COPY_AND_ASSIGN(EncodedBitstreamBuffer);
59 };
60
61 } // namespace media
62
63 // Pretty print operator for the EncodedBitstreamBuffer.
64 std::ostream& operator<<(std::ostream& output,
65 const media::EncodedBitstreamBuffer& b);
Ami GONE FROM CHROMIUM 2013/03/18 22:53:45 This isn't landable. You want a ToDebugString() me
Ville-Mikko Rautio 2013/03/19 16:45:43 Done.
66
67 #endif // MEDIA_BASE_ENCODED_BITSTREAM_BUFFER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698