[gst-devel] Re: [gst-cvs] rbultje gst-plugins: gst-plugins/sys/xvideo/

Thomas Vander Stichele thomas at urgent.rug.ac.be
Mon Sep 16 02:03:03 CEST 2002


Hey ronald,

I seem to be having a missing gstimage.h, something you forgot to commit ?

Thanks,
Thomas

> CVS Root:       /cvsroot/gstreamer
> Module:         gst-plugins
> Changes by:     rbultje
> Date:           Mon Sep 16 2002  00:26:58 PDT
> 
> Log message:
> Fixes bug 92958 - gstplayer should be able to play multiple movies now
> 
> Modified files:
>     sys/xvideo      : Makefile.am gstximage.c gstximage.h gstxvimage.c
>                       gstxvimage.h xvideosink.c xvideosink.h
> 
> Links:
> http://cvs.sf.net/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins/sys/xvideo/Makefile.am.diff?r1=1.8&r2=1.9
> http://cvs.sf.net/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins/sys/xvideo/gstximage.c.diff?r1=1.4&r2=1.5
> http://cvs.sf.net/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins/sys/xvideo/gstximage.h.diff?r1=1.3&r2=1.4
> http://cvs.sf.net/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins/sys/xvideo/gstxvimage.c.diff?r1=1.11&r2=1.12
> http://cvs.sf.net/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins/sys/xvideo/gstxvimage.h.diff?r1=1.4&r2=1.5
> http://cvs.sf.net/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins/sys/xvideo/xvideosink.c.diff?r1=1.19&r2=1.20
> http://cvs.sf.net/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins/sys/xvideo/xvideosink.h.diff?r1=1.7&r2=1.8
> 
> ====Begin Diffs====
> Index: Makefile.am
> ===================================================================
> RCS file: /cvsroot/gstreamer/gst-plugins/sys/xvideo/Makefile.am,v
> retrieving revision 1.8
> retrieving revision 1.9
> diff -u -d -r1.8 -r1.9
> --- Makefile.am	13 May 2002 14:48:23 -0000	1.8
> +++ Makefile.am	16 Sep 2002 07:26:45 -0000	1.9
> @@ -17,7 +17,7 @@
>  libgstxvideosink_la_LIBADD = $(X_LIBS) $(XVIDEO_LIBS) 
>  libgstxvideosink_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
>  
> -noinst_HEADERS = xvideosink.h gstxwindow.h gstximage.h gstxvimage.h
> +noinst_HEADERS = xvideosink.h gstxwindow.h gstximage.h gstxvimage.h gstimage.h
>  
>  # FIXME: do we still need this test ? move it somewhere else ?
>  # check_PROGRAMS = imagetest
> Index: gstximage.c
> ===================================================================
> RCS file: /cvsroot/gstreamer/gst-plugins/sys/xvideo/gstximage.c,v
> retrieving revision 1.4
> retrieving revision 1.5
> diff -u -d -r1.4 -r1.5
> --- gstximage.c	25 Mar 2002 06:11:05 -0000	1.4
> +++ gstximage.c	16 Sep 2002 07:26:45 -0000	1.5
> @@ -64,6 +64,7 @@
>    GstXImage *new;
>  
>    new = g_new (GstXImage, 1);
> +  GST_IMAGE(new)->type = GST_IMAGE_TYPE_X_IMAGE;
>    new->width = width;
>    new->height = height;
>    new->window = window;
> Index: gstximage.h
> ===================================================================
> RCS file: /cvsroot/gstreamer/gst-plugins/sys/xvideo/gstximage.h,v
> retrieving revision 1.3
> retrieving revision 1.4
> diff -u -d -r1.3 -r1.4
> --- gstximage.h	25 Mar 2002 06:11:05 -0000	1.3
> +++ gstximage.h	16 Sep 2002 07:26:45 -0000	1.4
> @@ -19,7 +19,9 @@
>  
>  #include "gstxwindow.h"
>  
> -#define GST_XIMAGE(img)		(GstXImage*)(img)
> +#include "gstimage.h"
> +
> +#define GST_XIMAGE(img)		((GstXImage*)(img))
>  
>  typedef struct _GstXImage	      GstXImage;
>  
> @@ -35,6 +37,8 @@
>  
>  struct _GstXImage
>  {
> +  GstImage parent;
> +
>    GstXWindow *window;
>  #ifdef USE_SHM
>    XShmSegmentInfo SHMInfo;
> Index: gstxvimage.c
> ===================================================================
> RCS file: /cvsroot/gstreamer/gst-plugins/sys/xvideo/gstxvimage.c,v
> retrieving revision 1.11
> retrieving revision 1.12
> diff -u -d -r1.11 -r1.12
> --- gstxvimage.c	2 Jun 2002 15:08:37 -0000	1.11
> +++ gstxvimage.c	16 Sep 2002 07:26:45 -0000	1.12
> @@ -225,6 +225,7 @@
>  
>    image = g_new (GstXvImage, 1);
>  
> +  GST_IMAGE(image)->type = GST_IMAGE_TYPE_XV_IMAGE;
>    image->type = type;
>    image->width = width;
>    image->height = height;
> Index: gstxvimage.h
> ===================================================================
> RCS file: /cvsroot/gstreamer/gst-plugins/sys/xvideo/gstxvimage.h,v
> retrieving revision 1.4
> retrieving revision 1.5
> diff -u -d -r1.4 -r1.5
> --- gstxvimage.h	25 Mar 2002 06:11:05 -0000	1.4
> +++ gstxvimage.h	16 Sep 2002 07:26:45 -0000	1.5
> @@ -15,15 +15,19 @@
>  
>  #include "gstxwindow.h"
>  
> +#include "gstimage.h"
> +
>  typedef struct _GstXvImage	      GstXvImage;
>  typedef guint64                       GstXvImageType;
>  
> -#define GST_XVIMAGE(img)	(GstXvImage *)(img)
> +#define GST_XVIMAGE(img)	((GstXvImage *)(img))
>  #define GST_XVIMAGE_DATA(img)	((img)->data)
>  #define GST_XVIMAGE_SIZE(img)	((img)->size)
>  
>  struct _GstXvImage
>  {
> +  GstImage parent;
> +
>    GstXWindow *window;
>    GstXvImageType  type;
>  #ifdef HAVE_XVIDEO
> Index: xvideosink.c
> ===================================================================
> RCS file: /cvsroot/gstreamer/gst-plugins/sys/xvideo/xvideosink.c,v
> retrieving revision 1.19
> retrieving revision 1.20
> diff -u -d -r1.19 -r1.20
> --- xvideosink.c	8 Aug 2002 19:57:20 -0000	1.19
> +++ xvideosink.c	16 Sep 2002 07:26:45 -0000	1.20
> @@ -231,12 +231,36 @@
>  gst_xvideosink_buffer_free (GstBufferPool *pool, GstBuffer *buffer, gpointer user_data)
>  {
>    GstXVideoSink *xvideosink;
> +  gboolean keep_buffer = FALSE;
>  
>    xvideosink = GST_XVIDEOSINK (user_data);
> -  
> -  g_mutex_lock (xvideosink->pool_lock);
> -  xvideosink->image_pool = g_slist_prepend (xvideosink->image_pool, GST_BUFFER_POOL_PRIVATE (buffer));
> -  g_mutex_unlock (xvideosink->pool_lock);
> +
> +  /* the question is, to be or not to be, or rather: do the settings of the buffer still apply? */
> +  g_mutex_lock (xvideosink->lock);
> +  if (xvideosink->image) {
> +    if (GST_IMAGE (GST_BUFFER_POOL_PRIVATE (buffer))->type == GST_IMAGE_TYPE_XV_IMAGE &&
> +        xvideosink->image->type == GST_IMAGE_TYPE_XV_IMAGE &&
> +        GST_XVIMAGE (GST_BUFFER_POOL_PRIVATE (buffer))->size == GST_XVIMAGE (xvideosink->image)->size) { /* XvImage */
> +      keep_buffer = TRUE;
> +    } else if (GST_IMAGE (GST_BUFFER_POOL_PRIVATE (buffer))->type == GST_IMAGE_TYPE_X_IMAGE &&
> +        xvideosink->image->type == GST_IMAGE_TYPE_X_IMAGE &&
> +        GST_XIMAGE (GST_BUFFER_POOL_PRIVATE (buffer))->size == GST_XIMAGE (xvideosink->image)->size) { /* XImage */
> +      keep_buffer = TRUE;
> +    }
> +  }
> +  g_mutex_unlock(xvideosink->lock);
> +
> +  if (keep_buffer) {
> +    g_mutex_lock (xvideosink->pool_lock);
> +    xvideosink->image_pool = g_slist_prepend (xvideosink->image_pool, GST_BUFFER_POOL_PRIVATE (buffer));
> +    g_mutex_unlock (xvideosink->pool_lock);
> +  } else {
> +    if (GST_IMAGE (GST_BUFFER_POOL_PRIVATE (buffer))->type == GST_IMAGE_TYPE_XV_IMAGE) { /* XvImage */
> +      _gst_xvimage_destroy(GST_BUFFER_POOL_PRIVATE (buffer));
> +    } else { /* XImage */
> +      _gst_ximage_destroy(GST_BUFFER_POOL_PRIVATE (buffer));
> +    }
> +  }
>  
>    GST_BUFFER_DATA (buffer) = NULL;
>  
> @@ -254,8 +278,10 @@
>      switch (xvideosink->format) {
>        case GST_MAKE_FOURCC ('R','G','B',' '):
>          GST_DEBUG (0, "xvideosink: creating RGB XImage bufferpool");
> +        break;
>        default:
>          GST_DEBUG (0, "xvideosink: creating YUV XvImage bufferpool");
> +        break;
>      }
>  
>      xvideosink->bufferpool = gst_buffer_pool_new (
> @@ -295,29 +321,50 @@
>    GST_DEBUG (0, "xvideosink: setting %08x (%4.4s) %dx%d\n", 
>  		  xvideosink->format, (gchar*)&print_format, xvideosink->width, xvideosink->height);
>  
> +  g_mutex_lock (xvideosink->lock);
> +
> +  /* if we have any old image settings lying around, clean that up first */
> +  if (xvideosink->image) {
> +    if (xvideosink->image->type == GST_IMAGE_TYPE_XV_IMAGE) {
> +      _gst_xvimage_destroy(GST_XVIMAGE (xvideosink->image));
> +    } else {
> +      _gst_ximage_destroy(GST_XIMAGE (xvideosink->image));
> +    }
> +    xvideosink->image = NULL;
> +    g_mutex_lock(xvideosink->pool_lock);
> +    while (xvideosink->image_pool) {
> +      GstImage *image = xvideosink->image_pool->data;
> +      xvideosink->image_pool = g_slist_delete_link (xvideosink->image_pool, xvideosink->image_pool);
> +      if (image->type == GST_IMAGE_TYPE_XV_IMAGE) {
> +        _gst_xvimage_destroy(GST_XVIMAGE (image));
> +      } else {
> +        _gst_ximage_destroy(GST_XIMAGE (image));
> +      }  
> +    }
> +    g_mutex_unlock(xvideosink->pool_lock);
> +  }
> +
>    switch (xvideosink->format) {
>      case GST_MAKE_FOURCC ('R','G','B',' '):
> -      g_mutex_lock (xvideosink->lock);
> -      xvideosink->ximage = _gst_ximage_new ( 
> +      xvideosink->image = GST_IMAGE (_gst_ximage_new ( 
>  		      xvideosink->window, 
> -		      xvideosink->width, xvideosink->height);
> -      g_mutex_unlock (xvideosink->lock);
> -
> -      xvideosink->xvimage = NULL;
> +		      xvideosink->width, xvideosink->height));
>        break;
>      default:
> -      if (xvideosink->disable_xv)
> +      if (xvideosink->disable_xv) {
> +        g_mutex_unlock (xvideosink->lock);
>  	return GST_PAD_CONNECT_REFUSED;
> +      }
>  
> -      g_mutex_lock (xvideosink->lock);
> -      xvideosink->xvimage = _gst_xvimage_new ( 
> +      xvideosink->image = GST_IMAGE (_gst_xvimage_new ( 
>  		      xvideosink->format,
>  		      xvideosink->window, 
> -		      xvideosink->width, xvideosink->height);
> -      g_mutex_unlock (xvideosink->lock);
> -      xvideosink->ximage = NULL;
> +		      xvideosink->width, xvideosink->height));
>        break;
>    }
> +
> +  g_mutex_unlock (xvideosink->lock);
> +
>    if (xvideosink->auto_size) {
>      _gst_xwindow_resize (xvideosink->window, xvideosink->width, xvideosink->height);
>    }
> @@ -361,6 +408,8 @@
>    xvideosink->clock = NULL;
>    xvideosink->send_xid = FALSE;
>    xvideosink->need_new_window = FALSE;
> +
> +  xvideosink->image = NULL;
>    
>    GST_ELEMENT (xvideosink)->setclockfunc = gst_xvideosink_set_clock;
>  
> @@ -386,6 +435,14 @@
>  
>    G_OBJECT_CLASS (parent_class)->dispose (object);
>  
> +  if (xvideosink->image) {
> +    if (xvideosink->image->type == GST_IMAGE_TYPE_XV_IMAGE) {
> +      _gst_xvimage_destroy(GST_XVIMAGE (xvideosink->image));
> +    } else {
> +      _gst_ximage_destroy(GST_XIMAGE (xvideosink->image));
> +    }
> +  }
> +  
>    g_mutex_free (xvideosink->lock);
>    g_mutex_free (xvideosink->pool_lock);
>  }
> @@ -445,13 +502,14 @@
>      }
>    }
>    else {
> -    if (xvideosink->xvimage) {
> -      memcpy (GST_XVIMAGE_DATA (xvideosink->xvimage), GST_BUFFER_DATA (buf), GST_BUFFER_SIZE (buf));
> -      _gst_xvimage_put (xvideosink->window, xvideosink->xvimage);
> -    }
> -    else if (xvideosink->ximage) {
> -      memcpy (GST_XIMAGE_DATA (xvideosink->ximage), GST_BUFFER_DATA (buf), GST_BUFFER_SIZE (buf));
> -      _gst_ximage_put (xvideosink->window, xvideosink->ximage);
> +    if (xvideosink->image) {
> +      if (xvideosink->image->type == GST_IMAGE_TYPE_XV_IMAGE) {
> +        memcpy (GST_XVIMAGE_DATA (GST_XVIMAGE (xvideosink->image)), GST_BUFFER_DATA (buf), GST_BUFFER_SIZE (buf));
> +        _gst_xvimage_put (xvideosink->window, GST_XVIMAGE (xvideosink->image));
> +      } else {
> +        memcpy (GST_XIMAGE_DATA (GST_XIMAGE (xvideosink->image)), GST_BUFFER_DATA (buf), GST_BUFFER_SIZE (buf));
> +        _gst_ximage_put (xvideosink->window, GST_XIMAGE (xvideosink->image));
> +      }
>      }
>      else {
>        g_mutex_unlock (xvideosink->lock);
> @@ -673,13 +731,13 @@
>          gst_buffer_pool_unref (xvideosink->bufferpool);
>        xvideosink->bufferpool = NULL;
>        if (xvideosink->window) {
> -	if (xvideosink->ximage) {
> -          _gst_ximage_destroy (xvideosink->ximage);
> -	  xvideosink->ximage = NULL;
> -	}
> -	if (xvideosink->xvimage) {
> -          _gst_xvimage_destroy (xvideosink->xvimage);
> -	  xvideosink->xvimage = NULL;
> +	if (xvideosink->image) {
> +          if (xvideosink->image->type == GST_IMAGE_TYPE_XV_IMAGE) {
> +            _gst_xvimage_destroy (GST_XVIMAGE (xvideosink->image));
> +          } else {
> +            _gst_ximage_destroy (GST_XIMAGE (xvideosink->image));
> +          }
> +	  xvideosink->image = NULL;
>  	}
>  	_gst_xwindow_destroy (xvideosink->window);
>  	xvideosink->window = NULL;
> Index: xvideosink.h
> ===================================================================
> RCS file: /cvsroot/gstreamer/gst-plugins/sys/xvideo/xvideosink.h,v
> retrieving revision 1.7
> retrieving revision 1.8
> diff -u -d -r1.7 -r1.8
> --- xvideosink.h	19 Jun 2002 19:25:23 -0000	1.7
> +++ xvideosink.h	16 Sep 2002 07:26:45 -0000	1.8
> @@ -55,8 +55,7 @@
>    GstPad *sinkpad;
>  
>    GstXWindow *window;
> -  GstXImage *ximage;
> -  GstXvImage *xvimage;
> +  GstImage *image;
>  
>    guint32 format;
>    gint width, height;
> 
> 
> -------------------------------------------------------
> This sf.net email is sponsored by:ThinkGeek
> Welcome to geek heaven.
> http://thinkgeek.com/sf
> _______________________________________________
> gstreamer-cvs-verbose mailing list
> gstreamer-cvs-verbose at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gstreamer-cvs-verbose
> 

-- 

The Dave/Dina Project : future TV today ! - http://davedina.apestaart.org/
<-*-                      -*->
If lovin' you is wrong
then I don't wanna be right
<-*- thomas at apestaart.org -*->
URGent, the best radio on the Internet - 24/7 ! - http://urgent.rug.ac.be/





More information about the gstreamer-devel mailing list