diff options
| -rw-r--r-- | recordmydesktop/include/recordmydesktop.h | 1 | ||||
| -rw-r--r-- | recordmydesktop/include/rmdtypes.h | 3 | ||||
| -rw-r--r-- | recordmydesktop/src/cache_audio.c | 6 | ||||
| -rw-r--r-- | recordmydesktop/src/cache_frame.c | 6 | ||||
| -rw-r--r-- | recordmydesktop/src/capture_sound.c | 18 | ||||
| -rw-r--r-- | recordmydesktop/src/encode_image_buffer.c | 6 | ||||
| -rw-r--r-- | recordmydesktop/src/encode_sound_buffer.c | 6 | ||||
| -rw-r--r-- | recordmydesktop/src/get_frame.c | 6 | ||||
| -rw-r--r-- | recordmydesktop/src/initialize_data.c | 4 | ||||
| -rw-r--r-- | recordmydesktop/src/rmd_timer.c | 8 | 
10 files changed, 33 insertions, 31 deletions
| diff --git a/recordmydesktop/include/recordmydesktop.h b/recordmydesktop/include/recordmydesktop.h index 42b2943..42965f8 100644 --- a/recordmydesktop/include/recordmydesktop.h +++ b/recordmydesktop/include/recordmydesktop.h @@ -50,7 +50,6 @@ u_int32_t   *yblocks,  /**Globals*/  //I've read somewhere that I'll go to hell for using globals... -pthread_mutex_t pause_mutex,time_mutex;  unsigned char   Yr[256],Yg[256],Yb[256],                  Ur[256],Ug[256],UbVr[256],                  Vg[256],Vb[256]; diff --git a/recordmydesktop/include/rmdtypes.h b/recordmydesktop/include/rmdtypes.h index 9225e6f..f4099ce 100644 --- a/recordmydesktop/include/rmdtypes.h +++ b/recordmydesktop/include/rmdtypes.h @@ -348,6 +348,9 @@ struct _ProgData {      boolean aborted;             //1 if we should abort      boolean pause_state_changed; //1 if pause state changed +    pthread_mutex_t pause_mutex; +    pthread_mutex_t time_mutex; +  #ifdef HAVE_LIBASOUND      snd_pcm_t *sound_handle;      snd_pcm_uframes_t periodsize; diff --git a/recordmydesktop/src/cache_audio.c b/recordmydesktop/src/cache_audio.c index ac21615..27a8141 100644 --- a/recordmydesktop/src/cache_audio.c +++ b/recordmydesktop/src/cache_audio.c @@ -43,9 +43,9 @@ void *CacheSoundBuffer(ProgData *pdata){          SndBuffer *buff=NULL;          if (pdata->paused) { -            pthread_mutex_lock(&pause_mutex); -            pthread_cond_wait(&pdata->pause_cond,&pause_mutex); -            pthread_mutex_unlock(&pause_mutex); +            pthread_mutex_lock(&pdata->pause_mutex); +            pthread_cond_wait(&pdata->pause_cond, &pdata->pause_mutex); +            pthread_mutex_unlock(&pdata->pause_mutex);          }          if(!pdata->args.use_jack){              if(pdata->sound_buffer==NULL){ diff --git a/recordmydesktop/src/cache_frame.c b/recordmydesktop/src/cache_frame.c index 79e955f..faf2394 100644 --- a/recordmydesktop/src/cache_frame.c +++ b/recordmydesktop/src/cache_frame.c @@ -116,9 +116,9 @@ void *CacheImageBuffer(ProgData *pdata){          pdata->th_enc_thread_waiting=0;          if (pdata->paused) { -            pthread_mutex_lock(&pause_mutex); -            pthread_cond_wait(&pdata->pause_cond,&pause_mutex); -            pthread_mutex_unlock(&pause_mutex); +            pthread_mutex_lock(&pdata->pause_mutex); +            pthread_cond_wait(&pdata->pause_cond, &pdata->pause_mutex); +            pthread_mutex_unlock(&pdata->pause_mutex);          }          pthread_mutex_lock(&pdata->yuv_mutex); diff --git a/recordmydesktop/src/capture_sound.c b/recordmydesktop/src/capture_sound.c index 71424f9..d32715e 100644 --- a/recordmydesktop/src/capture_sound.c +++ b/recordmydesktop/src/capture_sound.c @@ -43,16 +43,16 @@ void *CaptureSound(ProgData *pdata){  #ifdef HAVE_LIBASOUND              if(!pdata->hard_pause){                  snd_pcm_pause(pdata->sound_handle,1); -                pthread_mutex_lock(&pause_mutex); -                pthread_cond_wait(&pdata->pause_cond,&pause_mutex); -                pthread_mutex_unlock(&pause_mutex); +                pthread_mutex_lock(&pdata->pause_mutex); +                pthread_cond_wait(&pdata->pause_cond, &pdata->pause_mutex); +                pthread_mutex_unlock(&pdata->pause_mutex);                  snd_pcm_pause(pdata->sound_handle,0);              }              else{//device doesn't support pause(is this the norm?mine doesn't)                  snd_pcm_close(pdata->sound_handle); -                pthread_mutex_lock(&pause_mutex); -                pthread_cond_wait(&pdata->pause_cond,&pause_mutex); -                pthread_mutex_unlock(&pause_mutex); +                pthread_mutex_lock(&pdata->pause_mutex); +                pthread_cond_wait(&pdata->pause_cond, &pdata->pause_mutex); +                pthread_mutex_unlock(&pdata->pause_mutex);                  pdata->sound_handle=                      OpenDev(pdata->args.device,                              &pdata->args.channels, @@ -72,9 +72,9 @@ void *CaptureSound(ProgData *pdata){              }  #else              close(pdata->sound_handle); -            pthread_mutex_lock(&pause_mutex); -            pthread_cond_wait(&pdata->pause_cond,&pause_mutex); -            pthread_mutex_unlock(&pause_mutex); +            pthread_mutex_lock(&pdata->pause_mutex); +            pthread_cond_wait(&pdata->pause_cond, &pdata->pause_mutex); +            pthread_mutex_unlock(&pdata->pause_mutex);              pdata->sound_handle=                  OpenDev(pdata->args.device,                          pdata->args.channels, diff --git a/recordmydesktop/src/encode_image_buffer.c b/recordmydesktop/src/encode_image_buffer.c index 94cd5d2..1242071 100644 --- a/recordmydesktop/src/encode_image_buffer.c +++ b/recordmydesktop/src/encode_image_buffer.c @@ -39,9 +39,9 @@ void *EncodeImageBuffer(ProgData *pdata){          pdata->th_enc_thread_waiting=0;          encoder_busy=1;          if (pdata->paused) { -            pthread_mutex_lock(&pause_mutex); -            pthread_cond_wait(&pdata->pause_cond,&pause_mutex); -            pthread_mutex_unlock(&pause_mutex); +            pthread_mutex_lock(&pdata->pause_mutex); +            pthread_cond_wait(&pdata->pause_cond, &pdata->pause_mutex); +            pthread_mutex_unlock(&pdata->pause_mutex);          }          pthread_mutex_lock(&pdata->yuv_mutex); diff --git a/recordmydesktop/src/encode_sound_buffer.c b/recordmydesktop/src/encode_sound_buffer.c index 47b8211..919b649 100644 --- a/recordmydesktop/src/encode_sound_buffer.c +++ b/recordmydesktop/src/encode_sound_buffer.c @@ -43,9 +43,9 @@ void *EncodeSoundBuffer(ProgData *pdata){          SndBuffer *buff=NULL;          if (pdata->paused) { -            pthread_mutex_lock(&pause_mutex); -            pthread_cond_wait(&pdata->pause_cond,&pause_mutex); -            pthread_mutex_unlock(&pause_mutex); +            pthread_mutex_lock(&pdata->pause_mutex); +            pthread_cond_wait(&pdata->pause_cond, &pdata->pause_mutex); +            pthread_mutex_unlock(&pdata->pause_mutex);          }          if(!pdata->args.use_jack){              if(pdata->sound_buffer==NULL){ diff --git a/recordmydesktop/src/get_frame.c b/recordmydesktop/src/get_frame.c index d4dee67..1a5d445 100644 --- a/recordmydesktop/src/get_frame.c +++ b/recordmydesktop/src/get_frame.c @@ -390,9 +390,9 @@ void *GetFrame(ProgData *pdata){          //also before actually pausing we must make sure the streams          //are synced. sound stops so this should only happen quickly.          if(pdata->avd>0 || pdata->args.nosound){ -            pthread_mutex_lock(&time_mutex); -            pthread_cond_wait(&pdata->time_cond,&time_mutex); -            pthread_mutex_unlock(&time_mutex); +            pthread_mutex_lock(&pdata->time_mutex); +            pthread_cond_wait(&pdata->time_cond, &pdata->time_mutex); +            pthread_mutex_unlock(&pdata->time_mutex);              if (pdata->paused) {                  //this is necessary since event loop processes                  //the shortcuts which will unpause the program diff --git a/recordmydesktop/src/initialize_data.c b/recordmydesktop/src/initialize_data.c index 56e3beb..1e206ae 100644 --- a/recordmydesktop/src/initialize_data.c +++ b/recordmydesktop/src/initialize_data.c @@ -97,8 +97,8 @@ int InitializeData(ProgData *pdata,      pthread_mutex_init(&pdata->vorbis_lib_mutex,NULL);      pthread_mutex_init(&pdata->libogg_mutex,NULL);      pthread_mutex_init(&pdata->yuv_mutex,NULL); -    pthread_mutex_init(&pause_mutex,NULL); -    pthread_mutex_init(&time_mutex,NULL); +    pthread_mutex_init(&pdata->pause_mutex, NULL); +    pthread_mutex_init(&pdata->time_mutex, NULL);      pthread_cond_init(&pdata->time_cond,NULL);      pthread_cond_init(&pdata->pause_cond,NULL);      pthread_cond_init(&pdata->image_buffer_ready,NULL); diff --git a/recordmydesktop/src/rmd_timer.c b/recordmydesktop/src/rmd_timer.c index 0f8a032..28929ab 100644 --- a/recordmydesktop/src/rmd_timer.c +++ b/recordmydesktop/src/rmd_timer.c @@ -53,9 +53,9 @@ void *rmdTimer(ProgData *pdata){              else{                  pdata->paused = FALSE;                  fprintf(stderr,"STATE:RECORDING\n");fflush(stderr); -                pthread_mutex_lock(&pause_mutex); +                pthread_mutex_lock(&pdata->pause_mutex);                  pthread_cond_broadcast(&pdata->pause_cond); -                pthread_mutex_unlock(&pause_mutex); +                pthread_mutex_unlock(&pdata->pause_mutex);              }          } @@ -67,9 +67,9 @@ void *rmdTimer(ProgData *pdata){              }          } -        pthread_mutex_lock(&time_mutex); +        pthread_mutex_lock(&pdata->time_mutex);          pthread_cond_broadcast(&pdata->time_cond); -        pthread_mutex_unlock(&time_mutex); +        pthread_mutex_unlock(&pdata->time_mutex);          if(secs_tw) | 
