Add untested get-video-size function (bug 104360)

Original commit message from CVS:
Add untested get-video-size function (bug 104360)
This commit is contained in:
Ronald S. Bultje 2003-01-30 20:47:43 +00:00
parent 02b97c7b22
commit d1cdccccce
2 changed files with 41 additions and 5 deletions

View File

@ -49,6 +49,39 @@ gst_video_frame_rate (GstPad *pad)
return fps;
}
gboolean
gst_video_get_size (GstPad *pad,
gint *width,
gint *height)
{
GstCaps *caps;
g_return_val_if_fail(pad != NULL, FALSE);
caps = GST_PAD_CAPS(pad);
if (!caps) {
g_warning("gstvideo: failed to get caps of pad %s:%s",
GST_ELEMENT_NAME(gst_pad_get_parent (pad)), GST_PAD_NAME(pad));
return FALSE;
}
if (!gst_caps_has_property(caps, "width") ||
!gst_caps_has_property(caps, "height")) {
g_warning("gstvideo: resulting caps doesn't have width/height properties");
return FALSE;
}
if (width)
gst_caps_get_int(caps, "width", width);
if (height)
gst_caps_get_int(caps, "height", height);
GST_DEBUG(GST_CAT_ELEMENT_PADS, "size request on pad %s:%s: %dx%d",
GST_ELEMENT_NAME(gst_pad_get_parent (pad)), GST_PAD_NAME(pad),
width?*width:0, height?*height:0);
return TRUE;
}
static gboolean
plugin_init (GModule *module, GstPlugin *plugin)
{

View File

@ -24,5 +24,8 @@
#include <gst/gst.h>
gdouble gst_video_frame_rate (GstPad *pad);
gboolean gst_video_get_size (GstPad *pad,
gint *width,
gint *height);
#endif /* __GST_VIDEO_H__ */