video: confusing top/bottom field flags
These flags are documented as:
* @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).
* @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).
So they should be mutually exclusive. But checking for them is quite confusing, see this simple test:
GST_START_TEST (test_video_flags)
{
GstBuffer *buf;
buf = gst_buffer_new ();
GST_BUFFER_FLAG_SET (buf, GST_VIDEO_BUFFER_FLAG_TOP_FIELD);
g_assert (GST_BUFFER_FLAG_IS_SET (buf, GST_VIDEO_BUFFER_FLAG_TOP_FIELD));
g_assert (!GST_BUFFER_FLAG_IS_SET (buf, GST_VIDEO_BUFFER_FLAG_BOTTOM_FIELD)); // fail
gst_buffer_unref (buf);
buf = gst_buffer_new ();
GST_BUFFER_FLAG_SET (buf, GST_VIDEO_BUFFER_FLAG_BOTTOM_FIELD);
g_assert (!GST_BUFFER_FLAG_IS_SET (buf, GST_VIDEO_BUFFER_FLAG_TOP_FIELD)); // fail
g_assert (GST_BUFFER_FLAG_IS_SET (buf, GST_VIDEO_BUFFER_FLAG_BOTTOM_FIELD));
gst_buffer_unref (buf);
}
Because of the way they are defined it's basically useless to check for their presence or not which is pretty confusing.
GST_VIDEO_BUFFER_FLAG_TOP_FIELD = GST_VIDEO_BUFFER_FLAG_TFF |
GST_VIDEO_BUFFER_FLAG_ONEFIELD,
GST_VIDEO_BUFFER_FLAG_BOTTOM_FIELD = GST_VIDEO_BUFFER_FLAG_ONEFIELD,
We have the same problem with the equivalent frame flags: GST_VIDEO_FRAME_FLAG_TOP_FIELD
and GST_VIDEO_FRAME_FLAG_BOTTOM_FIELD
.
Not sure what's the right way to address this. Do we have other flags defined as a combination of other flags?
cc @ndufresne