Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 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_VIDEO_ENCODED_VIDEO_SOURCE_H_ | |
| 6 #define MEDIA_VIDEO_ENCODED_VIDEO_SOURCE_H_ | |
| 7 | |
| 8 #include "base/memory/ref_counted.h" | |
| 9 #include "base/memory/weak_ptr.h" | |
| 10 #include "media/base/encoded_bitstream_buffer.h" | |
| 11 #include "media/video/video_encode_types.h" | |
| 12 | |
| 13 namespace media { | |
| 14 | |
| 15 // Class to represent encoded video bitstream. | |
|
Ami GONE FROM CHROMIUM
2013/03/02 10:47:16
Please make an editorial pass on the comments in t
Ville-Mikko Rautio
2013/03/05 13:02:18
Done.
| |
| 16 class MEDIA_EXPORT EncodedVideoBitstream : | |
| 17 public base::RefCountedThreadSafe<EncodedVideoBitstream> { | |
|
tommi (sloooow) - chröme
2013/03/01 16:03:43
same class level comments as for the previous clas
| |
| 18 public: | |
| 19 class MEDIA_EXPORT Client { | |
| 20 public: | |
| 21 // After OnStreaming callback stream shall be considered to be streaming. | |
| 22 virtual void OnBitstreamStreaming( | |
| 23 scoped_refptr<EncodedVideoBitstream> bitstream, bool modifiable) = 0; | |
| 24 | |
| 25 // After OnRemoved client has to stop using the bitstream object and | |
| 26 // expecting bitstream buffers for that stream. OnRemoved will be called | |
| 27 // also in case of any unrecoverable failure in the capturer. After | |
| 28 // OnRemoved is called from a stream it is guaranteed that that there will | |
| 29 // be no longer pending calls coming in. | |
| 30 virtual void OnBitstreamRemoved( | |
| 31 scoped_refptr<EncodedVideoBitstream> bitstream) = 0; | |
| 32 | |
| 33 // OnBitstreamReady delivers the captured bitstream buffer by buffer to the | |
| 34 // client. | |
| 35 virtual void OnBitstreamReady( | |
| 36 scoped_refptr<EncodedVideoBitstream> bitstream, | |
| 37 scoped_refptr<const EncodedBitstreamBuffer> buffer) = 0; | |
| 38 | |
| 39 // OnBitstreamConfigChanged informs about change in bitstream parameters. | |
| 40 virtual void OnBitstreamConfigChanged( | |
|
tommi (sloooow) - chröme
2013/03/01 16:03:43
nit: All the methods in this class have the word "
Ville-Mikko Rautio
2013/03/05 13:02:18
Done.
| |
| 41 scoped_refptr<EncodedVideoBitstream> bitstream, | |
| 42 const RuntimeVideoEncodingParameters& params) = 0; | |
| 43 }; | |
| 44 | |
| 45 // TryConfigure issues a reconfiguration request. Old configuration must be | |
| 46 // considered to be the valid configuration until OnBitstreamConfigChanged | |
| 47 // callback has been issued with value signalling successful change. | |
| 48 virtual void TryConfigure( | |
| 49 const RuntimeVideoEncodingParameters& params) = 0; | |
| 50 | |
| 51 // RequestSpecialFrame allows the client to request special frames from the | |
| 52 // encoded video bitstream. The effect of the request is only visible in the | |
| 53 // bitstream buffers passed to client through the OnBitstreamReady callback. | |
| 54 // This request is served on best-effort basis and client is not given any | |
| 55 // guarantees of the realization or timing of the request. Flags parameters | |
| 56 // will be interpreted in format specific manner using enumerations. | |
| 57 virtual void RequestSpecialFrame(int flags) = 0; | |
| 58 | |
| 59 protected: | |
| 60 virtual ~EncodedVideoBitstream() {}; | |
| 61 friend class base::RefCountedThreadSafe<EncodedVideoBitstream>; | |
| 62 }; | |
|
Ami GONE FROM CHROMIUM
2013/03/02 10:47:16
Like I wrote in the _messages.h review, this inter
Ville-Mikko Rautio
2013/03/05 13:02:18
I added fair amount of comments about this. Trying
| |
| 63 | |
| 64 // Class to represent any encoded video source. Anything that provides encoded | |
| 65 // video can be an EncodedVideoSource. Notable examples of this can be video | |
| 66 // encoder (duh!) and webcam that has encoding capability. | |
| 67 class MEDIA_EXPORT EncodedVideoSource { | |
| 68 public: | |
| 69 virtual ~EncodedVideoSource() {}; | |
| 70 | |
| 71 // GetCapabilities informs the client what type of encoded bitstream encoder | |
| 72 // is capable to provide. Constraints in the reported capabilities should be | |
| 73 // obeyed when configuring bitstreams. | |
| 74 virtual VideoEncodingCapability GetCapabilities() = 0; | |
| 75 | |
| 76 // OpenBitstream returns object for the stream being added. Client must | |
| 77 // consider the returned stream valid until OnBitstreamRemoved callback is | |
| 78 // called with the id. Client should check the parameters agains limits | |
| 79 // reported by GetCapabilities before trying to issue an request to add an | |
| 80 // encoded bitstream. EncodedVideoSource retains the ownership of | |
| 81 // EncodedVideoBitstream and client just has the pointer to it. | |
| 82 virtual scoped_refptr<EncodedVideoBitstream> OpenBitstream( | |
| 83 base::WeakPtr<EncodedVideoBitstream::Client> client, | |
|
Ami GONE FROM CHROMIUM
2013/03/02 10:47:16
Putting WeakPtr in the API imposes threading const
Ville-Mikko Rautio
2013/03/05 13:02:18
I added some comments on this, but left also TODO
| |
| 84 const VideoEncodingParameters& params) = 0; | |
| 85 }; | |
| 86 | |
| 87 } // namespace media | |
| 88 | |
| 89 #endif // MEDIA_VIDEO_ENCODED_VIDEO_SOURCE_H_ | |
| 90 | |
| OLD | NEW |