[Bug 736100] video-info: doesn't return the right I420 image size for certain resolutions
GStreamer (bugzilla.gnome.org)
bugzilla at gnome.org
Sat Sep 6 11:54:39 PDT 2014
https://bugzilla.gnome.org/show_bug.cgi?id=736100
GStreamer | gst-plugins-base | git
--- Comment #4 from Aleix Conchillo Flaqué <aconchillo at gmail.com> 2014-09-06 18:54:34 UTC ---
In case anyone else needs this. This is what I end up doing which fixes the
problem.
-----
static void
WebRtcI420ToGStreamer (guint8 *dst, guint8 *src, gint width, gint height)
{
GstVideoInfo info;
gst_video_info_init (&info);
gst_video_info_set_format (&info, GST_VIDEO_FORMAT_I420, width, height);
guint src_y_stride = width;
guint src_u_stride = (width + 1) / 2;
guint src_v_stride = (width + 1) / 2;
guint dst_y_stride = GST_VIDEO_INFO_COMP_STRIDE (&info, 0);
guint dst_u_stride = GST_VIDEO_INFO_COMP_STRIDE (&info, 1);
guint dst_v_stride = GST_VIDEO_INFO_COMP_STRIDE (&info, 2);
// Y
for (guint h = 0; h < height; h++)
{ memcpy (dst, src, src_y_stride);
dst += dst_y_stride;
src += src_y_stride;
}
// U
for (guint h = 0; h < height / 2; h++)
{ memcpy (dst, src, src_u_stride);
dst += dst_u_stride;
src += src_u_stride;
}
// V
for (guint h = 0; h < height / 2; h++)
{ memcpy (dst, src, src_v_stride);
dst += dst_v_stride;
src += src_v_stride;
}
}
--
Configure bugmail: https://bugzilla.gnome.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.
More information about the gstreamer-bugs
mailing list