pylonsrc: return a copy of src->caps in get_caps; restored variable fps
This commit is contained in:
parent
04246feae7
commit
8bd6934d78
1
.gitignore
vendored
1
.gitignore
vendored
@ -23,6 +23,7 @@ Thumbs.db
|
|||||||
*.cache
|
*.cache
|
||||||
*.ilk
|
*.ilk
|
||||||
*.log
|
*.log
|
||||||
|
.vscode
|
||||||
[Bb]in
|
[Bb]in
|
||||||
[Dd]ebug*/
|
[Dd]ebug*/
|
||||||
*.lib
|
*.lib
|
||||||
|
|||||||
@ -290,3 +290,43 @@ gst_genicam_pixel_format_caps_from_pixel_format (const char *pixel_format,
|
|||||||
|
|
||||||
return caps;
|
return caps;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static GstCaps *
|
||||||
|
gst_genicam_pixel_format_caps_from_pixel_format_var (const char *pixel_format,
|
||||||
|
int endianness, int width, int height)
|
||||||
|
{
|
||||||
|
const char *caps_string;
|
||||||
|
GstCaps *caps;
|
||||||
|
GstStructure *structure;
|
||||||
|
|
||||||
|
GST_DEBUG
|
||||||
|
("Trying to create caps from: %s, endianness=%d, %dx%d",
|
||||||
|
pixel_format, endianness, width, height);
|
||||||
|
|
||||||
|
caps_string =
|
||||||
|
gst_genicam_pixel_format_to_caps_string (pixel_format, endianness);
|
||||||
|
if (caps_string == NULL)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
GST_DEBUG ("Got caps string: %s", caps_string);
|
||||||
|
|
||||||
|
structure = gst_structure_from_string (caps_string, NULL);
|
||||||
|
if (structure == NULL)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
gst_structure_set (structure,
|
||||||
|
"width", G_TYPE_INT, width,
|
||||||
|
"height", G_TYPE_INT, height,
|
||||||
|
"framerate", GST_TYPE_FRACTION_RANGE, 0, 1, G_MAXINT, 1, NULL);
|
||||||
|
|
||||||
|
if (g_str_has_prefix (pixel_format, "Bayer")) {
|
||||||
|
const GstGenicamPixelFormatInfo *info = gst_genicam_pixel_format_get_info(pixel_format, endianness);
|
||||||
|
g_assert (info);
|
||||||
|
gst_structure_set(structure, "bpp", G_TYPE_INT, (gint)info->bpp, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
caps = gst_caps_new_empty ();
|
||||||
|
gst_caps_append_structure (caps, structure);
|
||||||
|
|
||||||
|
return caps;
|
||||||
|
}
|
||||||
@ -991,7 +991,9 @@ gst_pylonsrc_get_caps (GstBaseSrc * bsrc, GstCaps * filter)
|
|||||||
GST_DEBUG_OBJECT (src, "Could not send caps - no camera connected.");
|
GST_DEBUG_OBJECT (src, "Could not send caps - no camera connected.");
|
||||||
return gst_pad_get_pad_template_caps (GST_BASE_SRC_PAD (bsrc));
|
return gst_pad_get_pad_template_caps (GST_BASE_SRC_PAD (bsrc));
|
||||||
} else {
|
} else {
|
||||||
return src->caps;
|
GstCaps* result = gst_caps_copy(src->caps);
|
||||||
|
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1486,8 +1488,8 @@ gst_pylonsrc_get_supported_caps (GstPylonSrc * src)
|
|||||||
|
|
||||||
// TODO: query FPS
|
// TODO: query FPS
|
||||||
format_caps =
|
format_caps =
|
||||||
gst_genicam_pixel_format_caps_from_pixel_format (info->pixel_format,
|
gst_genicam_pixel_format_caps_from_pixel_format_var (info->pixel_format,
|
||||||
G_BYTE_ORDER, src->width, src->height, 30, 1, 1, 1);
|
G_BYTE_ORDER, src->width, src->height);
|
||||||
|
|
||||||
if (format_caps)
|
if (format_caps)
|
||||||
gst_caps_append (caps, format_caps);
|
gst_caps_append (caps, format_caps);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user