Skip to content

Commit

Permalink
Implement dynamic bitrate update
Browse files Browse the repository at this point in the history
Use mmal_port_set_parameter_uint32 to update the encoder
bitrate.

Fixes #60
  • Loading branch information
thaytan committed Jan 27, 2017
1 parent 86564c3 commit c74ae97
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions src/RaspiCapture.c
Expand Up @@ -1908,13 +1908,9 @@ raspi_capture_update_config (RASPIVID_STATE *state, RASPIVID_CONFIG *config, gbo
MMAL_COMPONENT_T *encoder = state->encoder_component;
MMAL_PORT_T *encoder_output = encoder->output[0];

#if 0 /* not dynamically change-able */
encoder_output->format->bitrate = config->bitrate;
status = mmal_port_format_commit(encoder_output);
if (status != MMAL_SUCCESS) {
vcos_log_warn("Cannot change bitrate dynamically");
}
#endif
status = mmal_port_parameter_set_uint32(encoder_output, MMAL_PARAMETER_VIDEO_BIT_RATE, config->bitrate);
if (status != MMAL_SUCCESS)
vcos_log_warn("Unable to change bitrate dynamically");

{
MMAL_PARAMETER_UINT32_T param = {{ MMAL_PARAMETER_INTRAPERIOD, sizeof(param)}, config->intraperiod};
Expand Down

0 comments on commit c74ae97

Please sign in to comment.