2 * Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
3 * Library <2002> Ronald Bultje <rbultje@ronald.bitfreak.net>
4 * Copyright (C) 2007 David A. Schleef <ds@schleef.org>
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Library General Public License for more details.
16 * You should have received a copy of the GNU Library General Public
17 * License along with this library; if not, write to the
18 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19 * Boston, MA 02111-1307, USA.
30 * @short_description: Support library for video operations
34 * This library contains some helper functions and includes the
35 * videosink and videofilter base classes.
40 static GstVideoFormat gst_video_format_from_rgb32_masks (int red_mask,
41 int green_mask, int blue_mask);
42 static GstVideoFormat gst_video_format_from_rgba32_masks (int red_mask,
43 int green_mask, int blue_mask, int alpha_mask);
44 static GstVideoFormat gst_video_format_from_rgb24_masks (int red_mask,
45 int green_mask, int blue_mask);
49 * gst_video_frame_rate:
50 * @pad: pointer to a #GstPad
52 * A convenience function to retrieve a GValue holding the framerate
53 * from the caps on a pad.
55 * The pad needs to have negotiated caps containing a framerate property.
57 * Returns: NULL if the pad has no configured caps or the configured caps
58 * do not contain a framerate.
62 gst_video_frame_rate (GstPad * pad)
67 const GstCaps *caps = NULL;
68 GstStructure *structure;
71 caps = GST_PAD_CAPS (pad);
73 g_warning ("gstvideo: failed to get caps of pad %s:%s",
74 GST_DEBUG_PAD_NAME (pad));
78 structure = gst_caps_get_structure (caps, 0);
79 if ((fps = gst_structure_get_value (structure, "framerate")) == NULL) {
80 g_warning ("gstvideo: failed to get framerate property of pad %s:%s",
81 GST_DEBUG_PAD_NAME (pad));
84 if (!GST_VALUE_HOLDS_FRACTION (fps)) {
86 ("gstvideo: framerate property of pad %s:%s is not of type Fraction",
87 GST_DEBUG_PAD_NAME (pad));
91 fps_string = gst_value_serialize (fps);
92 GST_DEBUG ("Framerate request on pad %s:%s: %s",
93 GST_DEBUG_PAD_NAME (pad), fps_string);
100 * gst_video_get_size:
101 * @pad: pointer to a #GstPad
102 * @width: pointer to integer to hold pixel width of the video frames (output)
103 * @height: pointer to integer to hold pixel height of the video frames (output)
105 * Inspect the caps of the provided pad and retrieve the width and height of
106 * the video frames it is configured for.
108 * The pad needs to have negotiated caps containing width and height properties.
110 * Returns: TRUE if the width and height could be retrieved.
114 gst_video_get_size (GstPad * pad, gint * width, gint * height)
116 const GstCaps *caps = NULL;
117 GstStructure *structure;
120 g_return_val_if_fail (pad != NULL, FALSE);
121 g_return_val_if_fail (width != NULL, FALSE);
122 g_return_val_if_fail (height != NULL, FALSE);
124 caps = GST_PAD_CAPS (pad);
127 g_warning ("gstvideo: failed to get caps of pad %s:%s",
128 GST_DEBUG_PAD_NAME (pad));
132 structure = gst_caps_get_structure (caps, 0);
133 ret = gst_structure_get_int (structure, "width", width);
134 ret &= gst_structure_get_int (structure, "height", height);
137 g_warning ("gstvideo: failed to get size properties on pad %s:%s",
138 GST_DEBUG_PAD_NAME (pad));
142 GST_DEBUG ("size request on pad %s:%s: %dx%d",
143 GST_DEBUG_PAD_NAME (pad), width ? *width : -1, height ? *height : -1);
149 * gst_video_calculate_display_ratio:
150 * @dar_n: Numerator of the calculated display_ratio
151 * @dar_d: Denominator of the calculated display_ratio
152 * @video_width: Width of the video frame in pixels
153 * @video_height: Height of the video frame in pixels
154 * @video_par_n: Numerator of the pixel aspect ratio of the input video.
155 * @video_par_d: Denominator of the pixel aspect ratio of the input video.
156 * @display_par_n: Numerator of the pixel aspect ratio of the display device
157 * @display_par_d: Denominator of the pixel aspect ratio of the display device
159 * Given the Pixel Aspect Ratio and size of an input video frame, and the
160 * pixel aspect ratio of the intended display device, calculates the actual
161 * display ratio the video will be rendered with.
163 * Returns: A boolean indicating success and a calculated Display Ratio in the
164 * dar_n and dar_d parameters.
165 * The return value is FALSE in the case of integer overflow or other error.
170 gst_video_calculate_display_ratio (guint * dar_n, guint * dar_d,
171 guint video_width, guint video_height,
172 guint video_par_n, guint video_par_d,
173 guint display_par_n, guint display_par_d)
177 GValue display_ratio = { 0, };
179 GValue tmp2 = { 0, };
181 g_return_val_if_fail (dar_n != NULL, FALSE);
182 g_return_val_if_fail (dar_d != NULL, FALSE);
184 g_value_init (&display_ratio, GST_TYPE_FRACTION);
185 g_value_init (&tmp, GST_TYPE_FRACTION);
186 g_value_init (&tmp2, GST_TYPE_FRACTION);
188 /* Calculate (video_width * video_par_n * display_par_d) /
189 * (video_height * video_par_d * display_par_n) */
190 gst_value_set_fraction (&display_ratio, video_width, video_height);
191 gst_value_set_fraction (&tmp, video_par_n, video_par_d);
193 if (!gst_value_fraction_multiply (&tmp2, &display_ratio, &tmp))
196 gst_value_set_fraction (&tmp, display_par_d, display_par_n);
198 if (!gst_value_fraction_multiply (&display_ratio, &tmp2, &tmp))
201 num = gst_value_get_fraction_numerator (&display_ratio);
202 den = gst_value_get_fraction_denominator (&display_ratio);
204 g_value_unset (&display_ratio);
205 g_value_unset (&tmp);
206 g_value_unset (&tmp2);
208 g_return_val_if_fail (num > 0, FALSE);
209 g_return_val_if_fail (den > 0, FALSE);
216 g_value_unset (&display_ratio);
217 g_value_unset (&tmp);
218 g_value_unset (&tmp2);
223 * gst_video_format_parse_caps_interlaced:
224 * @caps: the fixed #GstCaps to parse
225 * @interlaced: whether @caps represents interlaced video or not, may be NULL (output)
227 * Extracts whether the caps represents interlaced content or not and places it
232 * Returns: TRUE if @caps was parsed correctly.
235 gst_video_format_parse_caps_interlaced (GstCaps * caps, gboolean * interlaced)
237 GstStructure *structure;
239 if (!gst_caps_is_fixed (caps))
242 structure = gst_caps_get_structure (caps, 0);
245 if (!gst_structure_get_boolean (structure, "interlaced", interlaced))
253 * gst_video_format_parse_caps:
254 * @caps: the #GstCaps to parse
255 * @format: the #GstVideoFormat of the video represented by @caps (output)
256 * @width: the width of the video represented by @caps, may be NULL (output)
257 * @height: the height of the video represented by @caps, may be NULL (output)
259 * Determines the #GstVideoFormat of @caps and places it in the location
260 * pointed to by @format. Extracts the size of the video and places it
261 * in the location pointed to by @width and @height. If @caps does not
262 * represent one of the raw video formats listed in #GstVideoFormat, the
263 * function will fail and return FALSE.
267 * Returns: TRUE if @caps was parsed correctly.
270 gst_video_format_parse_caps (GstCaps * caps, GstVideoFormat * format,
271 int *width, int *height)
273 GstStructure *structure;
276 if (!gst_caps_is_fixed (caps))
279 structure = gst_caps_get_structure (caps, 0);
282 if (gst_structure_has_name (structure, "video/x-raw-yuv")) {
285 ok &= gst_structure_get_fourcc (structure, "format", &fourcc);
287 *format = gst_video_format_from_fourcc (fourcc);
288 if (*format == GST_VIDEO_FORMAT_UNKNOWN) {
291 } else if (gst_structure_has_name (structure, "video/x-raw-rgb")) {
301 ok &= gst_structure_get_int (structure, "depth", &depth);
302 ok &= gst_structure_get_int (structure, "bpp", &bpp);
303 ok &= gst_structure_get_int (structure, "endianness", &endianness);
304 ok &= gst_structure_get_int (structure, "red_mask", &red_mask);
305 ok &= gst_structure_get_int (structure, "green_mask", &green_mask);
306 ok &= gst_structure_get_int (structure, "blue_mask", &blue_mask);
307 have_alpha = gst_structure_get_int (structure, "alpha_mask", &alpha_mask);
309 if (depth == 24 && bpp == 32 && endianness == G_BIG_ENDIAN) {
310 *format = gst_video_format_from_rgb32_masks (red_mask, green_mask,
312 if (*format == GST_VIDEO_FORMAT_UNKNOWN) {
315 } else if (depth == 32 && bpp == 32 && endianness == G_BIG_ENDIAN &&
317 *format = gst_video_format_from_rgba32_masks (red_mask, green_mask,
318 blue_mask, alpha_mask);
319 if (*format == GST_VIDEO_FORMAT_UNKNOWN) {
322 } else if (depth == 24 && bpp == 24 && endianness == G_BIG_ENDIAN) {
323 *format = gst_video_format_from_rgb24_masks (red_mask, green_mask,
325 if (*format == GST_VIDEO_FORMAT_UNKNOWN) {
337 ok &= gst_structure_get_int (structure, "width", width);
341 ok &= gst_structure_get_int (structure, "height", height);
349 * gst_video_parse_caps_framerate:
350 * @caps: pointer to a #GstCaps instance
351 * @fps_n: pointer to integer to hold numerator of frame rate (output)
352 * @fps_d: pointer to integer to hold denominator of frame rate (output)
354 * Extracts the frame rate from @caps and places the values in the locations
355 * pointed to by @fps_n and @fps_d. Returns TRUE if the values could be
356 * parsed correctly, FALSE if not.
358 * This function can be used with #GstCaps that have any media type; it
359 * is not limited to formats handled by #GstVideoFormat.
363 * Returns: TRUE if @caps was parsed correctly.
366 gst_video_parse_caps_framerate (GstCaps * caps, int *fps_n, int *fps_d)
368 GstStructure *structure;
370 if (!gst_caps_is_fixed (caps))
373 structure = gst_caps_get_structure (caps, 0);
375 return gst_structure_get_fraction (structure, "framerate", fps_n, fps_d);
379 * gst_video_parse_caps_pixel_aspect_ratio:
380 * @caps: pointer to a #GstCaps instance
381 * @par_n: pointer to numerator of pixel aspect ratio (output)
382 * @par_d: pointer to denominator of pixel aspect ratio (output)
384 * Extracts the pixel aspect ratio from @caps and places the values in
385 * the locations pointed to by @par_n and @par_d. Returns TRUE if the
386 * values could be parsed correctly, FALSE if not.
388 * This function can be used with #GstCaps that have any media type; it
389 * is not limited to formats handled by #GstVideoFormat.
393 * Returns: TRUE if @caps was parsed correctly.
396 gst_video_parse_caps_pixel_aspect_ratio (GstCaps * caps, int *par_n, int *par_d)
398 GstStructure *structure;
400 if (!gst_caps_is_fixed (caps))
403 structure = gst_caps_get_structure (caps, 0);
405 if (!gst_structure_get_fraction (structure, "pixel-aspect-ratio",
414 * gst_video_format_new_caps_interlaced:
415 * @format: the #GstVideoFormat describing the raw video format
416 * @width: width of video
417 * @height: height of video
418 * @framerate_n: numerator of frame rate
419 * @framerate_d: denominator of frame rate
420 * @par_n: numerator of pixel aspect ratio
421 * @par_d: denominator of pixel aspect ratio
422 * @interlaced: #TRUE if the format is interlaced
424 * Creates a new #GstCaps object based on the parameters provided.
428 * Returns: a new #GstCaps object, or NULL if there was an error
431 gst_video_format_new_caps_interlaced (GstVideoFormat format, int width,
432 int height, int framerate_n, int framerate_d, int par_n, int par_d,
438 gst_video_format_new_caps (format, width, height, framerate_n,
439 framerate_d, par_n, par_d);
440 if (interlaced && (res != NULL))
441 gst_caps_set_simple (res, "interlaced", G_TYPE_BOOLEAN, TRUE, NULL);
447 * gst_video_format_new_caps:
448 * @format: the #GstVideoFormat describing the raw video format
449 * @width: width of video
450 * @height: height of video
451 * @framerate_n: numerator of frame rate
452 * @framerate_d: denominator of frame rate
453 * @par_n: numerator of pixel aspect ratio
454 * @par_d: denominator of pixel aspect ratio
456 * Creates a new #GstCaps object based on the parameters provided.
460 * Returns: a new #GstCaps object, or NULL if there was an error
463 gst_video_format_new_caps (GstVideoFormat format, int width, int height,
464 int framerate_n, int framerate_d, int par_n, int par_d)
466 g_return_val_if_fail (format != GST_VIDEO_FORMAT_UNKNOWN, NULL);
467 g_return_val_if_fail (width > 0 && height > 0, NULL);
469 if (gst_video_format_is_yuv (format)) {
470 return gst_caps_new_simple ("video/x-raw-yuv",
471 "format", GST_TYPE_FOURCC, gst_video_format_to_fourcc (format),
472 "width", G_TYPE_INT, width,
473 "height", G_TYPE_INT, height,
474 "framerate", GST_TYPE_FRACTION, framerate_n, framerate_d,
475 "pixel-aspect-ratio", GST_TYPE_FRACTION, par_n, par_d, NULL);
477 if (gst_video_format_is_rgb (format)) {
489 case GST_VIDEO_FORMAT_RGBx:
490 case GST_VIDEO_FORMAT_BGRx:
491 case GST_VIDEO_FORMAT_xRGB:
492 case GST_VIDEO_FORMAT_xBGR:
497 case GST_VIDEO_FORMAT_RGBA:
498 case GST_VIDEO_FORMAT_BGRA:
499 case GST_VIDEO_FORMAT_ARGB:
500 case GST_VIDEO_FORMAT_ABGR:
505 case GST_VIDEO_FORMAT_RGB:
506 case GST_VIDEO_FORMAT_BGR:
520 mask >> (8 * gst_video_format_get_component_offset (format, 0, width,
523 mask >> (8 * gst_video_format_get_component_offset (format, 1, width,
526 mask >> (8 * gst_video_format_get_component_offset (format, 2, width,
529 caps = gst_caps_new_simple ("video/x-raw-rgb",
530 "bpp", G_TYPE_INT, bpp,
531 "depth", G_TYPE_INT, depth,
532 "endianness", G_TYPE_INT, G_BIG_ENDIAN,
533 "red_mask", G_TYPE_INT, red_mask,
534 "green_mask", G_TYPE_INT, green_mask,
535 "blue_mask", G_TYPE_INT, blue_mask,
536 "width", G_TYPE_INT, width,
537 "height", G_TYPE_INT, height,
538 "framerate", GST_TYPE_FRACTION, framerate_n, framerate_d,
539 "pixel-aspect-ratio", GST_TYPE_FRACTION, par_n, par_d, NULL);
542 mask >> (8 * gst_video_format_get_component_offset (format, 3, width,
544 gst_caps_set_simple (caps, "alpha_mask", G_TYPE_INT, alpha_mask, NULL);
552 * gst_video_format_from_fourcc:
553 * @fourcc: a FOURCC value representing raw YUV video
555 * Converts a FOURCC value into the corresponding #GstVideoFormat.
556 * If the FOURCC cannot be represented by #GstVideoFormat,
557 * #GST_VIDEO_FORMAT_UNKNOWN is returned.
561 * Returns: the #GstVideoFormat describing the FOURCC value
564 gst_video_format_from_fourcc (guint32 fourcc)
567 case GST_MAKE_FOURCC ('I', '4', '2', '0'):
568 return GST_VIDEO_FORMAT_I420;
569 case GST_MAKE_FOURCC ('Y', 'V', '1', '2'):
570 return GST_VIDEO_FORMAT_YV12;
571 case GST_MAKE_FOURCC ('Y', 'U', 'Y', '2'):
572 return GST_VIDEO_FORMAT_YUY2;
573 case GST_MAKE_FOURCC ('Y', 'V', 'Y', 'U'):
574 return GST_VIDEO_FORMAT_YVYU;
575 case GST_MAKE_FOURCC ('U', 'Y', 'V', 'Y'):
576 return GST_VIDEO_FORMAT_UYVY;
577 case GST_MAKE_FOURCC ('A', 'Y', 'U', 'V'):
578 return GST_VIDEO_FORMAT_AYUV;
579 case GST_MAKE_FOURCC ('Y', '4', '1', 'B'):
580 return GST_VIDEO_FORMAT_Y41B;
581 case GST_MAKE_FOURCC ('Y', '4', '2', 'B'):
582 return GST_VIDEO_FORMAT_Y42B;
583 case GST_MAKE_FOURCC ('Y', '4', '4', '4'):
584 return GST_VIDEO_FORMAT_Y444;
585 case GST_MAKE_FOURCC ('v', '2', '1', '0'):
586 return GST_VIDEO_FORMAT_v210;
587 case GST_MAKE_FOURCC ('v', '2', '1', '6'):
588 return GST_VIDEO_FORMAT_v216;
589 case GST_MAKE_FOURCC ('N', 'V', '1', '2'):
590 return GST_VIDEO_FORMAT_NV12;
591 case GST_MAKE_FOURCC ('N', 'V', '2', '1'):
592 return GST_VIDEO_FORMAT_NV21;
594 return GST_VIDEO_FORMAT_UNKNOWN;
599 * gst_video_format_to_fourcc:
600 * @format: a #GstVideoFormat video format
602 * Converts a #GstVideoFormat value into the corresponding FOURCC. Only
603 * a few YUV formats have corresponding FOURCC values. If @format has
604 * no corresponding FOURCC value, 0 is returned.
608 * Returns: the FOURCC corresponding to @format
611 gst_video_format_to_fourcc (GstVideoFormat format)
613 g_return_val_if_fail (format != GST_VIDEO_FORMAT_UNKNOWN, 0);
616 case GST_VIDEO_FORMAT_I420:
617 return GST_MAKE_FOURCC ('I', '4', '2', '0');
618 case GST_VIDEO_FORMAT_YV12:
619 return GST_MAKE_FOURCC ('Y', 'V', '1', '2');
620 case GST_VIDEO_FORMAT_YUY2:
621 return GST_MAKE_FOURCC ('Y', 'U', 'Y', '2');
622 case GST_VIDEO_FORMAT_YVYU:
623 return GST_MAKE_FOURCC ('Y', 'V', 'Y', 'U');
624 case GST_VIDEO_FORMAT_UYVY:
625 return GST_MAKE_FOURCC ('U', 'Y', 'V', 'Y');
626 case GST_VIDEO_FORMAT_AYUV:
627 return GST_MAKE_FOURCC ('A', 'Y', 'U', 'V');
628 case GST_VIDEO_FORMAT_Y41B:
629 return GST_MAKE_FOURCC ('Y', '4', '1', 'B');
630 case GST_VIDEO_FORMAT_Y42B:
631 return GST_MAKE_FOURCC ('Y', '4', '2', 'B');
632 case GST_VIDEO_FORMAT_Y444:
633 return GST_MAKE_FOURCC ('Y', '4', '4', '4');
634 case GST_VIDEO_FORMAT_v210:
635 return GST_MAKE_FOURCC ('v', '2', '1', '0');
636 case GST_VIDEO_FORMAT_v216:
637 return GST_MAKE_FOURCC ('v', '2', '1', '6');
638 case GST_VIDEO_FORMAT_NV12:
639 return GST_MAKE_FOURCC ('N', 'V', '1', '2');
640 case GST_VIDEO_FORMAT_NV21:
641 return GST_MAKE_FOURCC ('N', 'V', '2', '1');
648 * gst_video_format_from_rgb32_masks:
649 * @red_mask: red bit mask
650 * @green_mask: green bit mask
651 * @blue_mask: blue bit mask
653 * Converts red, green, blue bit masks into the corresponding
658 * Returns: the #GstVideoFormat corresponding to the bit masks
660 static GstVideoFormat
661 gst_video_format_from_rgb32_masks (int red_mask, int green_mask, int blue_mask)
663 if (red_mask == 0xff000000 && green_mask == 0x00ff0000 &&
664 blue_mask == 0x0000ff00) {
665 return GST_VIDEO_FORMAT_RGBx;
667 if (red_mask == 0x0000ff00 && green_mask == 0x00ff0000 &&
668 blue_mask == 0xff000000) {
669 return GST_VIDEO_FORMAT_BGRx;
671 if (red_mask == 0x00ff0000 && green_mask == 0x0000ff00 &&
672 blue_mask == 0x000000ff) {
673 return GST_VIDEO_FORMAT_xRGB;
675 if (red_mask == 0x000000ff && green_mask == 0x0000ff00 &&
676 blue_mask == 0x00ff0000) {
677 return GST_VIDEO_FORMAT_xBGR;
680 return GST_VIDEO_FORMAT_UNKNOWN;
683 static GstVideoFormat
684 gst_video_format_from_rgba32_masks (int red_mask, int green_mask, int blue_mask,
687 if (red_mask == 0xff000000 && green_mask == 0x00ff0000 &&
688 blue_mask == 0x0000ff00 && alpha_mask == 0x000000ff) {
689 return GST_VIDEO_FORMAT_RGBA;
691 if (red_mask == 0x0000ff00 && green_mask == 0x00ff0000 &&
692 blue_mask == 0xff000000 && alpha_mask == 0x000000ff) {
693 return GST_VIDEO_FORMAT_BGRA;
695 if (red_mask == 0x00ff0000 && green_mask == 0x0000ff00 &&
696 blue_mask == 0x000000ff && alpha_mask == 0xff000000) {
697 return GST_VIDEO_FORMAT_ARGB;
699 if (red_mask == 0x000000ff && green_mask == 0x0000ff00 &&
700 blue_mask == 0x00ff0000 && alpha_mask == 0xff000000) {
701 return GST_VIDEO_FORMAT_ABGR;
704 return GST_VIDEO_FORMAT_UNKNOWN;
707 static GstVideoFormat
708 gst_video_format_from_rgb24_masks (int red_mask, int green_mask, int blue_mask)
710 if (red_mask == 0xff0000 && green_mask == 0x00ff00 && blue_mask == 0x0000ff) {
711 return GST_VIDEO_FORMAT_RGB;
713 if (red_mask == 0x0000ff && green_mask == 0x00ff00 && blue_mask == 0xff0000) {
714 return GST_VIDEO_FORMAT_BGR;
717 return GST_VIDEO_FORMAT_UNKNOWN;
721 * gst_video_format_is_rgb:
722 * @format: a #GstVideoFormat
724 * Determine whether the video format is an RGB format.
728 * Returns: TRUE if @format represents RGB video
731 gst_video_format_is_rgb (GstVideoFormat format)
734 case GST_VIDEO_FORMAT_I420:
735 case GST_VIDEO_FORMAT_YV12:
736 case GST_VIDEO_FORMAT_YUY2:
737 case GST_VIDEO_FORMAT_YVYU:
738 case GST_VIDEO_FORMAT_UYVY:
739 case GST_VIDEO_FORMAT_AYUV:
740 case GST_VIDEO_FORMAT_Y41B:
741 case GST_VIDEO_FORMAT_Y42B:
742 case GST_VIDEO_FORMAT_Y444:
743 case GST_VIDEO_FORMAT_v210:
744 case GST_VIDEO_FORMAT_v216:
745 case GST_VIDEO_FORMAT_NV12:
746 case GST_VIDEO_FORMAT_NV21:
748 case GST_VIDEO_FORMAT_RGBx:
749 case GST_VIDEO_FORMAT_BGRx:
750 case GST_VIDEO_FORMAT_xRGB:
751 case GST_VIDEO_FORMAT_xBGR:
752 case GST_VIDEO_FORMAT_RGBA:
753 case GST_VIDEO_FORMAT_BGRA:
754 case GST_VIDEO_FORMAT_ARGB:
755 case GST_VIDEO_FORMAT_ABGR:
756 case GST_VIDEO_FORMAT_RGB:
757 case GST_VIDEO_FORMAT_BGR:
765 * gst_video_format_is_yuv:
766 * @format: a #GstVideoFormat
768 * Determine whether the video format is a YUV format.
772 * Returns: TRUE if @format represents YUV video
775 gst_video_format_is_yuv (GstVideoFormat format)
778 case GST_VIDEO_FORMAT_I420:
779 case GST_VIDEO_FORMAT_YV12:
780 case GST_VIDEO_FORMAT_YUY2:
781 case GST_VIDEO_FORMAT_YVYU:
782 case GST_VIDEO_FORMAT_UYVY:
783 case GST_VIDEO_FORMAT_AYUV:
784 case GST_VIDEO_FORMAT_Y41B:
785 case GST_VIDEO_FORMAT_Y42B:
786 case GST_VIDEO_FORMAT_Y444:
787 case GST_VIDEO_FORMAT_v210:
788 case GST_VIDEO_FORMAT_v216:
789 case GST_VIDEO_FORMAT_NV12:
790 case GST_VIDEO_FORMAT_NV21:
792 case GST_VIDEO_FORMAT_RGBx:
793 case GST_VIDEO_FORMAT_BGRx:
794 case GST_VIDEO_FORMAT_xRGB:
795 case GST_VIDEO_FORMAT_xBGR:
796 case GST_VIDEO_FORMAT_RGBA:
797 case GST_VIDEO_FORMAT_BGRA:
798 case GST_VIDEO_FORMAT_ARGB:
799 case GST_VIDEO_FORMAT_ABGR:
800 case GST_VIDEO_FORMAT_RGB:
801 case GST_VIDEO_FORMAT_BGR:
809 * gst_video_format_has_alpha:
810 * @format: a #GstVideoFormat
812 * Returns TRUE or FALSE depending on if the video format provides an
817 * Returns: TRUE if @format has an alpha channel
820 gst_video_format_has_alpha (GstVideoFormat format)
823 case GST_VIDEO_FORMAT_I420:
824 case GST_VIDEO_FORMAT_YV12:
825 case GST_VIDEO_FORMAT_YUY2:
826 case GST_VIDEO_FORMAT_YVYU:
827 case GST_VIDEO_FORMAT_UYVY:
828 case GST_VIDEO_FORMAT_Y41B:
829 case GST_VIDEO_FORMAT_Y42B:
830 case GST_VIDEO_FORMAT_Y444:
831 case GST_VIDEO_FORMAT_v210:
832 case GST_VIDEO_FORMAT_v216:
833 case GST_VIDEO_FORMAT_NV12:
834 case GST_VIDEO_FORMAT_NV21:
836 case GST_VIDEO_FORMAT_AYUV:
837 case GST_VIDEO_FORMAT_RGBA:
838 case GST_VIDEO_FORMAT_BGRA:
839 case GST_VIDEO_FORMAT_ARGB:
840 case GST_VIDEO_FORMAT_ABGR:
842 case GST_VIDEO_FORMAT_RGBx:
843 case GST_VIDEO_FORMAT_BGRx:
844 case GST_VIDEO_FORMAT_xRGB:
845 case GST_VIDEO_FORMAT_xBGR:
846 case GST_VIDEO_FORMAT_RGB:
847 case GST_VIDEO_FORMAT_BGR:
855 * gst_video_format_get_row_stride:
856 * @format: a #GstVideoFormat
857 * @component: the component index
858 * @width: the width of video
860 * Calculates the row stride (number of bytes from one row of pixels to
861 * the next) for the video component with an index of @component. For
862 * YUV video, Y, U, and V have component indices of 0, 1, and 2,
863 * respectively. For RGB video, R, G, and B have component indicies of
864 * 0, 1, and 2, respectively. Alpha channels, if present, have a component
865 * index of 3. The @width parameter always represents the width of the
866 * video, not the component.
870 * Returns: row stride of component @component
873 gst_video_format_get_row_stride (GstVideoFormat format, int component,
876 g_return_val_if_fail (format != GST_VIDEO_FORMAT_UNKNOWN, 0);
877 g_return_val_if_fail (component >= 0 && component <= 3, 0);
878 g_return_val_if_fail (width > 0, 0);
881 case GST_VIDEO_FORMAT_I420:
882 case GST_VIDEO_FORMAT_YV12:
883 if (component == 0) {
884 return GST_ROUND_UP_4 (width);
886 return GST_ROUND_UP_4 (GST_ROUND_UP_2 (width) / 2);
888 case GST_VIDEO_FORMAT_YUY2:
889 case GST_VIDEO_FORMAT_YVYU:
890 case GST_VIDEO_FORMAT_UYVY:
891 return GST_ROUND_UP_4 (width * 2);
892 case GST_VIDEO_FORMAT_AYUV:
893 case GST_VIDEO_FORMAT_RGBx:
894 case GST_VIDEO_FORMAT_BGRx:
895 case GST_VIDEO_FORMAT_xRGB:
896 case GST_VIDEO_FORMAT_xBGR:
897 case GST_VIDEO_FORMAT_RGBA:
898 case GST_VIDEO_FORMAT_BGRA:
899 case GST_VIDEO_FORMAT_ARGB:
900 case GST_VIDEO_FORMAT_ABGR:
902 case GST_VIDEO_FORMAT_RGB:
903 case GST_VIDEO_FORMAT_BGR:
904 return GST_ROUND_UP_4 (width * 3);
905 case GST_VIDEO_FORMAT_Y41B:
906 if (component == 0) {
907 return GST_ROUND_UP_4 (width);
909 return GST_ROUND_UP_16 (width) / 4;
911 case GST_VIDEO_FORMAT_Y42B:
912 if (component == 0) {
913 return GST_ROUND_UP_4 (width);
915 return GST_ROUND_UP_8 (width) / 2;
917 case GST_VIDEO_FORMAT_Y444:
918 return GST_ROUND_UP_4 (width);
919 case GST_VIDEO_FORMAT_v210:
920 return ((width + 47) / 48) * 128;
921 case GST_VIDEO_FORMAT_v216:
922 return GST_ROUND_UP_8 (width * 4);
923 case GST_VIDEO_FORMAT_NV12:
924 case GST_VIDEO_FORMAT_NV21:
925 return GST_ROUND_UP_4 (width);
932 * gst_video_format_get_pixel_stride:
933 * @format: a #GstVideoFormat
934 * @component: the component index
936 * Calculates the pixel stride (number of bytes from one pixel to the
937 * pixel to its immediate left) for the video component with an index
938 * of @component. See @gst_video_format_get_row_stride for a description
939 * of the component index.
943 * Returns: pixel stride of component @component
946 gst_video_format_get_pixel_stride (GstVideoFormat format, int component)
948 g_return_val_if_fail (format != GST_VIDEO_FORMAT_UNKNOWN, 0);
949 g_return_val_if_fail (component >= 0 && component <= 3, 0);
952 case GST_VIDEO_FORMAT_I420:
953 case GST_VIDEO_FORMAT_YV12:
954 case GST_VIDEO_FORMAT_Y41B:
955 case GST_VIDEO_FORMAT_Y42B:
956 case GST_VIDEO_FORMAT_Y444:
958 case GST_VIDEO_FORMAT_YUY2:
959 case GST_VIDEO_FORMAT_YVYU:
960 case GST_VIDEO_FORMAT_UYVY:
961 if (component == 0) {
966 case GST_VIDEO_FORMAT_AYUV:
967 case GST_VIDEO_FORMAT_RGBx:
968 case GST_VIDEO_FORMAT_BGRx:
969 case GST_VIDEO_FORMAT_xRGB:
970 case GST_VIDEO_FORMAT_xBGR:
971 case GST_VIDEO_FORMAT_RGBA:
972 case GST_VIDEO_FORMAT_BGRA:
973 case GST_VIDEO_FORMAT_ARGB:
974 case GST_VIDEO_FORMAT_ABGR:
976 case GST_VIDEO_FORMAT_RGB:
977 case GST_VIDEO_FORMAT_BGR:
979 case GST_VIDEO_FORMAT_v210:
980 /* v210 is packed at the bit level, so pixel stride doesn't make sense */
982 case GST_VIDEO_FORMAT_v216:
983 if (component == 0) {
988 case GST_VIDEO_FORMAT_NV12:
989 case GST_VIDEO_FORMAT_NV21:
990 if (component == 0) {
1001 * gst_video_format_get_component_width:
1002 * @format: a #GstVideoFormat
1003 * @component: the component index
1004 * @width: the width of video
1006 * Calculates the width of the component. See
1007 * @gst_video_format_get_row_stride for a description
1008 * of the component index.
1012 * Returns: width of component @component
1015 gst_video_format_get_component_width (GstVideoFormat format, int component,
1018 g_return_val_if_fail (format != GST_VIDEO_FORMAT_UNKNOWN, 0);
1019 g_return_val_if_fail (component >= 0 && component <= 3, 0);
1020 g_return_val_if_fail (width > 0, 0);
1023 case GST_VIDEO_FORMAT_I420:
1024 case GST_VIDEO_FORMAT_YV12:
1025 case GST_VIDEO_FORMAT_YUY2:
1026 case GST_VIDEO_FORMAT_YVYU:
1027 case GST_VIDEO_FORMAT_UYVY:
1028 case GST_VIDEO_FORMAT_Y42B:
1029 case GST_VIDEO_FORMAT_v210:
1030 case GST_VIDEO_FORMAT_v216:
1031 if (component == 0) {
1034 return GST_ROUND_UP_2 (width) / 2;
1036 case GST_VIDEO_FORMAT_Y41B:
1037 if (component == 0) {
1040 return GST_ROUND_UP_4 (width) / 4;
1042 case GST_VIDEO_FORMAT_AYUV:
1043 case GST_VIDEO_FORMAT_RGBx:
1044 case GST_VIDEO_FORMAT_BGRx:
1045 case GST_VIDEO_FORMAT_xRGB:
1046 case GST_VIDEO_FORMAT_xBGR:
1047 case GST_VIDEO_FORMAT_RGBA:
1048 case GST_VIDEO_FORMAT_BGRA:
1049 case GST_VIDEO_FORMAT_ARGB:
1050 case GST_VIDEO_FORMAT_ABGR:
1051 case GST_VIDEO_FORMAT_RGB:
1052 case GST_VIDEO_FORMAT_BGR:
1053 case GST_VIDEO_FORMAT_Y444:
1054 case GST_VIDEO_FORMAT_NV12:
1055 case GST_VIDEO_FORMAT_NV21:
1063 * gst_video_format_get_component_height:
1064 * @format: a #GstVideoFormat
1065 * @component: the component index
1066 * @height: the height of video
1068 * Calculates the height of the component. See
1069 * @gst_video_format_get_row_stride for a description
1070 * of the component index.
1074 * Returns: height of component @component
1077 gst_video_format_get_component_height (GstVideoFormat format, int component,
1080 g_return_val_if_fail (format != GST_VIDEO_FORMAT_UNKNOWN, 0);
1081 g_return_val_if_fail (component >= 0 && component <= 3, 0);
1082 g_return_val_if_fail (height > 0, 0);
1085 case GST_VIDEO_FORMAT_I420:
1086 case GST_VIDEO_FORMAT_YV12:
1087 case GST_VIDEO_FORMAT_NV12:
1088 case GST_VIDEO_FORMAT_NV21:
1089 if (component == 0) {
1092 return GST_ROUND_UP_2 (height) / 2;
1094 case GST_VIDEO_FORMAT_Y41B:
1095 case GST_VIDEO_FORMAT_Y42B:
1096 case GST_VIDEO_FORMAT_YUY2:
1097 case GST_VIDEO_FORMAT_YVYU:
1098 case GST_VIDEO_FORMAT_UYVY:
1099 case GST_VIDEO_FORMAT_AYUV:
1100 case GST_VIDEO_FORMAT_RGBx:
1101 case GST_VIDEO_FORMAT_BGRx:
1102 case GST_VIDEO_FORMAT_xRGB:
1103 case GST_VIDEO_FORMAT_xBGR:
1104 case GST_VIDEO_FORMAT_RGBA:
1105 case GST_VIDEO_FORMAT_BGRA:
1106 case GST_VIDEO_FORMAT_ARGB:
1107 case GST_VIDEO_FORMAT_ABGR:
1108 case GST_VIDEO_FORMAT_RGB:
1109 case GST_VIDEO_FORMAT_BGR:
1110 case GST_VIDEO_FORMAT_Y444:
1111 case GST_VIDEO_FORMAT_v210:
1112 case GST_VIDEO_FORMAT_v216:
1120 * gst_video_format_get_component_offset:
1121 * @format: a #GstVideoFormat
1122 * @component: the component index
1123 * @width: the width of video
1124 * @height: the height of video
1126 * Calculates the offset (in bytes) of the first pixel of the component
1127 * with index @component. For packed formats, this will typically be a
1128 * small integer (0, 1, 2, 3). For planar formats, this will be a
1129 * (relatively) large offset to the beginning of the second or third
1130 * component planes. See @gst_video_format_get_row_stride for a description
1131 * of the component index.
1135 * Returns: offset of component @component
1138 gst_video_format_get_component_offset (GstVideoFormat format, int component,
1139 int width, int height)
1141 g_return_val_if_fail (format != GST_VIDEO_FORMAT_UNKNOWN, 0);
1142 g_return_val_if_fail (component >= 0 && component <= 3, 0);
1143 g_return_val_if_fail (width > 0 && height > 0, 0);
1146 case GST_VIDEO_FORMAT_I420:
1150 return GST_ROUND_UP_4 (width) * GST_ROUND_UP_2 (height);
1151 if (component == 2) {
1152 return GST_ROUND_UP_4 (width) * GST_ROUND_UP_2 (height) +
1153 GST_ROUND_UP_4 (GST_ROUND_UP_2 (width) / 2) *
1154 (GST_ROUND_UP_2 (height) / 2);
1157 case GST_VIDEO_FORMAT_YV12: /* same as I420, but components 1+2 swapped */
1161 return GST_ROUND_UP_4 (width) * GST_ROUND_UP_2 (height);
1162 if (component == 1) {
1163 return GST_ROUND_UP_4 (width) * GST_ROUND_UP_2 (height) +
1164 GST_ROUND_UP_4 (GST_ROUND_UP_2 (width) / 2) *
1165 (GST_ROUND_UP_2 (height) / 2);
1168 case GST_VIDEO_FORMAT_YUY2:
1176 case GST_VIDEO_FORMAT_YVYU:
1184 case GST_VIDEO_FORMAT_UYVY:
1192 case GST_VIDEO_FORMAT_AYUV:
1202 case GST_VIDEO_FORMAT_RGBx:
1203 case GST_VIDEO_FORMAT_RGBA:
1213 case GST_VIDEO_FORMAT_BGRx:
1214 case GST_VIDEO_FORMAT_BGRA:
1224 case GST_VIDEO_FORMAT_xRGB:
1225 case GST_VIDEO_FORMAT_ARGB:
1235 case GST_VIDEO_FORMAT_xBGR:
1236 case GST_VIDEO_FORMAT_ABGR:
1246 case GST_VIDEO_FORMAT_RGB:
1254 case GST_VIDEO_FORMAT_BGR:
1262 case GST_VIDEO_FORMAT_Y41B:
1266 return GST_ROUND_UP_4 (width) * height;
1268 return (GST_ROUND_UP_4 (width) +
1269 (GST_ROUND_UP_16 (width) / 4)) * height;
1271 case GST_VIDEO_FORMAT_Y42B:
1275 return GST_ROUND_UP_4 (width) * height;
1277 return (GST_ROUND_UP_4 (width) + (GST_ROUND_UP_8 (width) / 2)) * height;
1279 case GST_VIDEO_FORMAT_Y444:
1280 return GST_ROUND_UP_4 (width) * height * component;
1281 case GST_VIDEO_FORMAT_v210:
1282 /* v210 is bit-packed, so this doesn't make sense */
1284 case GST_VIDEO_FORMAT_v216:
1292 case GST_VIDEO_FORMAT_NV12:
1296 return GST_ROUND_UP_4 (width) * GST_ROUND_UP_2 (height);
1298 return GST_ROUND_UP_4 (width) * GST_ROUND_UP_2 (height) + 1;
1299 case GST_VIDEO_FORMAT_NV21:
1303 return GST_ROUND_UP_4 (width) * GST_ROUND_UP_2 (height) + 1;
1305 return GST_ROUND_UP_4 (width) * GST_ROUND_UP_2 (height);
1312 * gst_video_format_get_size:
1313 * @format: a #GstVideoFormat
1314 * @width: the width of video
1315 * @height: the height of video
1317 * Calculates the total number of bytes in the raw video format. This
1318 * number should be used when allocating a buffer for raw video.
1322 * Returns: size (in bytes) of raw video format
1325 gst_video_format_get_size (GstVideoFormat format, int width, int height)
1329 g_return_val_if_fail (format != GST_VIDEO_FORMAT_UNKNOWN, 0);
1330 g_return_val_if_fail (width > 0 && height > 0, 0);
1333 case GST_VIDEO_FORMAT_I420:
1334 case GST_VIDEO_FORMAT_YV12:
1335 size = GST_ROUND_UP_4 (width) * GST_ROUND_UP_2 (height);
1336 size += GST_ROUND_UP_4 (GST_ROUND_UP_2 (width) / 2) *
1337 (GST_ROUND_UP_2 (height) / 2) * 2;
1339 case GST_VIDEO_FORMAT_YUY2:
1340 case GST_VIDEO_FORMAT_YVYU:
1341 case GST_VIDEO_FORMAT_UYVY:
1342 return GST_ROUND_UP_4 (width * 2) * height;
1343 case GST_VIDEO_FORMAT_AYUV:
1344 case GST_VIDEO_FORMAT_RGBx:
1345 case GST_VIDEO_FORMAT_BGRx:
1346 case GST_VIDEO_FORMAT_xRGB:
1347 case GST_VIDEO_FORMAT_xBGR:
1348 case GST_VIDEO_FORMAT_RGBA:
1349 case GST_VIDEO_FORMAT_BGRA:
1350 case GST_VIDEO_FORMAT_ARGB:
1351 case GST_VIDEO_FORMAT_ABGR:
1352 return width * 4 * height;
1353 case GST_VIDEO_FORMAT_RGB:
1354 case GST_VIDEO_FORMAT_BGR:
1355 return GST_ROUND_UP_4 (width * 3) * height;
1356 case GST_VIDEO_FORMAT_Y41B:
1357 /* simplification of ROUNDUP4(w)*h + 2*((ROUNDUP16(w)/4)*h */
1358 return (GST_ROUND_UP_4 (width) + (GST_ROUND_UP_16 (width) / 2)) * height;
1359 case GST_VIDEO_FORMAT_Y42B:
1360 /* simplification of ROUNDUP4(w)*h + 2*(ROUNDUP8(w)/2)*h */
1361 return (GST_ROUND_UP_4 (width) + GST_ROUND_UP_8 (width)) * height;
1362 case GST_VIDEO_FORMAT_Y444:
1363 return GST_ROUND_UP_4 (width) * height * 3;
1364 case GST_VIDEO_FORMAT_v210:
1365 return ((width + 47) / 48) * 128 * height;
1366 case GST_VIDEO_FORMAT_v216:
1367 return GST_ROUND_UP_8 (width * 4) * height;
1368 case GST_VIDEO_FORMAT_NV12:
1369 case GST_VIDEO_FORMAT_NV21:
1370 return GST_ROUND_UP_4 (width) * GST_ROUND_UP_2 (height) * 3 / 2;
1377 * gst_video_format_convert:
1378 * @format: a #GstVideoFormat
1379 * @width: the width of video
1380 * @height: the height of video
1381 * @fps_n: frame rate numerator
1382 * @fps_d: frame rate denominator
1383 * @src_format: #GstFormat of the @src_value
1384 * @src_value: value to convert
1385 * @dest_format: #GstFormat of the @dest_value
1386 * @dest_value: pointer to destination value
1388 * Converts among various #GstFormat types. This function handles
1389 * GST_FORMAT_BYTES, GST_FORMAT_TIME, and GST_FORMAT_DEFAULT. For
1390 * raw video, GST_FORMAT_DEFAULT corresponds to video frames. This
1391 * function can be to handle pad queries of the type GST_QUERY_CONVERT.
1395 * Returns: TRUE if the conversion was successful.
1398 gst_video_format_convert (GstVideoFormat format, int width, int height,
1399 int fps_n, int fps_d,
1400 GstFormat src_format, gint64 src_value,
1401 GstFormat dest_format, gint64 * dest_value)
1403 gboolean ret = FALSE;
1406 g_return_val_if_fail (format != GST_VIDEO_FORMAT_UNKNOWN, 0);
1407 g_return_val_if_fail (width > 0 && height > 0, 0);
1409 size = gst_video_format_get_size (format, width, height);
1411 GST_DEBUG ("converting value %" G_GINT64_FORMAT " from %s to %s",
1412 src_value, gst_format_get_name (src_format),
1413 gst_format_get_name (dest_format));
1415 if (src_format == dest_format) {
1416 *dest_value = src_value;
1421 if (src_value == -1) {
1427 /* bytes to frames */
1428 if (src_format == GST_FORMAT_BYTES && dest_format == GST_FORMAT_DEFAULT) {
1430 *dest_value = gst_util_uint64_scale_int (src_value, 1, size);
1432 GST_ERROR ("blocksize is 0");
1439 /* frames to bytes */
1440 if (src_format == GST_FORMAT_DEFAULT && dest_format == GST_FORMAT_BYTES) {
1441 *dest_value = gst_util_uint64_scale_int (src_value, size, 1);
1446 /* time to frames */
1447 if (src_format == GST_FORMAT_TIME && dest_format == GST_FORMAT_DEFAULT) {
1449 *dest_value = gst_util_uint64_scale (src_value,
1450 fps_n, GST_SECOND * fps_d);
1452 GST_ERROR ("framerate denominator is 0");
1459 /* frames to time */
1460 if (src_format == GST_FORMAT_DEFAULT && dest_format == GST_FORMAT_TIME) {
1462 *dest_value = gst_util_uint64_scale (src_value,
1463 GST_SECOND * fps_d, fps_n);
1465 GST_ERROR ("framerate numerator is 0");
1473 if (src_format == GST_FORMAT_TIME && dest_format == GST_FORMAT_BYTES) {
1475 *dest_value = gst_util_uint64_scale (src_value,
1476 fps_n * size, GST_SECOND * fps_d);
1478 GST_ERROR ("framerate denominator is 0");
1486 if (src_format == GST_FORMAT_BYTES && dest_format == GST_FORMAT_TIME) {
1487 if (fps_n != 0 && size != 0) {
1488 *dest_value = gst_util_uint64_scale (src_value,
1489 GST_SECOND * fps_d, fps_n * size);
1491 GST_ERROR ("framerate denominator and/or blocksize is 0");
1499 GST_DEBUG ("ret=%d result %" G_GINT64_FORMAT, ret, *dest_value);
1504 #define GST_VIDEO_EVENT_STILL_STATE_NAME "GstEventStillFrame"
1507 * gst_video_event_new_still_frame:
1508 * @in_still: boolean value for the still-frame state of the event.
1510 * Creates a new Still Frame event. If @in_still is %TRUE, then the event
1511 * represents the start of a still frame sequence. If it is %FALSE, then
1512 * the event ends a still frame sequence.
1514 * To parse an event created by gst_video_event_new_still_frame() use
1515 * gst_video_event_parse_still_frame().
1517 * Returns: The new GstEvent
1521 gst_video_event_new_still_frame (gboolean in_still)
1523 GstEvent *still_event;
1526 s = gst_structure_new (GST_VIDEO_EVENT_STILL_STATE_NAME,
1527 "still-state", G_TYPE_BOOLEAN, in_still, NULL);
1528 still_event = gst_event_new_custom (GST_EVENT_CUSTOM_DOWNSTREAM, s);
1534 * gst_video_event_parse_still_frame:
1535 * @event: A #GstEvent to parse
1536 * @in_still: A boolean to receive the still-frame status from the event, or NULL
1538 * Parse a #GstEvent, identify if it is a Still Frame event, and
1539 * return the still-frame state from the event if it is.
1540 * If the event represents the start of a still frame, the in_still
1541 * variable will be set to TRUE, otherwise FALSE. It is OK to pass NULL for the
1542 * in_still variable order to just check whether the event is a valid still-frame
1545 * Create a still frame event using gst_video_event_new_still_frame()
1547 * Returns: %TRUE if the event is a valid still-frame event. %FALSE if not
1551 gst_video_event_parse_still_frame (GstEvent * event, gboolean * in_still)
1553 const GstStructure *s;
1554 gboolean ev_still_state;
1556 g_return_val_if_fail (event != NULL, FALSE);
1558 if (GST_EVENT_TYPE (event) != GST_EVENT_CUSTOM_DOWNSTREAM)
1559 return FALSE; /* Not a still frame event */
1561 s = gst_event_get_structure (event);
1563 || !gst_structure_has_name (s, GST_VIDEO_EVENT_STILL_STATE_NAME))
1564 return FALSE; /* Not a still frame event */
1565 if (!gst_structure_get_boolean (s, "still-state", &ev_still_state))
1566 return FALSE; /* Not a still frame event */
1568 *in_still = ev_still_state;