rpicamsrc: More conversion to GStreamer logging

This commit is contained in:
Jan Schmidt 2015-03-06 01:27:44 +11:00 committed by Tim-Philipp Müller
parent 37028010f1
commit 52ae74f9ce
2 changed files with 14 additions and 12 deletions

View file

@ -271,7 +271,7 @@ void raspicapture_default_config(RASPIVID_CONFIG *config)
config->bInlineHeaders = 0; config->bInlineHeaders = 0;
config->inlineMotionVectors = 0; config->inlineMotionVectors = 0;
config->cameraNum = 0; config->cameraNum = 0;
config->settings = 0; config->settings = 0;
config->sensor_mode = 0; config->sensor_mode = 0;
@ -565,7 +565,7 @@ static int parse_cmdline(int argc, const char **argv, RASPIVID_STATE *state)
break; break;
} }
case CommandSplitWait: // split files on restart case CommandSplitWait: // split files on restart
{ {
// Must enable inline headers for this to work // Must enable inline headers for this to work
state->bInlineHeaders = 1; state->bInlineHeaders = 1;
@ -733,7 +733,7 @@ static void camera_control_callback(MMAL_PORT_T *port, MMAL_BUFFER_HEADER_T *buf
{ {
MMAL_PARAMETER_CAMERA_SETTINGS_T *settings = (MMAL_PARAMETER_CAMERA_SETTINGS_T*)param; MMAL_PARAMETER_CAMERA_SETTINGS_T *settings = (MMAL_PARAMETER_CAMERA_SETTINGS_T*)param;
vcos_log_error("Exposure now %u, analog gain %u/%u, digital gain %u/%u", vcos_log_error("Exposure now %u, analog gain %u/%u, digital gain %u/%u",
settings->exposure, settings->exposure,
settings->analog_gain.num, settings->analog_gain.den, settings->analog_gain.num, settings->analog_gain.den,
settings->digital_gain.num, settings->digital_gain.den); settings->digital_gain.num, settings->digital_gain.den);
vcos_log_error("AWB R=%u/%u, B=%u/%u", vcos_log_error("AWB R=%u/%u, B=%u/%u",
@ -898,7 +898,7 @@ static void encoder_buffer_callback(MMAL_PORT_T *port, MMAL_BUFFER_HEADER_T *buf
current_time = vcos_getmicrosecs64()/1000; current_time = vcos_getmicrosecs64()/1000;
if (state->base_time == -1) if (state->base_time == -1)
state->base_time = current_time; state->base_time = current_time;
// See if the second count has changed and we need to update any annotation // See if the second count has changed and we need to update any annotation
if (current_time/1000 != state->last_second) if (current_time/1000 != state->last_second)
{ {
@ -973,18 +973,18 @@ static MMAL_STATUS_T create_camera_component(RASPIVID_STATE *state)
vcos_log_error("Failed to create camera component"); vcos_log_error("Failed to create camera component");
goto error; goto error;
} }
MMAL_PARAMETER_INT32_T camera_num = MMAL_PARAMETER_INT32_T camera_num =
{{MMAL_PARAMETER_CAMERA_NUM, sizeof(camera_num)}, config->cameraNum}; {{MMAL_PARAMETER_CAMERA_NUM, sizeof(camera_num)}, config->cameraNum};
status = mmal_port_parameter_set(camera->control, &camera_num.hdr); status = mmal_port_parameter_set(camera->control, &camera_num.hdr);
if (status != MMAL_SUCCESS) if (status != MMAL_SUCCESS)
{ {
vcos_log_error("Could not select camera : error %d", status); vcos_log_error("Could not select camera : error %d", status);
goto error; goto error;
} }
if (!camera->output_num) if (!camera->output_num)
{ {
status = MMAL_ENOSYS; status = MMAL_ENOSYS;
@ -1091,15 +1091,14 @@ raspi_capture_set_format_and_start(RASPIVID_STATE *state)
//enable dynamic framerate if necessary //enable dynamic framerate if necessary
if (config->camera_parameters.shutter_speed) if (config->camera_parameters.shutter_speed)
{ {
if (((float)(config->fps_n) / config->fps_d) > 1000000.0 / config->camera_parameters.shutter_speed) if (((float)(config->fps_n) / config->fps_d) > 1000000.0 / config->camera_parameters.shutter_speed)
{ {
config->fps_n = 0; config->fps_n = 0;
config->fps_d = 1; config->fps_d = 1;
if (config->verbose) GST_INFO ("Enabling dynamic frame rate to fulfil shutter speed requirement");
fprintf(stderr, "Enable dynamic frame rate to fulfil shutter speed requirement\n");
} }
} }
format->encoding = MMAL_ENCODING_OPAQUE; format->encoding = MMAL_ENCODING_OPAQUE;
format->es->video.width = VCOS_ALIGN_UP(config->width, 32); format->es->video.width = VCOS_ALIGN_UP(config->width, 32);
@ -1393,7 +1392,7 @@ static MMAL_STATUS_T create_encoder_component(RASPIVID_STATE *state)
vcos_log_error("failed to set INLINE HEADER FLAG parameters"); vcos_log_error("failed to set INLINE HEADER FLAG parameters");
// Continue rather than abort.. // Continue rather than abort..
} }
//set INLINE VECTORS flag to request motion vector estimates //set INLINE VECTORS flag to request motion vector estimates
if (mmal_port_parameter_set_boolean(encoder_output, MMAL_PARAMETER_VIDEO_ENCODE_INLINE_VECTORS, config->inlineMotionVectors) != MMAL_SUCCESS) if (mmal_port_parameter_set_boolean(encoder_output, MMAL_PARAMETER_VIDEO_ENCODE_INLINE_VECTORS, config->inlineMotionVectors) != MMAL_SUCCESS)
{ {

View file

@ -59,6 +59,9 @@ GST_DEBUG_CATEGORY_EXTERN (gst_rpi_cam_src_debug);
#undef fprintf #undef fprintf
#define fprintf(f,...) GST_LOG(__VA_ARGS__) #define fprintf(f,...) GST_LOG(__VA_ARGS__)
#undef vcos_log_error
#define vcos_log_error GST_ERROR
G_BEGIN_DECLS G_BEGIN_DECLS
/** Structure containing all state information for the current run /** Structure containing all state information for the current run