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 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}
|
{"Bayer GB 16", 0, VIDEO_CAPS_MAKE_BAYER16 ("gbrg16", "1234"), 16, 16, 1}
|
||||||
|
,
|
||||||
|
{"JPEG", 0, "image/jpeg", 8, 8, 1}
|
||||||
};
|
};
|
||||||
|
|
||||||
static const ImaqDxCapsInfo *
|
static const ImaqDxCapsInfo *
|
||||||
@ -698,6 +700,11 @@ gst_niimaqdxsrc_fill (GstPushSrc * psrc, GstBuffer * buf)
|
|||||||
goto error;
|
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) {
|
while (timestamp == GST_CLOCK_TIME_NONE) {
|
||||||
/* wait 100 ms, shouldn't be needed if callback is working as expected */
|
/* wait 100 ms, shouldn't be needed if callback is working as expected */
|
||||||
GstNiImaqDxSrcTimeEntry *entry =
|
GstNiImaqDxSrcTimeEntry *entry =
|
||||||
@ -1018,15 +1025,19 @@ gst_niimaqdxsrc_start (GstBaseSrc * bsrc)
|
|||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
GST_LOG_OBJECT (src, "Registering callback functions");
|
if (src->is_jpeg) {
|
||||||
rval =
|
GST_DEBUG_OBJECT (src, "Source is JPEG, just use clock time");
|
||||||
IMAQdxRegisterFrameDoneEvent (src->session, 1,
|
} else {
|
||||||
gst_niimaqdxsrc_frame_done_callback, src);
|
GST_LOG_OBJECT (src, "Registering callback functions");
|
||||||
if (rval) {
|
rval =
|
||||||
gst_niimaqdxsrc_report_imaq_error (rval);
|
IMAQdxRegisterFrameDoneEvent (src->session, 1,
|
||||||
GST_ELEMENT_ERROR (src, RESOURCE, FAILED,
|
gst_niimaqdxsrc_frame_done_callback, src);
|
||||||
("Failed to register callback(s)"), (NULL));
|
if (rval) {
|
||||||
goto error;
|
gst_niimaqdxsrc_report_imaq_error (rval);
|
||||||
|
GST_ELEMENT_ERROR (src, RESOURCE, FAILED,
|
||||||
|
("Failed to register callback(s)"), (NULL));
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
gst_niimaqdxsrc_set_dx_attributes (src);
|
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);
|
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 =
|
src->dx_row_stride =
|
||||||
gst_niimaqdxsrc_pixel_format_get_stride (pixel_format, endianness,
|
gst_niimaqdxsrc_pixel_format_get_stride (pixel_format, endianness,
|
||||||
src->width);
|
src->width);
|
||||||
|
|||||||
@ -76,6 +76,7 @@ struct _GstNiImaqDxSrc {
|
|||||||
gint gst_framesize;
|
gint gst_framesize;
|
||||||
guint8 *temp_buffer;
|
guint8 *temp_buffer;
|
||||||
const ImaqDxCapsInfo *caps_info;
|
const ImaqDxCapsInfo *caps_info;
|
||||||
|
gboolean is_jpeg;
|
||||||
|
|
||||||
uInt32 cumbufnum;
|
uInt32 cumbufnum;
|
||||||
gint64 n_dropped_frames;
|
gint64 n_dropped_frames;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user