History

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ö committed 16 years ago

Commit 576fb481 parent e1745e28 files · +18 −8Browse files

Unified · Split

8 files
  1. ffserver.c +1 −1
  2. libavfilter/parseutils.c +1 −1
  3. libavformat/httpauth.c +1 −1
  4. libavformat/mxfenc.c +1 −1
  5. libavformat/rtpenc.c +2 −2
  6. libavutil/Makefile +1 −0
  7. libavutil/random_seed.c +10 −1
  8. libavutil/random_seed.h +1 −1
ffserver.c+1−1
@@ -4612,7 +4612,7 @@ int main(int argc, char **argv) · 4611 unmodified lines
46124612
46134613 unsetenv("http_proxy"); /* Kill the http_proxy */
46144614
4615− av_lfg_init(&random_state, ff_random_get_seed());
4615+ av_lfg_init(&random_state, av_get_random_seed());
46164616
46174617 memset(&sigact, 0, sizeof(sigact));
46184618 sigact.sa_handler = handle_child_exit;
libavfilter/parseutils.c+1−1
@@ -218,7 +218,7 @@ static int color_table_compare(const void *lhs, const void *rhs) · 217 unmodified lines
218218 int av_parse_color(uint8_t *rgba_color, const char *color_string, void *log_ctx)
219219 {
220220 if (!strcasecmp(color_string, "random") || !strcasecmp(color_string, "bikeshed")) {
221− int rgba = ff_random_get_seed();
221+ int rgba = av_get_random_seed();
222222 rgba_color[0] = rgba >> 24;
223223 rgba_color[1] = rgba >> 16;
224224 rgba_color[2] = rgba >> 8;
libavformat/httpauth.c+1−1
@@ -200,7 +200,7 @@ static char *make_digest_auth(HTTPAuthState *state, const char *username, · 199 unmodified lines
200200
201201 /* Generate a client nonce. */
202202 for (i = 0; i < 2; i++)
203− cnonce_buf[i] = ff_random_get_seed();
203+ cnonce_buf[i] = av_get_random_seed();
204204 ff_data_to_hex(cnonce, (const uint8_t*) cnonce_buf, sizeof(cnonce_buf), 1);
205205 cnonce[2*sizeof(cnonce_buf)] = 0;
206206
libavformat/mxfenc.c+1−1
@@ -1389,7 +1389,7 @@ static uint64_t mxf_parse_timestamp(time_t timestamp) · 1388 unmodified lines
13891389 static void mxf_gen_umid(AVFormatContext *s)
13901390 {
13911391 MXFContext *mxf = s->priv_data;
1392− uint32_t seed = ff_random_get_seed();
1392+ uint32_t seed = av_get_random_seed();
13931393 uint64_t umid = seed + 0x5294713400000000LL;
13941394
13951395 AV_WB64(mxf->umid , umid);
libavformat/rtpenc.c+2−2
@@ -80,10 +80,10 @@ static int rtp_write_header(AVFormatContext *s1) · 79 unmodified lines
8080 if (s->payload_type < 0)
8181 s->payload_type = RTP_PT_PRIVATE + (st->codec->codec_type == AVMEDIA_TYPE_AUDIO);
8282
83− s->base_timestamp = ff_random_get_seed();
83+ s->base_timestamp = av_get_random_seed();
8484 s->timestamp = s->base_timestamp;
8585 s->cur_timestamp = 0;
86− s->ssrc = ff_random_get_seed();
86+ s->ssrc = av_get_random_seed();
8787 s->first_packet = 1;
8888 s->first_rtcp_ntp_time = ff_ntp_time();
8989 if (s1->start_time_realtime)
libavutil/Makefile+1−0
@@ -19,6 +19,7 @@ HEADERS = adler32.h \ · 18 unmodified lines
1919 mem.h \
2020 pixdesc.h \
2121 pixfmt.h \
22+ random_seed.h \
2223 rational.h \
2324 sha1.h \
2425
libavutil/random_seed.c+10−1
@@ -22,8 +22,9 @@ · 21 unmodified lines
2222 #include <fcntl.h>
2323 #include "timer.h"
2424 #include "random_seed.h"
25+#include "avutil.h"
2526
26−uint32_t ff_random_get_seed(void)
27+uint32_t av_get_random_seed(void)
2728 {
2829 uint32_t seed;
2930 int fd;
@@ -42,3 +43,11 @@ uint32_t ff_random_get_seed(void) · 12 unmodified lines
4243 // XXX what to do ?
4344 return seed;
4445 }
46+
47+#if LIBAVUTIL_VERSION_MAJOR < 51
48+attribute_deprecated uint32_t ff_random_get_seed(void);
49+uint32_t ff_random_get_seed(void)
50+{
51+ return av_get_random_seed();
52+}
53+#endif
libavutil/random_seed.h+1−1
@@ -26,6 +26,6 @@ · 25 unmodified lines
2626 /**
2727 * Gets a seed to use in conjunction with random functions.
2828 */
29−uint32_t ff_random_get_seed(void);
29+uint32_t av_get_random_seed(void);
3030
3131 #endif /* AVUTIL_RANDOM_SEED_H */

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t