niimaqdxsrc: add support for JPEG PixelFormat
This commit is contained in:
parent
4a18d3e118
commit
a4af051165
@ -215,6 +215,8 @@ ImaqDxCapsInfo imaq_dx_caps_infos[] = {
|
||||
{"Bayer RG 16", 0, VIDEO_CAPS_MAKE_BAYER16 ("rggb16", "1234"), 16, 16, 1}
|
||||
,
|
||||
{"Bayer GB 16", 0, VIDEO_CAPS_MAKE_BAYER16 ("gbrg16", "1234"), 16, 16, 1}
|
||||
,
|
||||
{"JPEG", 0, "image/jpeg", 8, 8, 1}
|
||||
};
|
||||
|
||||
static const ImaqDxCapsInfo *
|
||||
@ -698,6 +700,11 @@ gst_niimaqdxsrc_fill (GstPushSrc * psrc, GstBuffer * buf)
|
||||
goto error;
|
||||
}
|
||||
|
||||
if (src->is_jpeg) {
|
||||
/* JPEG sources don't seem to give reliable callbacks, just pull clock */
|
||||
timestamp = gst_clock_get_time (gst_element_get_clock (GST_ELEMENT (src)));
|
||||
}
|
||||
|
||||
while (timestamp == GST_CLOCK_TIME_NONE) {
|
||||
/* wait 100 ms, shouldn't be needed if callback is working as expected */
|
||||
GstNiImaqDxSrcTimeEntry *entry =
|
||||
@ -1018,6 +1025,9 @@ gst_niimaqdxsrc_start (GstBaseSrc * bsrc)
|
||||
goto error;
|
||||
}
|
||||
|
||||
if (src->is_jpeg) {
|
||||
GST_DEBUG_OBJECT (src, "Source is JPEG, just use clock time");
|
||||
} else {
|
||||
GST_LOG_OBJECT (src, "Registering callback functions");
|
||||
rval =
|
||||
IMAQdxRegisterFrameDoneEvent (src->session, 1,
|
||||
@ -1028,6 +1038,7 @@ gst_niimaqdxsrc_start (GstBaseSrc * bsrc)
|
||||
("Failed to register callback(s)"), (NULL));
|
||||
goto error;
|
||||
}
|
||||
}
|
||||
|
||||
gst_niimaqdxsrc_set_dx_attributes (src);
|
||||
|
||||
@ -1162,6 +1173,12 @@ gst_niimaqdxsrc_set_caps (GstBaseSrc * bsrc, GstCaps * caps)
|
||||
|
||||
src->caps_info = gst_niimaqdxsrc_get_caps_info (pixel_format, endianness);
|
||||
|
||||
if (g_strcmp0 (pixel_format, "JPEG") == 0) {
|
||||
src->is_jpeg = TRUE;
|
||||
} else {
|
||||
src->is_jpeg = FALSE;
|
||||
}
|
||||
|
||||
src->dx_row_stride =
|
||||
gst_niimaqdxsrc_pixel_format_get_stride (pixel_format, endianness,
|
||||
src->width);
|
||||
|
||||
@ -76,6 +76,7 @@ struct _GstNiImaqDxSrc {
|
||||
gint gst_framesize;
|
||||
guint8 *temp_buffer;
|
||||
const ImaqDxCapsInfo *caps_info;
|
||||
gboolean is_jpeg;
|
||||
|
||||
uInt32 cumbufnum;
|
||||
gint64 n_dropped_frames;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user