summaryrefslogtreecommitdiff
path: root/recordmydesktop
diff options
context:
space:
mode:
Diffstat (limited to 'recordmydesktop')
-rw-r--r--recordmydesktop/ChangeLog3
-rw-r--r--recordmydesktop/include/recordmydesktop.h43
-rw-r--r--recordmydesktop/src/encode_image_buffer.c2
-rw-r--r--recordmydesktop/src/get_frame.c7
-rw-r--r--recordmydesktop/src/recordmydesktop.c3
-rw-r--r--recordmydesktop/src/register_callbacks.c5
6 files changed, 50 insertions, 13 deletions
diff --git a/recordmydesktop/ChangeLog b/recordmydesktop/ChangeLog
index 6807b6a..bd60427 100644
--- a/recordmydesktop/ChangeLog
+++ b/recordmydesktop/ChangeLog
@@ -48,4 +48,5 @@ instead of continuing with a different configuration.
pixel discarding is an option(used to be otherwise).
-
+/*VERSION 0.2.6*/
+*internal framedrop counter
diff --git a/recordmydesktop/include/recordmydesktop.h b/recordmydesktop/include/recordmydesktop.h
index 055918a..78a4b4b 100644
--- a/recordmydesktop/include/recordmydesktop.h
+++ b/recordmydesktop/include/recordmydesktop.h
@@ -77,6 +77,9 @@
#endif
+//do not be confused
+//this is useless and obsolete.
+//There are no plans for other fotmats
enum {UNSPECIFIED,OGG_THEORA_VORBIS};
@@ -106,14 +109,15 @@ typedef struct _RectArea{ //an area that has been damaged gets stored
struct _RectArea *prev,*next;
}RectArea;
-typedef struct _BRWindow{ //a window to be recorded specs
+typedef struct _BRWindow{ //'basic recorded window' specs
WGeometry geom; //window attributes
WGeometry rgeom; //part of window that is recorded
int nbytes; //size of zpixmap when screenshoting
Window windowid; //id
}BRWindow;
-
+//defaults in the following comment lines may be out of sync with reality
+//check DEFAULT_ARGS macro further bellow
typedef struct _ProgArgs{
int delay; //start up delay
Window windowid; //window to record(default root)
@@ -144,31 +148,36 @@ typedef struct _ProgArgs{
}ProgArgs;
-//this struct will hold anything related to encoding AND
+//this struct holds anything related to encoding AND
//writting out to file.
-//**TODO add vorbis specifics*/
typedef struct _EncData{
ogg_stream_state m_ogg_ts;//theora
ogg_stream_state m_ogg_vs;//vorbis
- ogg_page m_ogg_pg;
- ogg_packet m_ogg_pckt1;
- ogg_packet m_ogg_pckt2;
-
+ ogg_page m_ogg_pg;//this could be avoided since
+ // it is used only while initializing
+ ogg_packet m_ogg_pckt1;//theora stream
+ ogg_packet m_ogg_pckt2;//vorbis stream
+//theora data
theora_state m_th_st;
theora_info m_th_inf;
theora_comment m_th_cmmnt;
yuv_buffer yuv;
-
+//vorbis data
vorbis_info m_vo_inf;
vorbis_comment m_vo_cmmnt;
vorbis_dsp_state m_vo_dsp;
vorbis_block m_vo_block;
-
+//these should be 0, since area is quantized
+//before input
int x_offset,
y_offset;
+//our file
FILE *fp;
}EncData;
+//sound buffer
+//sound keeps coming so we que it in this list
+//which we then traverse
typedef struct _SndBuffer{
signed char *data;
struct _SndBuffer *next;
@@ -207,7 +216,11 @@ typedef struct _ProgData{
frametime;
pthread_mutex_t list_mutex[2],//mutexes for concurrency protection of the lists
sound_buffer_mutex,
- yuv_mutex;
+ yuv_mutex;//this might not be needed since we only have
+ //one read-only and one write-only thread
+ //also on previous versions, y component was looped separately
+ //and then u and v so this was needed to avoid wrong coloring to render
+ //Currently this mutex only prevents the cursor from flickering
pthread_cond_t time_cond,//this gets a broadcast by the handler whenever it's time to get a screenshot
pause_cond,//this is blocks execution, when program is paused
sound_buffer_ready,//sound encoding finished
@@ -225,7 +238,13 @@ pthread_cond_t *time_cond,*pause_cond;
unsigned char Yr[256],Yg[256],Yb[256],
Ur[256],Ug[256],Ub[256],
Vr[256],Vg[256],Vb[256];
-
+unsigned int frames_total,//frames calculated by total time expirations
+ frames_lost,//the value of shame
+ frames_to_add;//number of fake packets to be fed into the ogg stream
+//used to determine frame drop which can
+//happen on failure to receive a signal over a condition variable
+int capture_busy,
+ encoder_busy;
/**Macros*/
#define CLIP_EVENT_AREA(e,brwin,wgeom){\
diff --git a/recordmydesktop/src/encode_image_buffer.c b/recordmydesktop/src/encode_image_buffer.c
index 4ee34b0..315ad5c 100644
--- a/recordmydesktop/src/encode_image_buffer.c
+++ b/recordmydesktop/src/encode_image_buffer.c
@@ -32,6 +32,7 @@ void *EncodeImageBuffer(void *pdata){
pthread_mutex_init(&imut,NULL);
while(((ProgData *)pdata)->running){
+ encoder_busy=1;
pthread_cond_wait(&((ProgData *)pdata)->image_buffer_ready,&imut);
if(Paused)
pthread_cond_wait(&((ProgData *)pdata)->pause_cond,&pmut);//this may not be needed
@@ -44,6 +45,7 @@ void *EncodeImageBuffer(void *pdata){
theora_encode_packetout(&((ProgData *)pdata)->enc_data->m_th_st,0,&((ProgData *)pdata)->enc_data->m_ogg_pckt1);
ogg_stream_packetin(&((ProgData *)pdata)->enc_data->m_ogg_ts,&((ProgData *)pdata)->enc_data->m_ogg_pckt1);
((ProgData *)pdata)->avd+=((ProgData *)pdata)->frametime*2*((ProgData *)pdata)->args.channels;
+ encoder_busy=0;
}
//last packet
if(theora_encode_YUVin(&((ProgData *)pdata)->enc_data->m_th_st,&((ProgData *)pdata)->enc_data->yuv)){
diff --git a/recordmydesktop/src/get_frame.c b/recordmydesktop/src/get_frame.c
index ff935c0..2a55ba2 100644
--- a/recordmydesktop/src/get_frame.c
+++ b/recordmydesktop/src/get_frame.c
@@ -48,6 +48,8 @@ void *GetFrame(void *pdata){
if(Paused){
pthread_cond_wait(&((ProgData *)pdata)->pause_cond,&pmut);
}
+ capture_busy=1;
+
/*pthread_cond_wait(&((ProgData *)pdata)->pause_cond,&((ProgData *)pdata)->pause_cond_mutex);*/
//mutexes and lists with changes are useless when full_shots is enabled
if(!((ProgData *)pdata)->args.full_shots){
@@ -187,7 +189,12 @@ void *GetFrame(void *pdata){
ClearList(&((ProgData *)pdata)->rect_root[tlist_sel]);
pthread_mutex_unlock(&((ProgData *)pdata)->list_mutex[tlist_sel]);
}
+ if(encoder_busy){
+ frames_lost++;
+ frames_to_add++;
+ }
pthread_cond_broadcast(&((ProgData *)pdata)->image_buffer_ready);
+ capture_busy=0;
}
pthread_cond_broadcast(&((ProgData *)pdata)->image_buffer_ready);
pthread_exit(&errno);
diff --git a/recordmydesktop/src/recordmydesktop.c b/recordmydesktop/src/recordmydesktop.c
index fda74f9..3ebdd6a 100644
--- a/recordmydesktop/src/recordmydesktop.c
+++ b/recordmydesktop/src/recordmydesktop.c
@@ -73,6 +73,9 @@ int main(int argc,char **argv){
//init data
+ //these are globals, look for them at the header
+ frames_total=frames_lost=frames_to_add=encoder_busy=capture_busy=0;
+
if(!pdata.args.scshot){
fprintf(stderr,"Initializing...\n");
MakeMatrices();
diff --git a/recordmydesktop/src/register_callbacks.c b/recordmydesktop/src/register_callbacks.c
index d7fa00b..262e3ae 100644
--- a/recordmydesktop/src/register_callbacks.c
+++ b/recordmydesktop/src/register_callbacks.c
@@ -27,6 +27,11 @@
#include <recordmydesktop.h>
void SetExpired(int signum){
+ frames_total++;
+ if(capture_busy){
+ frames_to_add++;
+ frames_lost++;
+ }
pthread_cond_broadcast(time_cond);
}
© All Rights Reserved