spice/server/dcc-private.h
Frediano Ziglio 176970f3f1 red-channel-client: Remove GObject type
Make all RedChannelClient hierarchy a C++ class.
This allows to use virtual methods.
Added a normal contructor instead or properties and g_object_new.

As we remove GObject conversion macros I added a macro XXX_CAST
to create a function to replace the old macro.
They will be removed when more type safety is introduced.

There's a new SPICE_CXX_GLIB_ALLOCATOR macro in red-common.h.
This macro, added to a class define the class allocator allowing
to use, in this case, GLib for allocation. This to avoid C++ library
dependency and to initialize all structure to 0 (not all fields
are manually initialized, will be improved with more encapsulation).

Currently the methods are mainly public, access will be modified
when more encapsulation (all functions in method) are done.

Some classes are now defined in the header, C++ uses access to
limit accessibility but for efficiency and type safety/inline and
other features require types to be defined in the headers.

Some fields were moved from XxxPrivate structure to class, C++
has accessibility.

Many destructors are defined as protected to forbid the use of
stack, this as these objects uses internal reference counting
to have normal pointers. Maybe in the future pointers like
std::shared_ptr could be used instead.

Reference counting is now implemented very easily using atomic
operations.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
2020-05-01 06:58:09 +01:00

71 lines
2.2 KiB
C

/* -*- Mode: C; c-basic-offset: 4; indent-tabs-mode: nil -*- */
/*
Copyright (C) 2009-2015 Red Hat, Inc.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, see <http://www.gnu.org/licenses/>.
*/
#ifndef DCC_PRIVATE_H_
#define DCC_PRIVATE_H_
#include "cache-item.h"
#include "dcc.h"
#include "image-encoders.h"
#include "video-stream.h"
#include "red-channel-client.h"
struct DisplayChannelClientPrivate
{
SPICE_CXX_GLIB_ALLOCATOR
uint32_t id = 0;
SpiceImageCompression image_compression;
spice_wan_compression_t jpeg_state;
spice_wan_compression_t zlib_glz_state;
ImageEncoders encoders;
int expect_init = 0;
PixmapCache *pixmap_cache = nullptr;
uint32_t pixmap_cache_generation = 0;
int pending_pixmaps_sync = 0;
RedCacheItem *palette_cache[PALETTE_CACHE_HASH_SIZE];
Ring palette_cache_lru = { nullptr, nullptr };
long palette_cache_available = CLIENT_PALETTE_CACHE_SIZE;
struct {
FreeList free_list;
uint64_t pixmap_cache_items[MAX_DRAWABLE_PIXMAP_CACHE_ITEMS];
int num_pixmap_cache_items;
} send_data;
/* Host preferred video-codec order sorted with client preferred */
GArray *preferred_video_codecs;
/* Array with SPICE_VIDEO_CODEC_TYPE_ENUM_END elements, with the client
* preference order (index) as value */
GArray *client_preferred_video_codecs;
uint8_t surface_client_created[NUM_SURFACES];
QRegion surface_client_lossy_region[NUM_SURFACES];
VideoStreamAgent stream_agents[NUM_STREAMS];
uint32_t streams_max_latency;
uint64_t streams_max_bit_rate;
bool gl_draw_ongoing;
};
#endif /* DCC_PRIVATE_H_ */