fix
This commit is contained in:
parent
2cd9b4870f
commit
36e702bfbb
|
|
@ -8,14 +8,6 @@
|
||||||
#include <sys/mman.h>
|
#include <sys/mman.h>
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <wayland-client.h>
|
|
||||||
|
|
||||||
#include "config.h"
|
|
||||||
|
|
||||||
#include "shared/file-util.h"
|
|
||||||
#include "shared/os-compatibility.h"
|
|
||||||
#include "shared/xalloc.h"
|
|
||||||
#include "weston-screenshooter-client-protocol.h"
|
|
||||||
|
|
||||||
#include "gst/gstinfo.h"
|
#include "gst/gstinfo.h"
|
||||||
#include "gstwestonimagesrc.h"
|
#include "gstwestonimagesrc.h"
|
||||||
|
|
@ -41,28 +33,6 @@ static void gst_westonimagesrc_get_property(GObject *object, guint prop_id, GVal
|
||||||
|
|
||||||
G_DEFINE_TYPE(GstWestonImageSrc, gst_westonimagesrc, GST_TYPE_BASE_SRC);
|
G_DEFINE_TYPE(GstWestonImageSrc, gst_westonimagesrc, GST_TYPE_BASE_SRC);
|
||||||
|
|
||||||
// Screenshoter logic related declarations and defines
|
|
||||||
struct screenshooter_output {
|
|
||||||
struct wl_output *output;
|
|
||||||
struct wl_buffer *buffer;
|
|
||||||
int width, height, offset_x, offset_y;
|
|
||||||
void *data;
|
|
||||||
struct wl_list link;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct buffer_size {
|
|
||||||
int width, height;
|
|
||||||
int min_x, min_y;
|
|
||||||
int max_x, max_y;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct screenshooter_data {
|
|
||||||
struct wl_shm *shm;
|
|
||||||
struct wl_list output_list;
|
|
||||||
struct weston_screenshooter *screenshooter;
|
|
||||||
int buffer_copy_done;
|
|
||||||
};
|
|
||||||
|
|
||||||
static void weston_display_handle_mode(void *data, struct wl_output *wl_output, uint32_t flags, int width, int height, int refresh);
|
static void weston_display_handle_mode(void *data, struct wl_output *wl_output, uint32_t flags, int width, int height, int refresh);
|
||||||
static void weston_display_handle_geometry(void *data, struct wl_output *wl_output, int x, int y, int physical_width, int physical_height, int subpixel, const char *make,
|
static void weston_display_handle_geometry(void *data, struct wl_output *wl_output, int x, int y, int physical_width, int physical_height, int subpixel, const char *make,
|
||||||
const char *model, int transform);
|
const char *model, int transform);
|
||||||
|
|
@ -156,7 +126,7 @@ static void weston_handle_global(void *data, struct wl_registry *registry, uint3
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void screenshot_done(void *data, struct weston_screenshooter *screenshooter) {
|
static void weston_screenshot_done(void *data, struct weston_screenshooter *screenshooter) {
|
||||||
struct screenshooter_data *sh_data = data;
|
struct screenshooter_data *sh_data = data;
|
||||||
sh_data->buffer_copy_done = 1;
|
sh_data->buffer_copy_done = 1;
|
||||||
}
|
}
|
||||||
|
|
@ -236,7 +206,7 @@ static void gst_westonimagesrc_init(GstWestonImageSrc *westonimagesrc) {
|
||||||
}
|
}
|
||||||
|
|
||||||
weston_screenshooter_add_listener(sh_data.screenshooter, &screenshooter_listener, &sh_data);
|
weston_screenshooter_add_listener(sh_data.screenshooter, &screenshooter_listener, &sh_data);
|
||||||
screenshot_set_buffer_size(&buff_size, &sh_data.output_list);
|
weston_screenshot_set_buffer_size(&buff_size, &sh_data.output_list);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void gst_westonimagesrc_set_property(GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec) {
|
static void gst_westonimagesrc_set_property(GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec) {
|
||||||
|
|
@ -330,7 +300,7 @@ static GstFlowReturn gst_westonimagesrc_create(GstBaseSrc *basesrc, guint64 offs
|
||||||
}
|
}
|
||||||
|
|
||||||
wl_list_for_each(output, &sh_data.output_list, link) {
|
wl_list_for_each(output, &sh_data.output_list, link) {
|
||||||
output->buffer = screenshot_create_shm_buffer(output->width, output->height, &output->data, sh_data.shm);
|
output->buffer = weston_screenshot_create_shm_buffer(output->width, output->height, &output->data, sh_data.shm);
|
||||||
weston_screenshooter_shoot(sh_data.screenshooter, output->output, output->buffer);
|
weston_screenshooter_shoot(sh_data.screenshooter, output->output, output->buffer);
|
||||||
sh_data.buffer_copy_done = 0;
|
sh_data.buffer_copy_done = 0;
|
||||||
while (!sh_data.buffer_copy_done)
|
while (!sh_data.buffer_copy_done)
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,26 @@
|
||||||
#include <gst/base/gstbasesrc.h>
|
#include <gst/base/gstbasesrc.h>
|
||||||
#include <gst/gst.h>
|
#include <gst/gst.h>
|
||||||
|
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <errno.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <fcntl.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <limits.h>
|
||||||
|
#include <sys/param.h>
|
||||||
|
#include <sys/mman.h>
|
||||||
|
#include <wayland-client.h>
|
||||||
|
#include <wayland-util.h>
|
||||||
|
|
||||||
|
#include "config.h"
|
||||||
|
#include "weston-screenshooter-client-protocol.h"
|
||||||
|
#include "shared/os-compatibility.h"
|
||||||
|
#include "shared/xalloc.h"
|
||||||
|
#include "shared/file-util.h"
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
#define GST_TYPE_WESTONIMAGESRC (gst_westonimagesrc_get_type())
|
#define GST_TYPE_WESTONIMAGESRC (gst_westonimagesrc_get_type())
|
||||||
|
|
@ -33,6 +53,28 @@ GType gst_westonimagesrc_get_type(void);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
|
// Screenshoter logic related declarations and defines
|
||||||
|
struct screenshooter_output {
|
||||||
|
struct wl_output *output;
|
||||||
|
struct wl_buffer *buffer;
|
||||||
|
int width, height, offset_x, offset_y;
|
||||||
|
void *data;
|
||||||
|
struct wl_list link;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct buffer_size {
|
||||||
|
int width, height;
|
||||||
|
int min_x, min_y;
|
||||||
|
int max_x, max_y;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct screenshooter_data {
|
||||||
|
struct wl_shm *shm;
|
||||||
|
struct wl_list output_list;
|
||||||
|
struct weston_screenshooter *screenshooter;
|
||||||
|
int buffer_copy_done;
|
||||||
|
};
|
||||||
|
|
||||||
// Weston related structures
|
// Weston related structures
|
||||||
struct wl_display *display;
|
struct wl_display *display;
|
||||||
struct wl_registry *registry;
|
struct wl_registry *registry;
|
||||||
|
|
|
||||||
|
|
@ -359,9 +359,12 @@ if get_option('shell-desktop')
|
||||||
gst_version = meson.project_version()
|
gst_version = meson.project_version()
|
||||||
api_version = '0.1'
|
api_version = '0.1'
|
||||||
|
|
||||||
gst_dep = dependency('gstreamer-1.0',
|
gst_dep = dependency('gstreamer-1.0', version : '>=1.18',
|
||||||
fallback : ['gstreamer', 'gst_dep'])
|
fallback : ['gstreamer', 'gst_dep'])
|
||||||
|
|
||||||
|
gstbase_dep = dependency('gstreamer-base-1.0', version : '>=1.18',
|
||||||
|
fallback : ['gstreamer', 'gst_base_dep'])
|
||||||
|
|
||||||
gst_westonimagesrc_plugin_c_args = ['-DHAVE_CONFIG_H']
|
gst_westonimagesrc_plugin_c_args = ['-DHAVE_CONFIG_H']
|
||||||
|
|
||||||
gst_westonimagesrc_cdata = configuration_data()
|
gst_westonimagesrc_cdata = configuration_data()
|
||||||
|
|
@ -375,13 +378,16 @@ if get_option('shell-desktop')
|
||||||
|
|
||||||
# The westonimagesrc Plugin
|
# The westonimagesrc Plugin
|
||||||
gstwestonimagesrc_sources = [
|
gstwestonimagesrc_sources = [
|
||||||
'src/gstwestonimagesrc.c',
|
'gstwestonimagesrc.c',
|
||||||
]
|
]
|
||||||
|
|
||||||
gstwestonimagesrcexample = library('gstwestonimagesrc',
|
gstwestonimagesrcexample = library('gstwestonimagesrc',
|
||||||
gstwestonimagesrc_sources,
|
gstwestonimagesrc_sources,
|
||||||
|
weston_screenshooter_client_protocol_h,
|
||||||
|
weston_screenshooter_protocol_c,
|
||||||
|
include_directories: common_inc,
|
||||||
c_args: gst_westonimagesrc_plugin_c_args,
|
c_args: gst_westonimagesrc_plugin_c_args,
|
||||||
dependencies : [gst_dep, gstbase_dep],
|
dependencies : [gst_dep, gstbase_dep, dep_toytoolkit],
|
||||||
install : true,
|
install : true,
|
||||||
install_dir : plugins_install_dir,
|
install_dir : plugins_install_dir,
|
||||||
)
|
)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue