From f42afec4712501b25294cbcd2a8768a89db66d51 Mon Sep 17 00:00:00 2001 From: Jan Schmidt Date: Mon, 3 Oct 2016 15:29:49 +0000 Subject: [PATCH] rpicamsrc: Switch back to MJPEG codec for image/jpeg The JPEG codec hangs, not sure why yet. The MJPEG codec doesn't provide a quality setting, and sometimes freezes on shutdown, but otherwise seems more reliable --- sys/rpicamsrc/gstrpicamsrc.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/sys/rpicamsrc/gstrpicamsrc.c b/sys/rpicamsrc/gstrpicamsrc.c index 542c3bb246..a9cf7cd89d 100644 --- a/sys/rpicamsrc/gstrpicamsrc.c +++ b/sys/rpicamsrc/gstrpicamsrc.c @@ -78,6 +78,9 @@ GST_DEBUG_CATEGORY (gst_rpi_cam_src_debug); +/* comment out to use JPEG codec instead of MJPEG */ +// #define USE_JPEG_CODEC + /* Filter signals and args */ enum { @@ -299,10 +302,12 @@ gst_rpi_cam_src_class_init (GstRpiCamSrcClass * klass) "Bitrate for encoding. 0 for VBR using quantisation-parameter", 0, BITRATE_HIGHEST, BITRATE_DEFAULT, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); +#ifdef USE_JPEG_CODEC g_object_class_install_property (gobject_class, PROP_JPEG_QUALITY, g_param_spec_int ("jpeg-quality", "JPEG Quality", "Quality setting for JPEG encode", 1, 100, DEFAULT_JPEG_QUALITY, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); +#endif g_object_class_install_property (gobject_class, PROP_KEYFRAME_INTERVAL, g_param_spec_int ("keyframe-interval", "Keyframe Interface", "Interval (in frames) between I frames. -1 = automatic, 0 = single-keyframe", @@ -1307,7 +1312,11 @@ gst_rpi_cam_src_set_caps (GstBaseSrc * bsrc, GstCaps * caps) } } else if (gst_structure_has_name (structure, "image/jpeg")) { +#ifdef USE_JPEG_CODEC src->capture_config.encoding = MMAL_ENCODING_JPEG; +#else + src->capture_config.encoding = MMAL_ENCODING_MJPEG; +#endif } else { /* Raw caps */