rpicamsrc: Add keyframe-interval property to the element

This commit is contained in:
Jan Schmidt 2015-01-05 02:21:16 +11:00 committed by Tim-Philipp Müller
parent 27c35a8ff3
commit eb345f032c

View file

@ -1,6 +1,6 @@
/* /*
* GStreamer * GStreamer
* Copyright (C) 2013 Jan Schmidt <jan@centricular.com> * Copyright (C) 2013-2014 Jan Schmidt <jan@centricular.com>
* *
* Permission is hereby granted, free of charge, to any person obtaining a * Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"), * copy of this software and associated documentation files (the "Software"),
@ -91,6 +91,7 @@ enum
{ {
PROP_0, PROP_0,
PROP_BITRATE, PROP_BITRATE,
PROP_KEYFRAME_INTERVAL,
PROP_PREVIEW, PROP_PREVIEW,
PROP_PREVIEW_ENCODED, PROP_PREVIEW_ENCODED,
PROP_PREVIEW_OPACITY, PROP_PREVIEW_OPACITY,
@ -127,6 +128,7 @@ enum
#define ISO_DEFAULT 0 #define ISO_DEFAULT 0
#define VIDEO_STABILISATION_DEFAULT FALSE #define VIDEO_STABILISATION_DEFAULT FALSE
#define EXPOSURE_COMPENSATION_DEFAULT 0 #define EXPOSURE_COMPENSATION_DEFAULT 0
#define KEYFRAME_INTERVAL_DEFAULT 25
#define EXPOSURE_MODE_DEFAULT GST_RPI_CAM_SRC_EXPOSURE_MODE_AUTO #define EXPOSURE_MODE_DEFAULT GST_RPI_CAM_SRC_EXPOSURE_MODE_AUTO
#define EXPOSURE_METERING_MODE_DEFAULT GST_RPI_CAM_SRC_EXPOSURE_METERING_MODE_AVERAGE #define EXPOSURE_METERING_MODE_DEFAULT GST_RPI_CAM_SRC_EXPOSURE_METERING_MODE_AVERAGE
@ -205,6 +207,11 @@ gst_rpi_cam_src_class_init (GstRpiCamSrcClass * klass)
g_param_spec_int ("bitrate", "Bitrate", "Bitrate for encoding", g_param_spec_int ("bitrate", "Bitrate", "Bitrate for encoding",
1, BITRATE_HIGHEST, BITRATE_DEFAULT, 1, BITRATE_HIGHEST, BITRATE_DEFAULT,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class, PROP_KEYFRAME_INTERVAL,
g_param_spec_int ("keyframe-interval", "Keyframe Interface",
"Interval (in frames) between I frames. 0 = single-keyframe",
0, G_MAXINT, KEYFRAME_INTERVAL_DEFAULT,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class, PROP_PREVIEW, g_object_class_install_property (gobject_class, PROP_PREVIEW,
g_param_spec_boolean ("preview", g_param_spec_boolean ("preview",
"Preview Window", "Display preview window overlay", "Preview Window", "Display preview window overlay",
@ -329,7 +336,9 @@ gst_rpi_cam_src_init (GstRpiCamSrc * src)
gst_base_src_set_live (GST_BASE_SRC (src), TRUE); gst_base_src_set_live (GST_BASE_SRC (src), TRUE);
raspicapture_default_config (&src->capture_config); raspicapture_default_config (&src->capture_config);
src->capture_config.intraperiod = KEYFRAME_INTERVAL_DEFAULT;
src->capture_config.verbose = 1; src->capture_config.verbose = 1;
/* do-timestamping by default for now. FIXME: Implement proper timestamping */ /* do-timestamping by default for now. FIXME: Implement proper timestamping */
gst_base_src_set_do_timestamp (GST_BASE_SRC (src), TRUE); gst_base_src_set_do_timestamp (GST_BASE_SRC (src), TRUE);
} }
@ -344,6 +353,9 @@ gst_rpi_cam_src_set_property (GObject * object, guint prop_id,
case PROP_BITRATE: case PROP_BITRATE:
src->capture_config.bitrate = g_value_get_int (value); src->capture_config.bitrate = g_value_get_int (value);
break; break;
case PROP_KEYFRAME_INTERVAL:
src->capture_config.intraperiod = g_value_get_int (value);
break;
case PROP_PREVIEW: case PROP_PREVIEW:
src->capture_config.preview_parameters.wantPreview = src->capture_config.preview_parameters.wantPreview =
g_value_get_boolean (value); g_value_get_boolean (value);
@ -434,6 +446,9 @@ gst_rpi_cam_src_get_property (GObject * object, guint prop_id,
case PROP_BITRATE: case PROP_BITRATE:
g_value_set_int (value, src->capture_config.bitrate); g_value_set_int (value, src->capture_config.bitrate);
break; break;
case PROP_KEYFRAME_INTERVAL:
g_value_set_int (value, src->capture_config.intraperiod);
break;
case PROP_PREVIEW: case PROP_PREVIEW:
g_value_set_boolean (value, g_value_set_boolean (value,
src->capture_config.preview_parameters.wantPreview); src->capture_config.preview_parameters.wantPreview);