Browse code

Make ff_random_get_seed public, rename to av_get_random_seed, export the header

Keep an old ff_ named function for binary compatibility until the
next major bump.

Originally committed as revision 23254 to svn://svn.ffmpeg.org/ffmpeg/trunk

Martin Storsjö authored on 2010/05/23 17:53:40
Showing 8 changed files
... ...
@@ -4612,7 +4612,7 @@ int main(int argc, char **argv)
4612 4612
 
4613 4613
     unsetenv("http_proxy");             /* Kill the http_proxy */
4614 4614
 
4615
-    av_lfg_init(&random_state, ff_random_get_seed());
4615
+    av_lfg_init(&random_state, av_get_random_seed());
4616 4616
 
4617 4617
     memset(&sigact, 0, sizeof(sigact));
4618 4618
     sigact.sa_handler = handle_child_exit;
... ...
@@ -218,7 +218,7 @@ static int color_table_compare(const void *lhs, const void *rhs)
218 218
 int av_parse_color(uint8_t *rgba_color, const char *color_string, void *log_ctx)
219 219
 {
220 220
     if (!strcasecmp(color_string, "random") || !strcasecmp(color_string, "bikeshed")) {
221
-        int rgba = ff_random_get_seed();
221
+        int rgba = av_get_random_seed();
222 222
         rgba_color[0] = rgba >> 24;
223 223
         rgba_color[1] = rgba >> 16;
224 224
         rgba_color[2] = rgba >> 8;
... ...
@@ -200,7 +200,7 @@ static char *make_digest_auth(HTTPAuthState *state, const char *username,
200 200
 
201 201
     /* Generate a client nonce. */
202 202
     for (i = 0; i < 2; i++)
203
-        cnonce_buf[i] = ff_random_get_seed();
203
+        cnonce_buf[i] = av_get_random_seed();
204 204
     ff_data_to_hex(cnonce, (const uint8_t*) cnonce_buf, sizeof(cnonce_buf), 1);
205 205
     cnonce[2*sizeof(cnonce_buf)] = 0;
206 206
 
... ...
@@ -1389,7 +1389,7 @@ static uint64_t mxf_parse_timestamp(time_t timestamp)
1389 1389
 static void mxf_gen_umid(AVFormatContext *s)
1390 1390
 {
1391 1391
     MXFContext *mxf = s->priv_data;
1392
-    uint32_t seed = ff_random_get_seed();
1392
+    uint32_t seed = av_get_random_seed();
1393 1393
     uint64_t umid = seed + 0x5294713400000000LL;
1394 1394
 
1395 1395
     AV_WB64(mxf->umid  , umid);
... ...
@@ -80,10 +80,10 @@ static int rtp_write_header(AVFormatContext *s1)
80 80
     if (s->payload_type < 0)
81 81
         s->payload_type = RTP_PT_PRIVATE + (st->codec->codec_type == AVMEDIA_TYPE_AUDIO);
82 82
 
83
-    s->base_timestamp = ff_random_get_seed();
83
+    s->base_timestamp = av_get_random_seed();
84 84
     s->timestamp = s->base_timestamp;
85 85
     s->cur_timestamp = 0;
86
-    s->ssrc = ff_random_get_seed();
86
+    s->ssrc = av_get_random_seed();
87 87
     s->first_packet = 1;
88 88
     s->first_rtcp_ntp_time = ff_ntp_time();
89 89
     if (s1->start_time_realtime)
... ...
@@ -19,6 +19,7 @@ HEADERS = adler32.h                                                     \
19 19
           mem.h                                                         \
20 20
           pixdesc.h                                                     \
21 21
           pixfmt.h                                                      \
22
+          random_seed.h                                                 \
22 23
           rational.h                                                    \
23 24
           sha1.h                                                        \
24 25
 
... ...
@@ -22,8 +22,9 @@
22 22
 #include <fcntl.h>
23 23
 #include "timer.h"
24 24
 #include "random_seed.h"
25
+#include "avutil.h"
25 26
 
26
-uint32_t ff_random_get_seed(void)
27
+uint32_t av_get_random_seed(void)
27 28
 {
28 29
     uint32_t seed;
29 30
     int fd;
... ...
@@ -42,3 +43,11 @@ uint32_t ff_random_get_seed(void)
42 42
     // XXX what to do ?
43 43
     return seed;
44 44
 }
45
+
46
+#if LIBAVUTIL_VERSION_MAJOR < 51
47
+attribute_deprecated uint32_t ff_random_get_seed(void);
48
+uint32_t ff_random_get_seed(void)
49
+{
50
+    return av_get_random_seed();
51
+}
52
+#endif
... ...
@@ -26,6 +26,6 @@
26 26
 /**
27 27
  * Gets a seed to use in conjunction with random functions.
28 28
  */
29
-uint32_t ff_random_get_seed(void);
29
+uint32_t av_get_random_seed(void);
30 30
 
31 31
 #endif /* AVUTIL_RANDOM_SEED_H */