summaryrefslogtreecommitdiffstats
path: root/gst
diff options
context:
space:
mode:
Diffstat (limited to 'gst')
-rw-r--r--gst/camerabin/camerabinvideo.c20
-rw-r--r--gst/camerabin/camerabinvideo.h8
-rw-r--r--gst/camerabin/gstcamerabin.c86
-rw-r--r--gst/qtmux/atoms.c3
-rw-r--r--gst/qtmux/gstqtmux.c3
-rw-r--r--gst/shapewipe/gstshapewipe.c5
6 files changed, 51 insertions, 74 deletions
diff --git a/gst/camerabin/camerabinvideo.c b/gst/camerabin/camerabinvideo.c
index d3de662e..2569772a 100644
--- a/gst/camerabin/camerabinvideo.c
+++ b/gst/camerabin/camerabinvideo.c
@@ -184,6 +184,8 @@ gst_camerabin_video_init (GstCameraBinVideo * vid,
vid->pending_eos = NULL;
+ vid->mute = ARG_DEFAULT_MUTE;
+
/* Create src and sink ghost pads */
vid->sinkpad = gst_ghost_pad_new_no_target ("sink", GST_PAD_SINK);
gst_element_add_pad (GST_ELEMENT (vid), vid->sinkpad);
@@ -629,6 +631,8 @@ gst_camerabin_video_create_elements (GstCameraBinVideo * vid)
GST_WARNING_OBJECT (vid, "unable to add volume element");
/* gst_camerabin_try_add_element() destroyed the element */
vid->volume = NULL;
+ } else {
+ g_object_set (vid->volume, "mute", vid->mute, NULL);
}
/* Add user set or default audio encoder element */
@@ -732,8 +736,11 @@ gst_camerabin_video_destroy_elements (GstCameraBinVideo * vid)
void
gst_camerabin_video_set_mute (GstCameraBinVideo * vid, gboolean mute)
{
- if (vid && vid->volume) {
- GST_DEBUG_OBJECT (vid, "setting mute %s", mute ? "on" : "off");
+ g_return_if_fail (vid != NULL);
+
+ GST_DEBUG_OBJECT (vid, "setting mute %s", mute ? "on" : "off");
+ vid->mute = mute;
+ if (vid->volume) {
g_object_set (vid->volume, "mute", mute, NULL);
}
}
@@ -800,12 +807,13 @@ gst_camerabin_video_set_audio_src (GstCameraBinVideo * vid,
gboolean
gst_camerabin_video_get_mute (GstCameraBinVideo * vid)
{
- gboolean mute = ARG_DEFAULT_MUTE;
+ g_return_val_if_fail (vid != NULL, FALSE);
- if (vid && vid->volume) {
- g_object_get (vid->volume, "mute", &mute, NULL);
+ if (vid->volume) {
+ g_object_get (vid->volume, "mute", &vid->mute, NULL);
}
- return mute;
+
+ return vid->mute;
}
GstElement *
diff --git a/gst/camerabin/camerabinvideo.h b/gst/camerabin/camerabinvideo.h
index 9f4f5152..dd094d52 100644
--- a/gst/camerabin/camerabinvideo.h
+++ b/gst/camerabin/camerabinvideo.h
@@ -24,24 +24,19 @@
#include <gst/gstbin.h>
G_BEGIN_DECLS
-
//#define USE_TIMEOVERLAY 1
-
#define ARG_DEFAULT_MUTE FALSE
-
#define GST_TYPE_CAMERABIN_VIDEO (gst_camerabin_video_get_type())
#define GST_CAMERABIN_VIDEO_CAST(obj) ((GstCameraBinVideo*)(obj))
#define GST_CAMERABIN_VIDEO(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_CAMERABIN_VIDEO,GstCameraBinVideo))
#define GST_CAMERABIN_VIDEO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_CAMERABIN_VIDEO,GstCameraBinVideoClass))
#define GST_IS_CAMERABIN_VIDEO(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_CAMERABIN_VIDEO))
#define GST_IS_CAMERABIN_VIDEO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_CAMERABIN_VIDEO))
-
/**
* GstCameraBinVideo:
*
* The opaque #GstCameraBinVideo structure.
*/
-
typedef struct _GstCameraBinVideo GstCameraBinVideo;
typedef struct _GstCameraBinVideoClass GstCameraBinVideoClass;
@@ -86,6 +81,8 @@ struct _GstCameraBinVideo
GstElement *muxer; /* Muxer */
GstEvent *pending_eos;
+
+ gboolean mute;
};
struct _GstCameraBinVideoClass
@@ -132,5 +129,4 @@ GstElement *gst_camerabin_video_get_muxer (GstCameraBinVideo * vid);
GstElement *gst_camerabin_video_get_audio_src (GstCameraBinVideo * vid);
G_END_DECLS
-
#endif /* #ifndef __CAMERABIN_VIDEO_H__ */
diff --git a/gst/camerabin/gstcamerabin.c b/gst/camerabin/gstcamerabin.c
index ca2e8e18..0a110f50 100644
--- a/gst/camerabin/gstcamerabin.c
+++ b/gst/camerabin/gstcamerabin.c
@@ -907,29 +907,22 @@ camerabin_dispose_elements (GstCameraBin * camera)
/*
* gst_camerabin_image_capture_continue:
* @camera: camerabin object
+ * @filename: filename of the finished image
*
* Notify application that image has been saved with a signal.
*
* Returns TRUE if another image should be captured, FALSE otherwise.
*/
static gboolean
-gst_camerabin_image_capture_continue (GstCameraBin * camera)
+gst_camerabin_image_capture_continue (GstCameraBin * camera,
+ const gchar * filename)
{
- gchar *filename = NULL;
gboolean cont = FALSE;
- /* Check the filename of the written image */
- g_object_get (G_OBJECT (camera->imgbin), "filename", &filename, NULL);
-
GST_DEBUG_OBJECT (camera, "emitting img_done signal, filename: %s", filename);
g_signal_emit (G_OBJECT (camera), camerabin_signals[IMG_DONE_SIGNAL], 0,
filename, &cont);
- g_free (filename);
-
- GST_DEBUG_OBJECT (camera, "emitted img_done, new filename: %s, continue: %d",
- camera->filename->str, cont);
-
/* If the app wants to continue make sure new filename has been set */
if (cont && g_str_equal (camera->filename->str, "")) {
GST_ELEMENT_ERROR (camera, RESOURCE, NOT_FOUND,
@@ -965,11 +958,7 @@ gst_camerabin_change_mode (GstCameraBin * camera, gint mode)
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));
+ state_ret = gst_element_set_state (camera->active_bin, GST_STATE_PAUSED);
if (state_ret == GST_STATE_CHANGE_FAILURE) {
GST_WARNING_OBJECT (camera, "state change failed");
@@ -1527,10 +1516,6 @@ img_capture_prepared (gpointer data, GstCaps * caps)
}
g_object_set (G_OBJECT (camera->src_out_sel), "resend-latest", FALSE,
"active-pad", camera->pad_src_img, NULL);
-
- if (!GST_CAMERABIN_IMAGE (camera->imgbin)->elements_created) {
- gst_element_set_state (camera->imgbin, GST_STATE_READY);
- }
}
/*
@@ -1542,7 +1527,6 @@ img_capture_prepared (gpointer data, GstCaps * caps)
static void
gst_camerabin_start_image_capture (GstCameraBin * camera)
{
- GstStateChangeReturn state_ret;
gboolean wait_for_prepare = FALSE, ret = FALSE;
GST_INFO_OBJECT (camera, "starting image capture");
@@ -1576,23 +1560,12 @@ gst_camerabin_start_image_capture (GstCameraBin * camera)
}
if (!wait_for_prepare) {
- /* Image queue's srcpad data probe will set imagebin to PLAYING */
- state_ret = gst_element_set_state (camera->imgbin, GST_STATE_PAUSED);
- GST_DEBUG_OBJECT (camera, "setting imagebin to paused: %s",
- 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);
- camera->capturing = TRUE;
- ret = TRUE;
- g_mutex_unlock (camera->capture_mutex);
- } else {
- GST_WARNING_OBJECT (camera, "imagebin state change failed");
- gst_element_set_state (camera->imgbin, GST_STATE_NULL);
- }
+ 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);
+ camera->capturing = TRUE;
+ ret = TRUE;
+ g_mutex_unlock (camera->capture_mutex);
}
if (!ret) {
@@ -1672,7 +1645,6 @@ gst_camerabin_send_video_eos (GstCameraBin * camera)
* @blocked: TRUE to block, FALSE to unblock
* @u_data: camera bin object
*
- * Sends eos event to image bin if blocking pad leading to image bin.
* The pad will be unblocked when image bin posts eos message.
*/
static void
@@ -1945,6 +1917,12 @@ gst_camerabin_reset_to_view_finder (GstCameraBin * camera)
GstStateChangeReturn state_ret;
GST_DEBUG_OBJECT (camera, "resetting");
+ if (camera->src_out_sel) {
+ /* Set selector to forward data to view finder */
+ g_object_set (G_OBJECT (camera->src_out_sel), "resend-latest", FALSE,
+ "active-pad", camera->pad_src_view, NULL);
+ }
+
/* Set video bin to READY state */
if (camera->active_bin == camera->vidbin) {
state_ret = gst_element_set_state (camera->active_bin, GST_STATE_READY);
@@ -1959,12 +1937,6 @@ gst_camerabin_reset_to_view_finder (GstCameraBin * camera)
camera->stop_requested = FALSE;
camera->paused = FALSE;
- if (camera->src_out_sel) {
- /* Set selector to forward data to view finder */
- g_object_set (G_OBJECT (camera->src_out_sel), "resend-latest", FALSE,
- "active-pad", camera->pad_src_view, NULL);
- }
-
/* Enable view finder mode in v4l2camsrc */
if (camera->src_vid_src &&
g_object_class_find_property (G_OBJECT_GET_CLASS (camera->src_vid_src),
@@ -3064,6 +3036,10 @@ static gboolean
gst_camerabin_imgbin_finished (gpointer u_data)
{
GstCameraBin *camera = GST_CAMERABIN (u_data);
+ gchar *filename = NULL;
+
+ /* Get the filename of the finished image */
+ g_object_get (G_OBJECT (camera->imgbin), "filename", &filename, NULL);
GST_DEBUG_OBJECT (camera, "Image encoding finished");
@@ -3072,7 +3048,11 @@ gst_camerabin_imgbin_finished (gpointer u_data)
GST_DEBUG_OBJECT (camera, "Image pipeline set to READY");
/* Send img-done signal */
- gst_camerabin_image_capture_continue (camera);
+ gst_camerabin_image_capture_continue (camera, filename);
+ g_free (filename);
+
+ /* Set image bin back to PAUSED so that buffer-allocs don't fail */
+ gst_element_set_state (camera->imgbin, GST_STATE_PAUSED);
/* Unblock image queue pad to process next buffer */
gst_pad_set_blocked_async (camera->pad_src_queue, FALSE,
@@ -3143,6 +3123,10 @@ gst_camerabin_user_start (GstCameraBin * camera)
if (!camera->active_bin) {
GST_INFO_OBJECT (camera, "mode not explicitly set by application");
gst_camerabin_change_mode (camera, camera->mode);
+ if (!camera->active_bin) {
+ GST_ELEMENT_ERROR (camera, CORE, FAILED,
+ ("starting capture failed"), (NULL));
+ }
}
if (g_str_equal (camera->filename->str, "")) {
@@ -3201,12 +3185,6 @@ gst_camerabin_user_pause (GstCameraBin * camera)
g_object_set (G_OBJECT (camera->src_out_sel), "resend-latest", FALSE,
"active-pad", camera->pad_src_view, NULL);
- /* Enable view finder mode in v4l2camsrc */
- if (g_object_class_find_property (G_OBJECT_GET_CLASS
- (camera->src_vid_src), "capture-mode")) {
- g_object_set (G_OBJECT (camera->src_vid_src), "capture-mode", 0, NULL);
- }
-
/* Set view finder to PLAYING and leave videobin PAUSED */
gst_element_set_locked_state (camera->vidbin, TRUE);
gst_element_set_state (GST_ELEMENT (camera), GST_STATE_PLAYING);
@@ -3222,12 +3200,6 @@ gst_camerabin_user_pause (GstCameraBin * camera)
g_object_set (G_OBJECT (camera->src_out_sel), "resend-latest", TRUE,
"active-pad", camera->pad_src_vid, NULL);
- /* Enable video recording mode in v4l2camsrc */
- if (g_object_class_find_property (G_OBJECT_GET_CLASS
- (camera->src_vid_src), "capture-mode")) {
- g_object_set (G_OBJECT (camera->src_vid_src), "capture-mode", 2, NULL);
- }
-
/* Bring all camerabin elements to PLAYING */
gst_element_set_locked_state (camera->vidbin, FALSE);
gst_element_set_state (GST_ELEMENT (camera), GST_STATE_PLAYING);
diff --git a/gst/qtmux/atoms.c b/gst/qtmux/atoms.c
index 29859d00..ad3e0108 100644
--- a/gst/qtmux/atoms.c
+++ b/gst/qtmux/atoms.c
@@ -3004,14 +3004,11 @@ build_esds_extension (AtomTRAK * trak, guint8 object_type, guint8 stream_type,
AtomInfo *
build_mov_aac_extension (AtomTRAK * trak, const GstBuffer * codec_data)
{
- guint32 track_id;
AtomWAVE *wave;
AtomFRMA *frma;
Atom *ext_atom;
GstBuffer *buf;
- track_id = trak->tkhd.track_ID;
-
/* Add WAVE atom to the MP4A sample table entry */
wave = atom_wave_new ();
diff --git a/gst/qtmux/gstqtmux.c b/gst/qtmux/gstqtmux.c
index 8d811f41..ba155f6a 100644
--- a/gst/qtmux/gstqtmux.c
+++ b/gst/qtmux/gstqtmux.c
@@ -529,7 +529,8 @@ gst_qt_mux_add_3gp_date (GstQTMux * qtmux, const GstTagList * list,
return;
}
- GST_DEBUG_OBJECT (qtmux, "Adding tag %" GST_FOURCC_FORMAT " -> %d", year);
+ GST_DEBUG_OBJECT (qtmux, "Adding tag %" GST_FOURCC_FORMAT " -> %d",
+ GST_FOURCC_ARGS (fourcc), year);
atom_moov_add_3gp_uint_tag (qtmux->moov, fourcc, year);
}
diff --git a/gst/shapewipe/gstshapewipe.c b/gst/shapewipe/gstshapewipe.c
index 95218801..4029c494 100644
--- a/gst/shapewipe/gstshapewipe.c
+++ b/gst/shapewipe/gstshapewipe.c
@@ -334,7 +334,10 @@ gst_shape_wipe_video_sink_setcaps (GstPad * pad, GstCaps * caps)
g_mutex_unlock (self->mask_mutex);
}
- self->frame_duration = gst_util_uint64_scale (GST_SECOND, fps_d, fps_n);
+ if (fps_n != 0)
+ self->frame_duration = gst_util_uint64_scale (GST_SECOND, fps_d, fps_n);
+ else
+ self->frame_duration = 0;
ret = gst_pad_set_caps (self->srcpad, caps);