Mir
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
mir_screencast.h
Go to the documentation of this file.
1 /*
2  * Copyright © 2014 Canonical Ltd.
3  *
4  * This program is free software: you can redistribute it and/or modify it
5  * under the terms of the GNU Lesser General Public License version 3,
6  * as published by the Free Software Foundation.
7  *
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU Lesser General Public License for more details.
12  *
13  * You should have received a copy of the GNU Lesser General Public License
14  * along with this program. If not, see <http://www.gnu.org/licenses/>.
15  *
16  * Authored by: Alexandros Frantzis <alexandros.frantzis@canonical.com>
17  */
18 
19 #ifndef MIR_CLIENT_MIR_SCREENCAST_H_
20 #define MIR_CLIENT_MIR_SCREENCAST_H_
21 
22 #include "mir_client_surface.h"
23 #include "mir_wait_handle.h"
26 #include "mir_protobuf.pb.h"
27 #include "mir/geometry/size.h"
28 #include "mir/geometry/rectangle.h"
29 
30 #include <EGL/eglplatform.h>
31 
32 namespace mir
33 {
34 namespace protobuf { class DisplayServer; }
35 namespace client
36 {
37 class ClientBufferFactory;
38 class EGLNativeWindowFactory;
39 }
40 }
41 
43 {
44 public:
46  mir::geometry::Rectangle const& region,
48  MirPixelFormat pixel_format,
49  mir::protobuf::DisplayServer& server,
50  std::shared_ptr<mir::client::EGLNativeWindowFactory> const& egl_native_window_factory,
51  std::shared_ptr<mir::client::ClientBufferFactory> const& factory,
52  mir_screencast_callback callback, void* context);
53 
55  bool valid();
56 
58  mir_screencast_callback callback, void* context);
59 
61  mir_screencast_callback callback, void* context);
62 
63  EGLNativeWindowType egl_native_window();
64 
65  /* mir::client::ClientSurface */
67  std::shared_ptr<mir::client::ClientBuffer> get_current_buffer();
70 
71 private:
72  void process_buffer(mir::protobuf::Buffer const& buffer);
73  void screencast_created(
74  mir_screencast_callback callback, void* context);
75  void released(
76  mir_screencast_callback callback, void* context);
77  void next_buffer_received(
78  mir_screencast_callback callback, void* context);
79 
80  mir::protobuf::DisplayServer& server;
81  mir::geometry::Size const output_size;
82  MirPixelFormat const output_format;
83  std::shared_ptr<mir::client::EGLNativeWindowFactory> const egl_native_window_factory;
84  mir::client::ClientBufferDepository buffer_depository;
85  std::shared_ptr<EGLNativeWindowType> egl_native_window_;
86 
87  mir::protobuf::Screencast protobuf_screencast;
88  mir::protobuf::Buffer protobuf_buffer;
89  mir::protobuf::Void protobuf_void;
90 
91  MirWaitHandle create_screencast_wait_handle;
92  MirWaitHandle release_wait_handle;
93  MirWaitHandle next_buffer_wait_handle;
94 };
95 
96 #endif /* MIR_CLIENT_MIR_SCREENCAST_H_ */
Definition: size.h:30
Definition: mir_wait_handle.h:31
MirWaitHandle * release(mir_screencast_callback callback, void *context)
Definition: mir_screencast.cpp:140
void request_and_wait_for_next_buffer()
Definition: mir_screencast.cpp:178
bool valid()
Definition: mir_screencast.cpp:119
std::shared_ptr< mir::client::ClientBuffer > get_current_buffer()
Definition: mir_screencast.cpp:135
Definition: mir_screencast.h:42
Responsible for taking the buffer data sent from the server and wrapping it in a ClientBuffer.
Definition: client_buffer_depository.h:46
MirScreencast(mir::geometry::Rectangle const &region, mir::geometry::Size const &size, MirPixelFormat pixel_format, mir::protobuf::DisplayServer &server, std::shared_ptr< mir::client::EGLNativeWindowFactory > const &egl_native_window_factory, std::shared_ptr< mir::client::ClientBufferFactory > const &factory, mir_screencast_callback callback, void *context)
Definition: mir_screencast.cpp:71
void request_and_wait_for_configure(MirSurfaceAttrib a, int value)
Definition: mir_screencast.cpp:183
EGLNativeWindowType egl_native_window()
Definition: mir_screencast.cpp:173
Definition: mir_client_surface.h:31
MirSurfaceAttrib
Attributes of a surface that the client and server/shell may wish to get or set over the wire...
Definition: common.h:34
MirPixelFormat
The order of components in a format enum matches the order of the components as they would be written...
Definition: common.h:99
MirWaitHandle * creation_wait_handle()
Definition: mir_screencast.cpp:114
Definition: rectangle.h:33
MirWaitHandle * next_buffer(mir_screencast_callback callback, void *context)
Definition: mir_screencast.cpp:156
Definition: display_server.h:31
void(* mir_screencast_callback)(MirScreencast *screencast, void *client_context)
Callback to be passed when calling MirScreencast functions.
Definition: client_types.h:307
MirSurfaceParameters get_parameters() const
Definition: mir_screencast.cpp:124
int const size
Definition: make_socket_rpc_channel.cpp:50
MirSurfaceParameters is the structure of minimum required information that you must provide to Mir in...
Definition: client_types.h:121

Copyright © 2012,2013 Canonical Ltd.
Generated on Fri Apr 11 21:14:53 UTC 2014