MT#56493 store "mixed"/"single" in output_t

This is the "type" of the recording, but sadly we already have "type"
with a slightly different meaning (i.e. the SSRC in hex for single
streams), so we name this the recording "kind".

Change-Id: I2f7c36e42f7eb075a4324e9659d2845ab40b4f07
pull/1611/head
Richard Fuchs 2 years ago
parent 9df4c361f8
commit 10e6ab24b8

@ -311,7 +311,7 @@ void db_do_call(metafile_t *mf) {
// mf is locked
void db_do_stream(metafile_t *mf, output_t *op, const char *type, stream_t *stream, unsigned long ssrc) {
void db_do_stream(metafile_t *mf, output_t *op, stream_t *stream, unsigned long ssrc) {
if (check_conn())
return;
if (mf->db_id == 0)
@ -329,7 +329,7 @@ void db_do_stream(metafile_t *mf, output_t *op, const char *type, stream_t *stre
my_cstr(&b[3], op->full_filename);
my_cstr(&b[4], op->file_format);
my_cstr(&b[5], op->file_format);
my_cstr(&b[6], type);
my_cstr(&b[6], op->kind);
b[7] = (MYSQL_BIND) {
.buffer_type = MYSQL_TYPE_LONG,
.buffer = &id,

@ -6,7 +6,7 @@
void db_do_call(metafile_t *);
void db_close_call(metafile_t *);
void db_do_stream(metafile_t *mf, output_t *op, const char *type, stream_t *, unsigned long ssrc);
void db_do_stream(metafile_t *mf, output_t *op, stream_t *, unsigned long ssrc);
void db_close_stream(output_t *op);
void db_delete_stream(metafile_t *, output_t *op);
void db_config_stream(output_t *op);

@ -81,11 +81,11 @@ static void meta_stream_interface(metafile_t *mf, unsigned long snum, char *cont
if (output_enabled && output_mixed && mf->recording_on) {
pthread_mutex_lock(&mf->mix_lock);
if (!mf->mix) {
mf->mix_out = output_new(output_dir, mf->parent, "mix", "mix");
mf->mix_out = output_new(output_dir, mf->parent, "mix", "mixed", "mix");
if (mix_method == MM_CHANNELS)
mf->mix_out->channel_mult = mix_num_inputs;
mf->mix = mix_new();
db_do_stream(mf, mf->mix_out, "mixed", NULL, 0);
db_do_stream(mf, mf->mix_out, NULL, 0);
}
pthread_mutex_unlock(&mf->mix_lock);
}

@ -95,7 +95,7 @@ static output_t *output_alloc(const char *path, const char *name) {
return ret;
}
output_t *output_new(const char *path, const char *call, const char *type, const char *label) {
output_t *output_new(const char *path, const char *call, const char *type, const char *kind, const char *label) {
// construct output file name
struct timeval now;
struct tm tm;
@ -177,15 +177,17 @@ output_t *output_new(const char *path, const char *call, const char *type, const
done:;
output_t *ret = output_alloc(path, f->str);
create_parent_dirs(ret->full_filename);
ret->kind = kind;
g_string_free(f, TRUE);
return ret;
}
output_t *output_new_from_full_path(const char *path, char *name) {
output_t *output_new_from_full_path(const char *path, char *name, const char *kind) {
output_t *ret = output_alloc(path, name);
create_parent_dirs(ret->full_filename);
ret->kind = kind;
return ret;
}

@ -10,8 +10,8 @@ extern int mp3_bitrate;
void output_init(const char *format);
output_t *output_new(const char *path, const char *call, const char *type, const char *label);
output_t *output_new_from_full_path(const char *path, char *name);
output_t *output_new(const char *path, const char *call, const char *type, const char *kind, const char *label);
output_t *output_new_from_full_path(const char *path, char *name, const char *kind);
void output_close(metafile_t *, output_t *);
int output_config(output_t *output, const format_t *requested_format, format_t *actual_format);

@ -195,20 +195,20 @@ out:
if (sep) {
char *filename = sep + 1;
*sep = 0;
ret->output = output_new_from_full_path(path, filename);
ret->output = output_new_from_full_path(path, filename, "single");
ret->output->skip_filename_extension = TRUE;
}
else {
ret->output = output_new_from_full_path(output_dir, path);
ret->output = output_new_from_full_path(output_dir, path, "single");
}
}
else {
char buf[16];
snprintf(buf, sizeof(buf), "%08lx", ssrc);
tag_t *tag = tag_get(mf, stream->tag);
ret->output = output_new(output_dir, mf->parent, buf, tag->label);
ret->output = output_new(output_dir, mf->parent, buf, "single", tag->label);
}
db_do_stream(mf, ret->output, "single", stream, ssrc);
db_do_stream(mf, ret->output, stream, ssrc);
}
if ((stream->forwarding_on || mf->forwarding_on) && !ret->tls_fwd_stream && tls_send_to_ep.port) {
// initialise the connection

@ -148,6 +148,7 @@ struct output_s {
*file_name,
*filename; // path + filename + suffix
const char *file_format;
const char *kind; // "mixed" or "single"
unsigned long long db_id;
gboolean skip_filename_extension;
unsigned int channel_mult;

Loading…
Cancel
Save