Chromium Code Reviews| Index: media/video/encoded_video_source.h |
| diff --git a/media/video/encoded_video_source.h b/media/video/encoded_video_source.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..8fbc0a0f91090c6a5b00164ed31d0d9d2f1547c0 |
| --- /dev/null |
| +++ b/media/video/encoded_video_source.h |
| @@ -0,0 +1,75 @@ |
| +// Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef MEDIA_VIDEO_ENCODED_VIDEO_SOURCE_H_ |
| +#define MEDIA_VIDEO_ENCODED_VIDEO_SOURCE_H_ |
| + |
| +#include "base/memory/ref_counted.h" |
| +#include "media/base/encoded_bitstream_buffer.h" |
| +#include "media/video/video_encode_types.h" |
| + |
| +namespace media { |
| + |
| +// Class to represent any encoded video source. Anything that provides encoded |
| +// video can be an EncodedVideoSource. Notable examples of this can be video |
| +// encoder and webcam that has encoding capabilities. |
|
Ami GONE FROM CHROMIUM
2013/06/12 01:44:06
Add a TODO pointing to http://crbug.com/248334.
hshi1
2013/06/12 17:52:39
Done.
|
| +class MEDIA_EXPORT EncodedVideoSource { |
| + public: |
| + class MEDIA_EXPORT Client { |
| + public: |
| + // After OnStreaming callback stream shall be considered to be streaming. |
|
Ami GONE FROM CHROMIUM
2013/06/12 01:44:06
I think you missed the point of my comment:
Oh, s
hshi1
2013/06/12 17:52:39
Done.
|
| + virtual void OnStreaming(const VideoEncodingParameters& params) = 0; |
|
Ami GONE FROM CHROMIUM
2013/06/12 01:44:06
s/OnStreaming/OnOpened/ to mirror {Open,Close}Bits
hshi1
2013/06/12 17:52:39
Done.
|
| + |
| + // After OnClosed client has to stop using the bitstream object and |
| + // expecting bitstream buffers for that stream. OnClosed will be called |
| + // also in case of any unrecoverable failure in the capturer. After |
| + // OnClosed is called from a stream it is guaranteed that that there will |
| + // be no longer pending calls coming in. |
| + virtual void OnClosed() = 0; |
| + |
| + // OnBufferReady delivers the captured bitstream buffer by buffer to the |
| + // client. |
| + virtual void OnBufferReady( |
| + scoped_refptr<const EncodedBitstreamBuffer> buffer) = 0; |
| + |
| + // OnConfigChanged informs about change in bitstream parameters. |
| + virtual void OnConfigChanged( |
| + const RuntimeVideoEncodingParameters& params) = 0; |
| + }; |
| + |
| + // Callback is invoked once RequestCapabilities() is complete. |
| + typedef base::Callback<void(const VideoEncodingCapabilities& capabilities)> |
| + RequestCapabilitiesCallback; |
| + |
| + // RequestCapabilities initiates an asynchronous query for the types of |
| + // encoded bitstream supported by the encoder. This call should invoked only |
|
Ami GONE FROM CHROMIUM
2013/06/12 01:44:06
s/should/should be/
hshi1
2013/06/12 17:52:39
Done.
|
| + // once. EncodedVideoSource will invoke |callback| when capabilities become |
| + // available. |
| + virtual void RequestCapabilities( |
| + const RequestCapabilitiesCallback& callback) = 0; |
| + |
| + // OpenBitstream opens the bitstream on the encoded video source. Only one |
| + // bitstream can be opened for an encoded video source. |
| + virtual void OpenBitstream(Client* client, |
|
Ami GONE FROM CHROMIUM
2013/06/12 01:44:06
I think you missed my comment to the effect of:
he
hshi1
2013/06/12 17:52:39
I'm going to make a pass and update later today.
|
| + const VideoEncodingParameters& params) = 0; |
|
Ami GONE FROM CHROMIUM
2013/06/12 01:44:06
indent is off
hshi1
2013/06/12 17:52:39
Done. ("const" is aligned with "Client", is that c
|
| + |
| + // CloseBitstream closes the bitstream. |
| + virtual void CloseBitstream() = 0; |
| + |
| + // ReturnBitstreamBuffer notifies that the data within the buffer has been |
| + // processed and it can be reused to encode upcoming bitstream. |
| + virtual void ReturnBitstreamBuffer( |
| + scoped_refptr<const media::EncodedBitstreamBuffer> buffer) = 0; |
| + |
| + // TrySetBitstreamConfig requests to change encoding parameters. Old config |
| + // must be considered valid until OnConfigChanged is invoked on the client |
| + // signalling successful change. |
| + virtual void TrySetBitstreamConfig( |
| + const RuntimeVideoEncodingParameters& params) = 0; |
| +}; |
| + |
| +} // namespace media |
| + |
| +#endif // MEDIA_VIDEO_ENCODED_VIDEO_SOURCE_H_ |
| + |