when encoding to Ogg FLAC, set a random serial number (instead of 0) if one is not...
authorJosh Coalson <jcoalson@users.sourceforce.net>
Fri, 16 Jul 2004 00:17:06 +0000 (00:17 +0000)
committerJosh Coalson <jcoalson@users.sourceforce.net>
Fri, 16 Jul 2004 00:17:06 +0000 (00:17 +0000)
src/flac/encode.c

index 13a6f10..1bf51da 100644 (file)
 #include <stdio.h> /* for FILE etc. */
 #include <stdlib.h> /* for malloc */
 #include <string.h> /* for strcmp() */
+#if defined _MSC_VER || defined __MINGW32__
+#include <time.h>
+#else
+#include <sys/time.h>
+#endif
 #include "FLAC/all.h"
 #include "share/grabbag.h"
 #include "encode.h"
@@ -1459,6 +1464,13 @@ FLAC__bool EncoderSession_init_encoder(EncoderSession *e, encode_options_t optio
        e->blocksize = options.blocksize;
        e->stats_mask = (options.do_exhaustive_model_search || options.do_qlp_coeff_prec_search)? 0x0f : 0x3f;
 
+       /* set a random serial number if one has not yet been specified */
+       if(!options.has_serial_number) {
+               srand(time(0));
+               options.serial_number = rand();
+               options.has_serial_number = true;
+       }
+
 #ifdef FLAC__HAS_OGG
        if(e->use_ogg) {
                if(e->is_stdout) {