gst/videobox/gstvideobox.c: Use pad_alloc where possible.

Original commit message from CVS:
* gst/videobox/gstvideobox.c: (gst_video_box_fill_get_type),
(gst_video_box_class_init), (gst_video_box_set_property),
(gst_video_box_i420), (gst_video_box_ayuv), (gst_video_box_chain):
Use pad_alloc where possible.
This commit is contained in:
Wim Taymans 2004-07-07 16:35:02 +00:00
parent f68667a5e5
commit 5fc7b9191f
2 changed files with 25 additions and 12 deletions

View file

@ -1,3 +1,10 @@
2004-07-07 Wim Taymans <wim@fluendo.com>
* gst/videobox/gstvideobox.c: (gst_video_box_fill_get_type),
(gst_video_box_class_init), (gst_video_box_set_property),
(gst_video_box_i420), (gst_video_box_ayuv), (gst_video_box_chain):
Use pad_alloc where possible.
2004-07-07 Wim Taymans <wim@fluendo.com> 2004-07-07 Wim Taymans <wim@fluendo.com>
* sys/oss/gstosselement.c: (gst_osselement_reset), * sys/oss/gstosselement.c: (gst_osselement_reset),

View file

@ -219,20 +219,24 @@ gst_video_box_class_init (GstVideoBoxClass * klass)
GST_TYPE_VIDEO_BOX_FILL, DEFAULT_FILL_TYPE, GST_TYPE_VIDEO_BOX_FILL, DEFAULT_FILL_TYPE,
(GParamFlags) G_PARAM_READWRITE)); (GParamFlags) G_PARAM_READWRITE));
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_LEFT, g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_LEFT,
g_param_spec_int ("left", "Left", "Pixels to box at left", g_param_spec_int ("left", "Left",
G_MININT, G_MAXINT, DEFAULT_LEFT, G_PARAM_READWRITE)); "Pixels to box at left (<0 = add a border)", G_MININT, G_MAXINT,
DEFAULT_LEFT, G_PARAM_READWRITE));
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_RIGHT, g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_RIGHT,
g_param_spec_int ("right", "Right", "Pixels to box at right", g_param_spec_int ("right", "Right",
G_MININT, G_MAXINT, DEFAULT_RIGHT, G_PARAM_READWRITE)); "Pixels to box at right (<0 = add a border)", G_MININT, G_MAXINT,
DEFAULT_RIGHT, G_PARAM_READWRITE));
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_TOP, g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_TOP,
g_param_spec_int ("top", "Top", "Pixels to box at top", g_param_spec_int ("top", "Top",
G_MININT, G_MAXINT, DEFAULT_TOP, G_PARAM_READWRITE)); "Pixels to box at top (<0 = add a border)", G_MININT, G_MAXINT,
DEFAULT_TOP, G_PARAM_READWRITE));
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_BOTTOM, g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_BOTTOM,
g_param_spec_int ("bottom", "Bottom", "Pixels to box at bottom", g_param_spec_int ("bottom", "Bottom",
G_MININT, G_MAXINT, DEFAULT_BOTTOM, G_PARAM_READWRITE)); "Pixels to box at bottom (<0 = add a border)", G_MININT, G_MAXINT,
DEFAULT_BOTTOM, G_PARAM_READWRITE));
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_ALPHA, g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_ALPHA,
g_param_spec_double ("alpha", "Alpha", "Alpha value picture", g_param_spec_double ("alpha", "Alpha", "Alpha value picture", 0.0, 1.0,
0.0, 1.0, DEFAULT_ALPHA, G_PARAM_READWRITE)); DEFAULT_ALPHA, G_PARAM_READWRITE));
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_BORDER_ALPHA, g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_BORDER_ALPHA,
g_param_spec_double ("border_alpha", "Border Alpha", g_param_spec_double ("border_alpha", "Border Alpha",
"Alpha value of the border", 0.0, 1.0, DEFAULT_BORDER_ALPHA, "Alpha value of the border", 0.0, 1.0, DEFAULT_BORDER_ALPHA,
@ -674,12 +678,14 @@ gst_video_box_chain (GstPad * pad, GstData * _data)
} }
if (video_box->use_alpha) { if (video_box->use_alpha) {
outbuf = gst_buffer_new_and_alloc (new_width * new_height * 4); outbuf = gst_pad_alloc_buffer (video_box->srcpad,
GST_BUFFER_OFFSET_NONE, new_width * new_height * 4);
gst_video_box_ayuv (video_box, gst_video_box_ayuv (video_box,
GST_BUFFER_DATA (buffer), GST_BUFFER_DATA (outbuf)); GST_BUFFER_DATA (buffer), GST_BUFFER_DATA (outbuf));
} else { } else {
outbuf = gst_buffer_new_and_alloc ((new_width * new_height * 3) / 2); outbuf = gst_pad_alloc_buffer (video_box->srcpad,
GST_BUFFER_OFFSET_NONE, (new_width * new_height * 3) / 2);
gst_video_box_i420 (video_box, gst_video_box_i420 (video_box,
GST_BUFFER_DATA (buffer), GST_BUFFER_DATA (outbuf)); GST_BUFFER_DATA (buffer), GST_BUFFER_DATA (outbuf));