summaryrefslogtreecommitdiff
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
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
-rw-r--r--recordmydesktop/include/recordmydesktop.h7
-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
6 files changed, 19 insertions, 19 deletions
diff --git a/recordmydesktop/include/recordmydesktop.h b/recordmydesktop/include/recordmydesktop.h
index e148a74..98344c4 100644
--- a/recordmydesktop/include/recordmydesktop.h
+++ b/recordmydesktop/include/recordmydesktop.h
@@ -139,7 +139,8 @@ typedef struct _EncData{
vorbis_dsp_state m_vo_dsp;
vorbis_block m_vo_block;
-
+ int x_offset,
+ y_offset;
FILE *fp;
}EncData;
@@ -224,7 +225,7 @@ int avd;
(e)->area.height-((brwin)->rgeom.y-(e)->area.y):\
((e)->area.y<=(brwin)->rgeom.y+(brwin)->rgeom.height)?\
(((brwin)->rgeom.height-(e)->area.y+(brwin)->rgeom.y<(e)->area.height)?\
- ((brwin)->rgeom.height-(e)->area.y+(brwin)->rgeom.y<(e)->area.height):(e)->area.height):-1;\
+ (brwin)->rgeom.height-(e)->area.y+(brwin)->rgeom.y:(e)->area.height):-1;\
\
if((wgeom)->width>(brwin)->rgeom.width)(wgeom)->width=(brwin)->rgeom.width;\
if((wgeom)->height>(brwin)->rgeom.height)(wgeom)->height=(brwin)->rgeom.height;\
@@ -349,7 +350,7 @@ int RectInsert(RectArea **root,WGeometry *wgeom);
int CollideRects(WGeometry *wgeom1,WGeometry *wgeom2,WGeometry **wgeom_return,int *ngeoms);
void SetExpired(int signum);
void RegisterCallbacks(ProgArgs *args);
-void UpdateImage(Display * dpy,yuv_buffer *yuv,pthread_mutex_t *yuv_mutex,DisplaySpecs *specs,RectArea **root,BRWindow *brwin,char *datatemp,int noshmem);
+void UpdateImage(Display * dpy,yuv_buffer *yuv,pthread_mutex_t *yuv_mutex,DisplaySpecs *specs,RectArea **root,BRWindow *brwin,EncData *enc,char *datatemp,int noshmem);
void XImageToYUV(XImage *imgz,yuv_buffer *yuv);
int GetZPixmap(Display *dpy,Window root,char *data,int x,int y,int width,int height);
int ParseArgs(int argc,char **argv,ProgArgs *arg_return);
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