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 "media/base/encoded_bitstream_buffer.h" |
| 10 #include "media/video/video_encode_types.h" |
| 11 |
| 12 namespace media { |
| 13 |
| 14 // Class to represent any encoded video source. Anything that provides encoded |
| 15 // video can be an EncodedVideoSource. Notable examples of this can be video |
| 16 // encoder and webcam that has encoding capabilities. |
| 17 class MEDIA_EXPORT EncodedVideoSource { |
| 18 public: |
| 19 class MEDIA_EXPORT Client { |
| 20 public: |
| 21 // After OnStreaming callback stream shall be considered to be streaming. |
| 22 virtual void OnStreaming(const VideoEncodingParameters& params) = 0; |
| 23 |
| 24 // After OnClosed client has to stop using the bitstream object and |
| 25 // expecting bitstream buffers for that stream. OnClosed will be called |
| 26 // also in case of any unrecoverable failure in the capturer. After |
| 27 // OnClosed is called from a stream it is guaranteed that that there will |
| 28 // be no longer pending calls coming in. |
| 29 virtual void OnClosed() = 0; |
| 30 |
| 31 // OnBufferReady delivers the captured bitstream buffer by buffer to the |
| 32 // client. |
| 33 virtual void OnBufferReady( |
| 34 scoped_refptr<const EncodedBitstreamBuffer> buffer) = 0; |
| 35 |
| 36 // OnConfigChanged informs about change in bitstream parameters. |
| 37 virtual void OnConfigChanged( |
| 38 const RuntimeVideoEncodingParameters& params) = 0; |
| 39 }; |
| 40 |
| 41 // Callback is invoked once RequestCapabilities() is complete. |
| 42 typedef base::Callback<void(const VideoEncodingCapabilities& capabilities)> |
| 43 RequestCapabilitiesCallback; |
| 44 |
| 45 // RequestCapabilities initiates an asynchronous query for the types of |
| 46 // encoded bitstream supported by the encoder. This call should invoked only |
| 47 // once. EncodedVideoSource will invoke |callback| when capabilities become |
| 48 // available. |
| 49 virtual void RequestCapabilities( |
| 50 const RequestCapabilitiesCallback& callback) = 0; |
| 51 |
| 52 // OpenBitstream opens the bitstream on the encoded video source. Only one |
| 53 // bitstream can be opened for an encoded video source. |
| 54 virtual void OpenBitstream(Client* client, |
| 55 const VideoEncodingParameters& params) = 0; |
| 56 |
| 57 // CloseBitstream closes the bitstream. |
| 58 virtual void CloseBitstream() = 0; |
| 59 |
| 60 // ReturnBitstreamBuffer notifies that the data within the buffer has been |
| 61 // processed and it can be reused to encode upcoming bitstream. |
| 62 virtual void ReturnBitstreamBuffer( |
| 63 scoped_refptr<const media::EncodedBitstreamBuffer> buffer) = 0; |
| 64 |
| 65 // TrySetBitstreamConfig requests to change encoding parameters. Old config |
| 66 // must be considered valid until OnConfigChanged is invoked on the client |
| 67 // signalling successful change. |
| 68 virtual void TrySetBitstreamConfig( |
| 69 const RuntimeVideoEncodingParameters& params) = 0; |
| 70 }; |
| 71 |
| 72 } // namespace media |
| 73 |
| 74 #endif // MEDIA_VIDEO_ENCODED_VIDEO_SOURCE_H_ |
| 75 |
OLD | NEW |