[Spice-commits] server/display-channel.c server/display-channel.h server/stream.c
Victor Toso de Carvalho
victortoso at kemper.freedesktop.org
Tue Dec 6 12:47:11 UTC 2016
server/display-channel.c | 12 +++++++++++-
server/display-channel.h | 1 +
server/stream.c | 6 ++++--
3 files changed, 16 insertions(+), 3 deletions(-)
New commits:
commit f007c0a9915342b13fd7beae45faf8cbec8df372
Author: Victor Toso <me at victortoso.com>
Date: Fri Dec 2 16:44:25 2016 +0100
display-channel: Make video-codecs property read-write
This patch creates display_channel_get_video_codecs() helper to let
stream.c get the video-codecs without accessing the internal structure
of DisplayChannel.
As video-codecs is a property of DisplayChannel, this change means
making this property readable as well.
Signed-off-by: Victor Toso <victortoso at redhat.com>
Acked-by: Jonathon Jongsma <jjongsma at redhat.com>
diff --git a/server/display-channel.c b/server/display-channel.c
index bd9d2be..132f5a0 100644
--- a/server/display-channel.c
+++ b/server/display-channel.c
@@ -44,6 +44,9 @@ display_channel_get_property(GObject *object,
case PROP_N_SURFACES:
g_value_set_uint(value, self->priv->n_surfaces);
break;
+ case PROP_VIDEO_CODECS:
+ g_value_set_static_boxed(value, self->priv->video_codecs);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, property_id, pspec);
}
@@ -213,6 +216,13 @@ void display_channel_set_video_codecs(DisplayChannel *display, GArray *video_cod
display->priv->video_codecs = g_array_ref(video_codecs);
}
+GArray *display_channel_get_video_codecs(DisplayChannel *display)
+{
+ spice_return_val_if_fail(display, NULL);
+
+ return display->priv->video_codecs;
+}
+
int display_channel_get_stream_video(DisplayChannel *display)
{
return display->priv->stream_video;
@@ -2247,7 +2257,7 @@ display_channel_class_init(DisplayChannelClass *klass)
"Video Codecs",
G_TYPE_ARRAY,
G_PARAM_CONSTRUCT_ONLY |
- G_PARAM_WRITABLE |
+ G_PARAM_READWRITE |
G_PARAM_STATIC_STRINGS));
}
diff --git a/server/display-channel.h b/server/display-channel.h
index d782969..715ad1a 100644
--- a/server/display-channel.h
+++ b/server/display-channel.h
@@ -229,6 +229,7 @@ void display_channel_set_stream_video (DisplayCha
int stream_video);
void display_channel_set_video_codecs (DisplayChannel *display,
GArray *video_codecs);
+GArray* display_channel_get_video_codecs (DisplayChannel *display);
int display_channel_get_stream_video (DisplayChannel *display);
int display_channel_get_streams_timeout (DisplayChannel *display);
void display_channel_compress_stats_print (DisplayChannel *display);
diff --git a/server/stream.c b/server/stream.c
index 3f3c286..e2cd66e 100644
--- a/server/stream.c
+++ b/server/stream.c
@@ -691,9 +691,11 @@ static VideoEncoder* dcc_create_video_encoder(DisplayChannelClient *dcc,
RedChannelClient *rcc = RED_CHANNEL_CLIENT(dcc);
int client_has_multi_codec = red_channel_client_test_remote_cap(rcc, SPICE_DISPLAY_CAP_MULTI_CODEC);
int i;
+ GArray *video_codecs;
- for (i = 0; i < display->priv->video_codecs->len; i++) {
- RedVideoCodec* video_codec = &g_array_index (display->priv->video_codecs, RedVideoCodec, i);
+ video_codecs = display_channel_get_video_codecs(display);
+ for (i = 0; i < video_codecs->len; i++) {
+ RedVideoCodec* video_codec = &g_array_index (video_codecs, RedVideoCodec, i);
if (!client_has_multi_codec &&
video_codec->type != SPICE_VIDEO_CODEC_TYPE_MJPEG) {
More information about the Spice-commits
mailing list