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:
Jan Schmidt 2015-04-27 22:56:32 +10:00 committed by Tim-Philipp Müller
parent e58951cfb8
commit 4e827949ef
3 changed files with 13 additions and 3 deletions

View file

@ -1834,7 +1834,7 @@ raspi_capture_free(RASPIVID_STATE *state)
}
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;
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 */
state->config = *config;
if (!dynamic)
return;
if (config->change_flags & PROP_CHANGE_ENCODING) {
/* BITRATE or QUANT or KEY Interval, intra refresh */

View file

@ -119,7 +119,8 @@ void raspicapture_init();
void raspicapture_default_config(RASPIVID_CONFIG *config);
RASPIVID_STATE *raspi_capture_setup(RASPIVID_CONFIG *config);
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,
GstClock *clock, GstClockTime base_time);
void raspi_capture_stop(RASPIVID_STATE *state);

View file

@ -769,6 +769,8 @@ gst_rpi_cam_src_start (GstBaseSrc * parent)
GST_LOG_OBJECT (src, "In src_start()");
g_mutex_lock (&src->config_lock);
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);
if (src->capture_state == NULL)
return FALSE;
@ -925,6 +927,11 @@ gst_rpi_cam_src_create (GstPushSrc * parent, GstBuffer ** buf)
GstClockTime base_time;
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))
return GST_FLOW_ERROR;
src->started = TRUE;
@ -938,7 +945,7 @@ gst_rpi_cam_src_create (GstPushSrc * parent, GstBuffer ** buf)
g_mutex_lock (&src->config_lock);
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;
}
g_mutex_unlock (&src->config_lock);