2017-06-21 02:23:44 -04:00
|
|
|
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Copyright (C) 2015-2017 Red Hat Inc.
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License as
|
|
|
|
* published by the Free Software Foundation; either version 2 of the
|
|
|
|
* License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful, but
|
|
|
|
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
2023-08-07 05:50:23 -04:00
|
|
|
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
2017-06-21 02:23:44 -04:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2023-07-21 09:37:20 -04:00
|
|
|
#pragma once
|
2017-06-21 02:23:44 -04:00
|
|
|
|
|
|
|
#include <glib-object.h>
|
2018-12-14 11:47:57 -05:00
|
|
|
#include <spa/param/video/format-utils.h>
|
|
|
|
#include <spa/buffer/meta.h>
|
2017-06-21 02:23:44 -04:00
|
|
|
|
2018-12-14 11:47:57 -05:00
|
|
|
#include "backends/meta-backend-private.h"
|
|
|
|
#include "backends/meta-cursor-renderer.h"
|
|
|
|
#include "backends/meta-cursor.h"
|
|
|
|
#include "backends/meta-renderer.h"
|
2017-06-21 02:23:44 -04:00
|
|
|
#include "clutter/clutter.h"
|
2018-12-14 11:47:57 -05:00
|
|
|
#include "cogl/cogl.h"
|
2018-11-22 05:59:10 -05:00
|
|
|
#include "meta/boxes.h"
|
2017-06-21 02:23:44 -04:00
|
|
|
|
|
|
|
typedef struct _MetaScreenCastStream MetaScreenCastStream;
|
|
|
|
|
2020-07-03 10:48:52 -04:00
|
|
|
typedef enum _MetaScreenCastRecordFlag
|
|
|
|
{
|
|
|
|
META_SCREEN_CAST_RECORD_FLAG_NONE = 0,
|
2020-07-03 10:52:43 -04:00
|
|
|
META_SCREEN_CAST_RECORD_FLAG_CURSOR_ONLY = 1 << 0,
|
2020-07-03 10:48:52 -04:00
|
|
|
} MetaScreenCastRecordFlag;
|
|
|
|
|
2023-01-24 10:03:05 -05:00
|
|
|
typedef enum _MetaScreenCastRecordResult
|
|
|
|
{
|
|
|
|
META_SCREEN_CAST_RECORD_RESULT_RECORDED_NOTHING = 0,
|
|
|
|
META_SCREEN_CAST_RECORD_RESULT_RECORDED_FRAME = 1 << 0,
|
|
|
|
META_SCREEN_CAST_RECORD_RESULT_RECORDED_CURSOR = 1 << 1,
|
|
|
|
} MetaScreenCastRecordResult;
|
|
|
|
|
2023-11-17 10:51:05 -05:00
|
|
|
typedef enum _MetaScreenCastPaintPhase
|
|
|
|
{
|
|
|
|
META_SCREEN_CAST_PAINT_PHASE_DETACHED,
|
|
|
|
META_SCREEN_CAST_PAINT_PHASE_PRE_PAINT,
|
|
|
|
META_SCREEN_CAST_PAINT_PHASE_PRE_SWAP_BUFFER,
|
|
|
|
} MetaScreenCastPaintPhase;
|
|
|
|
|
2017-06-21 02:23:44 -04:00
|
|
|
#define META_TYPE_SCREEN_CAST_STREAM_SRC (meta_screen_cast_stream_src_get_type ())
|
|
|
|
G_DECLARE_DERIVABLE_TYPE (MetaScreenCastStreamSrc,
|
|
|
|
meta_screen_cast_stream_src,
|
|
|
|
META, SCREEN_CAST_STREAM_SRC,
|
|
|
|
GObject)
|
|
|
|
|
|
|
|
struct _MetaScreenCastStreamSrcClass
|
|
|
|
{
|
|
|
|
GObjectClass parent_class;
|
|
|
|
|
2021-02-01 04:41:57 -05:00
|
|
|
gboolean (* get_specs) (MetaScreenCastStreamSrc *src,
|
|
|
|
int *width,
|
|
|
|
int *height,
|
|
|
|
float *frame_rate);
|
2017-06-26 00:55:48 -04:00
|
|
|
void (* enable) (MetaScreenCastStreamSrc *src);
|
|
|
|
void (* disable) (MetaScreenCastStreamSrc *src);
|
2020-07-03 10:57:01 -04:00
|
|
|
gboolean (* record_to_buffer) (MetaScreenCastStreamSrc *src,
|
2023-11-17 10:51:05 -05:00
|
|
|
MetaScreenCastPaintPhase paint_phase,
|
2021-02-01 03:17:15 -05:00
|
|
|
int width,
|
|
|
|
int height,
|
|
|
|
int stride,
|
2020-07-03 10:57:01 -04:00
|
|
|
uint8_t *data,
|
|
|
|
GError **error);
|
2023-11-17 10:51:05 -05:00
|
|
|
gboolean (* record_to_framebuffer) (MetaScreenCastStreamSrc *src,
|
|
|
|
MetaScreenCastPaintPhase paint_phase,
|
|
|
|
CoglFramebuffer *framebuffer,
|
|
|
|
GError **error);
|
2020-07-03 17:57:31 -04:00
|
|
|
void (* record_follow_up) (MetaScreenCastStreamSrc *src);
|
|
|
|
|
2018-11-22 05:59:10 -05:00
|
|
|
gboolean (* get_videocrop) (MetaScreenCastStreamSrc *src,
|
2023-07-19 19:46:15 -04:00
|
|
|
MtkRectangle *crop_rect);
|
2018-12-14 11:47:57 -05:00
|
|
|
void (* set_cursor_metadata) (MetaScreenCastStreamSrc *src,
|
|
|
|
struct spa_meta_cursor *spa_meta_cursor);
|
2021-02-01 04:41:57 -05:00
|
|
|
|
|
|
|
void (* notify_params_updated) (MetaScreenCastStreamSrc *src,
|
|
|
|
struct spa_video_info_raw *video_format);
|
2023-08-11 15:03:53 -04:00
|
|
|
|
|
|
|
CoglPixelFormat (* get_preferred_format) (MetaScreenCastStreamSrc *src);
|
2017-06-21 02:23:44 -04:00
|
|
|
};
|
|
|
|
|
2021-02-01 03:54:56 -05:00
|
|
|
void meta_screen_cast_stream_src_close (MetaScreenCastStreamSrc *src);
|
|
|
|
|
2022-03-02 05:24:40 -05:00
|
|
|
gboolean meta_screen_cast_stream_src_is_enabled (MetaScreenCastStreamSrc *src);
|
|
|
|
|
2023-01-24 10:03:05 -05:00
|
|
|
MetaScreenCastRecordResult meta_screen_cast_stream_src_maybe_record_frame (MetaScreenCastStreamSrc *src,
|
|
|
|
MetaScreenCastRecordFlag flags,
|
2023-11-17 10:51:05 -05:00
|
|
|
MetaScreenCastPaintPhase paint_phase,
|
2023-09-04 10:30:38 -04:00
|
|
|
const MtkRegion *redraw_clip);
|
2023-01-24 10:03:05 -05:00
|
|
|
|
|
|
|
MetaScreenCastRecordResult meta_screen_cast_stream_src_maybe_record_frame_with_timestamp (MetaScreenCastStreamSrc *src,
|
|
|
|
MetaScreenCastRecordFlag flags,
|
2023-11-17 10:51:05 -05:00
|
|
|
MetaScreenCastPaintPhase paint_phase,
|
2023-09-04 10:30:38 -04:00
|
|
|
const MtkRegion *redraw_clip,
|
2023-01-24 10:03:05 -05:00
|
|
|
int64_t frame_timestamp_us);
|
2017-06-21 02:23:44 -04:00
|
|
|
|
2020-07-03 17:57:31 -04:00
|
|
|
gboolean meta_screen_cast_stream_src_pending_follow_up_frame (MetaScreenCastStreamSrc *src);
|
|
|
|
|
2017-06-21 02:23:44 -04:00
|
|
|
MetaScreenCastStream * meta_screen_cast_stream_src_get_stream (MetaScreenCastStreamSrc *src);
|
|
|
|
|
2019-01-24 12:40:06 -05:00
|
|
|
gboolean meta_screen_cast_stream_src_draw_cursor_into (MetaScreenCastStreamSrc *src,
|
|
|
|
CoglTexture *cursor_texture,
|
|
|
|
float scale,
|
2022-07-02 12:50:45 -04:00
|
|
|
MetaMonitorTransform transform,
|
2019-01-24 12:40:06 -05:00
|
|
|
uint8_t *data,
|
|
|
|
GError **error);
|
|
|
|
|
2019-01-21 08:32:05 -05:00
|
|
|
void meta_screen_cast_stream_src_unset_cursor_metadata (MetaScreenCastStreamSrc *src,
|
|
|
|
struct spa_meta_cursor *spa_meta_cursor);
|
|
|
|
|
|
|
|
void meta_screen_cast_stream_src_set_cursor_position_metadata (MetaScreenCastStreamSrc *src,
|
|
|
|
struct spa_meta_cursor *spa_meta_cursor,
|
|
|
|
int x,
|
|
|
|
int y);
|
|
|
|
|
|
|
|
void meta_screen_cast_stream_src_set_empty_cursor_sprite_metadata (MetaScreenCastStreamSrc *src,
|
|
|
|
struct spa_meta_cursor *spa_meta_cursor,
|
|
|
|
int x,
|
|
|
|
int y);
|
|
|
|
|
|
|
|
void meta_screen_cast_stream_src_set_cursor_sprite_metadata (MetaScreenCastStreamSrc *src,
|
|
|
|
struct spa_meta_cursor *spa_meta_cursor,
|
|
|
|
MetaCursorSprite *cursor_sprite,
|
|
|
|
int x,
|
|
|
|
int y,
|
2022-07-02 12:50:45 -04:00
|
|
|
float scale,
|
|
|
|
MetaMonitorTransform transform);
|
2019-01-21 08:32:05 -05:00
|
|
|
|
2023-05-04 06:31:41 -04:00
|
|
|
gboolean meta_screen_cast_stream_src_uses_dma_bufs (MetaScreenCastStreamSrc *src);
|
|
|
|
|
2023-08-11 15:03:53 -04:00
|
|
|
CoglPixelFormat
|
|
|
|
meta_screen_cast_stream_src_get_preferred_format (MetaScreenCastStreamSrc *src);
|