Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
sebastiankrzyszkowiak
megapixels
Commits
153d8c93
Commit
153d8c93
authored
Jan 06, 2021
by
Benjamin Schaaf
Browse files
Wait for postprocess process to complete before updating preview
Fixes #27 Fixes #28
parent
52e2fdcb
Changes
3
Hide whitespace changes
Inline
Side-by-side
main.c
View file @
153d8c93
...
...
@@ -169,7 +169,7 @@ draw_surface_scaled_centered(cairo_t *cr, uint32_t dst_width, uint32_t dst_heigh
static
bool
capture_completed
(
const
char
*
fname
)
{
strncpy
(
last_path
,
fname
,
2
60
);
strncpy
(
last_path
,
fname
,
2
59
);
// Create a thumbnail from the current surface
cairo_surface_t
*
thumb
=
...
...
@@ -330,7 +330,7 @@ on_open_last_clicked(GtkWidget *widget, gpointer user_data)
if
(
strlen
(
last_path
)
==
0
)
{
return
;
}
sprintf
(
uri
,
"file://%s
.tiff
"
,
last_path
);
sprintf
(
uri
,
"file://%s"
,
last_path
);
if
(
!
g_app_info_launch_default_for_uri
(
uri
,
NULL
,
&
error
))
{
g_printerr
(
"Could not launch image viewer: %s
\n
"
,
error
->
message
);
}
...
...
postprocess.sh
View file @
153d8c93
...
...
@@ -65,8 +65,11 @@ if [ -n "$DCRAW" ]; then
-overwrite_original
"
$TARGET_NAME
.jpg"
fi
echo
"
$TARGET_NAME
.jpg"
else
cp
"
$MAIN_PICTURE
.
$TIFF_EXT
"
"
$TARGET_NAME
.tiff"
echo
"
$TARGET_NAME
.tiff"
fi
fi
...
...
process_pipeline.c
View file @
153d8c93
...
...
@@ -301,6 +301,28 @@ process_image_for_capture(const MPImage *image, int count)
TIFFClose
(
tif
);
}
static
void
post_process_finished
(
GSubprocess
*
proc
,
GAsyncResult
*
res
,
gpointer
user_data
)
{
char
*
stdout
;
g_subprocess_communicate_utf8_finish
(
proc
,
res
,
&
stdout
,
NULL
,
NULL
);
// The last line contains the file name
int
end
=
strlen
(
stdout
);
// Skip the newline at the end
stdout
[
--
end
]
=
'\0'
;
char
*
path
=
path
=
stdout
+
end
-
1
;
do
{
if
(
*
path
==
'\n'
)
{
break
;
}
--
path
;
}
while
(
path
>
stdout
);
mp_main_capture_completed
(
path
);
}
static
void
process_capture_burst
()
{
...
...
@@ -315,9 +337,27 @@ process_capture_burst()
// Start post-processing the captured burst
g_print
(
"Post process %s to %s.ext
\n
"
,
burst_dir
,
capture_fname
);
char
command
[
1024
];
sprintf
(
command
,
"%s %s %s &"
,
processing_script
,
burst_dir
,
capture_fname
);
system
(
command
);
GError
*
error
=
NULL
;
GSubprocess
*
proc
=
g_subprocess_new
(
G_SUBPROCESS_FLAGS_STDOUT_PIPE
,
&
error
,
processing_script
,
burst_dir
,
capture_fname
,
NULL
);
if
(
!
proc
)
{
g_printerr
(
"Failed to spawn postprocess process: %s
\n
"
,
error
->
message
);
return
;
}
g_subprocess_communicate_utf8_async
(
proc
,
NULL
,
NULL
,
(
GAsyncReadyCallback
)
post_process_finished
,
NULL
);
}
static
void
...
...
@@ -335,8 +375,6 @@ process_image(MPPipeline *pipeline, const MPImage *image)
if
(
captures_remaining
==
0
)
{
process_capture_burst
();
mp_main_capture_completed
(
capture_fname
);
}
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment