mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-06-07 16:08:51 +00:00
rpicamsrc: Fix initial config setting.
Make sure to update the captsure config before starting capture. Since the capture component now keeps a local copy of the config, it's not updated automatically.
This commit is contained in:
parent
e58951cfb8
commit
4e827949ef
3 changed files with 13 additions and 3 deletions
|
@ -1834,7 +1834,7 @@ raspi_capture_free(RASPIVID_STATE *state)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
raspi_capture_update_config (RASPIVID_STATE *state, RASPIVID_CONFIG *config)
|
raspi_capture_update_config (RASPIVID_STATE *state, RASPIVID_CONFIG *config, gboolean dynamic)
|
||||||
{
|
{
|
||||||
MMAL_STATUS_T status;
|
MMAL_STATUS_T status;
|
||||||
RASPICAM_CAMERA_PARAMETERS *params = &config->camera_parameters;
|
RASPICAM_CAMERA_PARAMETERS *params = &config->camera_parameters;
|
||||||
|
@ -1842,6 +1842,8 @@ raspi_capture_update_config (RASPIVID_STATE *state, RASPIVID_CONFIG *config)
|
||||||
|
|
||||||
/* Store the new config */
|
/* Store the new config */
|
||||||
state->config = *config;
|
state->config = *config;
|
||||||
|
if (!dynamic)
|
||||||
|
return;
|
||||||
|
|
||||||
if (config->change_flags & PROP_CHANGE_ENCODING) {
|
if (config->change_flags & PROP_CHANGE_ENCODING) {
|
||||||
/* BITRATE or QUANT or KEY Interval, intra refresh */
|
/* BITRATE or QUANT or KEY Interval, intra refresh */
|
||||||
|
|
|
@ -119,7 +119,8 @@ void raspicapture_init();
|
||||||
void raspicapture_default_config(RASPIVID_CONFIG *config);
|
void raspicapture_default_config(RASPIVID_CONFIG *config);
|
||||||
RASPIVID_STATE *raspi_capture_setup(RASPIVID_CONFIG *config);
|
RASPIVID_STATE *raspi_capture_setup(RASPIVID_CONFIG *config);
|
||||||
gboolean raspi_capture_start(RASPIVID_STATE *state);
|
gboolean raspi_capture_start(RASPIVID_STATE *state);
|
||||||
void raspi_capture_update_config (RASPIVID_STATE *state, RASPIVID_CONFIG *config);
|
void raspi_capture_update_config (RASPIVID_STATE *state,
|
||||||
|
RASPIVID_CONFIG *config, gboolean dynamic);
|
||||||
GstFlowReturn raspi_capture_fill_buffer(RASPIVID_STATE *state, GstBuffer **buf,
|
GstFlowReturn raspi_capture_fill_buffer(RASPIVID_STATE *state, GstBuffer **buf,
|
||||||
GstClock *clock, GstClockTime base_time);
|
GstClock *clock, GstClockTime base_time);
|
||||||
void raspi_capture_stop(RASPIVID_STATE *state);
|
void raspi_capture_stop(RASPIVID_STATE *state);
|
||||||
|
|
|
@ -769,6 +769,8 @@ gst_rpi_cam_src_start (GstBaseSrc * parent)
|
||||||
GST_LOG_OBJECT (src, "In src_start()");
|
GST_LOG_OBJECT (src, "In src_start()");
|
||||||
g_mutex_lock (&src->config_lock);
|
g_mutex_lock (&src->config_lock);
|
||||||
src->capture_state = raspi_capture_setup (&src->capture_config);
|
src->capture_state = raspi_capture_setup (&src->capture_config);
|
||||||
|
/* Clear all capture flags */
|
||||||
|
src->capture_config.change_flags = 0;
|
||||||
g_mutex_unlock (&src->config_lock);
|
g_mutex_unlock (&src->config_lock);
|
||||||
if (src->capture_state == NULL)
|
if (src->capture_state == NULL)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -925,6 +927,11 @@ gst_rpi_cam_src_create (GstPushSrc * parent, GstBuffer ** buf)
|
||||||
GstClockTime base_time;
|
GstClockTime base_time;
|
||||||
|
|
||||||
if (!src->started) {
|
if (!src->started) {
|
||||||
|
g_mutex_lock (&src->config_lock);
|
||||||
|
raspi_capture_update_config (src->capture_state, &src->capture_config, FALSE);
|
||||||
|
src->capture_config.change_flags = 0;
|
||||||
|
g_mutex_unlock (&src->config_lock);
|
||||||
|
|
||||||
if (!raspi_capture_start (src->capture_state))
|
if (!raspi_capture_start (src->capture_state))
|
||||||
return GST_FLOW_ERROR;
|
return GST_FLOW_ERROR;
|
||||||
src->started = TRUE;
|
src->started = TRUE;
|
||||||
|
@ -938,7 +945,7 @@ gst_rpi_cam_src_create (GstPushSrc * parent, GstBuffer ** buf)
|
||||||
|
|
||||||
g_mutex_lock (&src->config_lock);
|
g_mutex_lock (&src->config_lock);
|
||||||
if (src->capture_config.change_flags) {
|
if (src->capture_config.change_flags) {
|
||||||
raspi_capture_update_config (src->capture_state, &src->capture_config);
|
raspi_capture_update_config (src->capture_state, &src->capture_config, TRUE);
|
||||||
src->capture_config.change_flags = 0;
|
src->capture_config.change_flags = 0;
|
||||||
}
|
}
|
||||||
g_mutex_unlock (&src->config_lock);
|
g_mutex_unlock (&src->config_lock);
|
||||||
|
|
Loading…
Reference in a new issue