mirror of
https://github.com/lwvmobile/dsd-fme.git
synced 2026-11-15 10:17:20 -05:00
Fixed file output directory.
- This fix is very minimal, as a result output directory arguments
must have a trailing slash.
Fixes #34
This commit is contained in:
1
dsd.h
1
dsd.h
@@ -76,6 +76,7 @@ typedef struct
|
|||||||
int playoffset;
|
int playoffset;
|
||||||
char mbe_out_dir[1024];
|
char mbe_out_dir[1024];
|
||||||
char mbe_out_file[1024];
|
char mbe_out_file[1024];
|
||||||
|
char mbe_out_path[1024];
|
||||||
FILE *mbe_out_f;
|
FILE *mbe_out_f;
|
||||||
float audio_gain;
|
float audio_gain;
|
||||||
int audio_out;
|
int audio_out;
|
||||||
|
|||||||
16
dsd_file.c
16
dsd_file.c
@@ -168,7 +168,7 @@ void
|
|||||||
closeMbeOutFile (dsd_opts * opts, dsd_state * state)
|
closeMbeOutFile (dsd_opts * opts, dsd_state * state)
|
||||||
{
|
{
|
||||||
|
|
||||||
char shell[255], newfilename[64], ext[5], datestr[32];
|
char shell[255], newfilename[64], ext[5], datestr[32], new_path[1024];
|
||||||
char tgid[17];
|
char tgid[17];
|
||||||
int sum, i, j;
|
int sum, i, j;
|
||||||
int talkgroup;
|
int talkgroup;
|
||||||
@@ -212,7 +212,8 @@ closeMbeOutFile (dsd_opts * opts, dsd_state * state)
|
|||||||
opts->mbe_out_f = NULL;
|
opts->mbe_out_f = NULL;
|
||||||
strftime (datestr, 31, "%Y-%m-%d-%H%M%S", &timep);
|
strftime (datestr, 31, "%Y-%m-%d-%H%M%S", &timep);
|
||||||
sprintf (newfilename, "nac%X-%s-tg%i%s", state->nac, datestr, talkgroup, ext);
|
sprintf (newfilename, "nac%X-%s-tg%i%s", state->nac, datestr, talkgroup, ext);
|
||||||
sprintf (shell, "mv %s %s", opts->mbe_out_file, newfilename);
|
sprintf (new_path, "%s%s", opts->mbe_out_dir, newfilename);
|
||||||
|
sprintf (shell, "mv %s %s", opts->mbe_out_path, new_path);
|
||||||
result = system (shell);
|
result = system (shell);
|
||||||
|
|
||||||
state->tgcount = 0;
|
state->tgcount = 0;
|
||||||
@@ -256,10 +257,13 @@ openMbeOutFile (dsd_opts * opts, dsd_state * state)
|
|||||||
|
|
||||||
gettimeofday (&tv, NULL);
|
gettimeofday (&tv, NULL);
|
||||||
sprintf (opts->mbe_out_file, "%i%s", (int) tv.tv_sec, ext);
|
sprintf (opts->mbe_out_file, "%i%s", (int) tv.tv_sec, ext);
|
||||||
opts->mbe_out_f = fopen (opts->mbe_out_file, "w");
|
|
||||||
|
sprintf(opts->mbe_out_path, "%s%s", opts->mbe_out_dir, opts->mbe_out_file);
|
||||||
|
|
||||||
|
opts->mbe_out_f = fopen (opts->mbe_out_path, "w");
|
||||||
if (opts->mbe_out_f == NULL)
|
if (opts->mbe_out_f == NULL)
|
||||||
{
|
{
|
||||||
printf ("Error, couldn't open %s\n", opts->mbe_out_file);
|
printf ("Error, couldn't open %s\n", opts->mbe_out_path);
|
||||||
}
|
}
|
||||||
|
|
||||||
// write magic
|
// write magic
|
||||||
@@ -273,7 +277,7 @@ openWavOutFile (dsd_opts * opts, dsd_state * state)
|
|||||||
{
|
{
|
||||||
|
|
||||||
// opts->wav_out_f = fopen (opts->wav_out_file, "w");
|
// opts->wav_out_f = fopen (opts->wav_out_file, "w");
|
||||||
|
|
||||||
SF_INFO info;
|
SF_INFO info;
|
||||||
info.samplerate = 8000;
|
info.samplerate = 8000;
|
||||||
info.channels = 1;
|
info.channels = 1;
|
||||||
@@ -287,7 +291,7 @@ openWavOutFile (dsd_opts * opts, dsd_state * state)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// state->wav_out_bytes = 0;
|
// state->wav_out_bytes = 0;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|||||||
@@ -103,6 +103,7 @@ initOpts (dsd_opts * opts)
|
|||||||
opts->playoffset = 0;
|
opts->playoffset = 0;
|
||||||
opts->mbe_out_dir[0] = 0;
|
opts->mbe_out_dir[0] = 0;
|
||||||
opts->mbe_out_file[0] = 0;
|
opts->mbe_out_file[0] = 0;
|
||||||
|
opts->mbe_out_path[0] = 0;
|
||||||
opts->mbe_out_f = NULL;
|
opts->mbe_out_f = NULL;
|
||||||
opts->audio_gain = 0;
|
opts->audio_gain = 0;
|
||||||
opts->audio_out = 1;
|
opts->audio_out = 1;
|
||||||
|
|||||||
Reference in New Issue
Block a user