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

Side by Side 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, 9 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_
7
8 #include "base/memory/ref_counted.h"
9 #include "base/memory/weak_ptr.h"
10 #include "media/base/encoded_bitstream_buffer.h"
11 #include "media/video/video_encode_types.h"
12
13 namespace media {
14
15 // Class to represent encoded video bitstream.
16 class MEDIA_EXPORT EncodedVideoBitstream :
17 public base::RefCountedThreadSafe<EncodedVideoBitstream> {
18 public:
19 class MEDIA_EXPORT Client {
20 public:
21 // After OnStreaming callback stream shall be considered to be streaming.
22 virtual void OnBitstreamStreaming(
23 scoped_refptr<EncodedVideoBitstream> bitstream, bool modifiable) = 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
wjia(left Chromium) 2013/02/28 18:46:26 comment doesn't match function name.
vmr 2013/03/01 14:24:00 Done.
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(
50 const RuntimeVideoEncodingParameters& params) = 0;
51
52 // RequestSpecialFrame allows the client to request special frames from the
53 // encoded video bitstream. The effect of the request is only visible in the
54 // bitstream buffers passed to client through the OnBitstreamReady callback.
55 // This request is served on best-effort basis and client is not given any
56 // guarantees of the realization or timing of the request. Flags parameters
57 // will be interpreted in format specific manner using enumerations.
58 virtual void RequestSpecialFrame(int flags) = 0;
59
60 protected:
61 virtual ~EncodedVideoBitstream() {};
62 friend class base::RefCountedThreadSafe<EncodedVideoBitstream>;
63 };
64
65 // Class to represent any encoded video source. Anything that provides encoded
66 // video can be an EncodedVideoSource. Notable examples of this can be video
67 // encoder (duh!) and webcam that has encoding capability.
68 class MEDIA_EXPORT EncodedVideoSource {
69 public:
70 virtual ~EncodedVideoSource() {};
71
72 // GetCapabilities informs the client what type of encoded bitstream encoder
73 // is capable to provide. Constraints in the reported capabilities should be
74 // obeyed when configuring bitstreams.
75 virtual VideoEncodingCapability GetCapabilities() = 0;
76
77 // OpenBitstream returns object for the stream being added. Client must
78 // consider the returned stream valid until OnBitstreamRemoved callback is
79 // called with the id. Client should check the parameters agains limits
80 // reported by GetCapabilities before trying to issue an request to add an
81 // encoded bitstream. EncodedVideoSource retains the ownership of
82 // EncodedVideoBitstream and client just has the pointer to it.
83 virtual scoped_refptr<EncodedVideoBitstream> OpenBitstream(
84 base::WeakPtr<EncodedVideoBitstream::Client> client,
85 const VideoEncodingParameters& params) = 0;
86 };
87
88 } // namespace media
89
90 #endif // MEDIA_VIDEO_ENCODED_VIDEO_SOURCE_H_
91
OLDNEW
« 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