[FFmpeg-cvslog] r16682 - in trunk: ffserver.c libavcodec/cook.c libavcodec/elbg.h libavcodec/mpc7.c libavcodec/mpc8.c libavcodec/nellymoserdec.c libavcodec/roqvideoenc.c libavutil/internal.h libavutil/random.c

stefano subversion
Mon Jan 19 00:04:33 CET 2009


Author: stefano
Date: Mon Jan 19 00:04:33 2009
New Revision: 16682

Log:
Replace calls to the deprecated function av_init_random() with
corresponding calls to av_random_init().

Modified:
   trunk/ffserver.c
   trunk/libavcodec/cook.c
   trunk/libavcodec/elbg.h
   trunk/libavcodec/mpc7.c
   trunk/libavcodec/mpc8.c
   trunk/libavcodec/nellymoserdec.c
   trunk/libavcodec/roqvideoenc.c
   trunk/libavutil/internal.h
   trunk/libavutil/random.c

Modified: trunk/ffserver.c
==============================================================================
--- trunk/ffserver.c	Sun Jan 18 23:57:40 2009	(r16681)
+++ trunk/ffserver.c	Mon Jan 19 00:04:33 2009	(r16682)
@@ -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;

Modified: trunk/libavcodec/cook.c
==============================================================================
--- trunk/libavcodec/cook.c	Sun Jan 18 23:57:40 2009	(r16681)
+++ trunk/libavcodec/cook.c	Mon Jan 19 00:04:33 2009	(r16682)
@@ -1053,7 +1053,7 @@ static int cook_decode_init(AVCodecConte
     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;

Modified: trunk/libavcodec/elbg.h
==============================================================================
--- trunk/libavcodec/elbg.h	Sun Jan 18 23:57:40 2009	(r16681)
+++ trunk/libavcodec/elbg.h	Mon Jan 19 00:04:33 2009	(r16682)
@@ -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,

Modified: trunk/libavcodec/mpc7.c
==============================================================================
--- trunk/libavcodec/mpc7.c	Sun Jan 18 23:57:40 2009	(r16681)
+++ trunk/libavcodec/mpc7.c	Mon Jan 19 00:04:33 2009	(r16682)
@@ -53,7 +53,7 @@ static av_cold int mpc7_decode_init(AVCo
         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();

Modified: trunk/libavcodec/mpc8.c
==============================================================================
--- trunk/libavcodec/mpc8.c	Sun Jan 18 23:57:40 2009	(r16681)
+++ trunk/libavcodec/mpc8.c	Mon Jan 19 00:04:33 2009	(r16682)
@@ -100,7 +100,7 @@ static av_cold int mpc8_decode_init(AVCo
         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();

Modified: trunk/libavcodec/nellymoserdec.c
==============================================================================
--- trunk/libavcodec/nellymoserdec.c	Sun Jan 18 23:57:40 2009	(r16681)
+++ trunk/libavcodec/nellymoserdec.c	Mon Jan 19 00:04:33 2009	(r16682)
@@ -128,7 +128,7 @@ static av_cold int decode_init(AVCodecCo
     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);

Modified: trunk/libavcodec/roqvideoenc.c
==============================================================================
--- trunk/libavcodec/roqvideoenc.c	Sun Jan 18 23:57:40 2009	(r16681)
+++ trunk/libavcodec/roqvideoenc.c	Mon Jan 19 00:04:33 2009	(r16682)
@@ -929,7 +929,7 @@ static int roq_encode_init(AVCodecContex
 {
     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)) {

Modified: trunk/libavutil/internal.h
==============================================================================
--- trunk/libavutil/internal.h	Sun Jan 18 23:57:40 2009	(r16681)
+++ trunk/libavutil/internal.h	Mon Jan 19 00:04:33 2009	(r16682)
@@ -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

Modified: trunk/libavutil/random.c
==============================================================================
--- trunk/libavutil/random.c	Sun Jan 18 23:57:40 2009	(r16681)
+++ trunk/libavutil/random.c	Mon Jan 19 00:04:33 2009	(r16682)
@@ -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++) {




More information about the ffmpeg-cvslog mailing list