TT#5566 more output config options

Change-Id: I8d9d1ec1274bbd0ac2e5f86408f4b6c8a60537c2
pull/305/head
Richard Fuchs 9 years ago
parent 9036d30ed8
commit 42216b86f7

@ -260,9 +260,11 @@ static int decoder_got_frame(decoder_t *dec, output_t *output, metafile_t *metaf
} }
pthread_mutex_unlock(&metafile->mix_lock); pthread_mutex_unlock(&metafile->mix_lock);
output_config(output, dec->out_clockrate, dec->channels); if (output) {
if (output_add(output, dec_frame)) output_config(output, dec->out_clockrate, dec->channels);
ilog(LOG_ERR, "Failed to add decoded packet to individual output"); if (output_add(output, dec_frame))
ilog(LOG_ERR, "Failed to add decoded packet to individual output");
}
return 0; return 0;
} }
@ -283,7 +285,7 @@ int decoder_input(decoder_t *dec, const str *data, unsigned long ts, output_t *o
} }
else { else {
// shift pts according to rtp ts shift // shift pts according to rtp ts shift
dec->pts += (ts - dec->rtp_ts) /* * output->avst->time_base.num * 8000 / output->avst->time_base.den */ ; dec->pts += (ts - dec->rtp_ts);
// XXX handle lost packets here if timestamps don't line up? // XXX handle lost packets here if timestamps don't line up?
} }
dec->rtp_ts = ts; dec->rtp_ts = ts;

@ -28,6 +28,8 @@ int num_threads = 8;
const char *spool_dir = "/var/spool/rtpengine"; const char *spool_dir = "/var/spool/rtpengine";
const char *output_dir = "/var/lib/rtpengine-recording"; const char *output_dir = "/var/lib/rtpengine-recording";
static const char *output_format = "wav"; static const char *output_format = "wav";
int output_mixed;
int output_single;
static GQueue threads = G_QUEUE_INIT; // only accessed from main thread static GQueue threads = G_QUEUE_INIT; // only accessed from main thread
@ -140,11 +142,16 @@ static void options(int *argc, char ***argv) {
{ "output-format", 0, 0, G_OPTION_ARG_STRING, &output_format, "Write audio files of this type", "wav|mp3" }, { "output-format", 0, 0, G_OPTION_ARG_STRING, &output_format, "Write audio files of this type", "wav|mp3" },
{ "resample-to", 0, 0, G_OPTION_ARG_INT, &resample_audio,"Resample all output audio", "INT" }, { "resample-to", 0, 0, G_OPTION_ARG_INT, &resample_audio,"Resample all output audio", "INT" },
{ "mp3-bitrate", 0, 0, G_OPTION_ARG_INT, &mp3_bitrate, "Bits per second for MP3 encoding", "INT" }, { "mp3-bitrate", 0, 0, G_OPTION_ARG_INT, &mp3_bitrate, "Bits per second for MP3 encoding", "INT" },
{ "output-mixed", 0, 0, G_OPTION_ARG_NONE, &output_mixed, "Mix participating sources into a single output",NULL },
{ "output-single", 0, 0, G_OPTION_ARG_NONE, &output_single, "Create one output file for each source",NULL },
{ NULL, } { NULL, }
}; };
config_load(argc, argv, e, " - rtpengine recording daemon", config_load(argc, argv, e, " - rtpengine recording daemon",
"/etc/rtpengine/rtpengine-recording.conf", "rtpengine-recording"); "/etc/rtpengine/rtpengine-recording.conf", "rtpengine-recording");
if (!output_mixed && !output_single)
output_mixed = output_single = 1;
} }

@ -6,6 +6,8 @@ extern int ktable;
extern int num_threads; extern int num_threads;
extern const char *spool_dir; extern const char *spool_dir;
extern const char *output_dir; extern const char *output_dir;
extern int output_mixed;
extern int output_single;
extern volatile int shutdown_flag; extern volatile int shutdown_flag;

@ -53,7 +53,7 @@ static void meta_destroy(metafile_t *mf) {
// mf is locked // mf is locked
static void meta_stream_interface(metafile_t *mf, unsigned long snum, char *content) { static void meta_stream_interface(metafile_t *mf, unsigned long snum, char *content) {
pthread_mutex_lock(&mf->mix_lock); pthread_mutex_lock(&mf->mix_lock);
if (!mf->mix) { if (!mf->mix && output_mixed) {
char buf[256]; char buf[256];
snprintf(buf, sizeof(buf), "%s/%s-mix", output_dir, mf->parent); snprintf(buf, sizeof(buf), "%s/%s-mix", output_dir, mf->parent);
mf->mix_out = output_new(buf); mf->mix_out = output_new(buf);

@ -59,6 +59,8 @@ static void mix_shutdown(mix_t *mix) {
void mix_destroy(mix_t *mix) { void mix_destroy(mix_t *mix) {
if (!mix)
return;
mix_shutdown(mix); mix_shutdown(mix);
av_frame_free(&mix->sink_frame); av_frame_free(&mix->sink_frame);
av_frame_free(&mix->swr_frame); av_frame_free(&mix->swr_frame);

@ -58,7 +58,8 @@ static ssrc_t *ssrc_get(metafile_t *mf, unsigned long ssrc) {
char buf[256]; char buf[256];
snprintf(buf, sizeof(buf), "%s/%s-%08lx", output_dir, mf->parent, ssrc); snprintf(buf, sizeof(buf), "%s/%s-%08lx", output_dir, mf->parent, ssrc);
ret->output = output_new(buf); if (output_single)
ret->output = output_new(buf);
g_hash_table_insert(mf->ssrc_hash, GUINT_TO_POINTER(ssrc), ret); g_hash_table_insert(mf->ssrc_hash, GUINT_TO_POINTER(ssrc), ret);

Loading…
Cancel
Save