Commit 9c868219 authored by Stefano Sabatini's avatar Stefano Sabatini

Replace calls to the deprecated function av_init_random() with

corresponding calls to av_random_init().

Originally committed as revision 16682 to svn://svn.ffmpeg.org/ffmpeg/trunk
parent 199436b9
......@@ -4485,7 +4485,7 @@ int main(int argc, char **argv)
unsetenv("http_proxy"); /* Kill the http_proxy */
av_init_random(av_gettime() + (getpid() << 16), &random_state);
av_random_init(&random_state, av_gettime() + (getpid() << 16));
memset(&sigact, 0, sizeof(sigact));
sigact.sa_handler = handle_child_exit;
......
......@@ -1053,7 +1053,7 @@ static int cook_decode_init(AVCodecContext *avctx)
q->bit_rate = avctx->bit_rate;
/* Initialize RNG. */
av_init_random(1, &q->random_state);
av_random_init(&q->random_state, 1);
/* Initialize extradata related variables. */
q->samples_per_channel = q->samples_per_frame / q->nb_channels;
......
......@@ -35,7 +35,7 @@
* @param numCB Number of points in the codebook.
* @param num_steps The maximum number of steps. One step is already a good compromise between time and quality.
* @param closest_cb Return the closest codebook to each point. Must be allocated.
* @param rand_state A random number generator state. Should be already initialised by av_init_random.
* @param rand_state A random number generator state. Should be already initialised by av_random_init.
*/
void ff_do_elbg(int *points, int dim, int numpoints, int *codebook,
int numCB, int num_steps, int *closest_cb,
......
......@@ -53,7 +53,7 @@ static av_cold int mpc7_decode_init(AVCodecContext * avctx)
return -1;
}
memset(c->oldDSCF, 0, sizeof(c->oldDSCF));
av_init_random(0xDEADBEEF, &c->rnd);
av_random_init(&c->rnd, 0xDEADBEEF);
dsputil_init(&c->dsp, avctx);
c->dsp.bswap_buf((uint32_t*)buf, (const uint32_t*)avctx->extradata, 4);
ff_mpc_init();
......
......@@ -100,7 +100,7 @@ static av_cold int mpc8_decode_init(AVCodecContext * avctx)
return -1;
}
memset(c->oldDSCF, 0, sizeof(c->oldDSCF));
av_init_random(0xDEADBEEF, &c->rnd);
av_random_init(&c->rnd, 0xDEADBEEF);
dsputil_init(&c->dsp, avctx);
ff_mpc_init();
......
......@@ -128,7 +128,7 @@ static av_cold int decode_init(AVCodecContext * avctx) {
NellyMoserDecodeContext *s = avctx->priv_data;
s->avctx = avctx;
av_init_random(0, &s->random_state);
av_random_init(&s->random_state, 0);
ff_mdct_init(&s->imdct_ctx, 8, 1);
dsputil_init(&s->dsp, avctx);
......
......@@ -929,7 +929,7 @@ static int roq_encode_init(AVCodecContext *avctx)
{
RoqContext *enc = avctx->priv_data;
av_init_random(1, &enc->randctx);
av_random_init(&enc->randctx, 1);
enc->framesSinceKeyframe = 0;
if ((avctx->width & 0xf) || (avctx->height & 0xf)) {
......
......@@ -231,7 +231,7 @@ if((y)<(x)){\
#undef rand
#define rand rand_is_forbidden_due_to_state_trashing_use_av_random
#undef srand
#define srand srand_is_forbidden_due_to_state_trashing_use_av_init_random
#define srand srand_is_forbidden_due_to_state_trashing_use_av_random_init
#undef random
#define random random_is_forbidden_due_to_state_trashing_use_av_random
#undef sprintf
......
......@@ -88,7 +88,7 @@ int main(void)
int i, j;
AVRandomState state;
av_init_random(0xdeadbeef, &state);
av_random_init(&state, 0xdeadbeef);
for (j = 0; j < 10000; j++) {
START_TIMER
for (i = 0; i < 624; i++) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment