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
4612 4612
4613 unsetenv("http_proxy"); /* Kill the http_proxy */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 memset(&sigact, 0, sizeof(sigact));4617 memset(&sigact, 0, sizeof(sigact));
4618 sigact.sa_handler = handle_child_exit;4618 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
218int av_parse_color(uint8_t *rgba_color, const char *color_string, void *log_ctx)218int av_parse_color(uint8_t *rgba_color, const char *color_string, void *log_ctx)
219{219{
220 if (!strcasecmp(color_string, "random") || !strcasecmp(color_string, "bikeshed")) {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 rgba_color[0] = rgba >> 24;222 rgba_color[0] = rgba >> 24;
223 rgba_color[1] = rgba >> 16;223 rgba_color[1] = rgba >> 16;
224 rgba_color[2] = rgba >> 8;224 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
200 200
201 /* Generate a client nonce. */201 /* Generate a client nonce. */
202 for (i = 0; i < 2; i++)202 for (i = 0; i < 2; i++)
203 cnonce_buf[i] = ff_random_get_seed();203 cnonce_buf[i] = av_get_random_seed();
204 ff_data_to_hex(cnonce, (const uint8_t*) cnonce_buf, sizeof(cnonce_buf), 1);204 ff_data_to_hex(cnonce, (const uint8_t*) cnonce_buf, sizeof(cnonce_buf), 1);
205 cnonce[2*sizeof(cnonce_buf)] = 0;205 cnonce[2*sizeof(cnonce_buf)] = 0;
206 206
libavformat/mxfenc.c+1−1
@@ -1389,7 +1389,7 @@ static uint64_t mxf_parse_timestamp(time_t timestamp) · 1388 unmodified lines
1389static void mxf_gen_umid(AVFormatContext *s)1389static void mxf_gen_umid(AVFormatContext *s)
1390{1390{
1391 MXFContext *mxf = s->priv_data;1391 MXFContext *mxf = s->priv_data;
1392 uint32_t seed = ff_random_get_seed();1392 uint32_t seed = av_get_random_seed();
1393 uint64_t umid = seed + 0x5294713400000000LL;1393 uint64_t umid = seed + 0x5294713400000000LL;
1394 1394
1395 AV_WB64(mxf->umid , umid);1395 AV_WB64(mxf->umid , umid);
libavformat/rtpenc.c+2−2
@@ -80,10 +80,10 @@ static int rtp_write_header(AVFormatContext *s1) · 79 unmodified lines
80 if (s->payload_type < 0)80 if (s->payload_type < 0)
81 s->payload_type = RTP_PT_PRIVATE + (st->codec->codec_type == AVMEDIA_TYPE_AUDIO);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 s->timestamp = s->base_timestamp;84 s->timestamp = s->base_timestamp;
85 s->cur_timestamp = 0;85 s->cur_timestamp = 0;
86 s->ssrc = ff_random_get_seed();86 s->ssrc = av_get_random_seed();
87 s->first_packet = 1;87 s->first_packet = 1;
88 s->first_rtcp_ntp_time = ff_ntp_time();88 s->first_rtcp_ntp_time = ff_ntp_time();
89 if (s1->start_time_realtime)89 if (s1->start_time_realtime)
libavutil/Makefile+1−0
@@ -19,6 +19,7 @@ HEADERS = adler32.h \ · 18 unmodified lines
19 mem.h \19 mem.h \
20 pixdesc.h \20 pixdesc.h \
21 pixfmt.h \21 pixfmt.h \
22 random_seed.h \
22 rational.h \23 rational.h \
23 sha1.h \24 sha1.h \
24 25
libavutil/random_seed.c+10−1
@@ -22,8 +22,9 @@ · 21 unmodified lines
22#include <fcntl.h>22#include <fcntl.h>
23#include "timer.h"23#include "timer.h"
24#include "random_seed.h"24#include "random_seed.h"
25#include "avutil.h"
25 26
26uint32_t ff_random_get_seed(void)27uint32_t av_get_random_seed(void)
27{28{
28 uint32_t seed;29 uint32_t seed;
29 int fd;30 int fd;
@@ -42,3 +43,11 @@ uint32_t ff_random_get_seed(void) · 12 unmodified lines
42 // XXX what to do ?43 // XXX what to do ?
43 return seed;44 return seed;
44}45}
46
47#if LIBAVUTIL_VERSION_MAJOR < 51
48attribute_deprecated uint32_t ff_random_get_seed(void);
49uint32_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
26/**26/**
27 * Gets a seed to use in conjunction with random functions.27 * Gets a seed to use in conjunction with random functions.
28 */28 */
29uint32_t ff_random_get_seed(void);29uint32_t av_get_random_seed(void);
30 30
31#endif /* AVUTIL_RANDOM_SEED_H */31#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