Add support for short movies

Short movies can now be recorded (~30 seconds, depending on disk
space), with audio. New button is added, for that, depending on state
it shows "Rec" (you can record), "Stop" (you are recording) and "Busy"
(movie is being converted).
This commit is contained in:
Pavel Machek
2024-04-26 23:14:43 +02:00
committed by Martijn Braam
parent fcba2b33c2
commit 1c9202c4cf
4 changed files with 200 additions and 31 deletions

View File

@@ -46,6 +46,8 @@ RENDERDOC_API_1_1_2 *rdoc_api = NULL;
mp_state_main state;
static int movie_start = 0;
static MPProcessPipelineBuffer *current_preview_buffer = NULL;
static char last_path[260] = "";
@@ -71,6 +73,7 @@ GtkWidget *iso_button;
GtkWidget *shutter_button;
LfbEvent *capture_event;
static GtkWidget *movie;
GSettings *settings;
GSettings *fb_settings;
@@ -904,6 +907,27 @@ flash_button_clicked(GtkWidget *button, gpointer user_data)
gtk_button_set_icon_name(GTK_BUTTON(button), icon_name);
}
void
notify_movie_progress(void)
{
if (!movie_start)
gtk_button_set_label(GTK_BUTTON(movie), "Rec");
}
void
on_movie_clicked(GtkWidget *widget, gpointer user_data)
{
if (movie_start) {
movie_start = 0;
gtk_button_set_label(GTK_BUTTON(movie), "Busy");
on_movie_stop();
} else {
movie_start = 1;
gtk_button_set_label(GTK_BUTTON(movie), "Stop");
on_movie_start();
}
}
static void
on_realize(GtkWidget *window, gpointer *data)
{
@@ -1204,6 +1228,7 @@ activate(GtkApplication *app, gpointer data)
preview_top_box = GTK_WIDGET(gtk_builder_get_object(builder, "top-box"));
preview_bottom_box =
GTK_WIDGET(gtk_builder_get_object(builder, "bottom-box"));
movie = GTK_WIDGET(gtk_builder_get_object(builder, "movie"));
message_box = GTK_WIDGET(gtk_builder_get_object(builder, "message-box"));
message_label = GTK_WIDGET(gtk_builder_get_object(builder, "message-label"));
@@ -1223,7 +1248,10 @@ activate(GtkApplication *app, gpointer data)
g_signal_connect(
flash_button, "clicked", G_CALLBACK(flash_button_clicked), NULL);
setup_fb_switch(builder);
g_signal_connect(movie, "clicked",
G_CALLBACK(on_movie_clicked), NULL);
setup_fb_switch(builder);
// Setup actions
create_simple_action(app, "capture", G_CALLBACK(run_capture_action));
@@ -1254,7 +1282,7 @@ activate(GtkApplication *app, gpointer data)
if (setting_postproc == NULL || setting_postproc[0] == '\0') {
printf("Initializing postprocessor gsetting\n");
setting_postproc = malloc(512);
if (!mp_process_find_processor(setting_postproc)) {
if (!mp_process_find_processor(setting_postproc, "postprocess.sh")) {
printf("No processor found\n");
exit(1);
}
@@ -1391,6 +1419,7 @@ main(int argc, char *argv[])
return 1;
}
} else {
printf("megapixels: No suitable config, defaulting to uvc\n");
if (!libmegapixels_load_uvc(state.configuration)) {
fprintf(stderr, "No config found\n");
return 1;