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

Side by Side Diff: media/video/encoded_video_source.h

Issue 15906019: Hook up EncodedVideoSource on the browser side (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@screencast_cl_6
Patch Set: bbd3b746f Rebase. 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 unified diff | Download patch
OLDNEW
(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_
hshi1 2013/06/12 18:34:47 I believe you don't really need this header file t
sheu 2013/06/12 19:51:18 It's in here since it's included by some other hea
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 encoded video bitstream.
15 class MEDIA_EXPORT EncodedVideoBitstream :
16 public base::RefCountedThreadSafe<EncodedVideoBitstream> {
17 public:
18 class MEDIA_EXPORT Client {
19 public:
20 // After OnStreaming callback stream shall be considered to be streaming.
21 virtual void OnBitstreamStreaming(
22 scoped_refptr<EncodedVideoBitstream> bitstream,
23 const VideoEncodingParameters& params) = 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(
41 scoped_refptr<EncodedVideoBitstream> bitstream,
42 const RuntimeVideoEncodingParameters& params) = 0;
43 };
44
45 // TrySetBitstreamConfig issues a reconfiguration request. Old configuration
46 // must be considered to be the valid configuration until
47 // OnBitstreamConfigChanged callback has been issued with value signalling
48 // successful change.
49 virtual void TryConfigure(const RuntimeVideoEncodingParameters& params) = 0;
50
51 protected:
52 virtual ~EncodedVideoBitstream() {};
53 friend class base::RefCountedThreadSafe<EncodedVideoBitstream>;
54 };
55
56 // Class to represent any encoded video source. Anything that provides encoded
57 // video can be an EncodedVideoSource. Notable examples of this can be video
58 // encoder and webcam that has encoding capability.
59 class MEDIA_EXPORT EncodedVideoSource {
60 public:
61
62 class Observer {
63 public:
64 // Invoked when an encoded video source's capabilities become available.
65 virtual void OnCapabilitiesAvailable(EncodedVideoSource* source) = 0;
66
67 protected:
68 virtual ~Observer() {}
69 };
70
71 virtual ~EncodedVideoSource() {};
72
73 // Adds/removes observer to receive OnCapabilitiesAvailable notification.
74 virtual void AddCapabilitiesObserver(Observer* observer) = 0;
75 virtual void RemoveCapabilitiesObserver(Observer* observer) = 0;
76
77 // StartFetchCapabilities initiates an asynchronous query for the types of
78 // encoded bitstream supported by the encoder. When the results become
79 // available, EncodedVideoSource will notify observers via the
80 // OnCapabilitiesAvailable() method.
81 virtual void StartFetchCapabilities() = 0;
82
83 // GetCapabilities informs the client what type of encoded bitstream encoder
84 // is capable to provide. Constraints in the reported capabilities should be
85 // obeyed when configuring bitstreams.
86 virtual VideoEncodingCapability GetCapabilities() = 0;
87
88 // OpenBitstream returns object for the stream being added. Client must
89 // consider the returned stream valid until OnBitstreamRemoved callback is
90 // called with the id. Client should check the parameters agains limits
91 // reported by GetCapabilities before trying to issue an request to add an
92 // encoded bitstream. EncodedVideoSource retains the ownership of
93 // EncodedVideoBitstream and client just has the pointer to it.
94 virtual scoped_refptr<EncodedVideoBitstream> OpenBitstream(
95 EncodedVideoBitstream::Client* client,
96 const VideoEncodingParameters& params) = 0;
97 // CloseBitstream removes the bitstream.
98 virtual void CloseBitstream(
99 scoped_refptr<media::EncodedVideoBitstream> bitstream) = 0;
100
101 // ReturnBitstreamBuffer notifies that the data within the buffer has been
102 // processed and it can be reused to encode upcoming bitstream.
103 virtual void ReturnBitstreamBuffer(
104 scoped_refptr<media::EncodedVideoBitstream> bitstream,
105 scoped_refptr<const media::EncodedBitstreamBuffer> buffer) = 0;
106 };
107
108 } // namespace media
109
110 #endif // MEDIA_VIDEO_ENCODED_VIDEO_SOURCE_H_
111
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698