Revision: 45444
http://sourceforge.net/p/vice-emu/code/45444
Author: gpz
Date: 2025-01-01 20:32:46 +0000 (Wed, 01 Jan 2025)
Log Message:
-----------
change ui_display_recording() arg from bool to type and pass the type of started recording. also use constants instead of magic values :) UI correctly displays the recording status now
Modified Paths:
--------------
trunk/vice/src/arch/gtk3/actions-snapshot.c
trunk/vice/src/arch/gtk3/uimedia.c
trunk/vice/src/arch/gtk3/uistatusbar.c
trunk/vice/src/arch/gtk3/widgets/statusbarrecordingwidget.c
trunk/vice/src/event.c
trunk/vice/src/screenshot.c
trunk/vice/src/uiapi.h
Modified: trunk/vice/src/arch/gtk3/actions-snapshot.c
===================================================================
--- trunk/vice/src/arch/gtk3/actions-snapshot.c 2024-12-31 11:19:51 UTC (rev 45443)
+++ trunk/vice/src/arch/gtk3/actions-snapshot.c 2025-01-01 20:32:46 UTC (rev 45444)
@@ -88,7 +88,7 @@
static void history_record_start_action(ui_action_map_t *self)
{
event_record_start();
- ui_display_recording(1);
+ ui_display_recording(UI_RECORDING_STATUS_EVENTS);
}
@@ -99,7 +99,7 @@
static void history_record_stop_action(ui_action_map_t *self)
{
event_record_stop();
- ui_display_recording(0);
+ ui_display_recording(UI_RECORDING_STATUS_NONE);
}
Modified: trunk/vice/src/arch/gtk3/uimedia.c
===================================================================
--- trunk/vice/src/arch/gtk3/uimedia.c 2024-12-31 11:19:51 UTC (rev 45443)
+++ trunk/vice/src/arch/gtk3/uimedia.c 2025-01-01 20:32:46 UTC (rev 45444)
@@ -358,14 +358,14 @@
save_screenshot_handler(data);
} else if (strcmp(child_name, CHILD_SOUND) == 0) {
save_audio_recording_handler(data);
- ui_display_recording(1);
+ ui_display_recording(UI_RECORDING_STATUS_AUDIO);
} else if (strcmp(child_name, CHILD_VIDEO) == 0) {
save_video_recording_handler(data);
- ui_display_recording(1);
+ ui_display_recording(UI_RECORDING_STATUS_VIDEO);
}
} else {
save_audio_recording_handler(data);
- ui_display_recording(1);
+ ui_display_recording(UI_RECORDING_STATUS_AUDIO);
}
#if 0
mainlockk_release();
@@ -1067,8 +1067,6 @@
grid = vice_gtk3_grid_new_spaced(16, 8);
-
-#if 1
label = gtk_label_new("Video driver");
gtk_widget_set_margin_start(label, 16);
@@ -1125,21 +1123,7 @@
video_driver_options_grid = options_grid;
gtk_grid_attach(GTK_GRID(grid), options_grid, 0, 1, 1, 1);
-#else
- label = gtk_label_new(NULL);
- gtk_label_set_line_wrap_mode(GTK_LABEL(label), PANGO_WRAP_WORD);
- gtk_widget_set_margin_start(label, 16);
- gtk_widget_set_margin_end(label, 16);
- gtk_widget_set_margin_top(label, 16);
- gtk_widget_set_margin_bottom(label, 16);
- gtk_label_set_markup(GTK_LABEL(label),
- "Video recording is unavailable due to VICE having being compiled"
- " without FFMPEG support.\nPlease recompile with"
- " <tt>--enable-ffmpeg</tt>.\n\n"
- "If you didn't compile VICE yourself, ask your provider.");
- gtk_grid_attach(GTK_GRID(grid), label, 0, 0, 1, 1);
-#endif
gtk_widget_show_all(grid);
return grid;
}
@@ -1256,7 +1240,7 @@
screenshot_stop_recording();
}
- ui_display_recording(0);
+ ui_display_recording(UI_RECORDING_STATUS_NONE);
statusbar_recording_widget_hide_all(ui_statusbar_get_recording_widget(), 10);
}
Modified: trunk/vice/src/arch/gtk3/uistatusbar.c
===================================================================
--- trunk/vice/src/arch/gtk3/uistatusbar.c 2024-12-31 11:19:51 UTC (rev 45443)
+++ trunk/vice/src/arch/gtk3/uistatusbar.c 2025-01-01 20:32:46 UTC (rev 45444)
@@ -106,7 +106,15 @@
#include "uistatusbar.h"
+/* #define DEBUG_STATUSBAR */
+#ifdef DEBUG_STATUSBAR
+#define DBG(x) log_printf x
+#else
+#define DBG(x)
+#endif
+
+
/** \brief The maximum number of status bars we will permit to exist at once. */
#define MAX_STATUS_BARS 3
@@ -2891,7 +2899,7 @@
void ui_display_recording(int recording_status)
{
GtkWidget *widget;
-
+ DBG(("ui_display_recording: %d", recording_status));
/* Ok to call from VICE thread */
widget = allocated_bars[0].record;
statusbar_recording_widget_set_recording_status(widget, recording_status);
Modified: trunk/vice/src/arch/gtk3/widgets/statusbarrecordingwidget.c
===================================================================
--- trunk/vice/src/arch/gtk3/widgets/statusbarrecordingwidget.c 2024-12-31 11:19:51 UTC (rev 45443)
+++ trunk/vice/src/arch/gtk3/widgets/statusbarrecordingwidget.c 2025-01-01 20:32:46 UTC (rev 45444)
@@ -35,11 +35,21 @@
#include "screenshot.h"
#include "sound.h"
#include "ui.h"
+#include "uiapi.h"
#include "uimedia.h"
+#include "log.h"
#include "statusbarrecordingwidget.h"
+/* #define DEBUG_RECORDING */
+#ifdef DEBUG_RECORDING
+#define DBG(x) log_printf x
+#else
+#define DBG(x)
+#endif
+
+
/** \brief Seconds to wait before hiding the widget after pressing 'STOP'
*/
#define HIDE_ALL_TIMEOUT 5
@@ -81,7 +91,7 @@
RW_ROW_BUTTON = 0 /**< STOP button (takes both rows) */
};
-
+#if 0
/** \brief Types of recordings
*/
enum {
@@ -90,8 +100,8 @@
RW_TYPE_AUDIO, /**< recording audio */
RW_TYPE_VIDEO /**< recording video */
};
+#endif
-
/** \brief Types of recordings as strings
*/
static const gchar *rec_types[] = {
@@ -238,13 +248,15 @@
* \param[in] status recording status (boolean)
*/
void statusbar_recording_widget_set_recording_status(GtkWidget *widget,
- int status)
+ int type)
{
GtkWidget *label;
gchar buffer[256];
GtkWidget *button;
- int type = 0; /* set recording type to 'inactive' */
+ int status = (type == UI_RECORDING_STATUS_NONE) ? 0 : 1;
+ DBG(("statusbar_recording_widget_set_recording_status status:%d", status));
+
if (timeout_id > 0) {
g_source_remove(timeout_id);
timeout_id = 0;
@@ -254,7 +266,9 @@
if (status == 0) {
g_object_set_data(G_OBJECT(widget), "Seconds", GINT_TO_POINTER(0));
}
-
+#if 0
+ DBG(("event_record_active():%d sound_is_recording():%d screenshot_is_recording():%d",
+ event_record_active(), sound_is_recording(), screenshot_is_recording()));
/* determine recording type */
if (event_record_active()) {
type = RW_TYPE_EVENTS;
@@ -271,10 +285,15 @@
} else if (screenshot_is_recording()) {
type = RW_TYPE_VIDEO;
}
+ if ((type != RW_TYPE_NONE) && (type != RW_TYPE_EVENTS) && status) {
+ g_timeout_add_seconds(1, update_timer, (gpointer)widget);
+ }
+#endif
- if (type != RW_TYPE_NONE && type != RW_TYPE_EVENTS && status) {
+ if ((type != UI_RECORDING_STATUS_NONE) && (type != UI_RECORDING_STATUS_EVENTS) && status) {
g_timeout_add_seconds(1, update_timer, (gpointer)widget);
}
+ DBG(("statusbar_recording_widget_set_recording_status type:%d", type));
/* update recording status text */
label = gtk_grid_get_child_at(GTK_GRID(widget), RW_COL_TEXT, RW_ROW_TEXT);
@@ -333,11 +352,11 @@
status = gtk_grid_get_child_at(GTK_GRID(widget), RW_COL_TEXT, RW_ROW_TEXT);
/* determine recording type */
if (event_record_active()) {
- type = RW_TYPE_EVENTS;
+ type = UI_RECORDING_STATUS_EVENTS;
} else if ((dev != NULL && *dev != '\0') && !screenshot_is_recording()) {
- type = RW_TYPE_AUDIO;
+ type = UI_RECORDING_STATUS_AUDIO;
} else {
- type = RW_TYPE_VIDEO;
+ type = UI_RECORDING_STATUS_VIDEO;
}
g_snprintf(buffer, sizeof(buffer), "Recording %s ...", rec_types[type]);
gtk_label_set_text(GTK_LABEL(status), buffer);
Modified: trunk/vice/src/event.c
===================================================================
--- trunk/vice/src/event.c 2024-12-31 11:19:51 UTC (rev 45443)
+++ trunk/vice/src/event.c 2025-01-01 20:32:46 UTC (rev 45444)
@@ -698,7 +698,7 @@
1, 1, 0) < 0) {
ui_error("Could not create start snapshot file %s.",
event_snapshot_path(event_start_snapshot));
- ui_display_recording(0);
+ ui_display_recording(UI_RECORDING_STATUS_NONE);
return;
}
destroy_list();
@@ -752,7 +752,7 @@
alarm_set(event_alarm, next_timestamp_clk);
record_active = 1;
- ui_display_recording(1);
+ ui_display_recording(UI_RECORDING_STATUS_EVENTS);
}
int event_record_start(void)
@@ -797,7 +797,7 @@
interrupt_maincpu_trigger_trap(event_record_stop_trap, (void *)0);
- ui_display_recording(0);
+ ui_display_recording(UI_RECORDING_STATUS_NONE);
alarm_unset(event_alarm);
Modified: trunk/vice/src/screenshot.c
===================================================================
--- trunk/vice/src/screenshot.c 2024-12-31 11:19:51 UTC (rev 45443)
+++ trunk/vice/src/screenshot.c 2025-01-01 20:32:46 UTC (rev 45444)
@@ -50,7 +50,14 @@
#include "ui.h"
#include "vsync.h"
+/* #define DEBUG_SCREENSHOT */
+#ifdef DEBUG_SCREENSHOT
+#define DBG(x) log_printf x
+#else
+#define DBG(x)
+#endif
+
static log_t screenshot_log = LOG_DEFAULT;
static gfxoutputdrv_t *recording_driver;
static struct video_canvas_s *recording_canvas;
@@ -197,7 +204,9 @@
screenshot_t screenshot;
gfxoutputdrv_t *drv;
int result;
- /* printf("screenshot_save(%s, %s, ...)\n", drvname, filename); */
+
+ DBG(("screenshot_save(%s, %s, ...)", drvname, filename));
+
if ((drv = gfxoutput_get_driver(drvname)) == NULL) {
return -1;
}
@@ -222,7 +231,7 @@
}
result = screenshot_save_core(&screenshot, drv, filename);
-
+ DBG(("screenshot_save_core result:%d", result));
if (result < 0) {
recording_driver = NULL;
recording_canvas = NULL;
@@ -248,6 +257,7 @@
}
#endif
+/* called for each frame */
int screenshot_record(void)
{
screenshot_t screenshot;
@@ -256,6 +266,8 @@
return 0;
}
+ /* DBG(("screenshot_record")); */
+
/* Retrive framebuffer and screen geometry. */
if (recording_canvas != NULL) {
if (machine_screenshot(&screenshot, recording_canvas) < 0) {
Modified: trunk/vice/src/uiapi.h
===================================================================
--- trunk/vice/src/uiapi.h 2024-12-31 11:19:51 UTC (rev 45443)
+++ trunk/vice/src/uiapi.h 2025-01-01 20:32:46 UTC (rev 45444)
@@ -101,6 +101,11 @@
/* Recording UI */
void ui_display_playback(int playback_status, char *version);
+
+#define UI_RECORDING_STATUS_NONE 0 /**< nothing is being recorded */
+#define UI_RECORDING_STATUS_EVENTS 1 /**< recording events */
+#define UI_RECORDING_STATUS_AUDIO 2 /**< recording audio */
+#define UI_RECORDING_STATUS_VIDEO 3 /**< recording video */
void ui_display_recording(int recording_status);
void ui_display_event_time(unsigned int current, unsigned int total);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|