summaryrefslogtreecommitdiff
path: root/recordmydesktop/src
diff options
context:
space:
mode:
authorbiocrasher <biocrasher@f606c939-3180-4ac9-a4b8-4b8779d57d0a>2006-07-14 10:05:22 +0000
committerbiocrasher <biocrasher@f606c939-3180-4ac9-a4b8-4b8779d57d0a>2006-07-14 10:05:22 +0000
commit1583f3b9199ec5dd12c29375aecb9cede3ece770 (patch)
tree20573f1e9bde41a8c6e116e0df1184d26edd2fab /recordmydesktop/src
parent3813935bbd79a8d0102aca24453355f45b1e3878 (diff)
theora size adjust and erroneous height cropping bugs fixed
git-svn-id: https://recordmydesktop.svn.sourceforge.net/svnroot/recordmydesktop/trunk@7 f606c939-3180-4ac9-a4b8-4b8779d57d0a
Diffstat (limited to 'recordmydesktop/src')
-rw-r--r--recordmydesktop/src/encode_image_buffer.c5
-rw-r--r--recordmydesktop/src/get_frame.c5
-rw-r--r--recordmydesktop/src/init_encoder.c9
-rw-r--r--recordmydesktop/src/setbrwindow.c7
-rw-r--r--recordmydesktop/src/update_image.c5
5 files changed, 15 insertions, 16 deletions
diff --git a/recordmydesktop/src/encode_image_buffer.c b/recordmydesktop/src/encode_image_buffer.c
index f4c712a..76c4126 100644
--- a/recordmydesktop/src/encode_image_buffer.c
+++ b/recordmydesktop/src/encode_image_buffer.c
@@ -10,8 +10,9 @@ void *EncodeImageBuffer(void *pdata){
if(Paused)
pthread_cond_wait(&((ProgData *)pdata)->pause_cond,&pmut);//this may not be needed
pthread_mutex_lock(&((ProgData *)pdata)->yuv_mutex);
- if(theora_encode_YUVin(&((ProgData *)pdata)->enc_data->m_th_st,&((ProgData *)pdata)->enc_data->yuv)){
- fprintf(stderr,"Encoder not ready!\n");
+ int za=theora_encode_YUVin(&((ProgData *)pdata)->enc_data->m_th_st,&((ProgData *)pdata)->enc_data->yuv);
+ if(za){
+ fprintf(stderr,"Encoder not ready %d!\n",za);
}
pthread_mutex_unlock(&((ProgData *)pdata)->yuv_mutex);
theora_encode_packetout(&((ProgData *)pdata)->enc_data->m_th_st,0,&((ProgData *)pdata)->enc_data->m_ogg_pckt1);
diff --git a/recordmydesktop/src/get_frame.c b/recordmydesktop/src/get_frame.c
index 67c6eb2..44f2ec4 100644
--- a/recordmydesktop/src/get_frame.c
+++ b/recordmydesktop/src/get_frame.c
@@ -78,6 +78,7 @@ void *GetFrame(void *pdata){
&((ProgData *)pdata)->specs,
&((ProgData *)pdata)->rect_root[tlist_sel],
&((ProgData *)pdata)->brwin,
+ ((ProgData *)pdata)->enc_data,
((((ProgData *)pdata)->args.noshared)?(((ProgData *)pdata)->datatemp):((ProgData *)pdata)->image->data),
((ProgData *)pdata)->args.noshared);
else{
@@ -106,8 +107,8 @@ void *GetFrame(void *pdata){
if((mouse_pos_temp.x>=0)&&(mouse_pos_temp.y>=0)&&(mouse_pos_temp.width>0)&&(mouse_pos_temp.height>0)){
DUMMY_POINTER_TO_YUV((&((ProgData *)pdata)->enc_data->yuv),
((ProgData *)pdata)->dummy_pointer,
- (mouse_pos_temp.x-((ProgData *)pdata)->brwin.rgeom.x),
- (mouse_pos_temp.y-((ProgData *)pdata)->brwin.rgeom.y),
+ (mouse_pos_temp.x-((ProgData *)pdata)->brwin.rgeom.x+((ProgData *)pdata)->enc_data->x_offset),
+ (mouse_pos_temp.y-((ProgData *)pdata)->brwin.rgeom.y+((ProgData *)pdata)->enc_data->y_offset),
mouse_pos_temp.width,
mouse_pos_temp.height,
((ProgData *)pdata)->npxl);
diff --git a/recordmydesktop/src/init_encoder.c b/recordmydesktop/src/init_encoder.c
index 35440dc..8995f6d 100644
--- a/recordmydesktop/src/init_encoder.c
+++ b/recordmydesktop/src/init_encoder.c
@@ -149,9 +149,9 @@ void InitEncoder(ProgData *pdata,EncData *enc_data_t){
- (enc_data_t)->yuv.y=(unsigned char *)malloc((pdata)->image->height*((ProgData *)pdata)->image->width);
- (enc_data_t)->yuv.u=(unsigned char *)malloc((pdata)->image->height*((ProgData *)pdata)->image->width/4);
- (enc_data_t)->yuv.v=(unsigned char *)malloc((pdata)->image->height*((ProgData *)pdata)->image->width/4);
+ (enc_data_t)->yuv.y=(unsigned char *)malloc((enc_data_t)->m_th_inf.height*(enc_data_t)->m_th_inf.width);
+ (enc_data_t)->yuv.u=(unsigned char *)malloc((enc_data_t)->m_th_inf.height*(enc_data_t)->m_th_inf.width/4);
+ (enc_data_t)->yuv.v=(unsigned char *)malloc((enc_data_t)->m_th_inf.height*(enc_data_t)->m_th_inf.width/4);
(enc_data_t)->yuv.y_width=(enc_data_t)->m_th_inf.width;
(enc_data_t)->yuv.y_height=(enc_data_t)->m_th_inf.height;
(enc_data_t)->yuv.y_stride=(enc_data_t)->m_th_inf.width;
@@ -159,7 +159,8 @@ void InitEncoder(ProgData *pdata,EncData *enc_data_t){
(enc_data_t)->yuv.uv_width=(enc_data_t)->m_th_inf.width/2;
(enc_data_t)->yuv.uv_height=(enc_data_t)->m_th_inf.height/2;
(enc_data_t)->yuv.uv_stride=(enc_data_t)->m_th_inf.width/2;
-
+ (enc_data_t)->x_offset=(enc_data_t)->m_th_inf.offset_x;
+ (enc_data_t)->y_offset=(enc_data_t)->m_th_inf.offset_y;
theora_info_clear(&(enc_data_t)->m_th_inf);
}
diff --git a/recordmydesktop/src/setbrwindow.c b/recordmydesktop/src/setbrwindow.c
index 3eda7ad..e5035d5 100644
--- a/recordmydesktop/src/setbrwindow.c
+++ b/recordmydesktop/src/setbrwindow.c
@@ -93,12 +93,7 @@ int SetBRWindow(Display *dpy,BRWindow *brwin,DisplaySpecs *specs,ProgArgs *args)
brwin->rgeom.x-=brwin->rgeom.x%2;
brwin->rgeom.y-=brwin->rgeom.y%2;
- //this is needed for theora
- //+-8 pixels
- brwin->rgeom.width=((((brwin->rgeom.width+16-(brwin->rgeom.width)%16+brwin->rgeom.x)<=specs->width)&&((brwin->rgeom.width)%16>8))?brwin->rgeom.width+16-(brwin->rgeom.width)%16:brwin->rgeom.width-(brwin->rgeom.width)%16);
- brwin->rgeom.height=((((brwin->rgeom.height+16-(brwin->rgeom.height)%16+brwin->rgeom.y)<=specs->height)&&((brwin->rgeom.height)%16>8))?brwin->rgeom.height+16-(brwin->rgeom.height)%16:brwin->rgeom.height-(brwin->rgeom.height)%16);
-
- brwin->nbytes=(brwin->rgeom.width*brwin->rgeom.height*4);
+ brwin->nbytes=(((brwin->rgeom.width+15)>>4)<<4)*(((brwin->rgeom.height+15)>>4)<<4)*4;
return 0;
}
diff --git a/recordmydesktop/src/update_image.c b/recordmydesktop/src/update_image.c
index 04cb16f..bf319e2 100644
--- a/recordmydesktop/src/update_image.c
+++ b/recordmydesktop/src/update_image.c
@@ -33,6 +33,7 @@ void UpdateImage(Display * dpy,
DisplaySpecs *specs,
RectArea **root,
BRWindow *brwin,
+ EncData *enc,
char *datatemp,
int noshmem){
RectArea *temp;
@@ -53,14 +54,14 @@ void UpdateImage(Display * dpy,
pthread_mutex_lock(yuv_mutex);
UPDATE_YUV_BUFFER_IM(yuv,dtap,
- (temp->geom.x-brwin->rgeom.x),(temp->geom.y-brwin->rgeom.y),
+ (temp->geom.x-brwin->rgeom.x+enc->x_offset),(temp->geom.y-brwin->rgeom.y+enc->y_offset),
(temp->geom.width),(temp->geom.height));
pthread_mutex_unlock(yuv_mutex);
}
else{
UPDATE_YUV_BUFFER_SH(yuv,dtap,
- (temp->geom.x-brwin->rgeom.x),(temp->geom.y-brwin->rgeom.y),
+ (temp->geom.x-brwin->rgeom.x+enc->x_offset),(temp->geom.y-brwin->rgeom.y+enc->y_offset),
(temp->geom.width),(temp->geom.height));
© All Rights Reserved