implement ICC color compensation element
This commit is contained in:
parent
af17cdfcfc
commit
444d17b548
1 changed files with 30 additions and 14 deletions
34
photobooth.c
34
photobooth.c
|
@ -505,11 +505,11 @@ static void photo_booth_capture_thread_func (PhotoBooth *pb)
|
||||||
else if (ret == 0 && state == CAPTURE_PRETRIGGER)
|
else if (ret == 0 && state == CAPTURE_PRETRIGGER)
|
||||||
{
|
{
|
||||||
gtk_label_set_text (priv->win->status, _("Focussing..."));
|
gtk_label_set_text (priv->win->status, _("Focussing..."));
|
||||||
|
photo_booth_focus (pb->cam_info);
|
||||||
#if CAM_REINIT_BEFORE_SNAPSHOT
|
#if CAM_REINIT_BEFORE_SNAPSHOT
|
||||||
photo_booth_cam_close (&pb->cam_info);
|
photo_booth_cam_close (&pb->cam_info);
|
||||||
photo_booth_cam_init (&pb->cam_info);
|
photo_booth_cam_init (&pb->cam_info);
|
||||||
#endif
|
#endif
|
||||||
photo_booth_focus (pb->cam_info);
|
|
||||||
}
|
}
|
||||||
else if (ret == 0 && state == CAPTURE_PHOTO)
|
else if (ret == 0 && state == CAPTURE_PHOTO)
|
||||||
{
|
{
|
||||||
|
@ -1190,10 +1190,13 @@ static GstPadProbeReturn photo_booth_catch_photo_buffer (GstPad * pad, GstPadPro
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define ICC_SRC_TEMPLATE "CNXD-sRGB.icc"
|
||||||
|
#define ICC_DST_TEMPLATE "CP955_F.icc"
|
||||||
|
|
||||||
static gboolean photo_booth_process_photo_plug_elements (PhotoBooth *pb)
|
static gboolean photo_booth_process_photo_plug_elements (PhotoBooth *pb)
|
||||||
{
|
{
|
||||||
PhotoBoothPrivate *priv;
|
PhotoBoothPrivate *priv;
|
||||||
GstElement *tee, *encoder, *filesink, *appsink;
|
GstElement *tee, *encoder, *filesink, *icc, *appsink;
|
||||||
priv = photo_booth_get_instance_private (pb);
|
priv = photo_booth_get_instance_private (pb);
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (pb, "plugging photo processing elements. locking...");
|
GST_DEBUG_OBJECT (pb, "plugging photo processing elements. locking...");
|
||||||
|
@ -1212,15 +1215,19 @@ static gboolean photo_booth_process_photo_plug_elements (PhotoBooth *pb)
|
||||||
if (!gst_element_link_many (tee, encoder, filesink, NULL))
|
if (!gst_element_link_many (tee, encoder, filesink, NULL))
|
||||||
GST_ERROR_OBJECT (pb->photo_bin, "couldn't link photobin filewrite elements!");
|
GST_ERROR_OBJECT (pb->photo_bin, "couldn't link photobin filewrite elements!");
|
||||||
|
|
||||||
|
icc = gst_element_factory_make ("icc", "print-icc");
|
||||||
appsink = gst_element_factory_make ("appsink", "print-appsink");
|
appsink = gst_element_factory_make ("appsink", "print-appsink");
|
||||||
if (!appsink)
|
if (!icc || !appsink )
|
||||||
GST_ERROR_OBJECT (pb->photo_bin, "Failed to make appsink");
|
GST_ERROR_OBJECT (pb->photo_bin, "Failed to make photo print processing element(s): %s%s", icc?"":" icc", appsink?"":" appsink");
|
||||||
|
|
||||||
gst_bin_add (GST_BIN (pb->photo_bin), appsink);
|
gst_bin_add_many (GST_BIN (pb->photo_bin), icc, appsink, NULL);
|
||||||
|
g_object_set (G_OBJECT (icc), "intent", 0, NULL);
|
||||||
|
g_object_set (G_OBJECT (icc), "src-profile", ICC_SRC_TEMPLATE, NULL);
|
||||||
|
g_object_set (G_OBJECT (icc), "dst-profile", ICC_DST_TEMPLATE, NULL);
|
||||||
g_object_set (G_OBJECT (appsink), "emit-signals", TRUE, NULL);
|
g_object_set (G_OBJECT (appsink), "emit-signals", TRUE, NULL);
|
||||||
g_object_set (G_OBJECT (appsink), "enable-last-sample", FALSE, NULL);
|
g_object_set (G_OBJECT (appsink), "enable-last-sample", FALSE, NULL);
|
||||||
g_signal_connect (appsink, "new-sample", G_CALLBACK (photo_booth_catch_print_buffer), pb);
|
g_signal_connect (appsink, "new-sample", G_CALLBACK (photo_booth_catch_print_buffer), pb);
|
||||||
if (!gst_element_link (tee, appsink))
|
if (!gst_element_link_many (tee, icc, appsink, NULL))
|
||||||
GST_ERROR_OBJECT (pb->photo_bin, "couldn't link appsink!");
|
GST_ERROR_OBJECT (pb->photo_bin, "couldn't link appsink!");
|
||||||
|
|
||||||
gst_object_unref (tee);
|
gst_object_unref (tee);
|
||||||
|
@ -1258,7 +1265,7 @@ static GstFlowReturn photo_booth_catch_print_buffer (GstElement * appsink, gpoin
|
||||||
static gboolean photo_booth_process_photo_remove_elements (PhotoBooth *pb)
|
static gboolean photo_booth_process_photo_remove_elements (PhotoBooth *pb)
|
||||||
{
|
{
|
||||||
PhotoBoothPrivate *priv;
|
PhotoBoothPrivate *priv;
|
||||||
GstElement *tee, *encoder, *filesink, *appsink;
|
GstElement *tee, *encoder, *filesink, *appsink, *icc;
|
||||||
priv = photo_booth_get_instance_private (pb);
|
priv = photo_booth_get_instance_private (pb);
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (pb, "remove output file encoder and writer elements and pause. locking...");
|
GST_DEBUG_OBJECT (pb, "remove output file encoder and writer elements and pause. locking...");
|
||||||
|
@ -1268,15 +1275,18 @@ static gboolean photo_booth_process_photo_remove_elements (PhotoBooth *pb)
|
||||||
tee = gst_bin_get_by_name (GST_BIN (pb->photo_bin), "photo-tee");
|
tee = gst_bin_get_by_name (GST_BIN (pb->photo_bin), "photo-tee");
|
||||||
encoder = gst_bin_get_by_name (GST_BIN (pb->photo_bin), "photo-encoder");
|
encoder = gst_bin_get_by_name (GST_BIN (pb->photo_bin), "photo-encoder");
|
||||||
filesink = gst_bin_get_by_name (GST_BIN (pb->photo_bin), "photo-filesink");
|
filesink = gst_bin_get_by_name (GST_BIN (pb->photo_bin), "photo-filesink");
|
||||||
|
icc = gst_bin_get_by_name (GST_BIN (pb->photo_bin), "print-icc");
|
||||||
appsink = gst_bin_get_by_name (GST_BIN (pb->photo_bin), "print-appsink");
|
appsink = gst_bin_get_by_name (GST_BIN (pb->photo_bin), "print-appsink");
|
||||||
gst_element_unlink_many (tee, encoder, filesink, NULL);
|
gst_element_unlink_many (tee, encoder, filesink, NULL);
|
||||||
gst_element_unlink_many (tee, appsink, NULL);
|
gst_element_unlink_many (tee, icc, appsink, NULL);
|
||||||
gst_bin_remove_many (GST_BIN (pb->photo_bin), encoder, filesink, appsink, NULL);
|
gst_bin_remove_many (GST_BIN (pb->photo_bin), encoder, filesink, icc, appsink, NULL);
|
||||||
gst_element_set_state (filesink, GST_STATE_NULL);
|
gst_element_set_state (filesink, GST_STATE_NULL);
|
||||||
gst_element_set_state (encoder, GST_STATE_NULL);
|
gst_element_set_state (encoder, GST_STATE_NULL);
|
||||||
|
gst_element_set_state (icc, GST_STATE_NULL);
|
||||||
gst_element_set_state (appsink, GST_STATE_NULL);
|
gst_element_set_state (appsink, GST_STATE_NULL);
|
||||||
gst_object_unref (tee);
|
gst_object_unref (tee);
|
||||||
gst_object_unref (encoder);
|
gst_object_unref (encoder);
|
||||||
|
gst_object_unref (icc);
|
||||||
gst_object_unref (filesink);
|
gst_object_unref (filesink);
|
||||||
priv->photo_block_id = 0;
|
priv->photo_block_id = 0;
|
||||||
|
|
||||||
|
@ -1310,6 +1320,8 @@ void photo_booth_button_yes_clicked (GtkButton *button, PhotoBoothWindow *win)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define ALWAYS_PRINT_DIALOG 1
|
||||||
|
|
||||||
static void photo_booth_print (PhotoBooth *pb)
|
static void photo_booth_print (PhotoBooth *pb)
|
||||||
{
|
{
|
||||||
PhotoBoothPrivate *priv;
|
PhotoBoothPrivate *priv;
|
||||||
|
@ -1319,7 +1331,11 @@ static void photo_booth_print (PhotoBooth *pb)
|
||||||
GST_INFO_OBJECT (pb, "PRINT! prints_remaining=%i", priv->prints_remaining);
|
GST_INFO_OBJECT (pb, "PRINT! prints_remaining=%i", priv->prints_remaining);
|
||||||
gtk_widget_hide (GTK_WIDGET (priv->win->button_yes));
|
gtk_widget_hide (GTK_WIDGET (priv->win->button_yes));
|
||||||
|
|
||||||
|
#ifdef ALWAYS_PRINT_DIALOG
|
||||||
|
if (1)
|
||||||
|
#else
|
||||||
if (priv->prints_remaining > 1)
|
if (priv->prints_remaining > 1)
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
gtk_label_set_text (priv->win->status, _("Printing..."));
|
gtk_label_set_text (priv->win->status, _("Printing..."));
|
||||||
photo_booth_change_state (pb, PB_STATE_PRINTING);
|
photo_booth_change_state (pb, PB_STATE_PRINTING);
|
||||||
|
|
Loading…
Add table
Reference in a new issue