> > On Fri, Oct 21, 2016 at 01:43:40PM +0100, Frediano Ziglio wrote: > > Signed-off-by: Frediano Ziglio <fziglio@xxxxxxxxxx> > > --- > > server/tests/gst-test.c | 55 > > +++++++++++++++++++++++++++++++++++++++++++++---- > > 1 file changed, 51 insertions(+), 4 deletions(-) > > > > Updated. Small rebase issue. > > > > diff --git a/server/tests/gst-test.c b/server/tests/gst-test.c > > index 0a68d7d..3277e04 100644 > > --- a/server/tests/gst-test.c > > +++ b/server/tests/gst-test.c > > @@ -54,6 +54,37 @@ typedef struct { > > SpiceBitmap *bitmap; > > } TestFrame; > > > > +#ifdef HAVE_GSTREAMER_0_10 > > + > > +#define VIDEOCONVERT "ffmpegcolorspace" > > +#define BGRx_CAPS > > "caps=video/x-raw-rgb,bpp=32,depth=24,blue_mask=-16777216,green_mask=16711680,red_mask=65280" > > + > > +typedef GstBuffer GstSample; > > +#define gst_sample_get_buffer(s) (s) > > +#define gst_sample_get_caps(s) GST_BUFFER_CAPS(s) > > +#define gst_sample_unref(s) gst_buffer_unref(s) > > +#define gst_app_sink_pull_sample(s) gst_app_sink_pull_buffer(s) > > +typedef struct { > > + uint8_t *data; > > +} GstMapInfo; > > +#define GST_MAP_READ 1 > > +static inline void > > +gst_buffer_unmap(GstBuffer *buffer, GstMapInfo *mapinfo) > > +{ } > > + > > +static inline gboolean > > +gst_buffer_map(GstBuffer *buffer, GstMapInfo *mapinfo, int flags) > > +{ > > + mapinfo->data = GST_BUFFER_DATA(buffer); > > + return mapinfo->data != NULL; > > +} > > +#else > > +#define VIDEOCONVERT "videoconvert" > > +#define BGRx_CAPS "caps=video/x-raw,format=BGRx" > > +#define gst_bus_set_sync_handler(bus, proc, param) \ > > + gst_bus_set_sync_handler(bus, proc, param, NULL) > > Can we have that compat #define in the HAVE_GSTREAME_0_10 branch, or is > it not going to work? > yes, just was easier to add a NULL parameter instead of removing checking it. > > +#endif > > + > > typedef void (*SampleProc)(GstSample *sample, void *param); > > > > typedef struct { > > @@ -214,7 +245,11 @@ static const EncoderInfo encoder_infos[] = { > > { "gstreamer:vp8", gstreamer_encoder_new, > > SPICE_VIDEO_CODEC_TYPE_VP8, > > "caps=video/x-vp8 ! vp8dec" }, > > { "gstreamer:h264", gstreamer_encoder_new, > > SPICE_VIDEO_CODEC_TYPE_H264, > > +#ifdef HAVE_GSTREAMER_0_10 > > + "! h264parse ! ffdec_h264" }, > > +#else > > "! h264parse ! avdec_h264" }, > > +#endif > > { NULL, NULL } > > }; > > > > @@ -491,7 +526,7 @@ create_pipeline(const char *desc, SampleProc > > sample_proc, void *param) > > gst_app_sink_set_callbacks(pipeline->appsink, &appsink_cbs, pipeline, > > NULL); > > > > GstBus *bus = gst_element_get_bus(pipeline->gst_pipeline); > > - gst_bus_set_sync_handler(bus, handle_pipeline_message, pipeline, > > NULL); > > + gst_bus_set_sync_handler(bus, handle_pipeline_message, pipeline); > > gst_object_unref(bus); > > > > if (gst_element_set_state(pipeline->gst_pipeline, GST_STATE_PLAYING) > > == > > @@ -508,7 +543,7 @@ create_output_pipeline(const EncoderInfo *encoder, > > SampleProc sample_proc, void > > { > > gchar *desc = > > g_strdup_printf("appsrc name=src is-live=true format=time > > max-bytes=0 block=true " > > - "%s ! videoconvert ! appsink name=sink > > caps=video/x-raw,format=BGRx" > > + "%s ! " VIDEOCONVERT " ! appsink name=sink " > > BGRx_CAPS > > " sync=false drop=false", encoder->caps_dec); > > > > TestPipeline *pipeline = create_pipeline(desc, sample_proc, param); > > @@ -525,7 +560,7 @@ static void > > create_input_pipeline(const char *input_pipeline_desc, SampleProc > > sample_proc, void *param) > > { > > gchar *desc = > > - g_strdup_printf("%s ! appsink name=sink > > caps=video/x-raw,format=BGRx" > > + g_strdup_printf("%s ! appsink name=sink " BGRx_CAPS > > " sync=false drop=false", input_pipeline_desc); > > > > TestPipeline *pipeline = create_pipeline(desc, sample_proc, param); > > @@ -548,14 +583,26 @@ video_buffer_release(VideoBuffer *video_buffer) > > static void > > pipeline_send_raw_data(TestPipeline *pipeline, VideoBuffer *video_buffer) > > { > > - GstBuffer *buffer = > > + GstBuffer *buffer; > > +#ifdef HAVE_GSTREAMER_0_10 > > + buffer = gst_buffer_new(); > > + > > + buffer->malloc_data = (void *) video_buffer; > > + GST_BUFFER_FREE_FUNC(buffer) = (void (*)(void *)) > > video_buffer_release; > > + GST_BUFFER_DATA(buffer) = video_buffer->data; > > + GST_BUFFER_SIZE(buffer) = video_buffer->size; > > > Maybe you could have a compat gst_buffer_new_wrapped_full() in the > #ifdef GSTREAMER_0_10 block ? > I'll try. > Looks good otherwise, > > Christophe > Frediano _______________________________________________ Spice-devel mailing list Spice-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/spice-devel