mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 04:01:08 +00:00
video: add macros checking for GST_VIDEO_BUFFER_FLAG_TOP/BOTTOM_FIELD flags
The GST_VIDEO_BUFFER_FLAG_TOP_FIELD flag is a superset of GST_VIDEO_BUFFER_FLAG_BOTTOM_FIELD as they are defined using other flags. As a result we can't use GST_BUFFER_FLAG_IS_SET() to check for those flags.
This commit is contained in:
parent
19f27f94ee
commit
26f386ce8b
2 changed files with 47 additions and 0 deletions
|
@ -173,9 +173,11 @@ gboolean gst_video_frame_copy_plane (GstVideoFrame *dest, const GstVideoFr
|
|||
* @GST_VIDEO_BUFFER_FLAG_TOP_FIELD: The video frame has the top field only. This is the
|
||||
* same as GST_VIDEO_BUFFER_FLAG_TFF |
|
||||
* GST_VIDEO_BUFFER_FLAG_ONEFIELD (Since: 1.16).
|
||||
* Use GST_VIDEO_BUFFER_IS_TOP_FIELD() to check for this flag.
|
||||
* @GST_VIDEO_BUFFER_FLAG_BOTTOM_FIELD: The video frame has the bottom field only. This is
|
||||
* the same as GST_VIDEO_BUFFER_FLAG_ONEFIELD
|
||||
* (GST_VIDEO_BUFFER_FLAG_TFF flag unset) (Since: 1.16).
|
||||
* Use GST_VIDEO_BUFFER_IS_BOTTOM_FIELD() to check for this flag.
|
||||
* @GST_VIDEO_BUFFER_FLAG_MARKER: The #GstBuffer contains the end of a video field or frame
|
||||
* boundary such as the last subframe or packet (Since: 1.18).
|
||||
* @GST_VIDEO_BUFFER_FLAG_LAST: Offset to define more flags
|
||||
|
@ -204,6 +206,26 @@ typedef enum {
|
|||
GST_VIDEO_BUFFER_FLAG_LAST = (GST_BUFFER_FLAG_LAST << 8)
|
||||
} GstVideoBufferFlags;
|
||||
|
||||
/* GST_VIDEO_BUFFER_FLAG_TOP_FIELD is a subset of
|
||||
* GST_VIDEO_BUFFER_FLAG_BOTTOM_FIELD so needs to be checked accordingly. */
|
||||
#define _GST_VIDEO_BUFFER_FLAG_FIELD_MASK GST_VIDEO_BUFFER_FLAG_TOP_FIELD
|
||||
|
||||
/**
|
||||
* GST_VIDEO_BUFFER_IS_TOP_FIELD:
|
||||
* @buf: a #GstBuffer
|
||||
*
|
||||
* Check if GST_VIDEO_BUFFER_FLAG_TOP_FIELD is set on @buf (Since: 1.18).
|
||||
*/
|
||||
#define GST_VIDEO_BUFFER_IS_TOP_FIELD(buf) ((GST_BUFFER_FLAGS (buf) & _GST_VIDEO_BUFFER_FLAG_FIELD_MASK) == GST_VIDEO_BUFFER_FLAG_TOP_FIELD)
|
||||
|
||||
/**
|
||||
* GST_VIDEO_BUFFER_IS_BOTTOM_FIELD:
|
||||
* @buf: a #GstBuffer
|
||||
*
|
||||
* Check if GST_VIDEO_BUFFER_FLAG_BOTTOM_FIELD is set on @buf (Since: 1.18).
|
||||
*/
|
||||
#define GST_VIDEO_BUFFER_IS_BOTTOM_FIELD(buf) ((GST_BUFFER_FLAGS (buf) & _GST_VIDEO_BUFFER_FLAG_FIELD_MASK) == GST_VIDEO_BUFFER_FLAG_BOTTOM_FIELD)
|
||||
|
||||
/**
|
||||
* GstVideoFrameMapFlags:
|
||||
* @GST_VIDEO_FRAME_MAP_FLAG_NO_REF: Don't take another reference of the buffer and store it in
|
||||
|
|
|
@ -3747,6 +3747,30 @@ GST_START_TEST (test_video_meta_align)
|
|||
|
||||
GST_END_TEST;
|
||||
|
||||
GST_START_TEST (test_video_flags)
|
||||
{
|
||||
GstBuffer *buf;
|
||||
|
||||
buf = gst_buffer_new ();
|
||||
fail_unless (!GST_VIDEO_BUFFER_IS_TOP_FIELD (buf));
|
||||
fail_unless (!GST_VIDEO_BUFFER_IS_BOTTOM_FIELD (buf));
|
||||
gst_buffer_unref (buf);
|
||||
|
||||
buf = gst_buffer_new ();
|
||||
GST_BUFFER_FLAG_SET (buf, GST_VIDEO_BUFFER_FLAG_TOP_FIELD);
|
||||
fail_unless (GST_VIDEO_BUFFER_IS_TOP_FIELD (buf));
|
||||
fail_unless (!GST_VIDEO_BUFFER_IS_BOTTOM_FIELD (buf));
|
||||
gst_buffer_unref (buf);
|
||||
|
||||
buf = gst_buffer_new ();
|
||||
GST_BUFFER_FLAG_SET (buf, GST_VIDEO_BUFFER_FLAG_BOTTOM_FIELD);
|
||||
fail_unless (!GST_VIDEO_BUFFER_IS_TOP_FIELD (buf));
|
||||
fail_unless (GST_VIDEO_BUFFER_IS_BOTTOM_FIELD (buf));
|
||||
gst_buffer_unref (buf);
|
||||
}
|
||||
|
||||
GST_END_TEST;
|
||||
|
||||
static Suite *
|
||||
video_suite (void)
|
||||
{
|
||||
|
@ -3797,6 +3821,7 @@ video_suite (void)
|
|||
tcase_add_test (tc_chain, test_video_format_info_plane_to_components);
|
||||
tcase_add_test (tc_chain, test_video_info_align);
|
||||
tcase_add_test (tc_chain, test_video_meta_align);
|
||||
tcase_add_test (tc_chain, test_video_flags);
|
||||
|
||||
return s;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue