mirror of
https://gitlab.uni-freiburg.de/opensourcevdi/spice
synced 2025-12-26 14:41:25 +00:00
record: Allocate recording file globally from reds.c
Allows to use recording function for multiple purposes. This will allow to register multiple screen VM or recording additional stuff like sound. Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
This commit is contained in:
parent
ab6ace6b66
commit
0bbfe733b8
@ -1308,7 +1308,6 @@ RedWorker* red_worker_new(QXLInstance *qxl,
|
||||
QXLDevInitInfo init_info;
|
||||
RedWorker *worker;
|
||||
Dispatcher *dispatcher;
|
||||
const char *record_filename;
|
||||
RedsState *reds = red_qxl_get_server(qxl->st);
|
||||
RedChannel *channel;
|
||||
|
||||
@ -1318,10 +1317,7 @@ RedWorker* red_worker_new(QXLInstance *qxl,
|
||||
worker->core = event_loop_core;
|
||||
worker->core.main_context = g_main_context_new();
|
||||
|
||||
record_filename = getenv("SPICE_WORKER_RECORD_FILENAME");
|
||||
if (record_filename) {
|
||||
worker->record = red_record_new(record_filename);
|
||||
}
|
||||
worker->record = reds_get_record(reds);
|
||||
dispatcher = red_qxl_get_dispatcher(qxl);
|
||||
dispatcher_set_opaque(dispatcher, worker);
|
||||
|
||||
|
||||
@ -25,6 +25,7 @@
|
||||
#include "main-channel.h"
|
||||
#include "inputs-channel.h"
|
||||
#include "stat-file.h"
|
||||
#include "red-record-qxl.h"
|
||||
|
||||
#define MIGRATE_TIMEOUT (MSEC_PER_SEC * 10)
|
||||
#define MM_TIME_DELTA 400 /*ms*/
|
||||
@ -135,6 +136,7 @@ struct RedsState {
|
||||
SpiceCoreInterfaceInternal core;
|
||||
GList *qxl_instances;
|
||||
MainDispatcher *main_dispatcher;
|
||||
RedRecord *record;
|
||||
};
|
||||
|
||||
#define FOREACH_QXL_INSTANCE(_reds, _iter, _qxl) \
|
||||
|
||||
@ -3469,7 +3469,9 @@ static const char default_video_codecs[] = "spice:mjpeg;" GSTREAMER_CODECS;
|
||||
/* new interface */
|
||||
SPICE_GNUC_VISIBLE SpiceServer *spice_server_new(void)
|
||||
{
|
||||
const char *record_filename;
|
||||
RedsState *reds = spice_new0(RedsState, 1);
|
||||
|
||||
reds->config = spice_new0(RedServerConfig, 1);
|
||||
reds->config->default_channel_security =
|
||||
SPICE_CHANNEL_SECURITY_NONE | SPICE_CHANNEL_SECURITY_SSL;
|
||||
@ -3501,6 +3503,12 @@ SPICE_GNUC_VISIBLE SpiceServer *spice_server_new(void)
|
||||
reds->listen_socket = -1;
|
||||
reds->secure_listen_socket = -1;
|
||||
|
||||
/* This environment was in red-worker so the "WORKER" in it.
|
||||
* For compatibility reason we maintain the old name */
|
||||
record_filename = getenv("SPICE_WORKER_RECORD_FILENAME");
|
||||
if (record_filename) {
|
||||
reds->record = red_record_new(record_filename);
|
||||
}
|
||||
return reds;
|
||||
}
|
||||
|
||||
@ -3709,6 +3717,7 @@ SPICE_GNUC_VISIBLE void spice_server_destroy(SpiceServer *reds)
|
||||
close(reds->secure_listen_socket);
|
||||
}
|
||||
|
||||
red_record_unref(reds->record);
|
||||
reds_cleanup(reds);
|
||||
#ifdef RED_STATISTICS
|
||||
stat_file_free(reds->stat_file);
|
||||
@ -4536,3 +4545,12 @@ static RedCharDeviceVDIPort *red_char_device_vdi_port_new(RedsState *reds)
|
||||
"self-tokens", (guint64)REDS_NUM_INTERNAL_AGENT_MESSAGES,
|
||||
NULL);
|
||||
}
|
||||
|
||||
RedRecord *reds_get_record(RedsState *reds)
|
||||
{
|
||||
if (reds->record) {
|
||||
return red_record_ref(reds->record);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -101,6 +101,11 @@ SpiceCoreInterfaceInternal* reds_get_core_interface(RedsState *reds);
|
||||
void reds_update_client_mouse_allowed(RedsState *reds);
|
||||
MainDispatcher* reds_get_main_dispatcher(RedsState *reds);
|
||||
|
||||
/* Get the recording object stored in RedsState.
|
||||
* You should free with red_record_unref.
|
||||
*/
|
||||
struct RedRecord *reds_get_record(RedsState *reds);
|
||||
|
||||
/* fd watches/timers */
|
||||
SpiceWatch *reds_core_watch_add(RedsState *reds,
|
||||
int fd, int event_mask,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user