<div dir="ltr">Hi<br><div><br><div class="gmail_quote"><div dir="ltr">On Thu, Mar 2, 2017 at 2:37 PM Victor Toso <<a href="mailto:victortoso@redhat.com">victortoso@redhat.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">From: Victor Toso <<a href="mailto:me@victortoso.com" class="gmail_msg" target="_blank">me@victortoso.com</a>><br class="gmail_msg">
<br class="gmail_msg">
This is a per channel-display property that stores and notifies the<br class="gmail_msg">
video-codec type being used if a stream is being used or 0 if there is<br class="gmail_msg">
no ongoing stream.<br class="gmail_msg"></blockquote><div><br></div><div>It doesn't handle well multiple streams. I think we should rather expose an array. Perhaps it's time to expose display_stream has an object, so we could add readable properties as needed.<br><br></div><div>I would rather revert this patch or fix it before a release.<br><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br class="gmail_msg">
Signed-off-by: Victor Toso <<a href="mailto:victortoso@redhat.com" class="gmail_msg" target="_blank">victortoso@redhat.com</a>><br class="gmail_msg">
---<br class="gmail_msg">
src/channel-display.c | 29 +++++++++++++++++++++++++++++<br class="gmail_msg">
1 file changed, 29 insertions(+)<br class="gmail_msg">
<br class="gmail_msg">
diff --git a/src/channel-display.c b/src/channel-display.c<br class="gmail_msg">
index 7a5a23b..f30c7ed 100644<br class="gmail_msg">
--- a/src/channel-display.c<br class="gmail_msg">
+++ b/src/channel-display.c<br class="gmail_msg">
@@ -70,6 +70,7 @@ struct _SpiceDisplayChannelPrivate {<br class="gmail_msg">
GArray *monitors;<br class="gmail_msg">
guint monitors_max;<br class="gmail_msg">
gboolean enable_adaptive_streaming;<br class="gmail_msg">
+ SpiceVideoCodecType stream_video_codec_type;<br class="gmail_msg">
#ifdef G_OS_WIN32<br class="gmail_msg">
HDC dc;<br class="gmail_msg">
#endif<br class="gmail_msg">
@@ -86,6 +87,7 @@ enum {<br class="gmail_msg">
PROP_MONITORS,<br class="gmail_msg">
PROP_MONITORS_MAX,<br class="gmail_msg">
PROP_GL_SCANOUT,<br class="gmail_msg">
+ PROP_STREAM_VIDEO_CODEC_TYPE,<br class="gmail_msg">
};<br class="gmail_msg">
<br class="gmail_msg">
enum {<br class="gmail_msg">
@@ -222,6 +224,10 @@ static void spice_display_get_property(GObject *object,<br class="gmail_msg">
g_value_set_static_boxed(value, spice_display_get_gl_scanout(channel));<br class="gmail_msg">
break;<br class="gmail_msg">
}<br class="gmail_msg">
+ case PROP_STREAM_VIDEO_CODEC_TYPE: {<br class="gmail_msg">
+ g_value_set_int(value, c->stream_video_codec_type);<br class="gmail_msg">
+ break;<br class="gmail_msg">
+ }<br class="gmail_msg">
default:<br class="gmail_msg">
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);<br class="gmail_msg">
break;<br class="gmail_msg">
@@ -335,6 +341,23 @@ static void spice_display_channel_class_init(SpiceDisplayChannelClass *klass)<br class="gmail_msg">
G_PARAM_STATIC_STRINGS));<br class="gmail_msg">
<br class="gmail_msg">
/**<br class="gmail_msg">
+ * SpiceDisplayChannel:stream-video-codec-type<br class="gmail_msg">
+ *<br class="gmail_msg">
+ * The SpiceVideoCodecType enum value for the video-codec being used in the<br class="gmail_msg">
+ * current stream or 0 when there is no ongoing streaming.<br class="gmail_msg">
+ *<br class="gmail_msg">
+ * Since: 0.34<br class="gmail_msg">
+ */<br class="gmail_msg">
+ g_object_class_install_property<br class="gmail_msg">
+ (gobject_class, PROP_STREAM_VIDEO_CODEC_TYPE,<br class="gmail_msg">
+ g_param_spec_int("stream-video-codec-type",<br class="gmail_msg">
+ "Stream Video Codec Type",<br class="gmail_msg">
+ "The Video Codec Type from current Stream",<br class="gmail_msg">
+ 0, SPICE_VIDEO_CODEC_TYPE_ENUM_END, 0,<br class="gmail_msg">
+ G_PARAM_READABLE |<br class="gmail_msg">
+ G_PARAM_STATIC_STRINGS));<br class="gmail_msg">
+<br class="gmail_msg">
+ /**<br class="gmail_msg">
* SpiceDisplayChannel::display-primary-create:<br class="gmail_msg">
* @display: the #SpiceDisplayChannel that emitted the signal<br class="gmail_msg">
* @format: %SPICE_SURFACE_FMT_32_xRGB or %SPICE_SURFACE_FMT_16_555;<br class="gmail_msg">
@@ -1218,6 +1241,10 @@ static void display_handle_stream_create(SpiceChannel *channel, SpiceMsgIn *in)<br class="gmail_msg">
spice_printerr("could not create a video decoder for codec %u", op->codec_type);<br class="gmail_msg">
destroy_stream(channel, op->id);<br class="gmail_msg">
report_invalid_stream(channel, op->id);<br class="gmail_msg">
+ } else {<br class="gmail_msg">
+ spice_debug("New stream created of type: %u", op->codec_type);<br class="gmail_msg">
+ c->stream_video_codec_type = op->codec_type;<br class="gmail_msg">
+ g_coroutine_object_notify(G_OBJECT(channel), "stream-video-codec-type");<br class="gmail_msg">
}<br class="gmail_msg">
}<br class="gmail_msg">
<br class="gmail_msg">
@@ -1567,6 +1594,8 @@ static void destroy_stream(SpiceChannel *channel, int id)<br class="gmail_msg">
<br class="gmail_msg">
g_free(st);<br class="gmail_msg">
c->streams[id] = NULL;<br class="gmail_msg">
+ c->stream_video_codec_type = 0;<br class="gmail_msg">
+ g_coroutine_object_notify(G_OBJECT(channel), "stream-video-codec-type");<br class="gmail_msg">
}<br class="gmail_msg">
<br class="gmail_msg">
static void clear_streams(SpiceChannel *channel)<br class="gmail_msg">
--<br class="gmail_msg">
2.9.3<br class="gmail_msg">
<br class="gmail_msg">
_______________________________________________<br class="gmail_msg">
Spice-devel mailing list<br class="gmail_msg">
<a href="mailto:Spice-devel@lists.freedesktop.org" class="gmail_msg" target="_blank">Spice-devel@lists.freedesktop.org</a><br class="gmail_msg">
<a href="https://lists.freedesktop.org/mailman/listinfo/spice-devel" rel="noreferrer" class="gmail_msg" target="_blank">https://lists.freedesktop.org/mailman/listinfo/spice-devel</a><br class="gmail_msg">
</blockquote></div></div></div><div dir="ltr">-- <br></div><div data-smartmail="gmail_signature"><div dir="ltr">Marc-André Lureau<br></div></div>