[gst-devel] does gstreamer support sub-square buffer transfer

zhangfei gao zhangfei.gao at gmail.com
Thu Jul 12 06:02:19 CEST 2007


Hi, Time

Thank you for your valuable inforamtion.
As your suggestion, we want to support 2d_sub_buffer , it will be more
meanful if the idea could be accepted by opensource experts, so could you
help review the idea and feasibility in advance.

See this figure, we just want to render display 2d_sub_buffer (x, y, w, h),
which is located inside transferd buffer.

Note: 2d_sub_buffer is based on the original buffer, they are sharing memory
and without memcpy. Here sub buffer just used to notify the sub area, no new
buffer is created.

Problem is how to negotiate with render where is the effective area.

New caps area is "2d_sud_buffer", if render do not detect such area, it will
do as usual to ensure compatibility, and render display the whole area.

2d_sud_buffer structure is as following, same as GstVideoRectangle.


typedef struct _2d_sud_buffer 2d_sud_buffer;

/**

 * 2d_sud_buffer:

 * @x: X coordinate of 2d-sud-buffer's top-left point

 * @y: Y coordinate of 2d-sud-buffer 's top-left point

 * @w: width of the 2d-sud-buffer

 * @h: height of the 2d-sud-buffer

 *

*/

struct _2d_sud_buffer {

  gint x;

  gint y;

  gint w;

  gint h;
};

Option 1:
Just send address of the 2d_sub_buffer by G_TYPE_INT.
In render set_capas function, we re-construct this structure by (2d_sub_buffer
*) priv.

Option 2:
Add one field in caps, such as G_TYPE_2D_SUB_BUFFER.
transmitter caps:
gst_caps_new_simple ("video/x-raw-yuv",
  "format", GST_TYPE_FOURCC, GST_MAKE_FOURCC ('Y', 'V', '1', '2'),
  "width", G_TYPE_INT, frameWidth,
  "height", G_TYPE_INT, frameHeight,
  "framerate", GST_TYPE_FRACTION, num, den,
 * "2d_sub_buffer", G_TYPE_2D_SUB_BUFFER, x, y, w, h,
*  NULL);

reciver set_caps:
if ((value = gst_structure_get_value (str, "2d_sub_buffer"))) {
   rect.x = gst_value_get_2d_sub_buffer_x(value);
   rect.y = gst_value_get_2d_sub_buffer_y(value);
   rect.w = gst_value_get_2d_sub_buffer_w(value);
   rect.h = gst_value_get_2d_sub_buffer_h(value);
  }

 If use option 2, Gstvalue.c and Gststructure.c need add a patch.

Could you give some suggestions.
Waiting for your instructions.

Thanks.




On 7/5/07, Tim Müller <t.i.m at zen.co.uk> wrote:
>
> On Thu, 2007-07-05 at 21:11 +0800, zhangfei gao wrote:
>
> > I am really wandering whether GStreamer supports transfering buffer
> > with padding or stride.
> > How to send information to post element that only pats of buffer is
> > effective.
> > Does caps negotiations support this function.
> >
> > If gstreamer can not support this feature, one aditional memcpy can
> > not be saved, which may down 3~4fps.
>
> Unfortunately, GStreamer does not support this yet.  Strides and row
> padding for the various formats in GStreamer are mostly implicit at the
> moment.  Border padding/cropping isn't defined/used at all.  It's
> something we want to fix though, it's just that no one has gotten around
> to actually doing it yet.
>
> You are of course free to create your own video/x-raw-my-yuv format
> which has additional parameters like that, but obviously that would only
> work for GStreamer pipelines (or parts thereof) that consist only of
> elements you have written and not any of the stock GStreamer elements.
>
> Cheers
> -Tim
>
>
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by DB2 Express
> Download DB2 Express C - the FREE version of DB2 express and take
> control of your XML. No limits. Just data. Click to get it now.
> http://sourceforge.net/powerbar/db2/
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20070712/20f57795/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.jpg
Type: image/jpeg
Size: 2816 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20070712/20f57795/attachment.jpg>


More information about the gstreamer-devel mailing list