[xiph-commits] r18455 - icecast/trunk/icecast/src
ph3-der-loewe at svn.xiph.org
ph3-der-loewe at svn.xiph.org
Tue Jul 17 07:42:16 PDT 2012
Author: ph3-der-loewe
Date: 2012-07-17 07:42:16 -0700 (Tue, 17 Jul 2012)
New Revision: 18455
Modified:
icecast/trunk/icecast/src/source.c
Log:
Allow (standard strftime(3)) %x codes in mount's <dump-file> to embedd timestamps in filenames. This currently only works on non windows. closes #1823
Modified: icecast/trunk/icecast/src/source.c
===================================================================
--- icecast/trunk/icecast/src/source.c 2012-07-17 14:03:37 UTC (rev 18454)
+++ icecast/trunk/icecast/src/source.c 2012-07-17 14:42:16 UTC (rev 18455)
@@ -579,6 +579,29 @@
}
+/* Open the file for stream dumping.
+ * This function should do all processing of the filename.
+ */
+static FILE * source_open_dumpfile(const char * filename) {
+#ifndef _WIN32
+ /* some of the below functions seems not to be standard winapi functions */
+ char buffer[PATH_MAX];
+ time_t curtime;
+ struct tm *loctime;
+
+ /* Get the current time. */
+ curtime = time (NULL);
+
+ /* Convert it to local time representation. */
+ loctime = localtime (&curtime);
+
+ strftime (buffer, sizeof(buffer), filename, loctime);
+ filename = buffer;
+#endif
+
+ return fopen (filename, "ab");
+}
+
/* Perform any initialisation just before the stream data is processed, the header
* info is processed by now and the format details are setup
*/
@@ -614,7 +637,7 @@
if (source->dumpfilename != NULL)
{
- source->dumpfile = fopen (source->dumpfilename, "ab");
+ source->dumpfile = source_open_dumpfile (source->dumpfilename);
if (source->dumpfile == NULL)
{
WARN2("Cannot open dump file \"%s\" for appending: %s, disabling.",
More information about the commits
mailing list