[Spice-devel] [spice-gtk v3 2/3] channel-display: new stream-video-codec-type property

Marc-André Lureau marcandre.lureau at gmail.com
Mon Mar 13 10:58:17 UTC 2017


Hi

On Thu, Mar 2, 2017 at 2:37 PM Victor Toso <victortoso at redhat.com> wrote:

> From: Victor Toso <me at victortoso.com>
>
> This is a per channel-display property that stores and notifies the
> video-codec type being used if a stream is being used or 0 if there is
> no ongoing stream.
>

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.

I would rather revert this patch or fix it before a release.


> Signed-off-by: Victor Toso <victortoso at redhat.com>
> ---
>  src/channel-display.c | 29 +++++++++++++++++++++++++++++
>  1 file changed, 29 insertions(+)
>
> diff --git a/src/channel-display.c b/src/channel-display.c
> index 7a5a23b..f30c7ed 100644
> --- a/src/channel-display.c
> +++ b/src/channel-display.c
> @@ -70,6 +70,7 @@ struct _SpiceDisplayChannelPrivate {
>      GArray                      *monitors;
>      guint                       monitors_max;
>      gboolean                    enable_adaptive_streaming;
> +    SpiceVideoCodecType         stream_video_codec_type;
>  #ifdef G_OS_WIN32
>      HDC dc;
>  #endif
> @@ -86,6 +87,7 @@ enum {
>      PROP_MONITORS,
>      PROP_MONITORS_MAX,
>      PROP_GL_SCANOUT,
> +    PROP_STREAM_VIDEO_CODEC_TYPE,
>  };
>
>  enum {
> @@ -222,6 +224,10 @@ static void spice_display_get_property(GObject
> *object,
>          g_value_set_static_boxed(value,
> spice_display_get_gl_scanout(channel));
>          break;
>      }
> +    case PROP_STREAM_VIDEO_CODEC_TYPE: {
> +        g_value_set_int(value, c->stream_video_codec_type);
> +        break;
> +    }
>      default:
>          G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
>          break;
> @@ -335,6 +341,23 @@ static void
> spice_display_channel_class_init(SpiceDisplayChannelClass *klass)
>                              G_PARAM_STATIC_STRINGS));
>
>      /**
> +     * SpiceDisplayChannel:stream-video-codec-type
> +     *
> +     * The SpiceVideoCodecType enum value for the video-codec being used
> in the
> +     * current stream or 0 when there is no ongoing streaming.
> +     *
> +     * Since: 0.34
> +     */
> +    g_object_class_install_property
> +        (gobject_class, PROP_STREAM_VIDEO_CODEC_TYPE,
> +         g_param_spec_int("stream-video-codec-type",
> +                          "Stream Video Codec Type",
> +                          "The Video Codec Type from current Stream",
> +                          0, SPICE_VIDEO_CODEC_TYPE_ENUM_END, 0,
> +                          G_PARAM_READABLE |
> +                          G_PARAM_STATIC_STRINGS));
> +
> +    /**
>       * SpiceDisplayChannel::display-primary-create:
>       * @display: the #SpiceDisplayChannel that emitted the signal
>       * @format: %SPICE_SURFACE_FMT_32_xRGB or %SPICE_SURFACE_FMT_16_555;
> @@ -1218,6 +1241,10 @@ static void
> display_handle_stream_create(SpiceChannel *channel, SpiceMsgIn *in)
>          spice_printerr("could not create a video decoder for codec %u",
> op->codec_type);
>          destroy_stream(channel, op->id);
>          report_invalid_stream(channel, op->id);
> +    } else {
> +        spice_debug("New stream created of type: %u", op->codec_type);
> +        c->stream_video_codec_type = op->codec_type;
> +        g_coroutine_object_notify(G_OBJECT(channel),
> "stream-video-codec-type");
>      }
>  }
>
> @@ -1567,6 +1594,8 @@ static void destroy_stream(SpiceChannel *channel,
> int id)
>
>      g_free(st);
>      c->streams[id] = NULL;
> +    c->stream_video_codec_type = 0;
> +    g_coroutine_object_notify(G_OBJECT(channel),
> "stream-video-codec-type");
>  }
>
>  static void clear_streams(SpiceChannel *channel)
> --
> 2.9.3
>
> _______________________________________________
> Spice-devel mailing list
> Spice-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/spice-devel
>
-- 
Marc-André Lureau
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/spice-devel/attachments/20170313/e242296a/attachment.html>


More information about the Spice-devel mailing list