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

Unified Diff: media/video/encoded_video_source.h

Issue 16320005: Define EncodedVideoSource and RtcCapturedEncodingVideoCapturer. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased at 209707. Fix compile warnings. Created 7 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « media/media.gyp ('k') | media/video/video_encode_types.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..1b269bfe82ed65dd83cce326725789dc20c653cc
--- /dev/null
+++ b/media/video/encoded_video_source.h
@@ -0,0 +1,76 @@
+// 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.
+// TODO(hshi): merge this with VEA interface. http://crbug.com/248334.
+class EncodedVideoSource {
+ public:
+ class Client {
+ public:
+ // Notifies client that bitstream is opened successfully. The |params|
+ // contains the actual encoding parameters chosen by the browser process.
+ // It may be different from the params requested in OpenBitstream().
+ virtual void OnOpened(const VideoEncodingParameters& params) = 0;
+
+ // Notifies client that bitstream is closed. After this call it is
+ // guaranteed that client will not receive further calls.
+ virtual void OnClosed() = 0;
+
+ // Delivers an encoded bitstream buffer to the client.
+ virtual void OnBufferReady(
+ scoped_refptr<const EncodedBitstreamBuffer> buffer) = 0;
+
+ // Notifies client that encoding parameters has changed. The |params|
+ // contains the current encoding parameters chosen by the browser process.
+ // It may be different from the params requested in TrySetBitstreamConfig().
+ 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 be invoked
+ // only 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,
+ const VideoEncodingParameters& params) = 0;
+
+ // 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
+ // signaling successful change.
+ virtual void TrySetBitstreamConfig(
+ const RuntimeVideoEncodingParameters& params) = 0;
+};
+
+} // namespace media
+
+#endif // MEDIA_VIDEO_ENCODED_VIDEO_SOURCE_H_
+
« no previous file with comments | « media/media.gyp ('k') | media/video/video_encode_types.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698