diff options
Diffstat (limited to 'recordmydesktop/src/encode_image_buffer.c')
-rw-r--r-- | recordmydesktop/src/encode_image_buffer.c | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/recordmydesktop/src/encode_image_buffer.c b/recordmydesktop/src/encode_image_buffer.c index 38a1d77..8ff9629 100644 --- a/recordmydesktop/src/encode_image_buffer.c +++ b/recordmydesktop/src/encode_image_buffer.c @@ -30,8 +30,8 @@ void *EncodeImageBuffer(void *pdata){ pthread_mutex_init(&pmut,NULL); pthread_mutex_init(&imut,NULL); while(((ProgData *)pdata)->running){ - encoder_busy=1; pthread_cond_wait(&((ProgData *)pdata)->image_buffer_ready,&imut); + encoder_busy=1; if(Paused) pthread_cond_wait(&((ProgData *)pdata)->pause_cond,&pmut);//this may not be needed pthread_mutex_lock(&((ProgData *)pdata)->yuv_mutex); @@ -62,4 +62,22 @@ void *EncodeImageBuffer(void *pdata){ pthread_exit(&errno); } +//this function is meant to be called normally +//not through a thread of it's own +void SyncEncodeImageBuffer(ProgData *pdata){ + if(theora_encode_YUVin(&pdata->enc_data->m_th_st, + &pdata->enc_data->yuv)){ + fprintf(stderr,"Encoder not ready!\n"); + } + else{ + if(theora_encode_packetout(&pdata->enc_data->m_th_st,0, + &pdata->enc_data->m_ogg_pckt1)==1){ + pthread_mutex_lock(&pdata->libogg_mutex); + ogg_stream_packetin(&pdata->enc_data->m_ogg_ts, + &pdata->enc_data->m_ogg_pckt1); + pthread_mutex_unlock(&pdata->libogg_mutex); + pdata->avd+=pdata->frametime*2*pdata->args.channels; + } + } +} |