[Spice-devel] [PATCH spice-server v3 2/5] Simplify gstreamer 0.10 compatibility

Frediano Ziglio fziglio at redhat.com
Thu Nov 10 22:38:55 UTC 2016


> 
> On Wed, 2016-11-09 at 10:19 +0000, Frediano Ziglio wrote:
> > Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
> > ---
> >  server/gstreamer-encoder.c | 6 +-----
> >  1 file changed, 1 insertion(+), 5 deletions(-)
> > 
> > diff --git a/server/gstreamer-encoder.c b/server/gstreamer-encoder.c
> > index 3d5f8a0..54e1b2e 100644
> > --- a/server/gstreamer-encoder.c
> > +++ b/server/gstreamer-encoder.c
> > @@ -969,11 +969,7 @@ static gboolean create_pipeline(SpiceGstEncoder
> > *encoder)
> >      encoder->gstenc = gst_bin_get_by_name(GST_BIN(encoder-
> > >pipeline), "encoder");
> >      encoder->appsink =
> > GST_APP_SINK(gst_bin_get_by_name(GST_BIN(encoder->pipeline),
> > "sink"));
> >  
> > -#ifdef HAVE_GSTREAMER_0_10
> > -    GstAppSinkCallbacks appsink_cbs = {NULL, NULL, &new_sample,
> > NULL, {NULL}};
> > -#else
> > -    GstAppSinkCallbacks appsink_cbs = {NULL, NULL, &new_sample,
> > {NULL}};
> > -#endif
> > +    GstAppSinkCallbacks appsink_cbs = {NULL, NULL, &new_sample,
> > ._gst_reserved = {NULL}};
> >      gst_app_sink_set_callbacks(encoder->appsink, &appsink_cbs,
> > encoder, NULL);
> >  
> >      /* Hook into the bus so we can handle errors */
> 
> 
> Personal preference, I suppose. This doesn't seem simpler to me since
> it mixes order-based initialization and name-based initialization. I
> personally find the original to be quicker to comprehend.
> 

Yes, previous patch was surely better looking.
If the callbacks parameters would be a "const GstAppSinkCallbacks *" I
would surely use a "static const GstAppSinkCallbacks ...", statics are all
initialized to zeroes (beside specified parts). Not being const (not that
actually would make much sense to change the structure) I wouldn't use
the static "trick".

Frediano


More information about the Spice-devel mailing list