niimaq: use standard video caps
Even though NI-IMAQ can specify 10-, 12-, or 14-bit images, no other standard element supports it, and in 0.11/1.0 caps are simplified to be gray8/gray16. We can always add back custom caps if there is a real need for it.
This commit is contained in:
parent
fa883c1ca1
commit
7c251fa83a
@ -908,9 +908,7 @@ gst_niimaqsrc_get_cam_caps (GstNiImaqSrc * niimaqsrc)
|
|||||||
Int32 rval;
|
Int32 rval;
|
||||||
uInt32 val;
|
uInt32 val;
|
||||||
gint width, height, depth, bpp;
|
gint width, height, depth, bpp;
|
||||||
GstStructure *gs;
|
GstVideoFormat format = GST_VIDEO_FORMAT_UNKNOWN;
|
||||||
|
|
||||||
gcaps = gst_caps_new_empty ();
|
|
||||||
|
|
||||||
if (!niimaqsrc->iid) {
|
if (!niimaqsrc->iid) {
|
||||||
GST_ELEMENT_ERROR (niimaqsrc, RESOURCE, FAILED,
|
GST_ELEMENT_ERROR (niimaqsrc, RESOURCE, FAILED,
|
||||||
@ -939,35 +937,17 @@ gst_niimaqsrc_get_cam_caps (GstNiImaqSrc * niimaqsrc)
|
|||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* create new structure and set caps we got from IMAQ */
|
if (depth == 8)
|
||||||
gs = gst_structure_empty_new ("video/x-raw-gray");
|
format = GST_VIDEO_FORMAT_GRAY8;
|
||||||
gst_structure_set (gs,
|
else if (depth == 16)
|
||||||
"bpp", G_TYPE_INT, bpp,
|
format = GST_VIDEO_FORMAT_GRAY16_LE;
|
||||||
"depth", G_TYPE_INT, depth,
|
else {
|
||||||
"width", G_TYPE_INT, width, "height", G_TYPE_INT, height, NULL);
|
GST_WARNING_OBJECT (niimaqsrc, "Depth %d not supported yet", depth);
|
||||||
if (depth > 8) {
|
goto error;
|
||||||
gst_structure_set (gs, "endianness", G_TYPE_INT, G_LITTLE_ENDIAN, NULL);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* hard code framerate to 30Hz as IMAQ doesn't tell us anything about it */
|
/* hard code framerate and par as IMAQ doesn't tell us anything about it */
|
||||||
GST_DEBUG_OBJECT (niimaqsrc, "Setting framerate to 30 fps");
|
gcaps = gst_video_format_new_caps (format, width, height, 30, 1, 1, 1);
|
||||||
gst_structure_set (gs, "framerate", GST_TYPE_FRACTION, 30, 1, NULL);
|
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (gs, "is the basic structure");
|
|
||||||
|
|
||||||
gst_caps_append_structure (gcaps, gst_structure_copy (gs));
|
|
||||||
|
|
||||||
/* if (8 < bpp < 16), then append structure with bpp=16 so ffmpegcolorspace
|
|
||||||
* and other elements can work directly with this src */
|
|
||||||
if (bpp > 8 && bpp < 16) {
|
|
||||||
GST_DEBUG_OBJECT (niimaqsrc, "Adding 16bpp caps for compatibility");
|
|
||||||
gst_structure_set (gs,
|
|
||||||
"bpp", G_TYPE_INT, 16,
|
|
||||||
"depth", G_TYPE_INT, 16,
|
|
||||||
"endianness", G_TYPE_INT, G_LITTLE_ENDIAN, NULL);
|
|
||||||
gst_caps_append_structure (gcaps, gst_structure_copy (gs));
|
|
||||||
}
|
|
||||||
gst_structure_free (gs);
|
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (gcaps, "are the camera caps");
|
GST_DEBUG_OBJECT (gcaps, "are the camera caps");
|
||||||
|
|
||||||
|
|||||||
@ -31,7 +31,7 @@
|
|||||||
</ImportGroup>
|
</ImportGroup>
|
||||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
<Import Project="$(GSTREAMER_SDK_ROOT_X86)\share\vs\2010\libs\gstreamer-base-0.10.props" />
|
<Import Project="$(GSTREAMER_SDK_ROOT_X86)\share\vs\2010\libs\gstreamer-video-0.10.props" />
|
||||||
<Import Project="$(GSTREAMER_SDK_ROOT_X86)\share\vs\2010\libs\gstreamer-interfaces-0.10.props" />
|
<Import Project="$(GSTREAMER_SDK_ROOT_X86)\share\vs\2010\libs\gstreamer-interfaces-0.10.props" />
|
||||||
<Import Project="niimaq.props" />
|
<Import Project="niimaq.props" />
|
||||||
</ImportGroup>
|
</ImportGroup>
|
||||||
@ -78,4 +78,4 @@
|
|||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||||
<ImportGroup Label="ExtensionTargets">
|
<ImportGroup Label="ExtensionTargets">
|
||||||
</ImportGroup>
|
</ImportGroup>
|
||||||
</Project>
|
</Project>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user