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

Unified Diff: media/video/encoded_video_source.h

Issue 12379011: Interfaces for encoded video sources (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Changed Client to be accessed through WeakPtr Created 7 years, 10 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
« media/base/encoded_bitstream_buffer_unittest.cc ('K') | « media/media.gyp ('k') | no next file » | 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..312cd21b0cc884f31a4741671181e751ec895071
--- /dev/null
+++ b/media/video/encoded_video_source.h
@@ -0,0 +1,91 @@
+// 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 "base/memory/weak_ptr.h"
+#include "media/base/encoded_bitstream_buffer.h"
+#include "media/video/video_encode_types.h"
+
+namespace media {
+
+// Class to represent encoded video bitstream.
+class MEDIA_EXPORT EncodedVideoBitstream :
+ public base::RefCountedThreadSafe<EncodedVideoBitstream> {
+ public:
+ class MEDIA_EXPORT Client {
+ public:
+ // After OnStreaming callback stream shall be considered to be streaming.
+ virtual void OnBitstreamStreaming(
+ scoped_refptr<EncodedVideoBitstream> bitstream, bool modifiable) = 0;
+
+ // After OnRemoved client has to stop using the bitstream object and
+ // expecting bitstream buffers for that stream. OnRemoved will be called
+ // also in case of any unrecoverable failure in the capturer. After
+ // OnRemoved is called from a stream it is guaranteed that that there will
+ // be no longer pending calls coming in.
+ virtual void OnBitstreamRemoved(
+ scoped_refptr<EncodedVideoBitstream> bitstream) = 0;
+
+ // OnBitstreamReady delivers the captured bitstream buffer by buffer to the
+ // client.
+ virtual void OnBitstreamReady(
+ scoped_refptr<EncodedVideoBitstream> bitstream,
+ scoped_refptr<const EncodedBitstreamBuffer> buffer) = 0;
+
+ // OnBitstreamConfigChanged informs about change in bitstream parameters.
+ virtual void OnBitstreamConfigChanged(
+ scoped_refptr<EncodedVideoBitstream> bitstream,
+ const RuntimeVideoEncodingParameters& params) = 0;
+ };
+
+ // TrySetBitstreamConfig issues a reconfiguration request. Old configuration
wjia(left Chromium) 2013/02/28 18:46:26 comment doesn't match function name.
vmr 2013/03/01 14:24:00 Done.
+ // must be considered to be the valid configuration until
+ // OnBitstreamConfigChanged callback has been issued with value signalling
+ // successful change.
+ virtual void TryConfigure(
+ const RuntimeVideoEncodingParameters& params) = 0;
+
+ // RequestSpecialFrame allows the client to request special frames from the
+ // encoded video bitstream. The effect of the request is only visible in the
+ // bitstream buffers passed to client through the OnBitstreamReady callback.
+ // This request is served on best-effort basis and client is not given any
+ // guarantees of the realization or timing of the request. Flags parameters
+ // will be interpreted in format specific manner using enumerations.
+ virtual void RequestSpecialFrame(int flags) = 0;
+
+ protected:
+ virtual ~EncodedVideoBitstream() {};
+ friend class base::RefCountedThreadSafe<EncodedVideoBitstream>;
+};
+
+// Class to represent any encoded video source. Anything that provides encoded
+// video can be an EncodedVideoSource. Notable examples of this can be video
+// encoder (duh!) and webcam that has encoding capability.
+class MEDIA_EXPORT EncodedVideoSource {
+ public:
+ virtual ~EncodedVideoSource() {};
+
+ // GetCapabilities informs the client what type of encoded bitstream encoder
+ // is capable to provide. Constraints in the reported capabilities should be
+ // obeyed when configuring bitstreams.
+ virtual VideoEncodingCapability GetCapabilities() = 0;
+
+ // OpenBitstream returns object for the stream being added. Client must
+ // consider the returned stream valid until OnBitstreamRemoved callback is
+ // called with the id. Client should check the parameters agains limits
+ // reported by GetCapabilities before trying to issue an request to add an
+ // encoded bitstream. EncodedVideoSource retains the ownership of
+ // EncodedVideoBitstream and client just has the pointer to it.
+ virtual scoped_refptr<EncodedVideoBitstream> OpenBitstream(
+ base::WeakPtr<EncodedVideoBitstream::Client> client,
+ const VideoEncodingParameters& params) = 0;
+};
+
+} // namespace media
+
+#endif // MEDIA_VIDEO_ENCODED_VIDEO_SOURCE_H_
+
« media/base/encoded_bitstream_buffer_unittest.cc ('K') | « media/media.gyp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698