GstVideo.VideoInfo fails to report width height
The following snippet fails to report width/height (maybe other fields as well) on gstreamer 1.19.1 compared to 1.18:
import gi
gi.require_version('Gst', '1.0')
gi.require_version('Gtk', '3.0')
gi.require_version('GstVideo', '1.0')
from gi.repository import Gst, Gtk, GstVideo, Gio
caps_string = "video/x-raw, width=(int)1920, height=(int)1080, interlace-mode=(string)progressive, multiview-mode=(string)mono, multiview-flags=(GstVideoMultiviewFlagsSet)0:ffffffff:/right-view-first/left-flipped/left-flopped/right-flipped/right-flopped/half-aspect/mixed-mono, pixel-aspect-ratio=(fraction)1/1, framerate=(fraction)30/1, format=(string)BGRx, colorimetry=(string)1:1:0:0"
if __name__ == '__main__':
Gst.init(None)
vinfo = GstVideo.VideoInfo()
caps = Gst.Caps.from_string(caps_string)
print(caps.to_string())
vinfo.from_caps(caps)
print(vinfo.width, vinfo.height)
In contrast, the equivalent C code does report the right width/height:
#include <glib.h>
#include <glib/gprintf.h>
#include <gst/gst.h>
#include <gst/video/video.h>
#define CAPS_TXT "video/x-raw, width=(int)1920, height=(int)1080, interlace-mode=(string)progressive, multiview-mode=(string)mono, multiview-flags=(GstVideoMultiviewFlagsSet)0:ffffffff:/right-view-first/left-flipped/left-flopped/right-flipped/right-flopped/half-aspect/mixed-mono, pixel-aspect-ratio=(fraction)1/1, framerate=(fraction)30/1, format=(string)BGRx, colorimetry=(string)1:1:0:0"
int main(int argc, char** argv) {
gst_init (&argc, &argv);
GstCaps *caps = gst_caps_from_string(CAPS_TXT);
if (!caps) {
g_printerr("nocaps\n");
return -1;
}
GstVideoInfo *vinfo = gst_video_info_new();
if (!gst_video_info_from_caps (vinfo, caps)) {
g_printerr("could not create from caps\n");
return -1;
}
g_printf("width: %d, height: %d\n", vinfo->width, vinfo->height);
return 0;
}