0

我正在尝试使用 gstreamer 来显示视频信息,例如频率、频道数、宽度和高度。我使用此代码来执行此操作,但它不起作用。我用C编码。

GstStructure *structure;
// guint32       fourcc;
const GValue *val;
GstPad     *audiopad;
GstCaps *caps;
gint    width;
gint    height;
int     fps_num = 1;
int     fps_den = 1;
audiopad = gst_element_get_pad (queuevideo, "tee");
caps = gst_pad_get_caps (audiopad);

structure = gst_caps_get_structure (GST_CAPS (caps), 0);
gst_structure_get_int (structure, "width", &width);
gst_structure_get_int (structure, "height", &height);
val = gst_structure_get_value (structure, "framerate");
if (val) {
    fps_num = gst_value_get_fraction_numerator (val);
    fps_den = gst_value_get_fraction_denominator (val);
}
printf("la taille est de  : %d*%d et la frequence de : %d/%d", width, height, fps_num, fps_den);
4

0 回答 0