[Spice-devel] [PATCH spice 1/3] Do not use gstreamer in default codecs if not available

Pavel Grunt pgrunt at redhat.com
Tue Nov 15 17:44:58 UTC 2016


On Tue, 2016-11-15 at 18:32 +0100, Victor Toso wrote:
> Hi,
> 
> On Tue, Nov 15, 2016 at 06:21:46PM +0100, Pavel Grunt wrote:
> > On Tue, 2016-11-15 at 12:10 -0500, Frediano Ziglio wrote:
> > > > 
> > > > Avoid the following warning when build with disabled
> > > > gstreamer:
> > > > Spice-WARNING **: reds.c:3660:reds_set_video_codecs: spice:
> > > > unsupported video
> > > > encoder gstreamer
> > > > ---
> > > >  server/reds.c | 7 ++++++-
> > > >  1 file changed, 6 insertions(+), 1 deletion(-)
> > > > 
> > > > diff --git a/server/reds.c b/server/reds.c
> > > > index 5daf9bd..5456d22 100644
> > > > --- a/server/reds.c
> > > > +++ b/server/reds.c
> > > > @@ -3510,7 +3510,12 @@ err:
> > > >  }
> > > >  
> > > >  static const char default_renderer[] = "sw";
> > > > -static const char default_video_codecs[] =
> > > > "spice:mjpeg;gstreamer:mjpeg;gstreamer:h264;gstreamer:vp8";
> > > > +static const char default_video_codecs[] = "spice:mjpeg;"
> > > > +#if defined(HAVE_GSTREAMER_1_0) ||
> > > > defined(HAVE_GSTREAMER_0_10)
> > > > +
> > > > "gstreamer:mjpeg;gstreamer:h264;gstreamer:vp8";
> > > > +#else
> > > > +                                           "";
> > > > +#endif
> > > >  
> > > >  /* new interface */
> > > >  SPICE_GNUC_VISIBLE SpiceServer *spice_server_new(void)
> > > 
> > > I would use something like
> > > 
> > > 
> > > #if defined(HAVE_GSTREAMER_1_0) || defined(HAVE_GSTREAMER_0_10)
> > > #define GSTREAMER_CODECS
> > > "gstreamer:mjpeg;gstreamer:h264;gstreamer:vp8"
> > > #else
> > > #define GSTREAMER_CODECS ""
> > > #endif
> > > static const char default_video_codecs[] = "spice:mjpeg;"
> > > GSTREAMER_CODECS;
> > > 
> > > 
> > > But maybe it's just me.
> > 
> > It is more readable, i will go for it
> > 
> > > Doesn't the string ending with ';' cause problems with the
> > > parsing?
> > > 
> > 
> > It doesn't - the check for end is:
> >          while (*codecs != '\0' && *codecs != ';') {
> 
> Ii does as it will end the parser on ';' -- gstreamer bits will be
> lost

Check parse_video_codecs(), it is called on a string of pairs
ENCODER:CODEC separated by semicolons

Regex:
{;*[0-9a-zA-Z_]*:[0-9a-zA-Z_]*;*}*

The function first skips ;* after that return NULL if '\0' and then it
 tries to scan the pair. In the end it return pointer to the next
potential pair

Pavel

> 
> > 
> > Thanks,
> > Pavel
> > 
> > > Maybe
> > > 
> > > 
> > > #if defined(HAVE_GSTREAMER_1_0) || defined(HAVE_GSTREAMER_0_10)
> > > #define GSTREAMER_CODECS
> > > ";gstreamer:mjpeg;gstreamer:h264;gstreamer:vp8"
> > > #else
> > > #define GSTREAMER_CODECS ""
> > > #endif
> > > static const char default_video_codecs[] = "spice:mjpeg"
> > > GSTREAMER_CODECS;
> > > 
> > > 
> > > Frediano
> > 
> > _______________________________________________
> > Spice-devel mailing list
> > Spice-devel at lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/spice-devel


More information about the Spice-devel mailing list