mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-24 09:10:36 +00:00
camerabin: code cruft removal and debug logs
Remove unused code. Add lots of debug loging. Change comments for local functions to not use /** gtk-doc start style.
This commit is contained in:
parent
11a78399d8
commit
a971391906
5 changed files with 92 additions and 134 deletions
|
@ -32,74 +32,6 @@
|
|||
|
||||
GST_DEBUG_CATEGORY (gst_camerabin_debug);
|
||||
|
||||
static gboolean
|
||||
camerabin_general_dbg_have_event (GstPad * pad, GstEvent * event,
|
||||
gpointer u_data)
|
||||
{
|
||||
switch (GST_EVENT_TYPE (event)) {
|
||||
case GST_EVENT_NEWSEGMENT:
|
||||
{
|
||||
GstElement *elem = (GstElement *) u_data;
|
||||
gchar *elem_name = gst_element_get_name (elem);
|
||||
gchar *pad_name = gst_pad_get_name (pad);
|
||||
|
||||
gboolean update;
|
||||
gdouble rate;
|
||||
GstFormat format;
|
||||
gint64 start, stop, pos;
|
||||
gst_event_parse_new_segment (event, &update, &rate, &format, &start,
|
||||
&stop, &pos);
|
||||
|
||||
GST_DEBUG ("element %s, pad %s, new_seg_start =%" GST_TIME_FORMAT
|
||||
", new_seg_stop =%" GST_TIME_FORMAT
|
||||
", new_seg_pos =%" GST_TIME_FORMAT "\n", elem_name, pad_name,
|
||||
GST_TIME_ARGS (start), GST_TIME_ARGS (stop), GST_TIME_ARGS (pos));
|
||||
|
||||
g_free (pad_name);
|
||||
g_free (elem_name);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
camerabin_general_dbg_have_buffer (GstPad * pad, GstBuffer * buffer,
|
||||
gpointer u_data)
|
||||
{
|
||||
GstElement *elem = (GstElement *) u_data;
|
||||
gchar *elem_name = gst_element_get_name (elem);
|
||||
gchar *pad_name = gst_pad_get_name (pad);
|
||||
|
||||
GST_DEBUG ("element %s, pad %s, buf_ts =%" GST_TIME_FORMAT "\n", elem_name,
|
||||
pad_name, GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (buffer)));
|
||||
|
||||
g_free (pad_name);
|
||||
g_free (elem_name);
|
||||
|
||||
return TRUE;
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
camerabin_general_dbg_set_probe (GstElement * elem, gchar * pad_name,
|
||||
gboolean buf, gboolean evt)
|
||||
{
|
||||
GstPad *pad = gst_element_get_static_pad (elem, pad_name);
|
||||
|
||||
if (buf)
|
||||
gst_pad_add_buffer_probe (pad,
|
||||
G_CALLBACK (camerabin_general_dbg_have_buffer), elem);
|
||||
if (evt)
|
||||
gst_pad_add_event_probe (pad,
|
||||
G_CALLBACK (camerabin_general_dbg_have_event), elem);
|
||||
|
||||
gst_object_unref (pad);
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_camerabin_add_element:
|
||||
* @bin: add an element to this bin
|
||||
|
@ -151,12 +83,12 @@ gst_camerabin_try_add_element (GstBin * bin, GstElement * new_elem)
|
|||
|
||||
/* Get pads for linking */
|
||||
bin_pad = gst_bin_find_unlinked_pad (bin, GST_PAD_SRC);
|
||||
GST_DEBUG ("adding %" GST_PTR_FORMAT " to %s:%s", new_elem,
|
||||
GST_DEBUG_PAD_NAME (bin_pad));
|
||||
/* Add to bin */
|
||||
gst_bin_add (GST_BIN (bin), new_elem);
|
||||
/* Link, if unconnected pad was found, otherwise just add it to bin */
|
||||
if (bin_pad) {
|
||||
GST_DEBUG_OBJECT (bin, "linking %s to %s:%s", GST_OBJECT_NAME (new_elem),
|
||||
GST_DEBUG_PAD_NAME (bin_pad));
|
||||
bin_elem = gst_pad_get_parent_element (bin_pad);
|
||||
gst_object_unref (bin_pad);
|
||||
if (!gst_element_link (bin_elem, new_elem)) {
|
||||
|
@ -164,6 +96,8 @@ gst_camerabin_try_add_element (GstBin * bin, GstElement * new_elem)
|
|||
ret = FALSE;
|
||||
}
|
||||
gst_object_unref (bin_elem);
|
||||
} else {
|
||||
GST_INFO_OBJECT (bin, "no unlinked source pad in bin");
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
|
|
@ -21,43 +21,17 @@
|
|||
#ifndef __CAMERABIN_GENERAL_H_
|
||||
#define __CAMERABIN_GENERAL_H_
|
||||
|
||||
#ifdef HAVE_SYS_TIME_H
|
||||
#include <sys/time.h>
|
||||
#endif
|
||||
#include <time.h>
|
||||
|
||||
#include <gst/gst.h>
|
||||
|
||||
|
||||
typedef struct timeval TIME_TYPE;
|
||||
#define GET_TIME(t) do { gettimeofday(&(t), NULL); } while(0)
|
||||
#define DIFF_TIME(t2,t1,d) do { d = ((t2).tv_sec - (t1).tv_sec) * 1000000 + \
|
||||
(t2).tv_usec - (t1).tv_usec; } while(0)
|
||||
|
||||
#define _INIT_TIMER_BLOCK TIME_TYPE t1, t2; guint32 d; do {;}while (0)
|
||||
|
||||
#define _OPEN_TIMER_BLOCK { GET_TIME(t1); do {;}while (0)
|
||||
#define _CLOSE_TIMER_BLOCK GET_TIME(t2); DIFF_TIME(t2,t1,d); \
|
||||
GST_DEBUG("elapsed time = %u\n", d); \
|
||||
} do {;}while (0)
|
||||
|
||||
|
||||
extern void
|
||||
camerabin_general_dbg_set_probe (GstElement * elem, gchar * pad_name,
|
||||
gboolean buf, gboolean evt);
|
||||
|
||||
gboolean gst_camerabin_try_add_element (GstBin * bin, GstElement * new_elem);
|
||||
|
||||
gboolean gst_camerabin_add_element (GstBin * bin, GstElement * new_elem);
|
||||
|
||||
GstElement *gst_camerabin_create_and_add_element (GstBin * bin,
|
||||
const gchar * elem_name);
|
||||
GstElement *gst_camerabin_create_and_add_element (GstBin * bin, const gchar * elem_name);
|
||||
|
||||
void gst_camerabin_remove_elements_from_bin (GstBin * bin);
|
||||
|
||||
gboolean
|
||||
gst_camerabin_drop_eos_probe (GstPad * pad, GstEvent * event, gpointer u_data);
|
||||
gboolean gst_camerabin_drop_eos_probe (GstPad * pad, GstEvent * event, gpointer u_data);
|
||||
|
||||
/* debug logging category */
|
||||
GST_DEBUG_CATEGORY_EXTERN (gst_camerabin_debug);
|
||||
#define GST_CAT_DEFAULT gst_camerabin_debug
|
||||
|
||||
|
|
|
@ -162,6 +162,8 @@ gst_camerabin_image_init (GstCameraBinImage * img,
|
|||
static void
|
||||
gst_camerabin_image_dispose (GstCameraBinImage * img)
|
||||
{
|
||||
GST_DEBUG_OBJECT (img, "disposing");
|
||||
|
||||
g_string_free (img->filename, TRUE);
|
||||
img->filename = NULL;
|
||||
|
||||
|
@ -184,7 +186,10 @@ gst_camerabin_image_change_state (GstElement * element,
|
|||
{
|
||||
GstStateChangeReturn ret = GST_STATE_CHANGE_SUCCESS;
|
||||
GstCameraBinImage *img = GST_CAMERABIN_IMAGE (element);
|
||||
GstObject *camerabin = NULL;
|
||||
|
||||
GST_DEBUG_OBJECT (element, "changing state: %s -> %s",
|
||||
gst_element_state_get_name (GST_STATE_TRANSITION_CURRENT (transition)),
|
||||
gst_element_state_get_name (GST_STATE_TRANSITION_NEXT (transition)));
|
||||
|
||||
switch (transition) {
|
||||
case GST_STATE_CHANGE_NULL_TO_READY:
|
||||
|
@ -221,12 +226,10 @@ gst_camerabin_image_change_state (GstElement * element,
|
|||
|
||||
switch (transition) {
|
||||
case GST_STATE_CHANGE_PAUSED_TO_PLAYING:
|
||||
camerabin = gst_element_get_parent (img);
|
||||
/* Write debug graph to file */
|
||||
GST_DEBUG_BIN_TO_DOT_FILE_WITH_TS (GST_BIN (camerabin),
|
||||
GST_DEBUG_BIN_TO_DOT_FILE_WITH_TS (GST_BIN (GST_ELEMENT_PARENT (img)),
|
||||
GST_DEBUG_GRAPH_SHOW_MEDIA_TYPE |
|
||||
GST_DEBUG_GRAPH_SHOW_NON_DEFAULT_PARAMS, "imagebin.playing");
|
||||
gst_object_unref (camerabin);
|
||||
break;
|
||||
case GST_STATE_CHANGE_READY_TO_NULL:
|
||||
gst_camerabin_image_destroy_elements (img);
|
||||
|
@ -235,6 +238,11 @@ gst_camerabin_image_change_state (GstElement * element,
|
|||
break;
|
||||
}
|
||||
|
||||
GST_DEBUG_OBJECT (element, "changed state: %s -> %s = %s",
|
||||
gst_element_state_get_name (GST_STATE_TRANSITION_CURRENT (transition)),
|
||||
gst_element_state_get_name (GST_STATE_TRANSITION_NEXT (transition)),
|
||||
gst_element_state_change_return_get_name (ret));
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -308,7 +316,7 @@ gst_camerabin_image_get_property (GObject * object, guint prop_id,
|
|||
* static helper functions implementation
|
||||
*/
|
||||
|
||||
/**
|
||||
/*
|
||||
* metadata_write_probe:
|
||||
* @pad: sink pad of metadata muxer
|
||||
* @buffer: received buffer
|
||||
|
@ -375,7 +383,7 @@ done:
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
/*
|
||||
* gst_camerabin_image_create_elements:
|
||||
* @img: a pointer to #GstCameraBinImage object
|
||||
*
|
||||
|
@ -480,7 +488,7 @@ done:
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
/*
|
||||
* gst_camerabin_image_destroy_elements:
|
||||
* @img: a pointer to #GstCameraBinImage object
|
||||
*
|
||||
|
@ -491,7 +499,7 @@ done:
|
|||
static void
|
||||
gst_camerabin_image_destroy_elements (GstCameraBinImage * img)
|
||||
{
|
||||
GST_LOG ("destroying img elements");
|
||||
GST_LOG ("destroying image elements");
|
||||
|
||||
gst_ghost_pad_set_target (GST_GHOST_PAD (img->sinkpad), NULL);
|
||||
|
||||
|
|
|
@ -242,11 +242,12 @@ gst_camerabin_video_set_property (GObject * object, guint prop_id,
|
|||
switch (prop_id) {
|
||||
case PROP_FILENAME:
|
||||
g_string_assign (bin->filename, g_value_get_string (value));
|
||||
GST_INFO_OBJECT (bin, "received filename: '%s'", bin->filename->str);
|
||||
if (bin->sink) {
|
||||
g_object_set (G_OBJECT (bin->sink), "location", bin->filename->str,
|
||||
NULL);
|
||||
} else {
|
||||
GST_INFO ("no sink, not setting name yet");
|
||||
GST_INFO_OBJECT (bin, "no sink, not setting name yet");
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
@ -290,7 +291,10 @@ gst_camerabin_video_change_state (GstElement * element,
|
|||
{
|
||||
GstStateChangeReturn ret = GST_STATE_CHANGE_SUCCESS;
|
||||
GstCameraBinVideo *vid = GST_CAMERABIN_VIDEO (element);
|
||||
GstObject *camerabin = NULL;
|
||||
|
||||
GST_DEBUG_OBJECT (element, "changing state: %s -> %s",
|
||||
gst_element_state_get_name (GST_STATE_TRANSITION_CURRENT (transition)),
|
||||
gst_element_state_get_name (GST_STATE_TRANSITION_NEXT (transition)));
|
||||
|
||||
switch (transition) {
|
||||
case GST_STATE_CHANGE_NULL_TO_READY:
|
||||
|
@ -314,7 +318,7 @@ gst_camerabin_video_change_state (GstElement * element,
|
|||
|
||||
case GST_STATE_CHANGE_PAUSED_TO_READY:
|
||||
/* Set sink to NULL in order to write the file _now_ */
|
||||
GST_INFO ("write vid file: %s", vid->filename->str);
|
||||
GST_INFO ("write video file: %s", vid->filename->str);
|
||||
gst_element_set_locked_state (vid->sink, TRUE);
|
||||
gst_element_set_state (vid->sink, GST_STATE_NULL);
|
||||
break;
|
||||
|
@ -326,12 +330,10 @@ gst_camerabin_video_change_state (GstElement * element,
|
|||
|
||||
switch (transition) {
|
||||
case GST_STATE_CHANGE_PAUSED_TO_PLAYING:
|
||||
camerabin = gst_element_get_parent (vid);
|
||||
/* Write debug graph to file */
|
||||
GST_DEBUG_BIN_TO_DOT_FILE_WITH_TS (GST_BIN (camerabin),
|
||||
GST_DEBUG_BIN_TO_DOT_FILE_WITH_TS (GST_BIN (GST_ELEMENT_PARENT (vid)),
|
||||
GST_DEBUG_GRAPH_SHOW_MEDIA_TYPE |
|
||||
GST_DEBUG_GRAPH_SHOW_NON_DEFAULT_PARAMS, "videobin.playing");
|
||||
gst_object_unref (camerabin);
|
||||
|
||||
if (vid->pending_eos) {
|
||||
/* Video bin is still paused, so push eos directly to video queue */
|
||||
|
@ -359,6 +361,11 @@ gst_camerabin_video_change_state (GstElement * element,
|
|||
break;
|
||||
}
|
||||
|
||||
GST_DEBUG_OBJECT (element, "changed state: %s -> %s = %s",
|
||||
gst_element_state_get_name (GST_STATE_TRANSITION_CURRENT (transition)),
|
||||
gst_element_state_get_name (GST_STATE_TRANSITION_NEXT (transition)),
|
||||
gst_element_state_change_return_get_name (ret));
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -366,7 +373,7 @@ gst_camerabin_video_change_state (GstElement * element,
|
|||
* static helper functions implementation
|
||||
*/
|
||||
|
||||
/**
|
||||
/*
|
||||
* camerabin_video_pad_tee_src0_have_buffer:
|
||||
* @pad: tee src pad leading to video encoding
|
||||
* @event: received buffer
|
||||
|
@ -414,7 +421,7 @@ camerabin_video_pad_tee_src0_have_buffer (GstPad * pad, GstBuffer * buffer,
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* camerabin_video_pad_aud_src_have_buffer:
|
||||
* @pad: audio source src pad
|
||||
* @event: received buffer
|
||||
|
@ -455,7 +462,7 @@ camerabin_video_pad_aud_src_have_buffer (GstPad * pad, GstBuffer * buffer,
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* camerabin_video_sink_have_event:
|
||||
* @pad: video bin sink pad
|
||||
* @event: received event
|
||||
|
@ -498,7 +505,7 @@ camerabin_video_sink_have_event (GstPad * pad, GstEvent * event,
|
|||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* gst_camerabin_video_create_elements:
|
||||
* @vid: a pointer to #GstCameraBinVideo
|
||||
*
|
||||
|
@ -675,7 +682,7 @@ error:
|
|||
|
||||
}
|
||||
|
||||
/**
|
||||
/*
|
||||
* gst_camerabin_video_destroy_elements:
|
||||
* @vid: a pointer to #GstCameraBinVideo
|
||||
*
|
||||
|
@ -716,8 +723,6 @@ gst_camerabin_video_destroy_elements (GstCameraBinVideo * vid)
|
|||
gst_event_unref (vid->pending_eos);
|
||||
vid->pending_eos = NULL;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -207,7 +207,11 @@ static guint camerabin_signals[LAST_SIGNAL];
|
|||
#define DEFAULT_CAPTURE_HEIGHT 600
|
||||
#define DEFAULT_FPS_N 0 /* makes it use the default */
|
||||
#define DEFAULT_FPS_D 1
|
||||
|
||||
#define CAMERABIN_DEFAULT_VF_CAPS "video/x-raw-yuv,format=(fourcc)I420"
|
||||
#define CAMERABIN_MAX_VF_WIDTH 848
|
||||
#define CAMERABIN_MAX_VF_HEIGHT 848
|
||||
|
||||
/* Using "bilinear" as default zoom method */
|
||||
#define CAMERABIN_DEFAULT_ZOOM_METHOD 1
|
||||
|
||||
|
@ -215,19 +219,20 @@ static guint camerabin_signals[LAST_SIGNAL];
|
|||
#define MAX_ZOOM 1000
|
||||
#define ZOOM_1X MIN_ZOOM
|
||||
|
||||
/* FIXME: this is v4l2camsrc specific */
|
||||
#define DEFAULT_V4L2CAMSRC_DRIVER_NAME "omap3cam"
|
||||
|
||||
/* pipeline configuration */
|
||||
//#define USE_VIEWFINDER_COLOR_CONVERTER 1
|
||||
//#define USE_VIEWFINDER_SCALE 1
|
||||
|
||||
/* internal element names */
|
||||
|
||||
#define USE_COLOR_CONVERTER 1
|
||||
|
||||
/* FIXME: Make sure this can work with autovideosrc and use that. */
|
||||
#define DEFAULT_SRC_VID_SRC "v4l2src"
|
||||
|
||||
#define DEFAULT_VIEW_SINK "autovideosink"
|
||||
|
||||
#define CAMERABIN_MAX_VF_WIDTH 848
|
||||
#define CAMERABIN_MAX_VF_HEIGHT 848
|
||||
/* message names */
|
||||
#define PREVIEW_MESSAGE_NAME "preview-image"
|
||||
#define IMG_CAPTURED_MESSAGE_NAME "image-captured"
|
||||
|
||||
|
@ -579,6 +584,7 @@ camerabin_create_src_elements (GstCameraBin * camera)
|
|||
goto done;
|
||||
|
||||
/* Set default "driver-name" for v4l2camsrc if not set */
|
||||
/* FIXME: v4l2camsrc specific */
|
||||
if (g_object_class_find_property (G_OBJECT_GET_CLASS (camera->src_vid_src),
|
||||
"driver-name")) {
|
||||
g_object_get (G_OBJECT (camera->src_vid_src), "driver-name",
|
||||
|
@ -650,6 +656,7 @@ camerabin_create_view_elements (GstCameraBin * camera)
|
|||
}
|
||||
camera->pad_view_src = GST_PAD (pads->data);
|
||||
|
||||
#ifdef USE_VIEWFINDER_CONVERTERS
|
||||
/* Add videoscale in case we need to downscale frame for view finder */
|
||||
if (!(camera->view_scale =
|
||||
gst_camerabin_create_and_add_element (GST_BIN (camera),
|
||||
|
@ -663,7 +670,8 @@ camerabin_create_view_elements (GstCameraBin * camera)
|
|||
"capsfilter"))) {
|
||||
goto error;
|
||||
}
|
||||
#ifdef USE_COLOR_CONVERTER
|
||||
#endif
|
||||
#ifdef USE_VIEWFINDER_COLOR_CONVERTER
|
||||
if (!gst_camerabin_create_and_add_element (GST_BIN (camera),
|
||||
"ffmpegcolorspace")) {
|
||||
goto error;
|
||||
|
@ -822,6 +830,7 @@ camerabin_destroy_elements (GstCameraBin * camera)
|
|||
}
|
||||
|
||||
camera->view_sink = NULL;
|
||||
camera->aspect_filter = NULL;
|
||||
camera->view_scale = NULL;
|
||||
camera->view_in_sel = NULL;
|
||||
|
||||
|
@ -943,18 +952,24 @@ static void
|
|||
gst_camerabin_change_mode (GstCameraBin * camera, gint mode)
|
||||
{
|
||||
if (camera->mode != mode || !camera->active_bin) {
|
||||
GST_DEBUG_OBJECT (camera, "setting mode: %d", mode);
|
||||
GST_DEBUG_OBJECT (camera, "setting mode: %d (old_mode=%d)",
|
||||
mode, camera->mode);
|
||||
/* Interrupt ongoing capture */
|
||||
gst_camerabin_do_stop (camera);
|
||||
camera->mode = mode;
|
||||
if (camera->active_bin) {
|
||||
GST_DEBUG_OBJECT (camera, "stopping active bin");
|
||||
gst_element_set_state (camera->active_bin, GST_STATE_NULL);
|
||||
}
|
||||
if (camera->mode == MODE_IMAGE) {
|
||||
GstStateChangeReturn state_ret;
|
||||
|
||||
camera->active_bin = camera->imgbin;
|
||||
/* we can't go to playing as filesink would error out if it does not have
|
||||
* a filename yet, we set the filename async with the buffer flow */
|
||||
state_ret = gst_element_set_state (camera->active_bin, GST_STATE_READY);
|
||||
GST_DEBUG_OBJECT (camera, "setting imagebin to ready: %s",
|
||||
gst_element_state_change_return_get_name (state_ret));
|
||||
|
||||
if (state_ret == GST_STATE_CHANGE_FAILURE) {
|
||||
GST_WARNING_OBJECT (camera, "state change failed");
|
||||
|
@ -979,7 +994,7 @@ static void
|
|||
gst_camerabin_change_filename (GstCameraBin * camera, const gchar * name)
|
||||
{
|
||||
if (0 != strcmp (camera->filename->str, name)) {
|
||||
GST_DEBUG_OBJECT (camera, "changing filename from %s to %s",
|
||||
GST_DEBUG_OBJECT (camera, "changing filename from '%s' to '%s'",
|
||||
camera->filename->str, name);
|
||||
g_string_assign (camera->filename, name);
|
||||
}
|
||||
|
@ -1567,6 +1582,7 @@ gst_camerabin_start_image_capture (GstCameraBin * camera)
|
|||
gst_element_state_change_return_get_name (state_ret));
|
||||
|
||||
if (state_ret != GST_STATE_CHANGE_FAILURE) {
|
||||
GST_INFO_OBJECT (camera, "imagebin is PAUSED");
|
||||
g_mutex_lock (camera->capture_mutex);
|
||||
g_object_set (G_OBJECT (camera->src_out_sel), "resend-latest", TRUE,
|
||||
"active-pad", camera->pad_src_img, NULL);
|
||||
|
@ -1766,6 +1782,8 @@ done:
|
|||
after one captured still image */
|
||||
gst_camerabin_finish_image_capture (camera);
|
||||
|
||||
GST_DEBUG_OBJECT (camera, "image captured, switching to viewfinder");
|
||||
|
||||
gst_camerabin_reset_to_view_finder (camera);
|
||||
|
||||
GST_DEBUG_OBJECT (camera, "switched back to viewfinder");
|
||||
|
@ -1823,7 +1841,7 @@ gst_camerabin_have_src_buffer (GstPad * pad, GstBuffer * buffer,
|
|||
/* We can't send real EOS event, since it would switch the image queue
|
||||
into "draining mode". Therefore we send our own custom eos and
|
||||
catch & drop it later in queue's srcpad data probe */
|
||||
GST_DEBUG_OBJECT (camera, "sending eos to image queue");
|
||||
GST_DEBUG_OBJECT (camera, "sending img-eos to image queue");
|
||||
gst_camerabin_send_img_queue_custom_event (camera,
|
||||
gst_structure_new ("img-eos", NULL));
|
||||
|
||||
|
@ -1886,13 +1904,14 @@ gst_camerabin_have_queue_data (GstPad * pad, GstMiniObject * mini_obj,
|
|||
if (GST_EVENT_TYPE (event) == GST_EVENT_TAG) {
|
||||
GstTagList *tlist;
|
||||
|
||||
GST_DEBUG_OBJECT (camera, "queue sending taglist to image pipeline");
|
||||
gst_event_parse_tag (event, &tlist);
|
||||
gst_tag_list_insert (camera->event_tags, tlist, GST_TAG_MERGE_REPLACE);
|
||||
ret = FALSE;
|
||||
} else if (evs && gst_structure_has_name (evs, "img-filename")) {
|
||||
const gchar *fname;
|
||||
|
||||
GST_LOG_OBJECT (camera, "queue setting image filename to imagebin");
|
||||
GST_DEBUG_OBJECT (camera, "queue setting image filename to imagebin");
|
||||
fname = gst_structure_get_string (evs, "filename");
|
||||
g_object_set (G_OBJECT (camera->imgbin), "filename", fname, NULL);
|
||||
|
||||
|
@ -1902,7 +1921,7 @@ gst_camerabin_have_queue_data (GstPad * pad, GstMiniObject * mini_obj,
|
|||
|
||||
ret = FALSE;
|
||||
} else if (evs && gst_structure_has_name (evs, "img-eos")) {
|
||||
GST_LOG_OBJECT (camera, "queue sending EOS to image pipeline");
|
||||
GST_DEBUG_OBJECT (camera, "queue sending EOS to image pipeline");
|
||||
gst_pad_set_blocked_async (camera->pad_src_queue, TRUE,
|
||||
(GstPadBlockCallback) image_pad_blocked, camera);
|
||||
gst_element_send_event (camera->imgbin, gst_event_new_eos ());
|
||||
|
@ -2140,10 +2159,10 @@ gst_camerabin_find_better_framerate (GstCameraBin * camera, GstStructure * st,
|
|||
gint res, comparison;
|
||||
|
||||
if (camera->night_mode) {
|
||||
GST_LOG_OBJECT (camera, "finding min framerate");
|
||||
GST_LOG_OBJECT (camera, "finding min framerate in %" GST_PTR_FORMAT, st);
|
||||
comparison = GST_VALUE_LESS_THAN;
|
||||
} else {
|
||||
GST_LOG_OBJECT (camera, "finding max framerate");
|
||||
GST_LOG_OBJECT (camera, "finding max framerate in %" GST_PTR_FORMAT, st);
|
||||
comparison = GST_VALUE_GREATER_THAN;
|
||||
}
|
||||
|
||||
|
@ -2198,6 +2217,7 @@ gst_camerabin_find_better_framerate (GstCameraBin * camera, GstStructure * st,
|
|||
static void
|
||||
gst_camerabin_update_aspect_filter (GstCameraBin * camera, GstCaps * new_caps)
|
||||
{
|
||||
#ifdef USE_VIEWFINDER_SCALE
|
||||
GstCaps *sink_caps, *ar_caps;
|
||||
GstStructure *st;
|
||||
gint in_w = 0, in_h = 0, sink_w = 0, sink_h = 0, target_w = 0, target_h = 0;
|
||||
|
@ -2266,6 +2286,7 @@ gst_camerabin_update_aspect_filter (GstCameraBin * camera, GstCaps * new_caps)
|
|||
ar_caps);
|
||||
g_object_set (G_OBJECT (camera->aspect_filter), "caps", ar_caps, NULL);
|
||||
gst_caps_unref (ar_caps);
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -2725,6 +2746,7 @@ gst_camerabin_init (GstCameraBin * camera, GstCameraBinClass * gclass)
|
|||
/* view finder elements */
|
||||
camera->view_in_sel = NULL;
|
||||
camera->view_scale = NULL;
|
||||
camera->aspect_filter = NULL;
|
||||
camera->view_sink = NULL;
|
||||
|
||||
memset (&camera->photo_settings, 0, sizeof (GstPhotoSettings));
|
||||
|
@ -2971,6 +2993,10 @@ gst_camerabin_change_state (GstElement * element, GstStateChange transition)
|
|||
GstCameraBin *camera = GST_CAMERABIN (element);
|
||||
GstStateChangeReturn ret;
|
||||
|
||||
GST_DEBUG_OBJECT (element, "changing state: %s -> %s",
|
||||
gst_element_state_get_name (GST_STATE_TRANSITION_CURRENT (transition)),
|
||||
gst_element_state_get_name (GST_STATE_TRANSITION_NEXT (transition)));
|
||||
|
||||
switch (transition) {
|
||||
case GST_STATE_CHANGE_NULL_TO_READY:
|
||||
if (!camerabin_create_elements (camera)) {
|
||||
|
@ -3000,9 +3026,13 @@ gst_camerabin_change_state (GstElement * element, GstStateChange transition)
|
|||
|
||||
ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
|
||||
|
||||
GST_DEBUG_OBJECT (element, "after chaining up: %s -> %s = %s",
|
||||
gst_element_state_get_name (GST_STATE_TRANSITION_CURRENT (transition)),
|
||||
gst_element_state_get_name (GST_STATE_TRANSITION_NEXT (transition)),
|
||||
gst_element_state_change_return_get_name (ret));
|
||||
|
||||
switch (transition) {
|
||||
case GST_STATE_CHANGE_PAUSED_TO_READY:
|
||||
GST_LOG_OBJECT (camera, "PAUSED to READY");
|
||||
g_mutex_lock (camera->capture_mutex);
|
||||
if (camera->capturing) {
|
||||
GST_WARNING_OBJECT (camera, "was capturing when changing to READY");
|
||||
|
@ -3022,6 +3052,10 @@ gst_camerabin_change_state (GstElement * element, GstStateChange transition)
|
|||
}
|
||||
|
||||
done:
|
||||
GST_DEBUG_OBJECT (element, "changed state: %s -> %s = %s",
|
||||
gst_element_state_get_name (GST_STATE_TRANSITION_CURRENT (transition)),
|
||||
gst_element_state_get_name (GST_STATE_TRANSITION_NEXT (transition)),
|
||||
gst_element_state_change_return_get_name (ret));
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
@ -3128,8 +3162,11 @@ gst_camerabin_user_start (GstCameraBin * camera)
|
|||
|
||||
if (camera->active_bin) {
|
||||
if (camera->active_bin == camera->imgbin) {
|
||||
GST_INFO_OBJECT (camera, "starting image capture");
|
||||
gst_camerabin_start_image_capture (camera);
|
||||
} else if (camera->active_bin == camera->vidbin) {
|
||||
GST_INFO_OBJECT (camera,
|
||||
"setting video filename and starting video capture");
|
||||
g_object_set (G_OBJECT (camera->active_bin), "filename",
|
||||
camera->filename->str, NULL);
|
||||
gst_camerabin_start_video_recording (camera);
|
||||
|
|
Loading…
Reference in a new issue