[Spice-devel] [spice-gtk v2 1/2] channel-display-gst: style changes in create_pipeline

Victor Toso lists at victortoso.com
Thu Oct 20 14:17:33 UTC 2016


Hi,

On Thu, Oct 20, 2016 at 06:40:52AM -0400, Frediano Ziglio wrote:
> > 
> > From: Victor Toso <me at victortoso.com>
> > 
> > Move declaration of variable to top and break big g_strdup_printf
> > line.
> > 
> > Signed-off-by: Victor Toso <victortoso at redhat.com>
> > ---
> >  src/channel-display-gst.c | 13 ++++++++++---
> >  1 file changed, 10 insertions(+), 3 deletions(-)
> > 
> > diff --git a/src/channel-display-gst.c b/src/channel-display-gst.c
> > index 430bb95..0c8fc01 100644
> > --- a/src/channel-display-gst.c
> > +++ b/src/channel-display-gst.c
> > @@ -250,6 +250,10 @@ static void free_pipeline(SpiceGstDecoder *decoder)
> >  static gboolean create_pipeline(SpiceGstDecoder *decoder)
> >  {
> >      const gchar *src_caps, *gstdec_name;
> > +    gchar *desc;
> > +    GstAppSinkCallbacks appsink_cbs = { 0 };
>
> I would use NULL instead of 0 as first member is a pointer.

Can't be as it is a struct and not a pointer.
https://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-base-libs/html/gst-plugins-base-libs-appsink.html#GstAppSinkCallbacks

> 
> > +    GError *err = NULL;
> > +
> >      switch (decoder->base.codec_type) {
> >      case SPICE_VIDEO_CODEC_TYPE_MJPEG:
> >          src_caps = "caps=image/jpeg";
> > @@ -293,10 +297,12 @@ static gboolean create_pipeline(SpiceGstDecoder
> > *decoder)
> >       * - Set max-bytes=0 on appsrc so it does not drop frames that may be
> >       *   needed by those that follow.
> >       */
> > -    gchar *desc = g_strdup_printf("appsrc name=src is-live=true format=time
> > max-bytes=0 block=true %s ! %s ! videoconvert ! appsink name=sink
> > caps=video/x-raw,format=BGRx sync=false drop=false", src_caps, gstdec_name);
> > +    desc = g_strdup_printf("appsrc name=src is-live=true format=time
> > max-bytes=0 block=true "
> > +                           "%s ! %s ! videoconvert ! appsink name=sink "
> > +                           "caps=video/x-raw,format=BGRx sync=false
> > drop=false",
> > +                           src_caps, gstdec_name);
> >      SPICE_DEBUG("GStreamer pipeline: %s", desc);
> >  
> > -    GError *err = NULL;
> >      decoder->pipeline = gst_parse_launch_full(desc, NULL,
> >      GST_PARSE_FLAG_FATAL_ERRORS, &err);
> >      g_free(desc);
> >      if (!decoder->pipeline) {
> > @@ -307,7 +313,8 @@ static gboolean create_pipeline(SpiceGstDecoder *decoder)
> >  
> >      decoder->appsrc =
> >      GST_APP_SRC(gst_bin_get_by_name(GST_BIN(decoder->pipeline), "src"));
> >      decoder->appsink =
> >      GST_APP_SINK(gst_bin_get_by_name(GST_BIN(decoder->pipeline), "sink"));
> > -    GstAppSinkCallbacks appsink_cbs = {NULL, NULL, &new_sample, {NULL}};
> > +
> > +    appsink_cbs.new_sample = new_sample;
> >      gst_app_sink_set_callbacks(decoder->appsink, &appsink_cbs, decoder,
> >      NULL);
> >  
> >      decoder->clock =
> >      gst_pipeline_get_clock(GST_PIPELINE(decoder->pipeline));
>
> Beside that
>
> Acked-by: Frediano Ziglio <fziglio at redhat.com>

Thanks,

>
> Frediano
> _______________________________________________
> Spice-devel mailing list
> Spice-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/spice-devel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/spice-devel/attachments/20161020/1f0e1e74/attachment.sig>


More information about the Spice-devel mailing list