summaryrefslogtreecommitdiffstats
path: root/gst/videobox
diff options
context:
space:
mode:
authorJulien Moutte <julien@moutte.net>2005-10-17 15:14:29 +0000
committerJulien Moutte <julien@moutte.net>2005-10-17 15:14:29 +0000
commitaa522287641fbd8a71ba8e353f0696c53442ecb3 (patch)
treeb584ed59ad18306a60e2d05742a314909d17a52a /gst/videobox
parentd472134c41418fcb34a9153761b2018de017d74c (diff)
gst/videobox/gstvideobox.c: Fix wrong size calculations and implement get_unit_size correctly.
Original commit message from CVS: 2005-10-17 Julien MOUTTE <julien@moutte.net> * gst/videobox/gstvideobox.c: (gst_video_box_transform_caps), (gst_video_box_get_unit_size): Fix wrong size calculations and implement get_unit_size correctly.
Diffstat (limited to 'gst/videobox')
-rw-r--r--gst/videobox/gstvideobox.c30
1 files changed, 20 insertions, 10 deletions
diff --git a/gst/videobox/gstvideobox.c b/gst/videobox/gstvideobox.c
index 2aff4074..9b548528 100644
--- a/gst/videobox/gstvideobox.c
+++ b/gst/videobox/gstvideobox.c
@@ -349,10 +349,10 @@ gst_video_box_transform_caps (GstBaseTransform * trans,
structure = gst_caps_get_structure (to, i);
if (gst_structure_get_int (structure, "width", &tmp))
gst_structure_set (structure, "width", G_TYPE_INT,
- tmp + direction * (video_box->box_left + video_box->box_right), NULL);
+ tmp + dir * (video_box->box_left + video_box->box_right), NULL);
if (gst_structure_get_int (structure, "height", &tmp))
gst_structure_set (structure, "height", G_TYPE_INT,
- tmp + direction * (video_box->box_top + video_box->box_bottom), NULL);
+ tmp + dir * (video_box->box_top + video_box->box_bottom), NULL);
}
return to;
@@ -398,18 +398,28 @@ gst_video_box_get_unit_size (GstBaseTransform * trans, GstCaps * caps,
guint * size)
{
GstVideoBox *video_box;
+ GstStructure *structure = NULL;
+ guint32 fourcc;
+ gint width, height;
g_return_val_if_fail (size, FALSE);
video_box = GST_VIDEO_BOX (trans);
- if (gst_caps_is_equal (caps, GST_PAD_CAPS (trans->sinkpad))) {
- *size = GST_VIDEO_I420_SIZE (video_box->in_width, video_box->in_height);
- } else if (gst_caps_is_equal (caps, GST_PAD_CAPS (trans->srcpad))) {
- if (video_box->use_alpha) {
- *size = video_box->out_height * video_box->out_height * 4;
- } else {
- *size = GST_VIDEO_I420_SIZE (video_box->out_width, video_box->out_height);
- }
+ structure = gst_caps_get_structure (caps, 0);
+ gst_structure_get_fourcc (structure, "format", &fourcc);
+ gst_structure_get_int (structure, "width", &width);
+ gst_structure_get_int (structure, "height", &height);
+
+ switch (fourcc) {
+ case GST_MAKE_FOURCC ('A', 'Y', 'U', 'V'):
+ *size = width * height * 4;
+ break;
+ case GST_MAKE_FOURCC ('I', '4', '2', '0'):
+ *size = GST_VIDEO_I420_SIZE (width, height);
+ break;
+ default:
+ return FALSE;
+ break;
}
return TRUE;