diff options
author | Tim-Philipp Müller <tim@centricular.net> | 2008-02-01 13:02:53 +0000 |
---|---|---|
committer | Tim-Philipp Müller <tim@centricular.net> | 2008-02-01 13:02:53 +0000 |
commit | 1bd5b1ddf7b8334157b603f86da09a697f886406 (patch) | |
tree | 9d9a6384d3ecaea4c4f6ebc35e0ca0c3a0313080 /gst/deinterlace | |
parent | 7a44301116944d95af91dca94eae3802dd776121 (diff) | |
download | gst-plugins-bad-1bd5b1ddf7b8334157b603f86da09a697f886406.tar.gz gst-plugins-bad-1bd5b1ddf7b8334157b603f86da09a697f886406.tar.bz2 gst-plugins-bad-1bd5b1ddf7b8334157b603f86da09a697f886406.zip |
configure.ac: Bump core/base requirements to released versions, to avoid confusion.
Original commit message from CVS:
* configure.ac:
Bump core/base requirements to released versions, to avoid confusion.
* gst/deinterlace/Makefile.am:
* gst/deinterlace/gstdeinterlace.c: (gst_deinterlace_set_caps):
Use the new GstVideoFormat API to get strides, plane offsets etc..
For Y42B we still need to calculate these ourselves, since the lib
in -base doesn't know about this format yet and we can't bump the
requirement to CVS right now. Fix the Y42B stride, offset and size
calculations for odd widths and heights while we're at it though
(to match those in videotestsrc).
Diffstat (limited to 'gst/deinterlace')
-rw-r--r-- | gst/deinterlace/Makefile.am | 7 | ||||
-rw-r--r-- | gst/deinterlace/gstdeinterlace.c | 58 |
2 files changed, 35 insertions, 30 deletions
diff --git a/gst/deinterlace/Makefile.am b/gst/deinterlace/Makefile.am index 22a691b5..3c1b5f5a 100644 --- a/gst/deinterlace/Makefile.am +++ b/gst/deinterlace/Makefile.am @@ -1,9 +1,10 @@ plugin_LTLIBRARIES = libgstdeinterlace.la -# NOTE: we don't need $(GST_PLUGINS_BASE_LIBS) at the moment libgstdeinterlace_la_SOURCES = gstdeinterlace.c -libgstdeinterlace_la_CFLAGS = $(GST_BASE_CFLAGS) $(GST_PLUGINS_BASE_CFLAGS) -libgstdeinterlace_la_LIBADD = $(GST_BASE_LIBS) +libgstdeinterlace_la_CFLAGS = \ + $(GST_PLUGINS_BASE_CFLAGS) $(GST_BASE_CFLAGS) +libgstdeinterlace_la_LIBADD = \ + $(GST_PLUGINS_BASE_LIBS) -lgstvideo-$(GST_MAJORMINOR) $(GST_BASE_LIBS) libgstdeinterlace_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) noinst_HEADERS = gstdeinterlace.h diff --git a/gst/deinterlace/gstdeinterlace.c b/gst/deinterlace/gstdeinterlace.c index e298c547..f0cc9880 100644 --- a/gst/deinterlace/gstdeinterlace.c +++ b/gst/deinterlace/gstdeinterlace.c @@ -178,54 +178,58 @@ gst_deinterlace_set_caps (GstBaseTransform * trans, GstCaps * incaps, GstCaps * outcaps) { GstDeinterlace *filter; + GstVideoFormat fmt; GstStructure *s; - gint picsize; + guint32 fourcc; + gint picsize, w, h; filter = GST_DEINTERLACE (trans); g_assert (gst_caps_is_equal_fixed (incaps, outcaps)); s = gst_caps_get_structure (incaps, 0); - if (!gst_structure_get_int (s, "width", &filter->width) || - !gst_structure_get_int (s, "height", &filter->height)) { + if (!gst_structure_get_int (s, "width", &w) || + !gst_structure_get_int (s, "height", &h) || + !gst_structure_get_fourcc (s, "format", &fourcc)) { return FALSE; } - if (!gst_structure_get_fourcc (s, "format", &filter->fourcc)) - return FALSE; - - GST_LOG_OBJECT (filter, "width x height = %d x %d", filter->width, - filter->height); + filter->width = w; + filter->height = h; + filter->fourcc = fourcc; - /*4:2:0 */ - filter->uv_height = filter->height / 2; - filter->y_stride = GST_ROUND_UP_4 (filter->width); - filter->u_stride = GST_ROUND_UP_8 (filter->width) / 2; - filter->v_stride = GST_ROUND_UP_8 (filter->width) / 2; + GST_DEBUG_OBJECT (filter, "width x height = %d x %d, fourcc: %" + GST_FOURCC_FORMAT, w, h, GST_FOURCC_ARGS (fourcc)); - filter->y_off = 0; - filter->u_off = 0 + filter->y_stride * GST_ROUND_UP_2 (filter->height); - filter->v_off = - filter->u_off + filter->u_stride * (GST_ROUND_UP_2 (filter->height) / 2); + fmt = gst_video_format_from_fourcc (fourcc); - picsize = - (filter->v_off + - (filter->v_stride * GST_ROUND_UP_2 (filter->height) / 2)); + if (fmt == GST_VIDEO_FORMAT_UNKNOWN) { + /* this is Y42B (4:2:2 planar) which -base <= 0.10.17 doesn't know about */ + /* FIXME: remove this once we can depend on -base >= 0.10.17.1 */ + g_assert (fourcc == GST_MAKE_FOURCC ('Y', '4', '2', 'B')); - /*4:2:2 */ - if (filter->fourcc == GST_MAKE_FOURCC ('Y', '4', '2', 'B')) { filter->uv_height = filter->height; filter->y_stride = GST_ROUND_UP_4 (filter->width); filter->u_stride = GST_ROUND_UP_8 (filter->width) / 2; filter->v_stride = GST_ROUND_UP_8 (filter->width) / 2; filter->y_off = 0; - filter->u_off = 0 + filter->y_stride * GST_ROUND_UP_2 (filter->height); - filter->v_off = - filter->u_off + filter->u_stride * (GST_ROUND_UP_2 (filter->height)); + filter->u_off = 0 + filter->y_stride * filter->height; + filter->v_off = filter->u_off + filter->u_stride * filter->height; + + picsize = filter->v_off + (filter->v_stride * filter->height); + } else { + filter->y_stride = gst_video_format_get_row_stride (fmt, 0, w); + filter->u_stride = gst_video_format_get_row_stride (fmt, 1, w); + filter->v_stride = gst_video_format_get_row_stride (fmt, 2, w); + + filter->uv_height = gst_video_format_get_component_height (fmt, 1, h); + + filter->y_off = gst_video_format_get_component_offset (fmt, 0, w, h); + filter->u_off = gst_video_format_get_component_offset (fmt, 1, w, h); + filter->v_off = gst_video_format_get_component_offset (fmt, 2, w, h); - picsize = - (filter->v_off + (filter->v_stride * GST_ROUND_UP_2 (filter->height))); + picsize = gst_video_format_get_size (fmt, w, h); } if (filter->picsize != picsize) { |