diff options
author | David Schleef <ds@schleef.org> | 2003-12-22 01:47:09 +0000 |
---|---|---|
committer | David Schleef <ds@schleef.org> | 2003-12-22 01:47:09 +0000 |
commit | b144bc6c58979f49a6e8e04a04a65f771247297a (patch) | |
tree | 648bc437ca5562bc7c67224ad71ef90dfacc12d1 /gst-libs/gst/video | |
parent | 2309d726b7b0c37dbd9c57c653e2053ec6258ac8 (diff) | |
download | gst-plugins-bad-b144bc6c58979f49a6e8e04a04a65f771247297a.tar.gz gst-plugins-bad-b144bc6c58979f49a6e8e04a04a65f771247297a.tar.bz2 gst-plugins-bad-b144bc6c58979f49a6e8e04a04a65f771247297a.zip |
Merge CAPS branch
Original commit message from CVS:
Merge CAPS branch
Diffstat (limited to 'gst-libs/gst/video')
-rw-r--r-- | gst-libs/gst/video/video.c | 29 | ||||
-rw-r--r-- | gst-libs/gst/video/video.h | 346 |
2 files changed, 173 insertions, 202 deletions
diff --git a/gst-libs/gst/video/video.c b/gst-libs/gst/video/video.c index 706acc3b..6d804a4d 100644 --- a/gst-libs/gst/video/video.c +++ b/gst-libs/gst/video/video.c @@ -26,11 +26,12 @@ /* This is simply a convenience function, nothing more or less */ -gfloat +gdouble gst_video_frame_rate (GstPad *pad) { - gfloat fps = 0.; + gdouble fps = 0.; GstCaps *caps; + GstStructure *structure; /* get pad caps */ caps = GST_PAD_CAPS (pad); @@ -41,16 +42,14 @@ gst_video_frame_rate (GstPad *pad) return 0.; } - if (!gst_caps_has_property_typed (caps, "framerate", - GST_PROPS_FLOAT_TYPE)) { + structure = gst_caps_get_structure (caps, 0); + if (!gst_structure_get_double (structure, "framerate", &fps)){ g_warning ("gstvideo: failed to get framerate property of pad %s:%s", GST_ELEMENT_NAME (gst_pad_get_parent (pad)), GST_PAD_NAME (pad)); return 0.; } - gst_caps_get_float (caps, "framerate", &fps); - GST_DEBUG ("Framerate request on pad %s:%s: %f", GST_ELEMENT_NAME (gst_pad_get_parent (pad)), GST_PAD_NAME(pad), fps); @@ -64,8 +63,12 @@ gst_video_get_size (GstPad *pad, gint *height) { GstCaps *caps; + GstStructure *structure; + gboolean ret; g_return_val_if_fail (pad != NULL, FALSE); + g_return_val_if_fail (width != NULL, FALSE); + g_return_val_if_fail (height != NULL, FALSE); caps = GST_PAD_CAPS (pad); @@ -76,21 +79,17 @@ gst_video_get_size (GstPad *pad, return FALSE; } - if (!gst_caps_has_property_typed (caps, "width", - GST_PROPS_INT_TYPE) || - !gst_caps_has_property_typed (caps, "height", - GST_PROPS_FLOAT_TYPE)) { + structure = gst_caps_get_structure (caps, 0); + ret = gst_structure_get_int (structure, "width", width); + ret &= gst_structure_get_int (structure, "height", height); + + if (!ret) { g_warning ("gstvideo: failed to get size properties on pad %s:%s", GST_ELEMENT_NAME (gst_pad_get_parent (pad)), GST_PAD_NAME(pad)); return FALSE; } - if (width) - gst_caps_get_int (caps, "width", width); - if (height) - gst_caps_get_int (caps, "height", height); - GST_DEBUG ("size request on pad %s:%s: %dx%d", GST_ELEMENT_NAME (gst_pad_get_parent (pad)), GST_PAD_NAME (pad), diff --git a/gst-libs/gst/video/video.h b/gst-libs/gst/video/video.h index 3ce2a2e9..7f5a1fdf 100644 --- a/gst-libs/gst/video/video.h +++ b/gst-libs/gst/video/video.h @@ -23,203 +23,175 @@ #include <gst/gst.h> -#define R_MASK_32 0xff000000 -#define G_MASK_32 0x00ff0000 -#define B_MASK_32 0x0000ff00 +#define R_MASK_32 "0xff000000" +#define G_MASK_32 "0x00ff0000" +#define B_MASK_32 "0x0000ff00" -#define R_MASK_32_REVERSE 0x000000ff -#define G_MASK_32_REVERSE 0x0000ff00 -#define B_MASK_32_REVERSE 0x00ff0000 +#define R_MASK_32_REVERSE "0x000000ff" +#define G_MASK_32_REVERSE "0x0000ff00" +#define B_MASK_32_REVERSE "0x00ff0000" -#define R_MASK_24 0xff0000 -#define G_MASK_24 0x00ff00 -#define B_MASK_24 0x0000ff +#define R_MASK_24 "0xff0000" +#define G_MASK_24 "0x00ff00" +#define B_MASK_24 "0x0000ff" -#define R_MASK_24_REVERSE 0x0000ff -#define G_MASK_24_REVERSE 0x00ff00 -#define B_MASK_24_REVERSE 0xff0000 +#define R_MASK_24_REVERSE "0x0000ff" +#define G_MASK_24_REVERSE "0x00ff00" +#define B_MASK_24_REVERSE "0xff0000" -#define R_MASK_16 0xf800 -#define G_MASK_16 0x07e0 -#define B_MASK_16 0x001f +#define R_MASK_16 "0xf800" +#define G_MASK_16 "0x07e0" +#define B_MASK_16 "0x001f" -#define R_MASK_15 0x8c00 -#define G_MASK_15 0x03e0 -#define B_MASK_15 0x001f +#define R_MASK_15 "0x7c00" +#define G_MASK_15 "0x03e0" +#define B_MASK_15 "0x001f" -#define SIZE_RANGE GST_PROPS_INT_RANGE (16, 4096) -#define FPS_RANGE GST_PROPS_FLOAT_RANGE (0, G_MAXFLOAT) +#define R_MASK_32_INT 0xff000000 +#define G_MASK_32_INT 0x00ff0000 +#define B_MASK_32_INT 0x0000ff00 + +#define R_MASK_32_REVERSE_INT 0x000000ff +#define G_MASK_32_REVERSE_INT 0x0000ff00 +#define B_MASK_32_REVERSE_INT 0x00ff0000 + +#define R_MASK_24_INT 0xff0000 +#define G_MASK_24_INT 0x00ff00 +#define B_MASK_24_INT 0x0000ff + +#define R_MASK_24_REVERSE_INT 0x0000ff +#define G_MASK_24_REVERSE_INT 0x00ff00 +#define B_MASK_24_REVERSE_INT 0xff0000 + +#define R_MASK_16_INT 0xf800 +#define G_MASK_16_INT 0x07e0 +#define B_MASK_16_INT 0x001f + +#define R_MASK_15_INT 0x7c00 +#define G_MASK_15_INT 0x03e0 +#define B_MASK_15_INT 0x001f + +#define SIZE_RANGE "(int) [ 16, 4096 ]" +#define FPS_RANGE "(double) [ 0, max ]" /* properties for pad templates */ -#define GST_VIDEO_RGB_PAD_TEMPLATE_PROPS_24_32 \ - gst_props_new ( \ - "bpp", GST_PROPS_LIST ( \ - GST_PROPS_INT (24), \ - GST_PROPS_INT (32) \ - ), \ - "depth", GST_PROPS_LIST ( \ - GST_PROPS_INT (24), \ - GST_PROPS_INT (32) \ - ), \ - "endianness", GST_PROPS_INT (G_BIG_ENDIAN), \ - "red_mask", GST_PROPS_LIST ( \ - GST_PROPS_INT (R_MASK_32), \ - GST_PROPS_INT (R_MASK_24) \ - ), \ - "green_mask", GST_PROPS_LIST ( \ - GST_PROPS_INT (G_MASK_32), \ - GST_PROPS_INT (G_MASK_24) \ - ), \ - "blue_mask", GST_PROPS_LIST ( \ - GST_PROPS_INT (B_MASK_32), \ - GST_PROPS_INT (B_MASK_24) \ - ), \ - "width", SIZE_RANGE, \ - "height", SIZE_RANGE, \ - "framerate", FPS_RANGE, \ - NULL) - -#define GST_VIDEO_RGB_PAD_TEMPLATE_PROPS_24_32_REVERSE \ - gst_props_new ( \ - "bpp", GST_PROPS_LIST ( \ - GST_PROPS_INT (24), \ - GST_PROPS_INT (32) \ - ), \ - "depth", GST_PROPS_LIST ( \ - GST_PROPS_INT (24), \ - GST_PROPS_INT (32) \ - ), \ - "endianness", GST_PROPS_INT (G_BIG_ENDIAN), \ - "red_mask", GST_PROPS_LIST ( \ - GST_PROPS_INT (R_MASK_32_REVERSE), \ - GST_PROPS_INT (R_MASK_24_REVERSE) \ - ), \ - "green_mask", GST_PROPS_LIST ( \ - GST_PROPS_INT (G_MASK_32_REVERSE), \ - GST_PROPS_INT (G_MASK_24_REVERSE) \ - ), \ - "blue_mask", GST_PROPS_LIST ( \ - GST_PROPS_INT (B_MASK_32_REVERSE), \ - GST_PROPS_INT (B_MASK_24_REVERSE) \ - ), \ - "width", SIZE_RANGE, \ - "height", SIZE_RANGE, \ - "framerate", FPS_RANGE, \ - NULL) - -#define GST_VIDEO_RGB_PAD_TEMPLATE_PROPS_32 \ - gst_props_new ( \ - "bpp", GST_PROPS_INT (32), \ - "depth", GST_PROPS_INT (32), \ - "endianness", GST_PROPS_INT (G_BIG_ENDIAN), \ - "red_mask", GST_PROPS_INT (R_MASK_32), \ - "green_mask", GST_PROPS_INT (G_MASK_32), \ - "blue_mask", GST_PROPS_INT (B_MASK_32), \ - "width", SIZE_RANGE, \ - "height", SIZE_RANGE, \ - "framerate", FPS_RANGE, \ - NULL) - -#define GST_VIDEO_RGB_PAD_TEMPLATE_PROPS_24 \ - gst_props_new ( \ - "bpp", GST_PROPS_INT (24), \ - "depth", GST_PROPS_INT (24), \ - "endianness", GST_PROPS_INT (G_BIG_ENDIAN), \ - "red_mask", GST_PROPS_INT (R_MASK_24), \ - "green_mask", GST_PROPS_INT (G_MASK_24), \ - "blue_mask", GST_PROPS_INT (B_MASK_24), \ - "width", SIZE_RANGE, \ - "height", SIZE_RANGE, \ - "framerate", FPS_RANGE, \ - NULL) - -#define GST_VIDEO_RGB_PAD_TEMPLATE_PROPS_32_REVERSE \ - gst_props_new ( \ - "bpp", GST_PROPS_INT (32), \ - "depth", GST_PROPS_INT (32), \ - "endianness", GST_PROPS_INT (G_BIG_ENDIAN), \ - "red_mask", GST_PROPS_INT (R_MASK_32_REVERSE), \ - "green_mask", GST_PROPS_INT (G_MASK_32_REVERSE), \ - "blue_mask", GST_PROPS_INT (B_MASK_32_REVERSE), \ - "width", SIZE_RANGE, \ - "height", SIZE_RANGE, \ - "framerate", FPS_RANGE, \ - NULL) - -#define GST_VIDEO_RGB_PAD_TEMPLATE_PROPS_24_REVERSE \ - gst_props_new ( \ - "bpp", GST_PROPS_INT (24), \ - "depth", GST_PROPS_INT (24), \ - "endianness", GST_PROPS_INT (G_BIG_ENDIAN), \ - "red_mask", GST_PROPS_INT (R_MASK_24_REVERSE), \ - "green_mask", GST_PROPS_INT (G_MASK_24_REVERSE), \ - "blue_mask", GST_PROPS_INT (B_MASK_24_REVERSE), \ - "width", SIZE_RANGE, \ - "height", SIZE_RANGE, \ - "framerate", FPS_RANGE, \ - NULL) - -#define GST_VIDEO_RGB_PAD_TEMPLATE_PROPS_15_16 \ - gst_props_new ( \ - "bpp", GST_PROPS_INT (16), \ - "depth", GST_PROPS_LIST ( \ - GST_PROPS_INT (15), \ - GST_PROPS_INT (16) \ - ), \ - "endianness", GST_PROPS_INT (G_BYTE_ORDER), \ - "red_mask", GST_PROPS_LIST ( \ - GST_PROPS_INT (R_MASK_15), \ - GST_PROPS_INT (R_MASK_16) \ - ), \ - "green_mask", GST_PROPS_LIST ( \ - GST_PROPS_INT (G_MASK_15), \ - GST_PROPS_INT (G_MASK_16) \ - ), \ - "blue_mask", GST_PROPS_LIST ( \ - GST_PROPS_INT (B_MASK_15), \ - GST_PROPS_INT (B_MASK_16) \ - ), \ - "width", SIZE_RANGE, \ - "height", SIZE_RANGE, \ - "framerate", FPS_RANGE, \ - NULL) - -#define GST_VIDEO_RGB_PAD_TEMPLATE_PROPS_16 \ - gst_props_new ( \ - "bpp", GST_PROPS_INT (16), \ - "depth", GST_PROPS_INT (16), \ - "endianness", GST_PROPS_INT (G_BYTE_ORDER), \ - "red_mask", GST_PROPS_INT (R_MASK_16), \ - "green_mask", GST_PROPS_INT (G_MASK_16), \ - "blue_mask", GST_PROPS_INT (B_MASK_16), \ - "width", SIZE_RANGE, \ - "height", SIZE_RANGE, \ - "framerate", FPS_RANGE, \ - NULL) - -#define GST_VIDEO_RGB_PAD_TEMPLATE_PROPS_15 \ - gst_props_new ( \ - "bpp", GST_PROPS_INT (15), \ - "depth", GST_PROPS_INT (15), \ - "endianness", GST_PROPS_INT (G_BYTE_ORDER), \ - "red_mask", GST_PROPS_INT (R_MASK_15), \ - "green_mask", GST_PROPS_INT (G_MASK_15), \ - "blue_mask", GST_PROPS_INT (B_MASK_15), \ - "width", SIZE_RANGE, \ - "height", SIZE_RANGE, \ - "framerate", FPS_RANGE, \ - NULL) - -#define GST_VIDEO_YUV_PAD_TEMPLATE_PROPS(fourcc) \ - gst_props_new (\ - "format", fourcc, \ - "width", SIZE_RANGE, \ - "height", SIZE_RANGE, \ - "framerate", FPS_RANGE, \ - NULL) +#define GST_VIDEO_RGB_PAD_TEMPLATE_CAPS_24_32 \ + "video/x-raw-rgb, " \ + "bpp = (int) { 24, 32 }, " \ + "depth = (int) { 24, 32 }, " \ + "endianness = (int) BIG_ENDIAN, " \ + "red_mask = (int) { " R_MASK_32 ", " R_MASK_24 " }, " \ + "green_mask = (int) { " G_MASK_32 ", " G_MASK_24 " }, " \ + "blue_mask = (int) { " B_MASK_32 ", " B_MASK_24 " }, " \ + "width = " SIZE_RANGE ", " \ + "height = " SIZE_RANGE ", " \ + "framerate = " FPS_RANGE + +#define GST_VIDEO_RGB_PAD_TEMPLATE_CAPS_24_32_REVERSE \ + "video/x-raw-rgb, " \ + "bpp = (int) { 24, 32 }, " \ + "depth = (int) { 24, 32 }, " \ + "endianness = (int) BIG_ENDIAN, " \ + "red_mask = (int) { " R_MASK_32_REVERSE ", " R_MASK_24_REVERSE "}, " \ + "green_mask = (int) { " G_MASK_32_REVERSE ", " G_MASK_24_REVERSE "}, " \ + "blue_mask = (int) { " B_MASK_32_REVERSE ", " B_MASK_24_REVERSE "}, " \ + "width = " SIZE_RANGE ", " \ + "height = " SIZE_RANGE ", " \ + "framerate = " FPS_RANGE + +#define GST_VIDEO_RGB_PAD_TEMPLATE_CAPS_32 \ + "video/x-raw-rgb, " \ + "bpp = (int) 32, " \ + "depth = (int) 32, " \ + "endianness = (int) BIG_ENDIAN, " \ + "red_mask = (int) " R_MASK_32 ", " \ + "green_mask = (int) " G_MASK_32 ", " \ + "blue_mask = (int) " B_MASK_32 ", " \ + "width = " SIZE_RANGE ", " \ + "height = " SIZE_RANGE ", " \ + "framerate = " FPS_RANGE + +#define GST_VIDEO_RGB_PAD_TEMPLATE_CAPS_24 \ + "video/x-raw-rgb, " \ + "bpp = (int) 24, " \ + "depth = (int) 24, " \ + "endianness = (int) BIG_ENDIAN, " \ + "red_mask = (int) " R_MASK_24 ", " \ + "green_mask = (int) " G_MASK_24 ", " \ + "blue_mask = (int) " B_MASK_24 ", " \ + "width = " SIZE_RANGE ", " \ + "height = " SIZE_RANGE ", " \ + "framerate = " FPS_RANGE + +#define GST_VIDEO_RGB_PAD_TEMPLATE_CAPS_32_REVERSE \ + "video/x-raw-rgb, " \ + "bpp = (int) 32, " \ + "depth = (int) 32, " \ + "endianness = (int) BIG_ENDIAN, " \ + "red_mask = (int) " R_MASK_32_REVERSE ", " \ + "green_mask = (int) " G_MASK_32_REVERSE ", " \ + "blue_mask = (int) " B_MASK_32_REVERSE ", " \ + "width = " SIZE_RANGE ", " \ + "height = " SIZE_RANGE ", " \ + "framerate = " FPS_RANGE + +#define GST_VIDEO_RGB_PAD_TEMPLATE_CAPS_24_REVERSE \ + "video/x-raw-rgb, " \ + "bpp = (int) 24, " \ + "depth = (int) 24, " \ + "endianness = (int) BIG_ENDIAN, " \ + "red_mask = (int) " R_MASK_24_REVERSE ", " \ + "green_mask = (int) " G_MASK_24_REVERSE ", " \ + "blue_mask = (int) " B_MASK_24_REVERSE ", " \ + "width = " SIZE_RANGE ", " \ + "height = " SIZE_RANGE ", " \ + "framerate = " FPS_RANGE + +#define GST_VIDEO_RGB_PAD_TEMPLATE_CAPS_15_16 \ + "video/x-raw-rgb, " \ + "bpp = (int) 16, " \ + "depth = (int) { 15, 16 }, " \ + "endianness = (int) BYTE_ORDER, " \ + "red_mask = (int) { " R_MASK_15 ", " R_MASK_16 " }, " \ + "green_mask = (int) { " G_MASK_15 ", " G_MASK_16 " }, " \ + "blue_mask = (int) { " B_MASK_15 ", " B_MASK_16 " }, " \ + "width = " SIZE_RANGE ", " \ + "height = " SIZE_RANGE ", " \ + "framerate = " FPS_RANGE + +#define GST_VIDEO_RGB_PAD_TEMPLATE_CAPS_16 \ + "video/x-raw-rgb, " \ + "bpp = (int) 16, " \ + "depth = (int) 16, " \ + "endianness = (int) BYTE_ORDER, " \ + "red_mask = (int) " R_MASK_16 ", " \ + "green_mask = (int) " G_MASK_16 ", " \ + "blue_mask = (int) " B_MASK_16 ", " \ + "width = " SIZE_RANGE ", " \ + "height = " SIZE_RANGE ", " \ + "framerate = " FPS_RANGE + +#define GST_VIDEO_RGB_PAD_TEMPLATE_CAPS_15 \ + "video/x-raw-rgb, " \ + "bpp = (int) 16, " \ + "depth = (int) 15, " \ + "endianness = (int) BYTE_ORDER, " \ + "red_mask = (int) " R_MASK_15 ", " \ + "green_mask = (int) " G_MASK_15 ", " \ + "blue_mask = (int) " B_MASK_15 ", " \ + "width = " SIZE_RANGE ", " \ + "height = " SIZE_RANGE ", " \ + "framerate = " FPS_RANGE + +#define GST_VIDEO_YUV_PAD_TEMPLATE_CAPS(fourcc) \ + "video/x-raw-yuv, " \ + "format = (fourcc) " fourcc ", " \ + "width = " SIZE_RANGE ", " \ + "height = " SIZE_RANGE ", " \ + "framerate = " FPS_RANGE /* functions */ -gfloat gst_video_frame_rate (GstPad *pad); +gdouble gst_video_frame_rate (GstPad *pad); gboolean gst_video_get_size (GstPad *pad, gint *width, gint *height); |