From 1138520df3361bed19cfe91255c303b12cb1430b Mon Sep 17 00:00:00 2001 From: Josh Coalson Date: Fri, 16 Jul 2004 00:17:06 +0000 Subject: [PATCH] when encoding to Ogg FLAC, set a random serial number (instead of 0) if one is not provided on the command-line --- src/flac/encode.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/flac/encode.c b/src/flac/encode.c index 13a6f104..1bf51da9 100644 --- a/src/flac/encode.c +++ b/src/flac/encode.c @@ -28,6 +28,11 @@ #include /* for FILE etc. */ #include /* for malloc */ #include /* for strcmp() */ +#if defined _MSC_VER || defined __MINGW32__ +#include +#else +#include +#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) {